Working Simpliciti implementation.
[goodfet] / shellcode / chipcon / cc1110 / txrxpacket.c
index 1fdb0f1..acde9e2 100644 (file)
@@ -5,23 +5,26 @@ char __xdata at 0xfe00 packet[256] ;
 
 //! Transmit a packet out of the radio from 0xFE00.
 void main(){
 
 //! Transmit a packet out of the radio from 0xFE00.
 void main(){
-  unsigned char len=packet[0], i=0;
-  
+  unsigned char len=packet[0], i=0, j;
+
   //idle a bit.
   RFST=RFST_SIDLE;
   while(MARCSTATE!=MARC_STATE_IDLE);
   
   RFST=RFST_STX;     //Begin transmit.
   //idle a bit.
   RFST=RFST_SIDLE;
   while(MARCSTATE!=MARC_STATE_IDLE);
   
   RFST=RFST_STX;     //Begin transmit.
+  i=0;
   while(i!=len+1){
     while(!RFTXRXIF); //Wait for byte to be ready.
     
     RFTXRXIF=0;      //Clear the flag.
     RFD=packet[i++]; //Send the next byte.
   }
   while(i!=len+1){
     while(!RFTXRXIF); //Wait for byte to be ready.
     
     RFTXRXIF=0;      //Clear the flag.
     RFD=packet[i++]; //Send the next byte.
   }
-  RFST = RFST_SIDLE; //End transmit.
   
   
+  //Wait for completion.
+  while(MARCSTATE==MARC_STATE_TX);
   
   
-  while(MARCSTATE!=MARC_STATE_IDLE);
+  //RFST = RFST_SIDLE; //End transmit.
+  //while(MARCSTATE!=MARC_STATE_IDLE);
   
   //Begin to receive.
   RFST=RFST_SRX;
   
   //Begin to receive.
   RFST=RFST_SRX;