9bea2421a88107533052d28487d0a5761c593c93
[goodfet] / shellcode / chipcon / cc1110 / rxpacket.c
1 #include <cc1110.h>
2 #include "cc1110-ext.h"
3
4 char __xdata at 0xfe00 packet[256] ;
5
6
7 //! Receives a packet out of the radio from 0xFE00.
8 void main(){
9   unsigned char len=100, i=0;
10   RFST=RFST_SRX;     //Begin to receive.
11   while(i!=len+1){
12     while(RFTXRXIF); //Wait for byte to be ready.
13     
14     RFTXRXIF=0;      //Clear the flag.
15     packet[i++]=RFD; //Grab the next byte.
16     len=packet[0];   //First byte of the packet is the length.
17   }
18   RFST = RFST_SIDLE; //End transmit.
19   HALT;
20 }