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:
- 5:c77b49508927
- Parent:
- 4:cc85cfaa2086
- Child:
- 6:2026890397d6
--- a/main.cpp Tue Jun 16 13:06:19 2015 +0000 +++ b/main.cpp Tue Jun 16 16:09:47 2015 +0000 @@ -3,7 +3,8 @@ #include "func_head.h" #include "i2c.h" #include "SDCard.h" - +#define HK_DATA 25 +#define HK_ITER 15 Serial pc(USBTX,USBRX); extern SPISlave pl_spi ; // mosi, miso, sclk, ssel --> using SPI1 @@ -16,6 +17,10 @@ extern DigitalOut irpt_2_slv; char i2c_data[25]; +int hk_count=0; +uint8_t hk_data[512]; +uint8_t* rtc_data; +uint64_t hk_block_number = 1; /*****************************************************************Threads USed*************************************************************************/ Thread *ptr_t_hk_acq; //pointer:::::::::to read state of one thread from another @@ -57,11 +62,39 @@ void TSC_CDMS_HK_MAIN(void const *args) { - uint8_t* rtc_data; pc.printf("in FUNC_CDMS_HK_MAIN()\r\n"); FCTN_MASTER_I2C('h' , i2c_data ); - rtc_data = FUNC_CDMS_RD_RTC(); - printf("\n\r rtc exited\n"); + FUNC_CDMS_RD_RTC(rtc_data); + for(int i=(hk_count%(HK_ITER+1)+hk_count*(HK_DATA+8));i<(hk_count%(HK_ITER+1)+hk_count*(HK_DATA+8))+8;i++) + { + hk_data[i] = rtc_data[i]; + } + for(int i=(hk_count%(HK_ITER+1)+hk_count*(HK_DATA+8))+8;i<(hk_count%(HK_ITER+1)+hk_count*(HK_DATA+8))+8+HK_DATA;i++) + { + hk_data[i] = i2c_data[i]; + } + hk_count++; + if(hk_count%15==0) + { + for(int i=((hk_count-1)%(HK_ITER+1)+(hk_count-1)*(HK_DATA+8))+8+HK_DATA;i<512;i++) + { + hk_data[i] = '/0'; + } + hk_count = 0; + FUNC_WR_SD(hk_data,hk_block_number); + for(int i=0;i<512;i++) + { + hk_data[i] = '/0'; + } + FUNC_RD_SD(hk_data,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]); + } + } + pc.printf("\n\r hk exited\n"); } void ISR_PL_RCV_SC_DATA()