bcn code modification for new short bcn format

Dependencies:   mbed

Fork of BEACON_CODE by pradeep shekhar

Revision:
18:3d8e70286f67
Parent:
17:afadd6b988a2
Child:
19:6863457ea3d1
--- a/BCN.cpp	Wed Oct 28 15:54:26 2015 +0000
+++ b/BCN.cpp	Fri Oct 30 06:26:48 2015 +0000
@@ -1,5 +1,4 @@
-#include "beacon.h"
-#include <stdio.h>
+#include "BCN.h"
 //Check the pin names
 //Takes max 4.3 sec in void FCTN_BCN_TX_MAIN() (temp.calc. + long_beacon + short_beacon) 
 
@@ -7,14 +6,15 @@
 SPI spi(D11, D12, D13);              // mosi, miso, sclk 
 DigitalOut cs(D10);                //slave select or chip select
 Timer t_i;
-//Ticker loop;
+Timeout flipper;
+Ticker loop;
 
 //GLOBAL VARIABLES
 uint8_t BCN_INIT_STATUS = 0;
 uint8_t BCN_TX_MAIN_STATUS = 0;
 uint8_t BCN_TX_STATUS = 0;
 uint8_t BCN_TX_EN = 1;              //hardcoding for now    //check where is this variable toggled??
-uint8_t BCN_FEN = 1;                //hardcoding for now
+uint8_t BCN_FEN = 0;                //hardcoding for now
 uint8_t BCN_STANDBY = 0;            //hardcoding for now    //check where is this variable toggled??
 uint8_t BCN_TS_BUFFER = 0;              // For Temperature 
 
@@ -22,6 +22,8 @@
 {
     pc.printf("FCTN_BCN_INIT\n");
     BCN_INIT_STATUS = 1;
+    if(BCN_FEN == 0)
+        flipper.attach(&FCTN_BCN_FEN, 30);
     Init_BEACON_HW();
     BCN_INIT_STATUS = 0;
 }
@@ -84,7 +86,7 @@
     }
     t_i.stop();
     int end = t_i.read_us();
-    pc.printf("The time required for short and long is %d seconds\r\n", end-begin);
+    pc.printf("The time required for FCTN_BCN_TX_MAIN is %d seconds\r\n", end-begin);
     
 }
 
@@ -333,7 +335,7 @@
     writereg(RF22_REG_0B_GPIO_CONFIGURATION0,0x15); // TX state                        
     writereg(RF22_REG_0C_GPIO_CONFIGURATION1,0x12); // RX state                        
 
-    setFrequency(435.0,05);
+    setFrequency(435.0,0.05);
 
     if((readreg(RF22_REG_02_DEVICE_STATUS)& 0x08)!= 0x00)
         {
@@ -379,7 +381,7 @@
         return 0;
     }
 }
-/*int main()
+int main()
 {
     FCTN_BCN_INIT(); 
     
@@ -387,4 +389,4 @@
     
     while(1);
     
-}*/
\ No newline at end of file
+}
\ No newline at end of file