jnlj

Dependencies:   mbed-rtos mbed

Fork of TFOX_CDMS_VR_1_0_WORKING by Team Fox

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers science.cpp Source File

science.cpp

00001 #include "mbed.h"
00002 #include "func_head.h"
00003 
00004 Serial sr(USBTX,USBRX);
00005 
00006 SPISlave pl_spi(PTE18, PTE19, PTE17, PTE16 ); // mosi, miso, sclk, ssel --> using SPI1
00007 //SPISlave pl_spi(PTD6, PTD7, PTD5, PTD4   ); // mosi, miso, sclk, ssel --> using SPI1
00008 int payloadBins = 4;
00009 
00010 void FUNC_PL_RCV_SC_DATA()
00011 {
00012         sr.printf("in FUNC_PL_RCV_SC_DATA\r\n");
00013         uint8_t scienceRawPacket[payloadBins];
00014         for(int i=0; i<payloadBins;i++)
00015         {
00016             while(!pl_spi.receive()); // blocking statement --> waiting for data from Payload
00017             uint8_t v = pl_spi.read();   // Read byte from master
00018             scienceRawPacket[i] = v;
00019         }
00020         // serial feedback
00021         sr.printf("Packet recieved\r\r\n");
00022         for(int i=0;i<payloadBins;i++)
00023         {
00024             sr.printf("%0x\t",scienceRawPacket[i]);
00025             scienceRawPacket[i] = 0;
00026         }
00027         sr.printf("\r\r\n");
00028 }