feat: 添加 BLE HID 键盘支持与配置
- 在 sdkconfig.defaults 中更新 BLE 配置以支持 HID 键盘功能 - 新增 ble_hid.c 和 ble_hid.h 文件,实现 BLE HID 键盘的核心功能 - 更新 CMakeLists.txt,包含新的服务文件以支持 BLE HID - 修改 ui_handlers.c,响应启动按钮事件以发送 HID 按键 - 更新 ble_manager.c,初始化 BLE HID 功能并处理连接状态 - 新增 esp_hid_gap.c 和 esp_hid_gap.h 文件,管理 BLE HID 的 GAP 相关功能
This commit is contained in:
+8
-11
@@ -2,28 +2,25 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "ble_hid.h"
|
||||
#include "boot_button.h"
|
||||
#include "lvgl_port.h"
|
||||
#include "ui.h"
|
||||
#include "esp_log.h"
|
||||
#include "ui_events.h"
|
||||
|
||||
static bool s_showing_screen1;
|
||||
static const char *TAG = "ui_handlers";
|
||||
|
||||
static void ui_toggle_screen(void)
|
||||
static void on_boot_press(void)
|
||||
{
|
||||
lvgl_port_lock();
|
||||
if (s_showing_screen1) {
|
||||
_ui_screen_change(&ui_Screen2, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, ui_Screen2_screen_init);
|
||||
if (ble_hid_ready()) {
|
||||
ble_hid_send_combo(0, HID_KEY_C);
|
||||
} else {
|
||||
_ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, ui_Screen1_screen_init);
|
||||
ESP_LOGW(TAG, "HID not ready");
|
||||
}
|
||||
s_showing_screen1 = !s_showing_screen1;
|
||||
lvgl_port_unlock();
|
||||
}
|
||||
|
||||
void ui_handlers_init(void)
|
||||
{
|
||||
boot_button_init(ui_toggle_screen);
|
||||
boot_button_init(on_boot_press);
|
||||
}
|
||||
|
||||
void update_year_action(lv_event_t * e)
|
||||
|
||||
Reference in New Issue
Block a user