diff --git a/components/esp_hid/include/esp_hidh.h b/components/esp_hid/include/esp_hidh.h index b1a82643075..d3d10021034 100644 --- a/components/esp_hid/include/esp_hidh.h +++ b/components/esp_hid/include/esp_hidh.h @@ -100,6 +100,7 @@ typedef union { typedef struct { esp_event_handler_t callback; + uint16_t event_stack_size; } esp_hidh_config_t; /** diff --git a/components/esp_hid/src/ble_hidh.c b/components/esp_hid/src/ble_hidh.c index 5fe54f2fa7e..a56eb04c444 100644 --- a/components/esp_hid/src/ble_hidh.c +++ b/components/esp_hid/src/ble_hidh.c @@ -617,7 +617,7 @@ esp_err_t esp_ble_hidh_init(const esp_hidh_config_t *config) .queue_size = 5, .task_name = "esp_ble_hidh_events", .task_priority = uxTaskPriorityGet(NULL), - .task_stack_size = 2048, + .task_stack_size = config->event_stack_size > 0 ? config->event_stack_size : 2048, .task_core_id = tskNO_AFFINITY }; ret = esp_event_loop_create(&event_task_args, &event_loop_handle); diff --git a/components/esp_hid/src/bt_hidh.c b/components/esp_hid/src/bt_hidh.c index 0fe44b21f8d..cfaf23584b8 100644 --- a/components/esp_hid/src/bt_hidh.c +++ b/components/esp_hid/src/bt_hidh.c @@ -325,7 +325,7 @@ esp_err_t esp_bt_hidh_init(const esp_hidh_config_t *config) .queue_size = 5, .task_name = "esp_bt_hidh_events", .task_priority = uxTaskPriorityGet(NULL), - .task_stack_size = 2048, + .task_stack_size = config->event_stack_size > 0 ? config->event_stack_size : 2048, .task_core_id = tskNO_AFFINITY }; esp_err_t ret = esp_event_loop_create(&event_task_args, &event_loop_handle); diff --git a/examples/bluetooth/esp_hid_host/main/esp_hid_host_main.c b/examples/bluetooth/esp_hid_host/main/esp_hid_host_main.c index 065aa85ec69..49f93f2e440 100644 --- a/examples/bluetooth/esp_hid_host/main/esp_hid_host_main.c +++ b/examples/bluetooth/esp_hid_host/main/esp_hid_host_main.c @@ -127,6 +127,7 @@ void app_main(void) ESP_ERROR_CHECK( esp_ble_gattc_register_callback(esp_hidh_gattc_event_handler) ); esp_hidh_config_t config = { .callback = hidh_callback, + .event_stack_size = 4096 }; ESP_ERROR_CHECK( esp_hidh_init(&config) );