1 |
#pragma once |
#pragma once |
2 |
|
|
3 |
#include <boost/thread/mutex.hpp> |
#include "thread.h" |
|
#include <queue> |
|
4 |
|
|
5 |
#include "../H7Serial.h" |
class SerialThread : public Thread |
|
|
|
|
struct WriteCommand |
|
|
{ |
|
|
WriteCommand(int t, int d) {target=t; data=d;} |
|
|
unsigned char target; |
|
|
unsigned char data; |
|
|
}; |
|
|
|
|
|
class SerialThread |
|
6 |
{ |
{ |
|
bool mContinue; |
|
|
bool mStopped; |
|
7 |
public: |
public: |
|
bool led3,led4,led5; |
|
|
bool switch2, switch3; |
|
|
short temp,potmeter; |
|
|
|
|
|
std::queue<WriteCommand> commands; |
|
|
|
|
|
boost::mutex& mWriteMutex; |
|
|
CH7Serial& mSerial; |
|
8 |
|
|
9 |
|
|
10 |
SerialThread(CH7Serial& s, boost::mutex& m); |
SerialThread(); |
11 |
|
|
|
void stop(); |
|
|
bool stopped(); |
|
|
|
|
12 |
void operator()(); |
void operator()(); |
13 |
}; |
}; |
14 |
|
|