Download GlucoBox System
Transcript
• RF_Init_Service initializes IO lines, set priority of interrupts (only argument to specify in this function) and programs MICRF506 with default configuration • RF_RX_Mode and RF_TX_Mode toggles between receive or transmit active modes of the RF IC • RF_TX_Power, RF_Powerdown_Mode and RF_Standby_Mode allow power management of MICRF506 • RF_Set_Local_ID and RF_Set_Local_Address enable changing current default local parameters (though this is not recommended) • RF_Get_Sender_Address, RF_Get_Sender_ID and RF_Get_Frame_Type give access to data extracted after a successful reception • RF_Get_Buffer_Pointer returns a pointer to access payload with the number of bytes to read given by RF_Get_Payload_Length Furthermore, RF_Send_Packet and RF_Receive_Packet are two essential functions to initiate communication. They are described in next sections. G.4 T RANSMIT PROCEDURE To transmit a packet over RF, just call RF_Send_Packet and provide necessary parameters: • a pointer to the data buffer to be sent • the number of bytes in this buffer to be sent • the type of the packet • the recipient’s address • last parameter to automatically power down after transmission or not After all being encoded and put into a buffer, data is sent by activating CN interrupts. Finally a flag is set to inform user that all data have been sent. A length error code is returned by RF_Send_Packet if the number of bytes to sent exceeds that defined by frame structure. G.5 R ECEIVE PROCEDURE Data can be received simply by calling RF_Receive_Packet. The main problem of a reception is to know whether there is an incoming signal. This is the role of the RF_CHECK_RSSI option. If no signal is present, RF_Receive_Packet will be automatically ended. On the other hand, if the RF_SKIP_RSSI option is used instead and no signal is present, then RF_Receive_Packet will constantly seek for a SYNC. The only way to force terminating this process is to modify an argument passed to this function. An example of how to modify this variable is by using a interrupt source (such a timer period match) that sets the argument to a value different from 0. As in the transmit packet function, error codes are also output here. Errors include: 90