Simple version of COM_MNG_TMTC_CODE for IITMSAT.
Dependencies: mbed-rtos mbed FreescaleIAP SimpleDMA
i2c.h@159:9951e803975f, 2016-04-13 (annotated)
- Committer:
- ee12b079
- Date:
- Wed Apr 13 19:38:09 2016 +0000
- Revision:
- 159:9951e803975f
- Parent:
- 132:d4a4461214ad
interfaced with pl, i2c working with double interrupt theory
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aniruddhv | 52:0bd68655c651 | 1 | #define tm_len 134 |
aniruddhv | 52:0bd68655c651 | 2 | #define tc_len 135 |
aniruddhv | 52:0bd68655c651 | 3 | #define tc_test_len 135 |
aniruddhv | 52:0bd68655c651 | 4 | |
ee12b079 | 159:9951e803975f | 5 | //InterruptIn irpt_4m_slv(D3); //I2c interrupt from CDMS |
ee12b079 | 159:9951e803975f | 6 | //DigitalOut irpt_2_slv(D4); //I2C interrupt to CDMS |
ee12b079 | 130:d5b53088270b | 7 | //I2C master(PTC9,PTC8); |
aniruddhv | 52:0bd68655c651 | 8 | const int addr = 0x20; //slave address |
ee12b079 | 130:d5b53088270b | 9 | const int addr_pl = 0x20<<1; //PL slave address |
ee12b079 | 132:d4a4461214ad | 10 | |
aniruddhv | 52:0bd68655c651 | 11 | bool write_ack = true; |
aniruddhv | 52:0bd68655c651 | 12 | bool read_ack = true; |
aniruddhv | 52:0bd68655c651 | 13 | |
ee12b079 | 132:d4a4461214ad | 14 | |
ee12b079 | 132:d4a4461214ad | 15 | char PL_I2C_DATA[134];//Payload i2c array |
ee12b079 | 132:d4a4461214ad | 16 | uint8_t PL_TM_SIZE;//size of data to bev read from i2c |
aniruddhv | 52:0bd68655c651 | 17 | |
ee12b079 | 130:d5b53088270b | 18 | void FCTN_I2C_WRITE_PL(char *data2,uint8_t tc_len2) |
aniruddhv | 52:0bd68655c651 | 19 | { |
ee12b079 | 130:d5b53088270b | 20 | write_ack = master.write(addr_pl|0x00,data2,tc_len2);//address to be defined in payload |
ee12b079 | 132:d4a4461214ad | 21 | if(write_ack == 1) |
ee12b079 | 130:d5b53088270b | 22 | { |
ee12b079 | 132:d4a4461214ad | 23 | printf("\n\rdata not sent\n"); |
ee12b079 | 130:d5b53088270b | 24 | } |
ee12b079 | 130:d5b53088270b | 25 | else |
aniruddhv | 52:0bd68655c651 | 26 | { |
ee12b079 | 132:d4a4461214ad | 27 | |
ee12b079 | 130:d5b53088270b | 28 | } |
ee12b079 | 130:d5b53088270b | 29 | } |
ee12b079 | 132:d4a4461214ad | 30 | |
ee12b079 | 132:d4a4461214ad | 31 | void isr_pyldtm() |
ee12b079 | 132:d4a4461214ad | 32 | { |
ee12b079 | 132:d4a4461214ad | 33 | |
ee12b079 | 132:d4a4461214ad | 34 | read_ack = master.read(addr_pl|1,PL_I2C_DATA,134); |
ee12b079 | 132:d4a4461214ad | 35 | gLEDR=!gLEDR; |
ee12b079 | 132:d4a4461214ad | 36 | rcv_isr = 1; |
aniruddhv | 52:0bd68655c651 | 37 | } |