MTS_SPI_Slave unfinished
Fork of MTS-Serial by
Revision 14:d5a86071845e, committed 2017-11-16
- Comitter:
- ScottHoppeMultitech
- Date:
- Thu Nov 16 17:02:41 2017 +0000
- Parent:
- 13:010d349bc731
- Commit message:
- added Thread member
Changed in this revision
MTS_SPI_Slave.cpp | Show annotated file Show diff for this revision Revisions of this file |
MTS_SPI_Slave.h | Show annotated file Show diff for this revision Revisions of this file |
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()
diff -r 010d349bc731 -r d5a86071845e MTS_SPI_Slave.h --- a/MTS_SPI_Slave.h Thu Nov 16 16:13:57 2017 +0000 +++ b/MTS_SPI_Slave.h Thu Nov 16 17:02:41 2017 +0000 @@ -28,6 +28,7 @@ virtual int receive(); virtual void handleRead(); virtual void handleWrite(); + Thread* _thread; }; }