Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of RAJANGAM_REVIEW_BAE_CODE by
Diff: BCN.cpp
- Revision:
- 84:afbedc6ed804
- Parent:
- 83:78b6a62cdf6a
diff -r 78b6a62cdf6a -r afbedc6ed804 BCN.cpp
--- a/BCN.cpp Sun Dec 11 15:21:34 2016 +0000
+++ b/BCN.cpp Sun Dec 11 17:40:06 2016 +0000
@@ -200,6 +200,11 @@
BCN_TX_MAIN_STATUS = 0;
timer_Set_BCN_TX_STATUS_SUSPENDED.stop();
}
+ else if(BCN_SW == 0)
+ {
+ BCN_TX_STATUS = BCN_TX_DISABLED;
+ BCN_TX_MAIN_STATUS = 0;
+ }
else
{
BCN_TX_STATUS = BCN_TX_FAILURE;
@@ -282,6 +287,7 @@
clearTxBuf();
break; //Check for flag update by COM
}
+ else if( BCN_SW == 0 ) break;
for(int j = 7; j >= 0; j--)
{
if(BCN_SPND_TX == 1)
@@ -289,6 +295,7 @@
clearTxBuf();
break; //Check for flag update by COM
}
+ else if( BCN_SW == 0 ) break;
cs = 0;
spi.write(0xFF);
if((SHORT_HK_data[byte_counter] & (uint8_t) pow(2.0,j))!= pow(2.0,j))
@@ -319,8 +326,8 @@
}
if(byte_counter == 1)
- if(BCN_SPND_TX != 1) //Check for flag update by COM
- {
+ if(BCN_SPND_TX != 1 && BCN_SW == 1) //Check for flag update by COM
+ {
//Set to Tx mode
writereg(RF22_REG_07_OPERATING_MODE1,0x08); //txon
wait(0.1);// takes time to set to tx mode hence the delay of 0.1.
@@ -338,7 +345,7 @@
//Check for fifoThresh
if(byte_counter > 0)
- if(BCN_SPND_TX != 1) //Check for flag update by COM
+ if(BCN_SPND_TX != 1 && BCN_SW ==1) //Check for flag update by COM
{
wait_ms(25);
while( timeout_count --)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) == 0x20)break;else if(timeout_count == 1) reset_rfm(1);
@@ -364,12 +371,13 @@
clearTxBuf();
break; //Check for flag update by COM
}
+ else if( BCN_SW == 0 ) break;
cs = 0;
spi.write(0xFF);
spi.write(LONG_HK_data[BCN_LONG_MSG_TYPE][byte_counter-15]);
cs = 1;
- if((byte_counter-15)%32==0 && BCN_SPND_TX != 1)
+ if((byte_counter-15)%32==0 && BCN_SPND_TX == 0 && BCN_SW == 1)
{ //Check for fifoThresh
wait_ms(25);
while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) == 0x20)break;else if(timeout_count == 1) reset_rfm(1);
@@ -381,29 +389,32 @@
}
wait_ms(70);
- //Check for fifoThresh
- while(timeout_count--)
- if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x40) == 0x00) break;
- else if(timeout_count == 1)
- if(BCN_SPND_TX != 1) reset_rfm(1);
- while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x40) == 0x00)break;else if(timeout_count == 1) reset_rfm(1);
+ if( BCN_SW == 1 )
{
- pc_bcn.printf("Waiting for fifo to empty\r\n");
+ //Check for fifoThresh
+ while(timeout_count--)
+ if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x40) == 0x00) break;
+ else if(timeout_count == 1)
+ if(BCN_SPND_TX != 1) reset_rfm(1);
+
+ while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x40) == 0x00)break;else if(timeout_count == 1) reset_rfm(1);
+ {
+ pc_bcn.printf("Waiting for fifo to empty\r\n");
+ }
+
+ //Check for packetsent interrupt
+ while(timeout_count--)
+ if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) == 0x04) break;
+ else if(timeout_count == 1)
+ if(BCN_SPND_TX != 1) reset_rfm(1);
+
+ while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) == 0x04)break;else if(timeout_count == 1) reset_rfm(1);
+
+ //pc_bcn.printf("Short packet sent, bytes written = %d\r\n",byte_count);
+
+ writereg(RF22_REG_07_OPERATING_MODE1,0x00); //standby mode
}
-
- //Check for packetsent interrupt
- while(timeout_count--)
- if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) == 0x04) break;
- else if(timeout_count == 1)
- if(BCN_SPND_TX != 1) reset_rfm(1);
-
- while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) == 0x04)break;else if(timeout_count == 1) reset_rfm(1);
-
- //pc_bcn.printf("Short packet sent, bytes written = %d\r\n",byte_count);
-
- writereg(RF22_REG_07_OPERATING_MODE1,0x00); //standby mode
-
}
void reset_rfm(uint8_t fl)
