
Compression code changed and RLY_TMTC pointers managed
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: ThreadsAndFunctions.h
- Revision:
- 245:da9d1bd999da
- Parent:
- 232:b1458c1e9199
- Child:
- 246:565458eefd94
--- a/ThreadsAndFunctions.h Sat Jul 09 13:11:25 2016 +0000 +++ b/ThreadsAndFunctions.h Sun Jul 10 13:47:26 2016 +0000 @@ -9,25 +9,29 @@ } void SCIENCE_FUN(void const *args){ - - // initialisation of payload spi - gPAY_SPI.frequency(1000000); - gPAY_SPI.format(8,0); - gPAY_SPI.bulkRead_init(gPAYLOAD_BUFFER, PAYLOAD_BUFFER_LENGTH, &payload_isr_fun); - gPAY_SPI.bulkRead_start(); - + gPAY_SPI = new dmaSPISlave(PAY_SPI_MOSI, PAY_SPI_MISO, PAY_SPI_CLK, PAY_SPI_CS); + gPAY_SPI->frequency(1000000); + gPAY_SPI->format(8,0); + gPAY_SPI->bulkRead_init(gPAYLOAD_BUFFER, PAYLOAD_BUFFER_LENGTH, &payload_isr_fun); + gPAY_SPI->bulkRead_start(); while(true){ gPC.puts("entering sci\r\n"); gSCIENCE_THREAD->signal_wait(SCIENCE_SIGNAL); - PL_wo_dma->stop();// gPC.puts("sig_set\r\n"); srp(gPAYLOAD_BUFFER); gPC.puts("exit_srp\r\n"); - //gPAY_SPI.bulkRead_start(); - + wait(2);/*timeout to be decided*/ + gPAY_SPI->bulkRead_start(); } } +//HK Thread(Contains HK_main() and PL_main()) +//RTOS timer calllback func +void hk_isr(void const *args){ + gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL); +} + + //COM THREAD // UART ISR void rx_read(){ @@ -110,7 +114,7 @@ gFLAGS = gFLAGS & (~UART_INT_FLAG); if( !(gFLAGS & COM_SESSION_FLAG) ){ // PENDING : DISABLE THREADS - PL_wo_dma->stop(); + gPAY_SPI->bulkRead_pause(); gFLAGS = gFLAGS | COM_SESSION_FLAG; gSESSION_TIMEOUT.attach(&after_session, SESSION_TIME_LIMIT); gFLAGS = gFLAGS | COM_RX_FLAG; @@ -194,7 +198,7 @@ reset_all; gFLAGS = gFLAGS & (~COM_SESSION_VALIDITY); // PENDING : ENABLE THREADS - /*PL_wo_dma->start(6000);*/ + gPAY_SPI->bulkRead_resume(&payload_isr_fun); gSESSION_TIMEOUT.detach(); gFLAGS = gFLAGS & (~COM_SESSION_FLAG); // WARNING: clear COM_MNG_TMTC ? @@ -247,7 +251,7 @@ gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG); reset_all; // PENDING : ENABLE THREADS - /*PL_wo_dma->start(6000);*/ + gPAY_SPI->bulkRead_resume(&payload_isr_fun); gSESSION_TIMEOUT.detach(); gFLAGS = gFLAGS & (~COM_SESSION_FLAG); } @@ -287,7 +291,7 @@ /*gPC.puts("session timeout: resetting in main\r\n");*/ COM_POWER_OFF_TX; /*PENDING : ENABLE THREADS*/ - + gPAY_SPI->bulkRead_resume(&payload_isr_fun); gSESSION_TIMEOUT.detach(); gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG); gFLAGS = gFLAGS & (~COM_SESSION_FLAG); @@ -299,7 +303,7 @@ COM_POWER_OFF_TX; reset_all; // PENDING : ENABLE THREADS - /*PL_wo_dma->start(6000);*/ + gPAY_SPI->bulkRead_resume(&payload_isr_fun); gSESSION_TIMEOUT.detach(); gFLAGS = gFLAGS & (~COM_SESSION_FLAG); }