vr1.1

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of CDMS_RTOS_v1_1 by Team Fox

Committer:
pradeepvk2208
Date:
Mon Jun 15 13:32:28 2015 +0000
Revision:
2:4c79b3dfef31
Parent:
0:d6e3d1e21484
Child:
3:0c3f7c3fabc9
cdms-rtos-v0.1-integration

Who changed what in which revision?

UserRevisionLine numberNew 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
pradeepvk2208 2:4c79b3dfef31 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 }