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 workinQM_5thJan_azad by
Diff: main.cpp
- Revision:
- 19:79e69017c855
- Parent:
- 18:3662058a7c10
- Child:
- 20:949d13045431
--- a/main.cpp Sat May 14 11:19:13 2016 +0000 +++ b/main.cpp Sat Jun 04 11:29:13 2016 +0000 @@ -5,11 +5,26 @@ #include "EPS.h" #include "BCN.h" #include "TCTM.h" - #define tm_len 135 #define tc_len 11 #define batt_heat_low 20 +//**********************************************GLOBAL RTOS TIMER*********************************************************// +RtosTimer *BAE_STANDBY_STATUS_TIMER; + +void BAE_STANDBY_STATUS_RESET(const void* arg) +{ + printf("\n\rBAE standby reset to 0x00"); + BAE_STANDBY=0x00; +} + +/*no problem in first stopping and then starting even when for the first time*/ +void BAE_STANDBY_TIMER_RESET() +{ + BAE_STANDBY_STATUS_TIMER->stop(); + BAE_STANDBY_STATUS_TIMER->start(30000);//20 min ie 20*60=1200 sec or 1200,000 milisec but for testing setting it to 30sec +} + //***************************************************** flags *************************************************************// uint32_t BAE_STATUS = 0x00000000; uint32_t BAE_ENABLE = 0xFFFFFFFF; @@ -17,16 +32,12 @@ //i2c// char data_send_flag = 'h'; -//.........acs...............// -/* char ACS_INIT_STATUS = 'q'; -char ACS_DATA_ACQ_STATUS = 'q'; -char ACS_ATS_STATUS = 'q'; -char ACS_MAIN_STATUS = 'q'; -char ACS_STATUS = 'q'; +//.........bae......................................// +uint8_t BAE_INIT_STATUS=0; +uint8_t BAE_I2CRX_STATUS=0; -char ACS_ATS_ENABLE = 'q'; -char ACS_DATA_ACQ_ENABLE = 'q'; -char ACS_STATE = 'q';*/ +//.........acs......................................// +/* removed character initialized values */ uint8_t ACS_INIT_STATUS = 0; uint8_t ACS_DATA_ACQ_STATUS = 0; @@ -37,24 +48,22 @@ uint8_t ACS_ATS_ENABLE = 1; uint8_t ACS_DATA_ACQ_ENABLE = 1; uint8_t ACS_STATE = 4; + +//_______________________bcn__________________________// + /*added for removing the stuck/hang problem*/ /*does it work? now doing it in main*/ +//it works great extern uint8_t BCN_FEN; extern void FCTN_BCN_FEN(void const *args); Timeout timeout_bcn; +/*long beacon data/sending*/ +/*be sure it is created in bcn.cpp*/ +extern void LONG_BCN_DATA(uint8_t* ); //.....................eps...................// +/* removed character initialization*/ //eps init -/*char EPS_INIT_STATUS = 'q'; -char EPS_BATTERY_GAUGE_STATUS = 'q'; -//eps main -char EPS_MAIN_STATUS = 'q'; -char EPS_BATTERY_TEMP_STATUS = 'q'; -char EPS_STATUS = 'q'; - -char EPS_BATTERY_HEAT_ENABLE = 'q'; -*/ - uint8_t EPS_INIT_STATUS = 0; uint8_t EPS_BATTERY_GAUGE_STATUS = 0; //eps main @@ -67,13 +76,20 @@ //.......................global variables..................................................................// new hk structure- everything has to changed based on this uint8_t BAE_data[74]; char BAE_chardata[74]; - +uint8_t BAE_RESET_COUNTER = 0; // INITIALIZATION or do you want to initialize evertime the main is reset? or is it same +uint32_t BAE_I2C_COUNTER = 0; +uint8_t BAE_STANDBY=0x00;// as Bcn Acs Eps last three bits BAE order , 1 refer to switch off. //*************************************Global declarations************************************************// const int addr = 0x20; //slave address Timer t_rfsilence; Timer t_start; +/*defined as of now to check execution time*/ +/*remember to remove them*/ +Timer t_acs; +Timer t_eps; + Timer t_tc; Timer t_tm; Serial pc(USBTX, USBRX); @@ -126,27 +142,19 @@ InterruptIn ir7(PIN42);//Charger IC - Fault Bar -//DigitalOut TRXY_SW_EN(PIN71); //TR XY Switch -//DigitalOut DRV_Z_SLP(PIN88); //Sleep pin of driver z -//DigitalOut TRZ_SW(PIN40); //TR Z Switch -//DigitalOut CDMS_RESET(PIN7); // CDMS RESET -//DigitalOut BCN_SW(PIN14); //Beacon switch -//DigitalOut DRV_XY_SLP(PIN82); - - DigitalOut TRXY_SW(PIN71); //TR XY Switch DigitalOut DRV_Z_EN(PIN88); //Sleep pin of driver z DigitalOut TRZ_SW(PIN40); //TR Z Switch -DigitalOut CDMS_RESET(PIN7); // CDMS RESET +DigitalOut CDMS_RESET(PIN7,1); // CDMS RESET DigitalOut BCN_SW(PIN14); //Beacon switch DigitalOut DRV_XY_EN(PIN82); + /*****************************************************************Threads USed***********************************************************************************/ - Thread *ptr_t_i2c; + /*********************************************************FCTN HEADERS***********************************************************************************/ - void FCTN_ISR_I2C(); void FCTN_TM(); void F_ACS(); @@ -162,10 +170,7 @@ void F_ACS() { - - - //...................// - + t_acs.start(); if(pf1check == 1) { if(iterP1 >= 3) @@ -190,12 +195,12 @@ } else { - ATS2_SW_ENABLE = 0; - iterP2++; + ATS2_SW_ENABLE = 0; + iterP2++; } pf2check = 0; } - if(if1check == 1) + if(if1check == 1) { if(iterI1 >= 3) { @@ -203,8 +208,8 @@ } else { - TRXY_SW = 1; //switch on TRXY - iterI1++; + TRXY_SW = 1; //switch on TRXY + iterI1++; } } if(if2check == 1) @@ -216,8 +221,8 @@ } else { - TRZ_SW = 1; //switch on Z - iterI2++; + TRZ_SW = 1; //switch on Z + iterI2++; } } @@ -238,25 +243,25 @@ if(ACS_DATA_ACQ_ENABLE == 1)// check if ACS_DATA_ACQ_ENABLE = 1? { - //FLAG(); - FCTN_ATS_DATA_ACQ(); //the angular velocity is stored in the first 3 values and magnetic field values in next 3 - pc.printf("gyro values\n\r"); //printing the angular velocity and magnetic field values - for(int i=0; i<3; i++) - { - printf("%f\n\r",actual_data.AngularSpeed_actual[i]); - } - pc.printf("mag values\n\r"); - for(int i=0; i<3; i++) - { - pc.printf("%f\n\r",actual_data.Bvalue_actual[i]); - } - // for(int i=0;i<3;i++) -// { -// omega1[i]= data[i]; -// b1[i] = data[i+3]; -// } + //FLAG(); + FCTN_ATS_DATA_ACQ(); //the angular velocity is stored in the first 3 values and magnetic field values in next 3 + pc.printf("gyro values\n\r"); //printing the angular velocity and magnetic field values + for(int i=0; i<3; i++) + { + printf("%f\n\r",actual_data.AngularSpeed_actual[i]); + } + pc.printf("mag values\n\r"); + for(int i=0; i<3; i++) + { + pc.printf("%f\n\r",actual_data.Bvalue_actual[i]); + } +// for(int i=0;i<3;i++) +// { +// omega1[i]= data[i]; +// b1[i] = data[i+3]; +// } }//if ACS_DATA_ACQ_ENABLE = 1 - else + else { // Z axis actuation is the only final solution, } @@ -283,22 +288,22 @@ moment[0] = 0; moment[1] = 0; moment[2] =1.3;// is a dummy value - FCTN_ACS_GENPWM_MAIN(moment) ; - } - else + FCTN_ACS_GENPWM_MAIN(moment) ; /*printf statements*/ + } + else { - if(ACS_STATE == 3) // check ACS_STATE = ACS_DATA_ACQ_FAILURE - { - FLAG(); - printf("\n\r acs data failure "); - ACS_STATUS = 3; // set ACS_STATUS = ACS_DATA_ACQ_FAILURE + if(ACS_STATE == 3) // check ACS_STATE = ACS_DATA_ACQ_FAILURE + { + FLAG(); + printf("\n\r acs data failure "); + ACS_STATUS = 3; // set ACS_STATUS = ACS_DATA_ACQ_FAILURE PWM1 = 0; //clear pwm pins PWM2 = 0; //clear pwm pins PWM3 = 0; //clear pwm pins - } - else - { - if(ACS_STATE == 4) // check ACS_STATE = ACS_NOMINAL_ONLY + } + else + { + if(ACS_STATE == 4) // check ACS_STATE = ACS_NOMINAL_ONLY { FLAG(); printf("\n\r nominal"); @@ -341,8 +346,7 @@ }//else of invalid }//else of autocontrol }//else of nominal - }//else of data acg failure - + }//else of data acg failure }//else fo z axis moment only }//if power >2 else @@ -355,54 +359,58 @@ PWM3 = 0; //clear pwm pins } } //else for acs control off -/// + printf("\n\rlow power crossed and pwm no hang"); ACS_MAIN_STATUS = 0; //clear ACS_MAIN_STATUS flag + + t_acs.stop(); + printf("\n\r the time for acs is %f",(float)t_acs.read_ms()); + t_acs.reset(); } + //***************************************************EPS THREAD***********************************************// void F_EPS() -{ +{ + t_eps.start(); pc.printf("\n\rEntered EPS %f\n",t_start.read()); EPS_MAIN_STATUS = 1; // Set EPS main status FCTN_BATT_TEMP_SENSOR_MAIN(actual_data.Batt_temp_actual); - pc.printf("\n\r Battery temperature %f %f" ,actual_data.Batt_temp_actual[0], actual_data.Batt_temp_actual[1]); - EPS_BATTERY_TEMP_STATUS = 1; //set EPS_BATTERY_TEMP_STATUS - if(EPS_BATTERY_HEAT_ENABLE == 1) - { - if((actual_data.Batt_temp_actual[0] < batt_heat_low) && (actual_data.Batt_temp_actual[1] < batt_heat_low)) // to confirm - { - batt_heat = 1; //turn on battery heater - } - else - { - batt_heat = 0; //turn off battery heater - } + pc.printf("\n\r Battery temperature %f %f" ,actual_data.Batt_temp_actual[0], actual_data.Batt_temp_actual[1]); + EPS_BATTERY_TEMP_STATUS = 1; //set EPS_BATTERY_TEMP_STATUS + if(EPS_BATTERY_HEAT_ENABLE == 1) + { + if((actual_data.Batt_temp_actual[0] < batt_heat_low) && (actual_data.Batt_temp_actual[1] < batt_heat_low)) // to confirm + { + batt_heat = 1; //turn on battery heater + } + else + { + batt_heat = 0; //turn off battery heater + } - } - else if(EPS_BATTERY_HEAT_ENABLE == 0) - { - EPS_STATUS = 1;//EPS_STATUS = EPS_BATTERY_HEATER_DISABLED - } + } + else if(EPS_BATTERY_HEAT_ENABLE == 0) + { + EPS_STATUS = 1;//EPS_STATUS = EPS_BATTERY_HEATER_DISABLED + } FCTN_BATTERYGAUGE_MAIN(actual_data.Batt_gauge_actual); if (actual_data.Batt_gauge_actual[1] == 200) //data not received { - actual_data.power_mode = 1; - EPS_BATTERY_GAUGE_STATUS = 0; //clear EPS_BATTERY_GAUGE_STATUS + actual_data.power_mode = 1; + EPS_BATTERY_GAUGE_STATUS = 0; //clear EPS_BATTERY_GAUGE_STATUS } else { - FCTN_EPS_POWERMODE(actual_data.Batt_gauge_actual[1]); //updating power level - EPS_BATTERY_GAUGE_STATUS = 1; //set EPS_BATTERY_GAUGE_STATUS + FCTN_EPS_POWERMODE(actual_data.Batt_gauge_actual[1]); //updating power level + EPS_BATTERY_GAUGE_STATUS = 1; //set EPS_BATTERY_GAUGE_STATUS } - // if( Temperature data received) + // if( Temperature data received) //{ - - - // } + //} // else // { // Set battery temp to XX @@ -410,11 +418,13 @@ // EPS_STATUS = EPS_ERR_BATTERY_TEMP; // } FCTN_HK_MAIN(); - // printf("\n\r here"); FCTN_APPEND_HKDATA(); minMaxHkData(); - //printf("\n\r here"); - EPS_MAIN_STATUS = 0; // clear EPS main status + EPS_MAIN_STATUS = 0; // clear EPS main status + + t_eps.stop(); + printf("\n\r the time for eps is %f",(float)t_eps.read_ms()); + t_eps.reset(); } @@ -422,7 +432,6 @@ void F_BCN() { - pc.printf("\n\rEntered BCN %f\n",t_start.read()); FCTN_BCN_TX_MAIN(); @@ -432,57 +441,120 @@ //**************************************************TCTM THREAD*******************************************************************// void T_TC(void const * args) -{ +{ while(1) - { - Thread::signal_wait(0x4); - wait_us(200); - //printf("\n\rreached\n"); // can be between 38 to 15700 - if( slave.receive() == 0) - {slave.stop(); - //printf("\n\rnot send\n"); + { + Thread::signal_wait(0x4); + wait_us(200);// se if it can be changed + + /*SHOULD IT BE PLACED INSIDE OR OUTSIDE?*/ + BAE_I2CRX_STATUS=1; + FLAG(); + BAE_I2C_COUNTER++; + //printf("\n\rreached\n"); // can be between 38 to 15700 + if( slave.receive() == 0) + { + slave.stop(); + //printf("\n\rnot send\n"); } - else if( slave.receive() == 1) // slave writes to master - { - if(data_send_flag == 'h') - { - //FCTN_APPEND_HKDATA(); - // pc.printf("\n\r here"); - write_ack=slave.write(BAE_chardata,74); - if(write_ack==0) - {irpt_2_mstr = 0; - printf("\n\rgot interrupt\n"); - } - } - else if(data_send_flag == 't') + else if( slave.receive() == 1) // slave writes to master { - write_ack=slave.write((char*)telemetry,tm_len); - data_send_flag = 'h'; - if(write_ack==0) - irpt_2_mstr = 0; - } - } - else if( slave.receive()==3 || slave.receive()==2) // slave read - { - read_ack=slave.read(telecommand,tc_len); - t_tc.start(); - //pc.printf("\n\rTELECOMMAND received from CDMS is %s \n",telecommand); - pc.printf("\n\r Executing Telecommand \n"); - // FCTN_TC_DECODE((uint8_t*) telecommand); + if(data_send_flag == 'h') + { + irpt_2_mstr =1;// wait till cdms code is changed + + FCTN_APPEND_HKDATA(); + // pc.printf("\n\r here"); + write_ack=slave.write(BAE_chardata,74); + if(write_ack==0)// wait till cdms code is changed + + { + irpt_2_mstr = 0; + printf("\n\rgot interrupt\n"); + } + } + else if(data_send_flag == 't') + { + write_ack=slave.write((char*)telemetry,tm_len); + data_send_flag = 'h'; + if(write_ack==0) + irpt_2_mstr = 0; + } + } + else if( slave.receive()==3 || slave.receive()==2) // slave read + { + read_ack=slave.read(telecommand,tc_len); + t_tc.start(); + //pc.printf("\n\rTELECOMMAND received from CDMS is %s \n",telecommand); + pc.printf("\n\r Executing Telecommand \n"); + // FCTN_TC_DECODE((uint8_t*) telecommand); - FCTN_BAE_TM_TC((uint8_t*) telecommand); - //telemetry = (char*)temp; + FCTN_BAE_TM_TC((uint8_t*) telecommand); + //telemetry = (char*)temp; - FCTN_TM(); - t_tc.stop(); - printf("\n\r time taken %d",t_tc.read_us()); - t_tc.reset(); - // for(int i = 0; i<134; i++) - //pc.printf("%c", telemetry[i]); - } + FCTN_TM(); + t_tc.stop(); + printf("\n\r time taken %d",t_tc.read_us()); + t_tc.reset(); + // for(int i = 0; i<134; i++) + //pc.printf("%c", telemetry[i]); + } - } +/*implemented when cdms send telecommand as t and long bcn data seperately + { + read_ack=slave.read(telecommand,tc_len); + t_tc.start(); + + //*code for differentiating wether the given data is tc or long beacon asssuming the first bit differentiate + if(telecommand[0]=='t') //*i.e telecommand is recieved + { + pc.printf("\n\r data is = %x ",telecommand[0]); + //pc.printf("\n\rTELECOMMAND received from CDMS is %s \n",telecommand); + pc.printf("\n\r Executing Telecommand "); + // FCTN_TC_DECODE((uint8_t*) telecommand); + + FCTN_BAE_TM_TC((uint8_t*) telecommand); + //telemetry = (char*)temp; + + FCTN_TM(); +/// t_tc.stop(); +/// printf("\n\r time taken %d",t_tc.read_us()); +/// t_tc.reset(); + // for(int i = 0; i<134; i++) + //pc.printf("%c", telemetry[i]); + } + + else if(telecommand[0]=='l') //*i.e long beacon data is recieved* / + { + pc.printf("\n\r sending the long beacon data "); + /*if data is to send as in uint8 format if it is to be send as char + then just forward it without converting* / + //*creating a new function here to update the long beacon data everytime cdms sends it* / + LONG_BCN_DATA((uint8_t*)telecommand); + //here long beacon structure change +/// t_tc.stop(); +/// printf("\n\r time taken %d",t_tc.read_us()); +/// t_tc.reset(); + } + else + { + pc.printf("\n\r none of case met a miss "); +/// t_tc.stop(); +/// printf("\n\r time taken %d",t_tc.read_us()); +/// t_tc.reset(); + } + + t_tc.stop(); + printf("\n\r time taken %d",t_tc.read_us()); + t_tc.reset(); + + } +*/ + BAE_I2CRX_STATUS=0; + FLAG(); + + } } void FCTN_TM() @@ -629,43 +701,53 @@ uint8_t schedcount=1; void T_SC(void const *args) { - printf("\n\r in scheduler"); +/// printf("\n\r in scheduler"); + + /*if keeping thish many cases creates a problem then make 3 seperate flagvariable i.e bae_standby_acs so on that will make it easy.!!!*/ if(schedcount == 7) //to reset the counter { schedcount = 1; } if(schedcount%1==0) - { pc.printf("\nSTATE IS !!!!!! = %x !!\n",ACS_STATE); - pc.printf("\niterp1 !!!!!! = %x !!\n",iterP1); - pc.printf("\niteri2 IS !!!!!! = %x !!\n",iterI2); - F_ACS(); + { + if( BAE_STANDBY!=0x02 && BAE_STANDBY!=0x03 && BAE_STANDBY!=0x06 && BAE_STANDBY!=0x07) + { + pc.printf("\nSTATE IS !!!!!! = %x !!\n",ACS_STATE); + F_ACS(); + } } if(schedcount%2==0) - { - printf("\n\rreached scheduler part2 "); - //F_EPS(); - //F_BCN(); + { + if( BAE_STANDBY!=0x01 && BAE_STANDBY!=0x03 && BAE_STANDBY!=0x05 && BAE_STANDBY!=0x07) + F_EPS(); } - printf("\n\rexited scheduler part2 "); if(schedcount%3==0) - { - printf("\n\rreached scheduler part3 "); - //F_ACS(); - F_BCN(); + { + if(BAE_STANDBY!=0x04 && BAE_STANDBY!=0x05 && BAE_STANDBY!=0x06 && BAE_STANDBY!=0x07) + F_BCN(); } schedcount++; - //t_start.start(); - printf("\n\r did increment %d",schedcount); - printf("\n\r ex h"); + printf("\n\r exited scheduler h"); printf("\n\r time taken %f",t_start.read()); } Timer t_flag; + void FLAG() { - + +//.............bae..................// + if(BAE_INIT_STATUS == 1) + BAE_STATUS = BAE_STATUS | 0x00000001; //BAE_STATUS |= 0x00000001; + else if(BAE_INIT_STATUS == 0) + BAE_STATUS &= 0xFFFFFFFE; + + if(BAE_I2CRX_STATUS == 1) + BAE_STATUS = BAE_STATUS | 0x00000002; + if(BAE_I2CRX_STATUS == 0) + BAE_STATUS &= 0xFFFFFFFD; //.............acs..................// if(ACS_INIT_STATUS == 1) BAE_STATUS = BAE_STATUS | 0x00000080; //set ACS_INIT_STATUS flag @@ -773,12 +855,16 @@ void FCTN_BAE_INIT() { printf("\n\r Initialising BAE _________________________________________________________________________________"); + BAE_INIT_STATUS=1; + FLAG(); + //..........intial status....// ACS_STATE = 4; ACS_ATS_ENABLE = 1; ACS_DATA_ACQ_ENABLE = 1; EPS_BATTERY_HEAT_ENABLE = 1; actual_data.power_mode=3; + //............intializing pins................// ATS1_SW_ENABLE = 0; ATS2_SW_ENABLE = 1; @@ -788,39 +874,31 @@ TRZ_SW = 1; TRXY_SW = 1; - //............................// + //...........order mentioned in flow chart.................// FCTN_ACS_INIT(); FCTN_EPS_INIT(); FCTN_BCN_INIT(); + + uint32_t data_flash=FCTN_BAE_RD_FLASH_ENTITY(0);/*sending the 0 entity as in mms tc/tm bae_reset_counter is present in first 32 bits */ + uint32_t data_modify=data_flash & 0x000000FF; + data_modify +=1; + data_modify |=data_flash; + FCTN_BAE_WR_FLASH(0,data_modify) + printf("\n\rthe number of reset %d",data_modify); - + BAE_INIT_STATUS=0; FLAG(); } int main() { - pc.printf("\n\r BAE Activated. Testing Version 1.1 \n"); + pc.printf("\n\r BAE Activated. Testing Version 1.2 \n"); CDMS_RESET = 1; - /*if (BCN_FEN == 0) //dummy implementation - { - pc.printf("\n\r RF silence "); - FCTN_BCN_FEN(); - t_rfsilence.start();//Start the timer for RF_Silence - while(t_rfsilence.read() < RF_SILENCE_TIME); - } - */ - - //ACS_INIT_STATUS = 0; - //ACS_DATA_ACQ_STATUS = 0; - - - + + /*BCN_FEN == 0 //dummy implementation removed */ //FLAG(); FCTN_BAE_INIT(); - - //...i2c.. - //strcpy(telemetry,"This is telemetry THis is sample telemetry. ffffffffffffffffffffffffffffff end"); slave.address(addr); irpt_2_mstr = 0; @@ -829,38 +907,23 @@ irpt_4m_mstr.enable_irq(); irpt_4m_mstr.rise(&FCTN_I2C_ISR); - // ir1.fall(&ir1clear); //Battery Gauge - Alert Bar Signal - /* ir2.fall(&ir2clear); //TRXY Driver TR switch Fault - ir3.fall(&ir3clear); //TRZ Driver Fault Bar - ir4.fall(&ir4clear); //TRZ Driver TR switch Fault - ir5.fall(&ir5clear); //CDMS - Switch Fault - ir6.fall(&ir6clear); //Beacon- Switch OC bar - ir7.fall(&ir7clear); //Charger IC - Fault Bar - - */ + RtosTimer t_sc_timer(T_SC,osTimerPeriodic); // Initiating the scheduler thread t_sc_timer.start(10000); t_start.start(); pc.printf("\n\rStarted scheduler %f\n\r",t_start.read()); + /*if one defines it dynamically then one has to take care that the destuct function is calle everytime BAE resets otheriwse it will lead to memory leakage*/ + //BAE_STANDBY_STATUS_TIMER = new RtosTimer(BAE_STANDBY_STATUS_RESET,osTimerOnce); + + /*static allocation*/ + RtosTimer STANDBY_TIMER(BAE_STANDBY_STATUS_RESET,osTimerOnce); + BAE_STANDBY_STATUS_TIMER=&STANDBY_TIMER; RtosTimer bcn_start_timer(FCTN_BCN_FEN,osTimerOnce); /*later change it to 30 min 1800 seconds*/ - bcn_start_timer.start(10000); - - /*for calling bcn_fen function after 30 min as of now say 40 sec*/ - /*but it will be called again and again */ - -/// even this doesn't work if(t_start.read()>38 && t_start.read()<43) -/// if(BCN_FEN==0) -/// { -/// FCTN_BCN_FEN(); -/// printf("\n\r entered the condition \n"); -/// } + bcn_start_timer.start(20000); -// it won't work timeout_bcn.attach(&FCTN_BCN_FEN,42.0); - - //FCTN_BAE_INIT(); while(1); //required to prevent main from terminating }