![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
General testings
Revision 5:ee01f6c87022, committed 2016-04-13
- Comitter:
- shekhar
- Date:
- Wed Apr 13 13:31:31 2016 +0000
- Parent:
- 4:d1a2b3ff6b5e
- Commit message:
- Ready to integrate with BAE...
Changed in this revision
BCN.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/BCN.cpp Wed Apr 13 13:21:56 2016 +0000 +++ b/BCN.cpp Wed Apr 13 13:31:31 2016 +0000 @@ -1,10 +1,13 @@ + #include "BCN.h" +#include <stdio.h> +#include "pin_config.h" //Check the pin names //Takes max 4.3 sec in void FCTN_BCN_TX_MAIN() (temp.calc. + long_beacon + short_beacon) -Serial pc(USBTX, USBRX); //tx,rx -SPI spi(D11, D12, D13); // mosi, miso, sclk -DigitalOut cs(D10); //slave select or chip select +Serial pc_bcn(USBTX, USBRX); //tx,rx +SPI spi(PIN16, PIN17, PIN15); // mosi, miso, sclk +DigitalOut cs(PIN6); //slave select or chip select Timer t_i; Timeout rf_sl_timeout; Ticker loop; @@ -20,7 +23,7 @@ void FCTN_BCN_INIT() { - pc.printf("FCTN_BCN_INIT\n"); + pc_bcn.printf("FCTN_BCN_INIT\n"); BCN_INIT_STATUS = 1; if(BCN_FEN == 0) rf_sl_timeout.attach(&FCTN_BCN_FEN, 30); @@ -29,12 +32,12 @@ } void FCTN_BCN_FEN() { - pc.printf("FCTN_FEN\n"); + pc_bcn.printf("FCTN_FEN\n"); BCN_FEN = 1;//write this value to flash } void FCTN_BCN_TX_MAIN() { - pc.printf("FCTN_BCN_TX_MAIN\n"); + pc_bcn.printf("FCTN_BCN_TX_MAIN\n"); t_i.start(); int begin = t_i.read_us(); BCN_TX_MAIN_STATUS = 1; @@ -45,7 +48,7 @@ { //Measure and store BCN temperature in BCN_TS_BUFFER BCN_TS_BUFFER = check_Temperature(); - pc.printf("\n\ntemperature = %d\n\n",BCN_TS_BUFFER); + pc_bcn.printf("\n\ntemperature = %d\n\n",BCN_TS_BUFFER); //Get BCN_HK data from BCN HW(SPI) //Store BCN_HK data in BCN_HK_BUFFER if(BCN_STANDBY == 1 ) { @@ -86,7 +89,7 @@ } t_i.stop(); int end = t_i.read_us(); - pc.printf("The time required for FCTN_BCN_TX_MAIN is %d useconds\r\n", end-begin); + pc_bcn.printf("The time required for FCTN_BCN_TX_MAIN is %d useconds\r\n", end-begin); } @@ -172,7 +175,7 @@ //Check for packet_sent while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) == 0x04)break; - //pc.printf("Short packet sent\r\n"); + //pc_bcn.printf("Short packet sent\r\n"); writereg(RF22_REG_07_OPERATING_MODE1,0x00); //standby mode @@ -230,7 +233,7 @@ //Check for packetsent interrupt while(timeout_count--)if((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) == 0x04)break; - //pc.printf("Long packet sent\r\n"); + //pc_bcn.printf("Long packet sent\r\n"); writereg(RF22_REG_07_OPERATING_MODE1,0x00); //standby mode } @@ -302,9 +305,9 @@ //should either have a flag for invalid SPI or discard this for actual case or add reset if (readreg(RF22_REG_00_DEVICE_TYPE) == 0x08) - pc.printf("spi connection valid\r\n"); + pc_bcn.printf("spi connection valid\r\n"); else - {pc.printf("error in spi connection\r\n"); + {pc_bcn.printf("error in spi connection\r\n"); reset_rfm(); } @@ -331,7 +334,7 @@ if((readreg(RF22_REG_02_DEVICE_STATUS)& 0x08)!= 0x00) { - pc.printf("frequency not set properly\r\n"); + pc_bcn.printf("frequency not set properly\r\n"); reset_rfm(); } @@ -369,7 +372,7 @@ } else { - pc.printf("Packet not sent\r\n"); + pc_bcn.printf("Packet not sent\r\n"); return 0; } }