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
796 B

4 years ago
#ifndef DEVICESERVICE_H
#define DEVICESERVICE_H
#include <QObject>
4 years ago
#include <QTimer>
4 years ago
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 GPIO_PIN_SET
#define KEY_Down GPIO_PIN_RESET
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:
public slots:
void ledSet(int status);
quint8 keyReadOnce();
//quint8 keyDetection();
};
#endif // DEVICESERVICE_H