vr1.1

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of CDMS_RTOS_v1_1 by Team Fox

Committer:
sakthipriya
Date:
Tue Jun 16 09:04:53 2015 +0000
Revision:
3:0c3f7c3fabc9
Parent:
2:4c79b3dfef31
Child:
7:c270a9e37290
vr 1.0 working

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
sakthipriya 3:0c3f7c3fabc9 6 SPISlave pl_spi(PTE18, PTE19, PTE17, PTE16 ); // mosi, miso, sclk, ssel --> using SPI1
sakthipriya 3:0c3f7c3fabc9 7 //SPISlave pl_spi(PTD6, PTD7, PTD5, PTD4 ); // mosi, miso, sclk, ssel --> using SPI1
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 {
sakthipriya 3:0c3f7c3fabc9 16 while(!pl_spi.receive()); // blocking statement --> waiting for data from Payload
sakthipriya 3:0c3f7c3fabc9 17 uint8_t v = pl_spi.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 }