-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpiopin.h
49 lines (38 loc) · 1.04 KB
/
gpiopin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef GPIOPIN_H
#define GPIOPIN_H
#include <QObject>
#include <QTimer>
#include "gpiocontroller.h"
class GpioPin : public QObject
{
Q_OBJECT
Q_PROPERTY(int number READ number WRITE setNumber)
Q_PROPERTY(int value READ value NOTIFY pinValueChanged)
Q_PROPERTY(bool poll READ poll WRITE setPoll NOTIFY pollChanged)
Q_PROPERTY(QString direction READ direction WRITE setDirection NOTIFY pinDirectionChanged)
public:
explicit GpioPin(QObject *parent = nullptr);
~GpioPin();
QString direction(void);
int value(void);
int number(void);
void setNumber(int);
bool poll(void);
void setPoll(bool);
signals:
void pinDirectionChanged(const QString&);
void pinValueChanged(int);
void pollChanged(void);
public slots:
void setDirection(const QString&);
void setValue(int);
private slots:
void onPinPoll(void);
private:
int m_num;
QString m_dir;
int m_val;
QTimer m_poll;
GpioController& m_pinController;
};
#endif // GPIOPIN_H