![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Final Beacon code for testing
Diff: main.cpp
- Revision:
- 1:8b18c140a710
- Parent:
- 0:e4162b2d1a79
- Child:
- 2:44b63c859531
diff -r e4162b2d1a79 -r 8b18c140a710 main.cpp --- a/main.cpp Mon Oct 05 13:52:48 2015 +0000 +++ b/main.cpp Mon Oct 05 17:15:24 2015 +0000 @@ -22,18 +22,22 @@ } void P_BCN_TX_MAIN() { + pc.printf("line 25"); BCN_TX_MAIN_STATUS = 1; if(BCN_FEN == 1) { + pc.printf("line 30"); if(BCN_TX_EN == 1) { + pc.printf("line 33"); //Measure and store BCN temperature in BCN_TS_BUFFER BCN_TS_BUFFER = ((check_Temperature())*0.5) - 64; - + pc.printf("line 36"); //Get BCN_HK data from BCN HW(SPI) //Store BCN_HK data in BCN_HK_BUFFER if(BCN_STANDBY == 1 ) { + pc.printf("line 40"); Set_BCN_TX_STATUS(BCN_TX_STANDBY); BCN_TX_MAIN_STATUS = 0; @@ -42,11 +46,13 @@ else { //pc.printf("in BCN_TX_STANDBY != 1\r\n"); - + pc.printf("line 49"); t.start(); int begin = t.read(); + pc.printf("line 52"); SHORT_BCN_TX(); LONG_BCN_TX(); + pc.printf("line 55"); int end = t.read(); pc.printf("The time required for short and long is %d seconds\r\n", end-begin); pc.printf("Short and Long packets sent\r\n"); @@ -142,11 +148,13 @@ int byte = 0; cs = 0; spi.write(0xFF); - - for (int byte_counter = 0; byte_counter <15 ; i++) + pc.printf("line 151"); + for (int byte_counter = 0; byte_counter <15 ; byte_counter++) { + pc.printf("%d byte counter\n", byte_counter); for(int j = 3; j >= 0 ; j--) { + pc.printf("%d j \n", j); if((short_beacon[byte_counter] & (uint8_t) pow(2.0,(j*2+1)))!= pow(2.0,(j*2+1))) { byte=0x00; @@ -168,14 +176,14 @@ } cs = 1; - + pc.printf("line 177\n"); //Set to Tx mode writereg(RF22_REG_07_OPERATING_MODE1,0x09); //Check for fifoThresh while((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) != 0x20); //pc.printf("fifothresh1?\n"); - + pc.printf("line 184\n"); //rf22.waitPacketSent(); while((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) != 0x04); //pc.printf(" chk pkt sent!\r\n"); @@ -384,23 +392,34 @@ } int main() { - //int temp, final_temp; + + pc.printf("entered main"); + int temp, final_temp; P_BCN_INIT(); + pc.printf("completed bcn_init"); + + writereg(RF22_REG_07_OPERATING_MODE1,0x00); //standby mode t.start(); - loop.attach(&P_BCN_TX_MAIN, 30.0); + //loop.attach(&P_BCN_TX_MAIN, 10.0); + pc.printf("loop_attached"); + while (t.read() < RF_SILENCE_TIME); P_BCN_FEN(); + P_BCN_TX_MAIN(); + t.stop(); -// temp = check_Temperature(); -// final_temp = (float)temp*0.5 - 64; -// pc.printf("%d\r\n", final_temp); + while(1) + { + temp = check_Temperature(); + final_temp = (float)temp*0.5 - 64; + pc.printf("final temp = %d\r\n", final_temp);} //while(1) // { // temp = check_Temperature(); @@ -411,7 +430,7 @@ while(1) { - pc.printf("%d\n",BCN_TS_BUFFER); + //pc.printf("%d\n",BCN_TS_BUFFER); //display statuses or wait //BCN_INIT_STATUS