![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
things are working
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_DEC_2016_jan by
Diff: main.cpp
- Revision:
- 1:ad3b8a8032e2
- Parent:
- 0:bcbd76c86cde
- Child:
- 3:23cdab96a05d
--- a/main.cpp Wed Dec 16 09:06:59 2015 +0000 +++ b/main.cpp Thu Jan 21 14:46:28 2016 +0000 @@ -6,7 +6,10 @@ #include "i2c.h" #include "cdms_rtc.h" #include "main_funcs.h" +#include "CDMS_HK.h" #include "TMTC.h" +#include "main.h" + Serial pc(USBTX,USBRX); @@ -14,6 +17,9 @@ Thread *ptr_t_tmtc; InterruptIn pl_sc_data(PIN81); +InterruptIn cdms_rcv_tc(PIN38); +extern DigitalOut irpt_2_slv; + /* only for sd testing*/ uint8_t write_to_sd[512]; @@ -23,11 +29,14 @@ Base_tc *tc_test = new Long_tc; Base_tm *tm_test = new Long_tm; + + + void TSC_HK_BAE_CDMS_PL_MODE(void const *args) { - BAE_HK(); - CDMS_HK(); - PL_MODE(); + + FCTN_CDMS_HK_MAIN(); + } void BAE_HK() @@ -35,35 +44,31 @@ printf("\n\rBAE_HK Function Executed\r\n"); } -void CDMS_HK() -{ - printf("\n\rCDMS_HK Function Executed\r\n"); - uint64_t time = FCTN_CDMS_RD_RTC(); - printf("\n\r0x%016llx\n\r", time); - disk_write(write_to_sd,4); - disk_read(read_from_sd,4); - for(int i=0;i<512;i++) - { - printf("%d",read_from_sd[i]); - } -} + void PL_MODE() { printf("\n\rPL_MODE Function Executed\r\n"); - ptr_t_tmtc->signal_set(0x3); + } void T_CDMS_RLY_TMTC(void const *args) { - while(1) - { - Thread::signal_wait(0x3); - printf("\rin T_CDMS_RLY_TM\r\n"); - tc_test->TC_string[0] = 43; - tc_test->TC_string[1] = 81; - tc_test->TC_string[2] = 97; - tc_test->TC_string[3] = 80; + + + printf("\rin T_CDMS_RLY_TMTC\r\n"); + printf("\r \n Enter a valid TC \n\r"); + uint8_t read; + /* for(int i=0;i <4 ; i++) + { + scanf("%d",&tc_test->TC_string[i]); + }*/ + + tc_test->TC_string[0] = 43; + tc_test->TC_string[1] = 0x40; + tc_test->TC_string[2] = 0x81; + tc_test->TC_string[3] = 0x13; + for(int i=4;i < 135 ; i++) tc_test->TC_string[i] = 43; printf("%s", tc_test->TC_string); @@ -75,7 +80,7 @@ // printf("%c", tm_test->TM_string[i]); // } //FUNC_CDMS_RLY_TM(); - } + } void T_PL_RCV_SC_DATA(void const *args) @@ -83,15 +88,16 @@ while(1) { Thread::signal_wait(0x1); - FCTN_PL_RCV_SC_DATA(); + //uint8_t* buff=FCTN_PL_RCV_SC_DATA(); + uint8_t* buff; FCTN_COM_COMP_SC_DATA(); FCTN_CDMS_RD_RTC(); - disk_write(write_to_sd,2); - disk_read(read_from_sd,2); - for(int i=0;i<512;i++) + uint8_t fsc=FCTN_SD_MNGR(0x0); + SD_WRITE(buff,fsc,0x0); + /*for(int i=0;i<512;i++) { printf("%d",read_from_sd[i]); - } + }*/ } } @@ -100,36 +106,45 @@ ptr_t_sc_data->signal_set(0x1); } -void FCTN_PL_RCV_SC_DATA() +/*uint8_t* FCTN_PL_RCV_SC_DATA() { printf("\n\rFCTN_PL_RCV_SC_DATA Function Executed\r\n"); -} + uint8_t buff[512]; + for(int i=0;i<512;i++) + { + buff[i]=0x32; + } + return buff; + +} */ void FCTN_COM_COMP_SC_DATA() { printf("\n\rFCTN_COM_COMP_SC_DATA Function Executed\r\n"); } -void FCTN_CDMS_WR_SD() + + +void ISR_TMTC_THREAD() { - printf("\n\rFCTN_CDMS_WR_SD Function Executed\r\n"); + ptr_t_tmtc->signal_set(0x3); } + int main() { - printf("\n\r CDMS Activated \r\n"); - initialise_card(); - disk_initialize(); + irpt_2_slv=0; + FCTN_CDMS_SD_INIT(); FCTN_CDMS_INIT_RTC(); - for(int i=0;i<512;i++) - { - write_to_sd[i] = i; - } - RtosTimer TIMER_HK_ACQ(TSC_HK_BAE_CDMS_PL_MODE,osTimerPeriodic); - TIMER_HK_ACQ.start(10000); + RtosTimer TIMER_HK_ACQ(T_CDMS_RLY_TMTC,osTimerPeriodic); + TIMER_HK_ACQ.start(20000); ptr_t_tmtc = new Thread (T_CDMS_RLY_TMTC); ptr_t_sc_data = new Thread (T_PL_RCV_SC_DATA); pl_sc_data.rise(&ISR_PL_RCV_SC_DATA); - - while(1); + cdms_rcv_tc.rise(&ISR_TMTC_THREAD); + while(1) + { + Thread::wait(10); + + } } \ No newline at end of file