diff --git a/main/app/ui_handlers.c b/main/app/ui_handlers.c index 02f5597..6abddeb 100644 --- a/main/app/ui_handlers.c +++ b/main/app/ui_handlers.c @@ -9,15 +9,20 @@ static const char *TAG = "ui_handlers"; -static void on_boot_press(void) +static void send_hid_combo_or_warn(uint8_t modifier, uint8_t keycode) { if (ble_hid_ready()) { - ble_hid_send_combo(0, HID_KEY_C); + ble_hid_send_combo(modifier, keycode); } else { ESP_LOGW(TAG, "HID not ready"); } } +static void on_boot_press(void) +{ + send_hid_combo_or_warn(0, HID_KEY_C); +} + void ui_handlers_init(void) { boot_button_init(on_boot_press); @@ -31,14 +36,17 @@ void update_year_action(lv_event_t * e) void click_button_two(lv_event_t * e) { (void)e; + send_hid_combo_or_warn(HID_MOD_LCTRL, HID_KEY_C); } void click_button_three(lv_event_t * e) { (void)e; + send_hid_combo_or_warn(HID_MOD_LCTRL, HID_KEY_V); } void click_button_one(lv_event_t * e) { (void)e; + send_hid_combo_or_warn(HID_MOD_LCTRL, HID_KEY_X); } diff --git a/main/services/ble_hid.h b/main/services/ble_hid.h index fe61819..be87967 100644 --- a/main/services/ble_hid.h +++ b/main/services/ble_hid.h @@ -9,6 +9,8 @@ #define HID_MOD_LGUI 0x08 #define HID_KEY_C 0x06 +#define HID_KEY_V 0x19 +#define HID_KEY_X 0x1B #define HID_KEY_F5 0x3E typedef void (*ble_hid_status_cb_t)(bool connected);