-
Notifications
You must be signed in to change notification settings - Fork 7
/
HidDev.h
46 lines (42 loc) · 815 Bytes
/
HidDev.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
#pragma once
#include <linux/input.h>
#include <linux/hiddev.h>
#include <cstdio>
#include <string>
#include <time.h>
#include <sys/time.h>
#include <chrono>
#include "lvgl_.h"
class HidDev
{
public:
void init(std::string input_dev);
HidDev();
~HidDev();
void step_vfo();
lv_indev_state_t encoder_key_press();
int encoder_rotate();
private:
int m_fd;
int numIndex;
char HidDevName[80];
bool bstep;
input_event in_event;
hiddev_event hid_event;
int step;
int value;
int last_val{0};
int speed;
bool encoder{false};
std::chrono::high_resolution_clock::time_point last_time;
bool enc_key_pressed{false};
int enc_moved{0};
bool enc_pressed{false};
void rotate(int value);
void rotate_vfo();
bool read_event();
std::string HidName;
bool txstate{false};
bool usb_hid;
float fspeed;
};