From d922930a8d5bcee1d9ba5ba67770f0f41a7b1e73 Mon Sep 17 00:00:00 2001 From: Joe Maples Date: Sun, 25 Dec 2022 01:32:05 -0500 Subject: [PATCH] Add custom button actions --- apps/main/apps.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/main/apps.cpp b/apps/main/apps.cpp index b2a13a4..0c81721 100644 --- a/apps/main/apps.cpp +++ b/apps/main/apps.cpp @@ -1369,17 +1369,30 @@ void app_latency_switch_key_handler(void) } } +void app_bt_function_key(APP_KEY_STATUS *status, void *param) +{ + TRACE(2,"%s event %d", __func__, status->event); + bt_key_send(status); +} + void app_key_init(void) { -#if defined(IBRT) +#if defined(IBRT_TESTMODE) app_ibrt_ui_test_key_init(); #else uint8_t i = 0; TRACE(1,"%s",__func__); + const APP_KEY_HANDLE key_cfg[] = { + {{APP_KEY_CODE_PWR,APP_KEY_EVENT_CLICK},"bt function key",app_bt_function_key, NULL}, + {{APP_KEY_CODE_PWR,APP_KEY_EVENT_DOUBLECLICK},"bt function key",app_bt_function_key, NULL}, + {{APP_KEY_CODE_PWR,APP_KEY_EVENT_LONGPRESS},"bt function key",app_bt_function_key, NULL}, + {{APP_KEY_CODE_PWR,APP_KEY_EVENT_TRIPLECLICK},"bt anc key",app_anc_key, NULL}, + }; + app_key_handle_clear(); - for (i=0; i<(sizeof(app_key_handle_cfg)/sizeof(APP_KEY_HANDLE)); i++){ - app_key_handle_registration(&app_key_handle_cfg[i]); + for (i=0; i<(sizeof(key_cfg)/sizeof(APP_KEY_HANDLE)); i++){ + app_key_handle_registration(&key_cfg[i]); } #endif }