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.
Fork of TFOX_CDMS_VR_1_0_WORKING by
Diff: main.cpp
- Revision:
- 7:4f17f1afe95e
- Parent:
- 6:2026890397d6
- Child:
- 8:f3b50b921414
--- a/main.cpp Tue Jun 16 16:16:12 2015 +0000 +++ b/main.cpp Tue Jun 16 20:14:03 2015 +0000 @@ -3,8 +3,9 @@ #include "func_head.h" #include "i2c.h" #include "SDCard.h" +#include "HK_CDMS.h" #define HK_DATA 25 -#define HK_ITER 15 +#define HK_ITER 5 Serial pc(USBTX,USBRX); extern SPISlave pl_spi ; // mosi, miso, sclk, ssel --> using SPI1 @@ -19,7 +20,7 @@ char i2c_data[25]; int hk_count=0; uint8_t hk_data[512]; -uint8_t* rtc_data; +uint8_t rtc_data[8]; uint64_t hk_block_number = 1; /*****************************************************************Threads USed*************************************************************************/ @@ -67,14 +68,14 @@ FUNC_CDMS_RD_RTC(rtc_data); for(int i=(hk_count%(HK_ITER+1))*(HK_DATA+8);i<(hk_count%(HK_ITER+1))*(HK_DATA+8)+8;i++) { - hk_data[i] = rtc_data[i]; + hk_data[i] = rtc_data[i-(hk_count%(HK_ITER+1))*(HK_DATA+8)]; } for(int i=(hk_count%(HK_ITER+1))*(HK_DATA+8)+8;i<(hk_count%(HK_ITER+1))*(HK_DATA+8)+8+HK_DATA;i++) { - hk_data[i] = i2c_data[i]; + hk_data[i] = i2c_data[i-(hk_count%(HK_ITER+1))*(HK_DATA+8)+8]; } hk_count++; - if(hk_count%15==0) + if(hk_count%HK_ITER==0) { for(int i=(hk_count%(HK_ITER+1))*(HK_DATA+8)+8+HK_DATA;i<512;i++) { @@ -87,12 +88,13 @@ hk_data[i] = '/0'; } FUNC_RD_SD(hk_data,hk_block_number); - hk_block_number; + hk_block_number++; printf("\n\r sd card hk data\n"); for(int i=0;i<512;i++) { pc.printf("%d|",hk_data[i]); } + // FCTN_CDMS_HK_MAIN(); } pc.printf("\n\r hk exited\n"); } @@ -119,7 +121,7 @@ ptr_t_sc_data = new Thread (T_PL_RCV_SC_DATA); master.frequency(100000); RtosTimer TIMER_HK_ACQ(TSC_CDMS_HK_MAIN,osTimerPeriodic); - TIMER_HK_ACQ.start(20000); + 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); @@ -129,6 +131,7 @@ pl_spi.format(8,3); // SPI format --> 16 bits, mode = 0 pl_spi.frequency(1000000); + FCTN_CDMS_HK_INIT(); FUNC_INIT_RTC(); int *status_sd = FUNC_INIT_SD();