diff --git a/components/esp_hid/Kconfig b/components/esp_hid/Kconfig new file mode 100644 index 0000000000..619042645c --- /dev/null +++ b/components/esp_hid/Kconfig @@ -0,0 +1,17 @@ +menu "ESP HID" + config ESPHID_TASK_SIZE_BT + int "Task stack size for ESP HID BR/EDR" + range 2048 10240 + default 2048 + help + This is the stack size for the BT HID task. + Default is 2048 bytes. + + config ESPHID_TASK_SIZE_BLE + int "Task stack size for ESP HID BLE" + range 2048 10240 + default 4096 + help + This is the stack size for the BLE HID task. + Default is 4096 bytes. +endmenu diff --git a/components/esp_hid/include/esp_hid_common.h b/components/esp_hid/include/esp_hid_common.h index d3dfc204b8..461f48f867 100644 --- a/components/esp_hid/include/esp_hid_common.h +++ b/components/esp_hid/include/esp_hid_common.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -85,6 +85,19 @@ extern "C" { #define ESP_HID_CCC_NOTIFICATIONS_ENABLED 0x01 // Notifications enabled #define ESP_HID_CCC_INDICATIONS_ENABLED 0x02 // Indications enabled +/* HID Task Size configuration */ +#ifdef CONFIG_ESPHID_TASK_SIZE_BT +#define BT_HID_DEVICE_TASK_SIZE_BT CONFIG_ESPHID_TASK_SIZE_BT +#else +#define BT_HID_DEVICE_TASK_SIZE_BT 2048 +#endif + +#ifdef CONFIG_ESPHID_TASK_SIZE_BLE +#define BT_HID_DEVICE_TASK_SIZE_BLE CONFIG_ESPHID_TASK_SIZE_BLE +#else +#define BT_HID_DEVICE_TASK_SIZE_BLE 4096 +#endif + /* HID Transports */ typedef enum { ESP_HID_TRANSPORT_BT, @@ -202,8 +215,8 @@ esp_hid_report_map_t *esp_hid_parse_report_map(const uint8_t *hid_rm, size_t hid void esp_hid_free_report_map(esp_hid_report_map_t *map); /** - * @brief Calculate the HID Device usage type from the BLE Apperance - * @param appearance : BLE Apperance value + * @brief Calculate the HID Device usage type from the BLE Appearance + * @param appearance : BLE Appearance value * * @return: the hid usage type */ diff --git a/components/esp_hid/src/ble_hidd.c b/components/esp_hid/src/ble_hidd.c index ec8d9fd29b..c46c3cab92 100644 --- a/components/esp_hid/src/ble_hidd.c +++ b/components/esp_hid/src/ble_hidd.c @@ -971,7 +971,7 @@ esp_err_t esp_ble_hidd_dev_init(esp_hidd_dev_t *dev_p, const esp_hid_device_conf .queue_size = 5, .task_name = "ble_hidd_events", .task_priority = uxTaskPriorityGet(NULL), - .task_stack_size = 4096, + .task_stack_size = BT_HID_DEVICE_TASK_SIZE_BLE, .task_core_id = tskNO_AFFINITY }; ret = esp_event_loop_create(&event_task_args, &s_dev->event_loop_handle); diff --git a/components/esp_hid/src/bt_hidd.c b/components/esp_hid/src/bt_hidd.c index acf9d7e7ab..61f421d451 100644 --- a/components/esp_hid/src/bt_hidd.c +++ b/components/esp_hid/src/bt_hidd.c @@ -809,7 +809,7 @@ esp_err_t esp_bt_hidd_dev_init(esp_hidd_dev_t *dev_p, const esp_hid_device_confi .queue_size = 5, .task_name = "bt_hidd_events", .task_priority = uxTaskPriorityGet(NULL), - .task_stack_size = 2048, + .task_stack_size = BT_HID_DEVICE_TASK_SIZE_BT, .task_core_id = tskNO_AFFINITY }; ret = esp_event_loop_create(&event_task_args, &s_hidd_param.dev->event_loop_handle);