Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: ThreadsAndFunctions.h
- Revision:
- 101:bece931236a2
- Parent:
- 98:fd99ddc0e0a1
- Child:
- 124:7f0d823c5881
- Child:
- 125:a3b95a9c16ef
--- a/ThreadsAndFunctions.h Tue Jan 26 12:37:17 2016 +0000
+++ b/ThreadsAndFunctions.h Tue Jan 26 13:15:01 2016 +0000
@@ -271,82 +271,24 @@
}
}
+void payload_isr_fun(){
+ gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);
+}
-uint8_t payload_data[6723];
-
void SCIENCE_FUN(void const *args){
- uint8_t *ptr;
- //gPC.puts("haha\r\n");
- ptr = &(payload_data[3]);
- //gPC.puts("haha2\r\n");
- int counter = 0;
- //gPC.puts("haha3\r\n");
- payload_data[2] = 0;//for mode
- for(int i = 0; i<60 ;i++){ //for mode 0.....callibra
- for(int j= 0; j<48; j++){ //2 byte values
- ptr[counter++] = 0; ptr[counter++] = 65;
- }
- for(int j=96; j <100 ; j++){
- ptr[counter++] = 0; ptr[counter++] = 0; ptr[counter++] = 0; ptr[counter++] = 65;
- }
- ptr = ptr+112;
- counter = 0;
- }
- //srp(payload_data);
- //gPC.puts("data given to payload");
- //gSCIENCE_THREAD->wait(2000); gSCIENCE_THREAD->terminate();
+ // 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();
- //while(true){
-// gSCIENCE_THREAD->wait(osWaitForever);
-// gLEDR = !gLEDR;
-// }
while(true){
gPC.puts("entering sci\r\n");
gSCIENCE_THREAD->signal_wait(SCIENCE_SIGNAL);
gPC.puts("sig_set\r\n");
- srp(payload_data);
+ srp(gPAYLOAD_BUFFER);
gPC.puts("exit_srp\r\n");
+ gPAY_SPI.bulkRead_start();
}
-}
-
-
-
-//void SCIENCE_FUN(void const *args){
-//// SPIpayload.format(8,0);
-//// SPIpayload.frequency(1000000);
-// for ( int i = 0 ; i < PAYLOAD_BUFFER_LENGTH ; i++ ){
-// gPAYLOAD_BUFFER[i] = 1;
-// }
-//
-// // initialise the buffer for dma
-// // SPIpayload.bulkRead_init(VAR_SPACE::payload_dma_buffer, PAYLOAD_DMA_SIZE, &payload_interrupt_fun);
-// // start dma read
-// // SPIpayload.bulkRead_start();
-//
-// // attach DMA interrupt
-// while(true){
-// gSCIENCE_THREAD->signal_wait(0x01);
-//
-////*********************************************************THE TEST
-//
-// //read rtc time later
-// uint64_t RTC_time = 0;
-// Science_Data_Compression::complete_compression( gPAYLOAD_BUFFER , RTC_time);
-//// SPI_mutex.lock();
-//// disk_write(SDcard_lastWritten , 5);
-//// SPI_mutex.unlock();
-//
-////**********************************************THE TEST
-//
-//// counter_for_payload++;
-//// if(counter_for_payload == 10){
-//// payload_ticker.detach();
-//// ledg = 0;
-//// PC.puts("its over\r\n");
-//// }
-//
-//// SPIpayload.bulkRead_start();
-//
-// }
-//}
\ No newline at end of file
+}
\ No newline at end of file
