CDMS code for testing sbc
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: ThreadsAndFunctions.h
- Revision:
- 211:5006c998ea50
- Parent:
- 199:9f03d6ca94c9
--- a/ThreadsAndFunctions.h Sat Jul 02 14:25:11 2016 +0000 +++ b/ThreadsAndFunctions.h Sun Jul 03 18:50:32 2016 +0000 @@ -11,20 +11,37 @@ 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(); + int counter = 0; while(true){ + counter++; gPC.puts("entering sci\r\n"); gSCIENCE_THREAD->signal_wait(SCIENCE_SIGNAL); - PL_wo_dma->stop();// + //PL_wo_dma->stop();// gPC.puts("sig_set\r\n"); - srp(gPAYLOAD_BUFFER); + //srp(gPAYLOAD_BUFFER); gPC.puts("exit_srp\r\n"); - //gPAY_SPI.bulkRead_start(); - + gPAY_SPI->bulkRead_start(); + if(counter == 3) + { + gPC.puts("paused\r\n"); + gPAY_SPI->bulkRead_pause(); + } + if(counter == 4) + { + /*delete gPAY_SPI; + 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(); + gPC.puts("resumed\r\n");*/ + gPAY_SPI->bulkRead_resume(&payload_isr_fun); + } } }