working
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of COM_MNG_TMTC_SIMPLE by
Revision 137:6fcbbaf19284, committed 2016-03-12
- Comitter:
- Piasiv1206
- Date:
- Sat Mar 12 10:42:22 2016 +0000
- Parent:
- 136:8074893cd24e
- Commit message:
- workin
Changed in this revision
i2c.h | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8074893cd24e -r 6fcbbaf19284 i2c.h --- a/i2c.h Thu Mar 10 15:26:50 2016 +0000 +++ b/i2c.h Sat Mar 12 10:42:22 2016 +0000 @@ -103,8 +103,9 @@ void isr_pyldtm() { - - read_ack = master.read(addr_pl|1,PL_I2C_DATA,134); + + master.read(addr_pl|1,PL_I2C_DATA,13); gLEDR=!gLEDR; + rcv_isr = 1; } \ No newline at end of file
diff -r 8074893cd24e -r 6fcbbaf19284 main.cpp --- a/main.cpp Thu Mar 10 15:26:50 2016 +0000 +++ b/main.cpp Sat Mar 12 10:42:22 2016 +0000 @@ -5,8 +5,8 @@ uint8_t rcv_isr = 0; // flag for interrupt #define DEBUG 1 -#define SDCARD 1 -#define I2C_PL 0 +#define SDCARD 0 +#define I2C_PL 1 #include "SimpleDMA.h" @@ -34,6 +34,33 @@ //void set_sig(){gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);} +char pia1 [13] ; + +void INIT_TC_TEMP (void) +{ + int i; + uint16_t CRC_VALUE = 0 ; + + pia1[0] = 123 ; + pia1[1] = 0xff ; + pia1[2] = 0x81 ; + pia1[3] = 0xD0 ; + pia1[4] = 0x00 ; + pia1[5] = 0x00 ; + pia1[6] = 0x00 ; + pia1[7] = 0x00 ; + pia1[8] = 0x00 ; + CRC_VALUE = 0 ; + pia1[9] = (char)((CRC_VALUE >> 8) & 0xff); + pia1[10] = (char)((CRC_VALUE >> 0) & 0xff); + + for(i = 0; i < 13 ; i++) + { + PL_I2C_DATA[i]= 0; + } + + +} int main() { @@ -49,10 +76,10 @@ // gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values; RX1M.attach(&rx_read, Serial::RxIrq); - #if I2c + //I2C to Payload (depends on pl interrupt design) PYLD_I2C_Int.rise(&isr_pyldtm); - #endif + // DEBUG //gPC.puts("welcome to mng_tm_tc\r\n"); @@ -111,28 +138,31 @@ {delete gSCIENCE_THREAD; break;} }*/ - #if I2c + INIT_TC_TEMP(); int i =0 ; char test[1] ; test[0] = 7; while(1) { + //test[0] = gPC.getc(); + gPC.printf("Wriring to I2C\n\r"); - wait(5); - printf("Wriring to I2C\n"); - master.write(addr_pl|0x00,test,1); + wait(10); + + master.write(addr_pl|0x00,pia1,11); if(rcv_isr == 1) { - for(i = 0; i < 134 ; i++) + for(i = 0; i < 13 ; i++) { - printf("%d\r\n",PL_I2C_DATA[i]); + gPC.printf("%d\r\n",PL_I2C_DATA[i]); + PL_I2C_DATA[i] = 0 ; } rcv_isr = 0; } } - #endif + while(true){ Thread::wait(osWaitForever); //state = gCOM_MNG_TMTC_THREAD->get_state() + '0';