GP32 RF module examples


pcklee123

Member
Joined
Nov 14, 2003
Messages
403
Does anyone have any example source code which uses the RF module? I am guessing it must be connected to one of the serial ports.
 
source code for the RF module...I never thought of that! I am not sure of where to get some, but there may be some games that use the RF link where the source has been released. I can only think of Jump and Bump, but I don't think the source for that has been released. Maybe someone else knows. And yes, the RF link goes in the serial port.
 
Isn't there a RF-lib around?
by Black.. or what he called himself..

---
mithris
 
There are also RF-Link docs from our belowed Gamepark.. I can look around as I remember seeing those on my HD once.. black-'s RFLib hits the hardware and is IRQ driven so if my memory serves it beats the Gamepark's equivalent 6-5 <_<
 
gamerf.h
-------------------------
#ifndef __gamerf_h__
#define __gamerf_h__


#define COMM_RF_CONNECT 0x01

//////////////////RF///////////////
void RfModeInit(void);
void RfConnect(int count,int * p_id);

void SendRfData(unsigned char data);
void PutLinkComm(unsigned char data);
void WaitReady(void);

int GetRfData(uchar * p_data, int flag_block);
unsigned char GetLinkComm(unsigned char * data);

void Disconnect(void);

#endif
-------------------------
gamerf.c
-----------------------
#include "gpnetlib.h"
#include "gpcomm.h"
#include "gpsockdef.h"

#include "gamerf.h"

GPN_DESC m_desc;
GPN_COMM rf_comm,net_comm;

void RfModeInit(void) //RF ├╩▒т╚н ╟╤┤┘.
{
int err;

m_desc.port_kind = COMM_APP_RF;
m_desc.tr_buf_size = 1024;
m_desc.tr_rate = 19200;
m_desc.isr_comm_ram = NULL;

gp_str_func.memset(&rf_comm, 0, sizeof(GPN_COMM));

if ( GpCommCreate(&m_desc,&rf_comm) )
{
//error
while ( 1 )
;
}

err = rf_comm.comm_open(&m_desc);
if ( err )
{
//error
while ( 1 )
;
}
}

void RfConnect(int count, int * p_id)
{
unsigned char data1,data2;


PutLinkComm(COMM_RF_CONNECT); //Connection ┐ф├╗
PutLinkComm(count-1);

while(!GetLinkComm(&data1)); //Connected └└┤ф┤ы▒т
while(!GetLinkComm(&data2));

*p_id = (int)data2;

}


/*******************╡е└╠┼═Transfer*************************/
void SendRfData(unsigned char data)
{

PutLinkComm(0x10);
PutLinkComm(data);

WaitReady();
}

void PutLinkComm(unsigned char data)
{
if ( !rf_comm.comm_send_one(data) )
{
//error
while ( 1 )
;
}
}


void WaitReady(void)
{
unsigned char data1,data2;
data1 = 0;

do{
while(!GetLinkComm(&data1));
while(!GetLinkComm(&data2));
}while(data1 != 0x10);
}
/***********************************************************/

/*******************╡е└╠┼═Receive**************************/
int GetRfData(uchar * p_data, int flag_block)
{
unsigned char data1,data2;

do{
if ( GetLinkComm(&data1) )
{
while (!GetLinkComm(&data2));
*p_data = data2;
return 1;
}
}while (flag_block);
return 0;
}

unsigned char GetLinkComm(unsigned char * data) //╡е└╠┼═Receive
{
return rf_comm.comm_recv_one(data);
}
/***********************************************************/


void Disconnect(void) //DisConect┐ф├╗
{
PutLinkComm(0x04);
PutLinkComm(0x00);

rf_comm.comm_close();
GpCommDelete(&m_desc);
}
 
Thanks. Before I saw this I kept wondering how 4 players can connect through one serial port
 
Back
Top