![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
vr1.1
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_RTOS_v1_1 by
science.cpp@0:d6e3d1e21484, 2015-06-15 (annotated)
- Committer:
- cholletisaik777
- Date:
- Mon Jun 15 12:16:59 2015 +0000
- Revision:
- 0:d6e3d1e21484
- Child:
- 2:4c79b3dfef31
CDMS-RTOSv0.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cholletisaik777 | 0:d6e3d1e21484 | 1 | #include "mbed.h" |
cholletisaik777 | 0:d6e3d1e21484 | 2 | #include "func_head.h" |
cholletisaik777 | 0:d6e3d1e21484 | 3 | |
cholletisaik777 | 0:d6e3d1e21484 | 4 | Serial sr(USBTX,USBRX); |
cholletisaik777 | 0:d6e3d1e21484 | 5 | |
cholletisaik777 | 0:d6e3d1e21484 | 6 | SPISlave pl_spi2(PTD6, PTD7, PTD5,PTD4 ); // mosi, miso, sclk, ssel --> using SPI1 |
cholletisaik777 | 0:d6e3d1e21484 | 7 | |
cholletisaik777 | 0:d6e3d1e21484 | 8 | int payloadBins = 4; |
cholletisaik777 | 0:d6e3d1e21484 | 9 | |
cholletisaik777 | 0:d6e3d1e21484 | 10 | void FUNC_PL_RCV_SC_DATA() |
cholletisaik777 | 0:d6e3d1e21484 | 11 | { |
cholletisaik777 | 0:d6e3d1e21484 | 12 | sr.printf("in FUNC_PL_RCV_SC_DATA\r\n"); |
cholletisaik777 | 0:d6e3d1e21484 | 13 | uint8_t scienceRawPacket[payloadBins]; |
cholletisaik777 | 0:d6e3d1e21484 | 14 | for(int i=0; i<payloadBins;i++) |
cholletisaik777 | 0:d6e3d1e21484 | 15 | { |
cholletisaik777 | 0:d6e3d1e21484 | 16 | while(!pl_spi2.receive()); // blocking statement --> waiting for data from Payload |
cholletisaik777 | 0:d6e3d1e21484 | 17 | uint8_t v = pl_spi2.read(); // Read byte from master |
cholletisaik777 | 0:d6e3d1e21484 | 18 | scienceRawPacket[i] = v; |
cholletisaik777 | 0:d6e3d1e21484 | 19 | } |
cholletisaik777 | 0:d6e3d1e21484 | 20 | // serial feedback |
cholletisaik777 | 0:d6e3d1e21484 | 21 | sr.printf("Packet recieved\r\r\n"); |
cholletisaik777 | 0:d6e3d1e21484 | 22 | for(int i=0;i<payloadBins;i++) |
cholletisaik777 | 0:d6e3d1e21484 | 23 | { |
cholletisaik777 | 0:d6e3d1e21484 | 24 | sr.printf("%0x\t",scienceRawPacket[i]); |
cholletisaik777 | 0:d6e3d1e21484 | 25 | scienceRawPacket[i] = 0; |
cholletisaik777 | 0:d6e3d1e21484 | 26 | } |
cholletisaik777 | 0:d6e3d1e21484 | 27 | sr.printf("\r\r\n"); |
cholletisaik777 | 0:d6e3d1e21484 | 28 | } |