2 #include "cc1110-ext.h"
5 char __xdata at 0xfe00 packet[MAXLEN] ;
7 //! Receives a packet out of the radio from 0xFE00.
9 unsigned char len=16, i=0;
22 while(MARCSTATE!=MARC_STATE_IDLE);
26 while(MARCSTATE!=MARC_STATE_RX);
30 while(i<len+3){ //len+3 if status is appended.
31 while(!RFTXRXIF); //Wait for byte to be ready.
32 RFTXRXIF=0; //Clear the flag.
34 packet[i++]=RFD; //Grab the next byte.
35 len=packet[0]; //First byte of the packet is the length.
41 while(!RFTXRXIF); //Wait for byte to be ready.
42 RFTXRXIF=0; //Clear the flag.
44 packet[i++]=RFD; //Grab the next byte.
47 RFST = RFST_SIDLE; //End receive.
49 //This while loop can be used for filtering. Unused for now.
50 }while(0); //packet[0]==(char) 0x0f || packet[1]==(char) 0xFF || packet[9]==(char) 0x03);