MTS_SPI_Slave unfinished

Fork of MTS-Serial by MultiTech

Revision:
14:d5a86071845e
Parent:
13:010d349bc731
diff -r 010d349bc731 -r d5a86071845e MTS_SPI_Slave.cpp
--- a/MTS_SPI_Slave.cpp	Thu Nov 16 16:13:57 2017 +0000
+++ b/MTS_SPI_Slave.cpp	Thu Nov 16 17:02:41 2017 +0000
@@ -1,7 +1,7 @@
 #include "mbed.h"
 #include "MTS_SPI_Slave.h"
 #include "MTSLog.h"
-//#include <Thread.h>
+#include <Thread.h>
 
 using namespace mts;
 Serial debug(USBTX, USBRX); //DELETE
@@ -9,17 +9,19 @@
 MTS_SPI_Slave::MTS_SPI_Slave(PinName mosi, PinName miso, PinName sclk, PinName ssel, int txBufferSize, int rxBufferSize)
     : MTSBufferedIO(txBufferSize, rxBufferSize)
     , spi(mosi,miso,sclk,ssel)
+    , _thread(new Thread)
 
 {
    //this is where you are going to have a thread that is constantly polling to see if data has been sent, having the thread go to sleep in the time inbetween the polling
-   Thread thread;
+
+   
    debug.baud(115200); //DELETE
-   //thread.start(this, &MTS_SPI_Slave::recieved_Read);
-   osStatus status = thread.start(this, &MTS_SPI_Slave::recieved_Read);
+  // _thread->start(this, &MTS_SPI_Slave::recieved_Read);
+   osStatus status = _thread->start(this, &MTS_SPI_Slave::recieved_Read);
         if (status != osOK) {
             debug.printf("Thread is not OK");
         }
-   debug.printf("Thread state:  %d\n\r",thread.get_state());
+   debug.printf("Thread state:  %d\n\r",_thread->get_state());
 }
 
 MTS_SPI_Slave::~MTS_SPI_Slave()