You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
793 B
46 lines
793 B
#ifndef DEVICESERVICE_H
|
|
#define DEVICESERVICE_H
|
|
|
|
#include <QObject>
|
|
#include <QTimer>
|
|
|
|
typedef enum{
|
|
GPIO_PIN_RESET = 0u,
|
|
GPIO_PIN_SET
|
|
} GPIO_PinState;
|
|
|
|
typedef enum{
|
|
None = (uint8_t)0,
|
|
Click = (uint8_t)1,
|
|
Dbl_Click = (uint8_t)2,
|
|
Tri_Click = (uint8_t)3,
|
|
Press = (uint8_t)4,
|
|
}KeyFlag;
|
|
|
|
#define KEY_Up 1
|
|
#define KEY_Down 0
|
|
|
|
typedef struct{
|
|
KeyFlag flag;
|
|
quint8 lastState;
|
|
}KeyType;
|
|
|
|
class DeviceService : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit DeviceService(QObject *parent = 0);
|
|
private:
|
|
KeyType key;
|
|
int m_ledStatus,m_keyStatus;
|
|
QTimer timer1,timer2;
|
|
signals:
|
|
void keyClicked();
|
|
|
|
public slots:
|
|
void ledSet(int status);
|
|
quint8 keyReadOnce();
|
|
quint8 keyDetection();
|
|
};
|
|
|
|
#endif // DEVICESERVICE_H
|
|
|