Adjust constants and button event handling
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
8cf3221944
commit
754b5c131a
2 changed files with 91 additions and 31 deletions
|
@ -33,15 +33,62 @@
|
|||
#include <cstdint>
|
||||
#endif
|
||||
|
||||
#define DEVICE4_ACTION_PASSIVE_POLL_START 0b00010
|
||||
#define DEVICE4_ACTION_BRIGHTNESS_COMMAND 0b00011
|
||||
#define DEVICE4_ACTION_MANUAL_POLL_CLICK 0b00101
|
||||
#define DEVICE4_ACTION_ACTIVE_POLL 0b01001
|
||||
#define DEVICE4_ACTION_PASSIVE_POLL_END 0b10010
|
||||
#define DEVICE4_MSG_P_BRIGHTNESS 0x03
|
||||
#define DEVICE4_MSG_W_DISP_MODE 0x08
|
||||
#define DEVICE4_MSG_R_GLASSID 0x15
|
||||
#define DEVICE4_MSG_R_DP7911_FW_VERSION 0x16
|
||||
#define DEVICE4_MSG_R_DSP_VERSION 0x18
|
||||
#define DEVICE4_MSG_W_CANCEL_ACTIVATION 0x19
|
||||
#define DEVICE4_MSG_P_HEARTBEAT 0x1A
|
||||
#define DEVICE4_MSG_W_SLEEP_TIME 0x1E
|
||||
|
||||
#define DEVICE4_BUTTON_DISPLAY_TOGGLE 0x1
|
||||
#define DEVICE4_BUTTON_BRIGHTNESS_UP 0x2
|
||||
#define DEVICE4_BUTTON_BRIGHTNESS_DOWN 0x3
|
||||
#define DEVICE4_MSG_R_DSP_APP_FW_VERSION 0x21
|
||||
#define DEVICE4_MSG_R_MCU_APP_FW_VERSION 0x26
|
||||
#define DEVICE4_MSG_R_ACTIVATION_TIME 0x29
|
||||
#define DEVICE4_MSG_W_ACTIVATION_TIME 0x2A
|
||||
|
||||
#define DEVICE4_MSG_R_DP7911_FW_IS_UPDATE 0x3C
|
||||
#define DEVICE4_MSG_W_UPDATE_DP 0x3D
|
||||
#define DEVICE4_MSG_W_UPDATE_MCU_APP_FW_PREPARE 0x3E
|
||||
#define DEVICE4_MSG_W_UPDATE_MCU_APP_FW_START 0x3F
|
||||
|
||||
#define DEVICE4_MSG_W_UPDATE_MCU_APP_FW_TRANSMIT 0x40
|
||||
#define DEVICE4_MSG_W_UPDATE_MCU_APP_FW_FINISH 0x41
|
||||
#define DEVICE4_MSG_W_BOOT_JUMP_TO_APP 0x42
|
||||
#define DEVICE4_MSG_W_MCU_APP_JUMP_TO_BOOT 0x44
|
||||
#define DEVICE4_MSG_W_UPDATE_DSP_APP_FW_PREPARE 0x45
|
||||
#define DEVICE4_MSG_W_UPDATE_DSP_APP_FW_START 0x46
|
||||
#define DEVICE4_MSG_W_UPDATE_DSP_APP_FW_TRANSMIT 0x47
|
||||
#define DEVICE4_MSG_W_UPDATE_DSP_APP_FW_FINISH 0x48
|
||||
#define DEVICE4_MSG_R_IS_NEED_UPGRADE_DSP_FW 0x49
|
||||
|
||||
#define DEVICE4_MSG_W_FORCE_UPGRADE_DSP_FW 0x69
|
||||
|
||||
#define DEVICE4_MSG_W_BOOT_UPDATE_MODE 0x1100
|
||||
#define DEVICE4_MSG_W_BOOT_UPDATE_CONFIRM 0x1101
|
||||
#define DEVICE4_MSG_W_BOOT_UPDATE_PREPARE 0x1102
|
||||
#define DEVICE4_MSG_W_BOOT_UPDATE_START 0x1103
|
||||
#define DEVICE4_MSG_W_BOOT_UPDATE_TRANSMIT 0x1104
|
||||
#define DEVICE4_MSG_W_BOOT_UPDATE_FINISH 0x1105
|
||||
|
||||
#define DEVICE4_MSG_P_START_HEARTBEAT 0x6c02
|
||||
#define DEVICE4_MSG_P_BUTTON_PRESSED 0x6C05
|
||||
#define DEVICE4_MSG_P_END_HEARTBEAT 0x6c12
|
||||
#define DEVICE4_MSG_P_ASYNC_TEXT_LOG 0x6c09
|
||||
|
||||
#define DEVICE4_MSG_E_DSP_ONE_PACKGE_WRITE_FINISH 0x6C0E
|
||||
#define DEVICE4_MSG_E_DSP_UPDATE_PROGRES 0x6C10
|
||||
#define DEVICE4_MSG_E_DSP_UPDATE_ENDING 0x6C11
|
||||
|
||||
#define DEVICE4_BUTTON_PHYS_DISPLAY_TOGGLE 0x1
|
||||
#define DEVICE4_BUTTON_PHYS_BRIGHTNESS_UP 0x2
|
||||
#define DEVICE4_BUTTON_PHYS_BRIGHTNESS_DOWN 0x3
|
||||
|
||||
#define DEVICE4_BUTTON_VIRT_DISPLAY_TOGGLE 0x1
|
||||
#define DEVICE4_BUTTON_VIRT_BRIGHTNESS_UP 0x6
|
||||
#define DEVICE4_BUTTON_VIRT_BRIGHTNESS_DOWN 0x7
|
||||
#define DEVICE4_BUTTON_VIRT_MODE_UP 0x8
|
||||
#define DEVICE4_BUTTON_VIRT_MODE_DOWN 0x9
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -53,8 +100,8 @@ struct __attribute__((__packed__)) device4_packet_t {
|
|||
uint16_t length;
|
||||
uint8_t _padding0 [4];
|
||||
uint32_t timestamp;
|
||||
uint8_t action;
|
||||
uint8_t _padding1 [6];
|
||||
uint16_t msgid;
|
||||
uint8_t _padding1 [5];
|
||||
union {
|
||||
char text [42];
|
||||
uint8_t data [42];
|
||||
|
|
Reference in a new issue