![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
vr1.1
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_RTOS_v1_1 by
Diff: science.cpp
- Revision:
- 0:d6e3d1e21484
- Child:
- 2:4c79b3dfef31
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/science.cpp Mon Jun 15 12:16:59 2015 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "func_head.h" + +Serial sr(USBTX,USBRX); + +SPISlave pl_spi2(PTD6, PTD7, PTD5,PTD4 ); // mosi, miso, sclk, ssel --> using SPI1 + +int payloadBins = 4; + +void FUNC_PL_RCV_SC_DATA() +{ + sr.printf("in FUNC_PL_RCV_SC_DATA\r\n"); + uint8_t scienceRawPacket[payloadBins]; + for(int i=0; i<payloadBins;i++) + { + while(!pl_spi2.receive()); // blocking statement --> waiting for data from Payload + uint8_t v = pl_spi2.read(); // Read byte from master + scienceRawPacket[i] = v; + } + // serial feedback + sr.printf("Packet recieved\r\r\n"); + for(int i=0;i<payloadBins;i++) + { + sr.printf("%0x\t",scienceRawPacket[i]); + scienceRawPacket[i] = 0; + } + sr.printf("\r\r\n"); +} \ No newline at end of file