Project

General

Profile

Raspberry PI GPIO Scol plugin
rpiecho.h
1
2#ifndef RPIECHO_H
3#define RPIECHO_H
4
5#include <boost/thread.hpp>
6
7class RpiEcho
8{
9public:
10 RpiEcho();
11
12 RpiEcho(int triggerpin, int echopin);
13
14 ~RpiEcho();
15
16 void threadLoop();
17
18 int ReadValue();
19
20private:
21 long pulseIn(int timeout);
22 int mTriggerPin;
23 int mEchoPin;
24 int mValue;
25 bool mState;
26 boost::thread mThread;
27 boost::mutex mMutex;
28};
29
30#endif //RPIECHO_H