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 BAE_CODE_MARCH_2017 by
Diff: BCN.cpp
- Revision:
- 74:2c82080db98b
- Parent:
- 73:d2bca4d2cc64
- Child:
- 76:293693fb7949
--- a/BCN.cpp Wed Dec 07 13:26:01 2016 +0000 +++ b/BCN.cpp Sat Dec 10 09:57:10 2016 +0000 @@ -140,14 +140,14 @@ int begin = t_i.read_us(); //int begins,beginl,endl; int begintx,endtx; - BCN_TX_MAIN_STATUS = 1; + BCN_TX_MAIN_STATUS = 1; // tranmission started BCN_TX_MAIN_COUNTER++; - printf("BCN_FEN = %d\n\r",BCN_FEN); + pc_bcn.printf("BCN_FEN = %d\n\r",BCN_FEN); //to be checked next time if(BCN_FEN == 1) { - printf("BCN_TX_SW_STATUS = %d\n\r",BCN_TX_SW_STATUS); + pc_bcn.printf("BCN_TX_SW_STATUS = %d\n\r",BCN_TX_SW_STATUS); // to be checked nxt time //if(BCN_TX_SW_STATUS == 0b00000001) - if(BCN_TX_SW_STATUS != 0b00000000) + if(BCN_TX_SW_STATUS != 0b00000000) // why have we put it as !0== why not just ==01?? { timer_Init_BEACON_HW.reset(); timer_Init_BEACON_HW.start(); @@ -156,16 +156,19 @@ if( BCN_TX_STATUS == BCN_INIT_SUCCESS ) { - pc_bcn.printf("\n\r transmitting"); + pc_bcn.printf("\n\r trying to trmntng"); + //Measure and store BCN temperature in BCN_TS_BUFFER uint8_t temp_temp = check_Temperature(); if( temp_temp != 0xFF ) BCN_TMP = temp_temp; - printf("\n\rthe BCN_TMP is %d\n",temp_temp); + + pc_bcn.printf("\n\rthe BCN_TMP is %d\n",temp_temp); pc_bcn.printf("temperature = %d\n\r",BCN_TMP); + //Get BCN_HK data from BCN HW(SPI) //Store BCN_HK data in BCN_HK_BUFFER pc_bcn.printf("BCN_SPND_TX = %d\n\r",BCN_SPND_TX); - if(BCN_SPND_TX == 1 ) + if(BCN_SPND_TX == 1) { timer_Set_BCN_TX_STATUS_SUSPENDED.reset(); timer_Set_BCN_TX_STATUS_SUSPENDED.start(); @@ -246,7 +249,7 @@ } uint32_t timeout_count; -void BCN_TX() +void BCN_TX() // main function for transmitting { pc_bcn.printf("BCN_TX\n\r"); writereg(RF22_REG_6E_TX_DATA_RATE,0x0A); @@ -283,10 +286,10 @@ int byte_counter; uint8_t onebyte[4] = {0x81,0xA6,0xBE,0x4E}; uint8_t zerobyte[4] = {0x7E,0x59,0x41,0xB1}; - for (byte_counter = 0; byte_counter <15 ; byte_counter++) + for (byte_counter = 0; byte_counter <15 ; byte_counter++) // include condition in the foor loop itself { if(BCN_SPND_TX == 1) continue; //changed - for(int j = 7; j >= 0 ; j--) + for(int j = 7; j >= 0; j--) { if(BCN_SPND_TX == 1) continue; //changed cs = 0; @@ -342,7 +345,7 @@ { wait_ms(25); while( timeout_count --)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) == 0x20)break;else if(timeout_count == 1) reset_rfm(1); - { + { //loop corresponds to ?? wait_ms(25); while( timeout_count --)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) == 0x20)break;else if(timeout_count == 1) reset_rfm(1); { @@ -365,7 +368,7 @@ //pc_bcn.printf("W = %d\r\n",byte_counter); } - for(byte_counter = 15;byte_counter<149;byte_counter++) + for(byte_counter = 15;byte_counter<149;byte_counter++) // include it in the loop itself { if(BCN_SPND_TX == 1) continue; cs = 0; @@ -445,8 +448,8 @@ //Check for fifoThresh while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) == 0x20)break;else if(timeout_count == 1) { - pc_bcn.printf("Reset\n"); - reset_rfm(1); + pc_bcn.printf("Rst T1); + reset_rfm(1); // if it reaches countdown } timeout_count=10e5; @@ -461,7 +464,7 @@ //Check for fifoThresh while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x20) == 0x20)break;else if(timeout_count == 1) { - pc_bcn.printf("Reset\n"); + pc_bcn.printf("Rst T2); reset_rfm(1);} timeout_count=10e5; @@ -478,7 +481,7 @@ if (fl ==1 && ERROR_CHECK ==0) { BCN_FAIL_COUNT++; ERROR_CHECK=1; - pc_bcn.printf("BCN_FAIL_COUNT++\n"); + pc_bcn.printf("BCN_FAIL_COUNT+++\n"); } else if(fl == 0) {