![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
vr1.1
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_RTOS_v1_1 by
Diff: PL.cpp
- Revision:
- 8:607ae92fa6af
- Parent:
- 7:c270a9e37290
- Child:
- 9:7ff6d75cc09e
diff -r c270a9e37290 -r 607ae92fa6af PL.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PL.cpp Sat Jul 04 08:56:34 2015 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" +#include "PL.h" +#include "all_funcs.h" + +Serial sr(USBTX,USBRX); + +SPISlave pl_spi(PTE18, PTE19, PTE17, PTE16 ); // mosi, miso, sclk, ssel --> using SPI1 +//SPISlave pl_spi(PTD6, PTD7, PTD5, PTD4 ); // mosi, miso, sclk, ssel --> using SPI1 +int payloadBins = 4; + +void FCTN_PL_RCV_SC_DATA() +{ + sr.printf("in FCTN_PL_RCV_SC_DATA\r\n"); + uint8_t scienceRawPacket[payloadBins]; + for(int i=0; i<payloadBins;i++) + { + while(!pl_spi.receive()); // blocking statement --> waiting for data from Payload + uint8_t v = pl_spi.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