@@ -41,6 +41,17 @@ static StackType_t hs_xStack[ NIMBLE_HS_STACK_SIZE ];
4141static StaticTask_t hs_xTaskBuffer ;
4242#endif
4343
44+ // configMAX_PRIORITIES - 1 is Tmr builtin task
45+ #ifndef NIMBLE_LL_PRIORITY
46+ #define NIMBLE_LL_PRIORITY (configMAX_PRIORITIES - 2)
47+ #endif
48+ #ifndef NIMBLE_BLE_PRIORITY
49+ #define NIMBLE_BLE_PRIORITY (configMAX_PRIORITIES - 3)
50+ #endif
51+ #ifndef NIMBLE_HOST_PRIORITY
52+ #define NIMBLE_HOST_PRIORITY (configMAX_PRIORITIES - 4)
53+ #endif
54+
4455static TaskHandle_t host_task_h = NULL ;
4556
4657#ifdef ESP_PLATFORM
@@ -58,7 +69,7 @@ esp_err_t esp_nimble_enable(void *host_task)
5869 * default queue it is just easier to make separate task which does this.
5970 */
6071 xTaskCreatePinnedToCore (host_task , "nimble_host" , NIMBLE_HS_STACK_SIZE ,
61- NULL , ( configMAX_PRIORITIES - 4 ) , & host_task_h , NIMBLE_CORE );
72+ NULL , NIMBLE_HOST_PRIORITY , & host_task_h , NIMBLE_CORE );
6273 return ESP_OK ;
6374
6475}
@@ -112,15 +123,15 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn)
112123 * since it has compatible prototype.
113124 */
114125 ll_task_h = xTaskCreateStatic (nimble_port_ll_task_func , "ll" , NIMBLE_LL_STACK_SIZE ,
115- NULL , configMAX_PRIORITIES , ll_xStack , & ll_xTaskBuffer );
126+ NULL , NIMBLE_LL_PRIORITY , ll_xStack , & ll_xTaskBuffer );
116127#endif
117128 /*
118129 * Create task where NimBLE host will run. It is not strictly necessary to
119130 * have separate task for NimBLE host, but since something needs to handle
120131 * default queue it is just easier to make separate task which does this.
121132 */
122133 host_task_h = xTaskCreateStatic (host_task_fn , "ble" , NIMBLE_HS_STACK_SIZE ,
123- NULL , ( configMAX_PRIORITIES - 1 ) , hs_xStack , & hs_xTaskBuffer );
134+ NULL , NIMBLE_BLE_PRIORITY , hs_xStack , & hs_xTaskBuffer );
124135}
125136
126137void
0 commit comments