$(CC) $<
clean:
rm -f *.ihx *.rel *.hex *.sym *.asm *.lst *.lnk *.map *.mem *.rst *.adb
+install: all
+ cp $(objs) ../../../client/shellcode/chipcon/cc1110/
+ #Shellcode installed.
//! Start the crystal oscillator at 26MHz.
void main(){
- SLEEP &= ~SLEEP_OSC_PD; // Turn both high speed oscillators on
- while( !(SLEEP & SLEEP_XOSC_S) ); // Wait until xtal oscillator is stable
- CLKCON = (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC)) | CLKSPD_DIV_1; // Select xtal osc, 26 MHz
- while (CLKCON & CLKCON_OSC); // Wait for change to take effect
- SLEEP |= SLEEP_OSC_PD; // Turn off the other high speed oscillator (the RC osc)
+ // Turn both high speed oscillators on
+ SLEEP &= ~SLEEP_OSC_PD;
+ // Wait until xtal oscillator is stable
+ while( !(SLEEP & SLEEP_XOSC_S) );
+
+ // Select xtal osc, 26 MHz
+ CLKCON =
+ (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC))
+ | CLKSPD_DIV_1;
+ // Wait for change to take effect
+ while (CLKCON & CLKCON_OSC);
+ // Turn off the RC osc.
+ SLEEP |= SLEEP_OSC_PD;
HALT;
}
//Begin to receive.
RFST=RFST_SRX;
while(MARCSTATE!=MARC_STATE_RX);
-
- while(i<len+3){ //len+3 if status is appended.
- while(!RFTXRXIF); //Wait for byte to be ready.
- RFTXRXIF=0; //Clear the flag.
-
- packet[i++]=RFD; //Grab the next byte.
- len=packet[0]; //First byte of the packet is the length.
+
+ if(PKTCTRL0&1){
+ //auto length
+ while(i<len+3){ //len+3 if status is appended.
+ while(!RFTXRXIF); //Wait for byte to be ready.
+ RFTXRXIF=0; //Clear the flag.
+
+ packet[i++]=RFD; //Grab the next byte.
+ len=packet[0]; //First byte of the packet is the length.
+ }
+ }else{
+ //Fixed length
+ packet[i++]=PKTLEN;
+ while(i<PKTLEN){
+ while(!RFTXRXIF); //Wait for byte to be ready.
+ RFTXRXIF=0; //Clear the flag.
+
+ packet[i++]=RFD; //Grab the next byte.
+ }
}
RFST = RFST_SIDLE; //End receive.