X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=firmware%2Fapps%2Fradios%2Fccspi.c;h=4ab98fdb43b8f0ed6861ff1b1c54aca168cc6b85;hb=5c9f0bab9a953ecae957f8ac1c376c228a55026f;hp=cca3305b7807ba3b0fedd9367dd49183a449d7c9;hpb=345dd7e12dca804dcd7c8b3f69a332752bcc2642;p=goodfet diff --git a/firmware/apps/radios/ccspi.c b/firmware/apps/radios/ccspi.c index cca3305..4ab98fd 100644 --- a/firmware/apps/radios/ccspi.c +++ b/firmware/apps/radios/ccspi.c @@ -19,8 +19,8 @@ //! Handles a Chipcon SPI command. void ccspi_handle_fn( uint8_t const app, - uint8_t const verb, - uint32_t const len); + uint8_t const verb, + uint32_t const len); // define the ccspi app's app_t app_t const ccspi_app = { @@ -163,9 +163,9 @@ void ccspi_handle_fn( uint8_t const app, SETSS; //Flush buffer. - //CLRSS; - //ccspitrans8(0x08); //SFLUSHRX - //SETSS; + CLRSS; + ccspitrans8(0x08); //SFLUSHRX + SETSS; //Only should transmit length of one more than the reported @@ -191,42 +191,50 @@ void ccspi_handle_fn( uint8_t const app, case CCSPI_REFLEX: #if defined(FIFOP) && defined(SFD) && defined(FIFO) && defined(PLED2DIR) && defined(PLED2PIN) && defined(PLED2OUT) - txdata(app,verb,1); //Just sending some response back to client + //txdata(app,verb,1); //Let the client continue its business. while(1) { - //Wait until a packet is received - while(!SFD); - //Turn on LED 2 (green) as signal - PLED2DIR |= PLED2PIN; - PLED2OUT &= ~PLED2PIN; + //Wait until a packet is received + while(!SFD){ + //Has there been an overflow in the RX buffer? + if((!FIFO)&&FIFOP){ + debugstr("Clearing RX overflow"); + CLRSS; + ccspitrans8(0x08); //SFLUSHRX + SETSS; + } + } + //Turn on LED 2 (green) as signal + PLED2DIR |= PLED2PIN; + PLED2OUT &= ~PLED2PIN; - //Put radio in TX mode - CLRSS; - ccspitrans8(0x04); - SETSS; + //Put radio in TX mode + CLRSS; + ccspitrans8(0x04); + SETSS; - //Load the jamming packet. - //Note: attempts to preload this actually slowed the jam time down from 7 to 9 bytes. - CLRSS; - ccspitrans8(CCSPI_TXFIFO); - char pkt[15] = {0x0f, 0x01, 0x08, 0x82, 0xff, 0xff, 0xff, 0xff, 0xde, 0xad, 0xbe, 0xef, 0xba, 0xbe, 0xc0}; - //char pkt[12] = {0x0c, 0x01, 0x08, 0x82, 0xff, 0xff, 0xff, 0xff, 0xde, 0xad, 0xbe, 0xef}; - for(i=0;i