PWM and ALGO updated.. PWM getting generated
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of TFR_BAE_vr1_1working_finally_PWM_CTRLALGO_update by
Diff: TCTM.cpp
- Revision:
- 4:39a4ae8c7ecd
- Parent:
- 3:07e15677a75c
- Child:
- 5:bb592f3185cc
diff -r 07e15677a75c -r 39a4ae8c7ecd TCTM.cpp --- a/TCTM.cpp Tue Dec 29 05:14:39 2015 +0000 +++ b/TCTM.cpp Wed Dec 30 04:57:46 2015 +0000 @@ -1,7 +1,13 @@ #include "mbed.h" #include "TCTM.h" #include "crc.h" +#include "EPS.h" +#include "FreescaleIAP.h" + +extern BAE_HK_actual actual_data; +extern BAE_HK_min_max bae_HK_minmax; +extern uint32_t BAE_STATUS; uint8_t* FCTN_BAE_TM_TC (uint8_t* tc) @@ -26,7 +32,35 @@ } case 0x02: { - printf("Read from RAM\r\n"); + printf("Read from RAM\r\n"); + switch(tc[3]) + { + case 0x00: + { + printf("Read HK\r\n"); + tm[0] = 0x60; + tm[1] = tc[0]; + tm[2] = ACK_CODE; + for (int i=4; i<132;i++) + { + + } + crc16 = CRC::crc16_gen(tm,132); + tm[132] = (uint8_t)((crc16&0xFF00)>>8); + tm[133] = (uint8_t)(crc16&0x00FF); + + + } + case 0x01: + { + printf("Read min max data"); + } + case 0x02: + { + printf("Read status"); + + } + } } case 0x05: { @@ -588,4 +622,35 @@ } } } -} \ No newline at end of file +} + + + + +int strt_add = flash_size() - (2*SECTOR_SIZE); +uint32_t flasharray[8]; //256+(3*1024) +char *nativeflash = (char*)strt_add; + +/*Writing to the Flash*/ +void FCTN_CDMS_WR_FLASH(uint16_t j,uint32_t fdata) //j-position to write address ; fdata - flash data to be written +{ + for(int i=0;i<8;i++) + { + flasharray[i]=nativeflash[i]; + } + flasharray[j]=fdata; + erase_sector(strt_add); + program_flash(strt_add, (char*)&flasharray,4*8); +} +/*End*/ + +/*Reading from Flash*/ +uint32_t FCTN_CDMS_RD_FLASH(uint16_t j) +{ + for(int i=0;i<8;i++) + { + flasharray[i]=nativeflash[i]; + } + return flasharray[j]; +} +/*End*/ \ No newline at end of file