Skip to content

Commit d4b3a7e

Browse files
mitchellcairnsesp-zhp
authored andcommitted
feat(ble/bluedroid): Support change HID task size by Kconfig in HID example
1 parent fa40d97 commit d4b3a7e

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

components/esp_hid/Kconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
menu "ESP HID"
2+
config ESPHID_TASK_SIZE_BT
3+
int "Task stack size for ESP HID BR/EDR"
4+
range 2048 10240
5+
default 2048
6+
help
7+
This is the stack size for the BT HID task.
8+
Default is 2048 bytes.
9+
10+
config ESPHID_TASK_SIZE_BLE
11+
int "Task stack size for ESP HID BLE"
12+
range 2048 10240
13+
default 4096
14+
help
15+
This is the stack size for the BLE HID task.
16+
Default is 4096 bytes.
17+
endmenu

components/esp_hid/include/esp_hid_common.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -85,6 +85,19 @@ extern "C" {
8585
#define ESP_HID_CCC_NOTIFICATIONS_ENABLED 0x01 // Notifications enabled
8686
#define ESP_HID_CCC_INDICATIONS_ENABLED 0x02 // Indications enabled
8787

88+
/* HID Task Size configuration */
89+
#ifdef CONFIG_ESPHID_TASK_SIZE_BT
90+
#define BT_HID_DEVICE_TASK_SIZE_BT CONFIG_ESPHID_TASK_SIZE_BT
91+
#else
92+
#define BT_HID_DEVICE_TASK_SIZE_BT 2048
93+
#endif
94+
95+
#ifdef CONFIG_ESPHID_TASK_SIZE_BLE
96+
#define BT_HID_DEVICE_TASK_SIZE_BLE CONFIG_ESPHID_TASK_SIZE_BLE
97+
#else
98+
#define BT_HID_DEVICE_TASK_SIZE_BLE 4096
99+
#endif
100+
88101
/* HID Transports */
89102
typedef enum {
90103
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
202215
void esp_hid_free_report_map(esp_hid_report_map_t *map);
203216

204217
/**
205-
* @brief Calculate the HID Device usage type from the BLE Apperance
206-
* @param appearance : BLE Apperance value
218+
* @brief Calculate the HID Device usage type from the BLE Appearance
219+
* @param appearance : BLE Appearance value
207220
*
208221
* @return: the hid usage type
209222
*/

components/esp_hid/src/ble_hidd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ esp_err_t esp_ble_hidd_dev_init(esp_hidd_dev_t *dev_p, const esp_hid_device_conf
971971
.queue_size = 5,
972972
.task_name = "ble_hidd_events",
973973
.task_priority = uxTaskPriorityGet(NULL),
974-
.task_stack_size = 4096,
974+
.task_stack_size = BT_HID_DEVICE_TASK_SIZE_BLE,
975975
.task_core_id = tskNO_AFFINITY
976976
};
977977
ret = esp_event_loop_create(&event_task_args, &s_dev->event_loop_handle);

components/esp_hid/src/bt_hidd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ esp_err_t esp_bt_hidd_dev_init(esp_hidd_dev_t *dev_p, const esp_hid_device_confi
809809
.queue_size = 5,
810810
.task_name = "bt_hidd_events",
811811
.task_priority = uxTaskPriorityGet(NULL),
812-
.task_stack_size = 2048,
812+
.task_stack_size = BT_HID_DEVICE_TASK_SIZE_BT,
813813
.task_core_id = tskNO_AFFINITY
814814
};
815815
ret = esp_event_loop_create(&event_task_args, &s_hidd_param.dev->event_loop_handle);

0 commit comments

Comments
 (0)