vr1.1
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_RTOS_v1_1 by
main.cpp
- Committer:
- pradeepvk2208
- Date:
- 2015-07-04
- Revision:
- 9:7ff6d75cc09e
- Parent:
- 8:607ae92fa6af
- Child:
- 11:d6dc9074075b
File content as of revision 9:7ff6d75cc09e:
/*Header Files*/ #include "mbed.h" #include "rtos.h" #include "main.h" #include "Flags.h" #include "all_funcs.h" /*End*/ Serial pc(USBTX, USBRX); /*All Threads*/ void T_CDMS_RLY_TC(void const *args) { while(1) { Thread::signal_wait(0x2); pc.printf("in T_CDMS_RLY_TC\r\n"); FCTN_CDMS_RLY_TC(); } } void T_CDMS_RLY_TM(void const *args) { while(1) { Thread::signal_wait(0x3); pc.printf("\rin T_CDMS_RLY_TM\r\n"); FCTN_CDMS_RLY_TM(); } } void T_PL_RCV_SC_DATA(void const *args) { while(1) { Thread::signal_wait(0x1); pc.printf("\rin T_PL_RCV_SC_DATA\r\n"); FCTN_PL_RCV_SC_DATA(); } } /*End*/ /*RTOS Scheduler*/ void T_SC(void const *args) { sc_timer++; if(sc_timer%18==0) { FCTN_CDMS_HK_MAIN(); } if(sc_timer%9==0) { FCTN_PL_MAIN(); } } /*End*/ /*All ISR's*/ void ISR_PL_RCV_SC_DATA() { ptr_t_sc_data->signal_set(0x1); //science thread is signalled from here } void ISR_CDMS_RLY_TC() { ptr_t_tc->signal_set(0x2); //TC thread is signalled from here } void ISR_CDMS_RLY_TM() { ptr_t_tm->signal_set(0x3); //TM thread is signalled from here whenever a interrupt comes from } /*End*/ /*main thread*/ int main() { printf("\n\r CDMS Activated \n"); ptr_t_tc = new Thread (T_CDMS_RLY_TC); ptr_t_tm = new Thread (T_CDMS_RLY_TM); ptr_t_sc_data = new Thread (T_PL_RCV_SC_DATA); master.frequency(100000); RtosTimer TIMER_HK_ACQ(T_SC,osTimerPeriodic); TIMER_HK_ACQ.start(10000); irpt_2_slv = 1; pl_sc_data.rise(&ISR_PL_RCV_SC_DATA); cdms_rcv_tc.rise(&ISR_CDMS_RLY_TC); bae_tm_rcv.rise(&ISR_CDMS_RLY_TM); pl_tm_rcv.rise(&ISR_CDMS_RLY_TM); pl_spi.format(8,3); // SPI format --> 16 bits, mode = 0 pl_spi.frequency(1000000); FCTN_CDMS_HK_INIT(); FCTN_INIT_RTC(); int *status_sd = FCTN_INIT_SD(); while(1); } /*End*/