feat(ble/bluedroid): Support change HID task size by Kconfig in HID example

(cherry picked from commit d4b3a7e99d29150d9718415384db7ac5ae7673d5)

Co-authored-by: Mitch Cairns <mitch.cairns@handheldlegend.com>
This commit is contained in:
Zhang Hai Peng 2025-02-17 11:15:46 +08:00 committed by zhanghaipeng
parent fe57c1bfb9
commit 2f9c756d74
5 changed files with 39 additions and 18 deletions

View File

@ -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

View File

@ -1,16 +1,8 @@
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once #pragma once
@ -94,6 +86,19 @@ extern "C" {
#define ESP_HID_CCC_NOTIFICATIONS_ENABLED 0x01 // Notifications enabled #define ESP_HID_CCC_NOTIFICATIONS_ENABLED 0x01 // Notifications enabled
#define ESP_HID_CCC_INDICATIONS_ENABLED 0x02 // Indications 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 */ /* HID Transports */
typedef enum { typedef enum {
ESP_HID_TRANSPORT_BT, ESP_HID_TRANSPORT_BT,
@ -203,8 +208,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); void esp_hid_free_report_map(esp_hid_report_map_t *map);
/** /**
* @brief Calculate the HID Device usage type from the BLE Apperance * @brief Calculate the HID Device usage type from the BLE Appearance
* @param appearance : BLE Apperance value * @param appearance : BLE Appearance value
* *
* @return: the hid usage type * @return: the hid usage type
*/ */

View File

@ -977,7 +977,7 @@ esp_err_t esp_ble_hidd_dev_init(esp_hidd_dev_t *dev_p, const esp_hid_device_conf
.queue_size = 5, .queue_size = 5,
.task_name = "ble_hidd_events", .task_name = "ble_hidd_events",
.task_priority = uxTaskPriorityGet(NULL), .task_priority = uxTaskPriorityGet(NULL),
.task_stack_size = 4096, .task_stack_size = BT_HID_DEVICE_TASK_SIZE_BLE,
.task_core_id = tskNO_AFFINITY .task_core_id = tskNO_AFFINITY
}; };
ret = esp_event_loop_create(&event_task_args, &s_dev->event_loop_handle); ret = esp_event_loop_create(&event_task_args, &s_dev->event_loop_handle);

View File

@ -811,7 +811,7 @@ esp_err_t esp_bt_hidd_dev_init(esp_hidd_dev_t *dev_p, const esp_hid_device_confi
.queue_size = 5, .queue_size = 5,
.task_name = "bt_hidd_events", .task_name = "bt_hidd_events",
.task_priority = uxTaskPriorityGet(NULL), .task_priority = uxTaskPriorityGet(NULL),
.task_stack_size = 2048, .task_stack_size = BT_HID_DEVICE_TASK_SIZE_BT,
.task_core_id = tskNO_AFFINITY .task_core_id = tskNO_AFFINITY
}; };
ret = esp_event_loop_create(&event_task_args, &s_hidd_param.dev->event_loop_handle); ret = esp_event_loop_create(&event_task_args, &s_hidd_param.dev->event_loop_handle);

View File

@ -431,7 +431,6 @@ components/esp_event/include/esp_event_loop.h
components/esp_event/private_include/esp_event_internal.h components/esp_event/private_include/esp_event_internal.h
components/esp_event/private_include/esp_event_private.h components/esp_event/private_include/esp_event_private.h
components/esp_event/test/test_event.c components/esp_event/test/test_event.c
components/esp_hid/include/esp_hid_common.h
components/esp_hid/include/esp_hidd.h components/esp_hid/include/esp_hidd.h
components/esp_hid/include/esp_hidd_gatts.h components/esp_hid/include/esp_hidd_gatts.h
components/esp_hid/include/esp_hidd_transport.h components/esp_hid/include/esp_hidd_transport.h