QITH FLAGS
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of TF_conops_BAE1_3 by
Diff: beacon.cpp
- Revision:
- 1:7185136654ce
- Parent:
- 0:246d1b5f11ae
--- a/beacon.cpp Tue Jun 30 05:55:48 2015 +0000 +++ b/beacon.cpp Mon Jul 06 07:34:00 2015 +0000 @@ -15,13 +15,12 @@ */ // 6CC000 for 435 MHz //set all values as FF for checking on spectrum analyzer + #include "beacon.h" -#include "HK.h" +#include "EPS.h" #include "pin_config.h" -Serial chavan(USBTX, USBRX); // tx, rx -//SPI spi(PIN2,PIN1,PIN3); // mosi, miso, sclk +Serial pc_bea(USBTX, USBRX); // tx, rx DigitalOut cs(PIN6); //slave select or chip select -//SPI spi(PTD6,PTD7,PTD5); // mosi, miso, sclk SPI spi(PIN16,PIN17,PIN15); //DigitalOut cs_bar(PTC11); //slave select or chip select //InterruptIn button(p9); @@ -30,13 +29,14 @@ /*void interrupt_func() { - chavan.printf("INTERRUPT_FUNC TRIGGERED\n wait for 3 secs\n"); + pc_bea.printf("INTERRUPT_FUNC TRIGGERED\n wait for 3 secs\n"); wait(3); }*/ - - +/***********************************************global variable declaration***************************************************************/ +extern uint32_t BAE_STATUS; +extern uint32_t BAE_ENABLE; extern ShortBeacy Shortbeacon; void writereg(uint8_t reg,uint8_t val) @@ -91,7 +91,7 @@ void FCTN_BEA_INIT() { - //reset() + BAE_STATUS |= 0x00000004; //set BEA_INIT_STATUS flag writereg(RF22_REG_07_OPERATING_MODE1,0x80); //sw_reset wait(1); //takes time to reset @@ -160,12 +160,14 @@ writereg(RF22_REG_72_FREQUENCY_DEVIATION,0x02); //set tx power writereg(RF22_REG_6D_TX_POWER,0x07); //20dbm - writereg(RF22_REG_3E_PACKET_LENGTH,TX_DATA); //packet length + writereg(RF22_REG_3E_PACKET_LENGTH,TX_DATA); //packet length + BAE_STATUS &= 0xFFFFFFFB; //clear BEA_INIT_STATUS flag } -void FCTN_BEA_MAIN() +void FCTN_BEA_TX_MAIN() { - FCTN_BEA_INIT(); + //FCTN_BEA_INIT(); + BAE_STATUS |= 0x00000008; //set BEA_TX_MAIN_STATUS flag printf("\nBeacon function entered\n"); wait(1); // wait for POR to complete //change the timing later cs=1; // chip must be deselected @@ -234,5 +236,5 @@ //rf22.waitPacketSent(); while((readreg(RF22_REG_03_INTERRUPT_STATUS1) & 0x04) != 0x04);//pc.printf(" chck pkt sent!\n"); printf("\nBeacon function exiting\n"); - + BAE_STATUS &= 0xFFFFFFF7; // clear BEA_TX_MAIN_STATUS flag } \ No newline at end of file