@@ -41,6 +41,17 @@ static StackType_t hs_xStack[ NIMBLE_HS_STACK_SIZE ];
41
41
static StaticTask_t hs_xTaskBuffer ;
42
42
#endif
43
43
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
+
44
55
static TaskHandle_t host_task_h = NULL ;
45
56
46
57
#ifdef ESP_PLATFORM
@@ -58,7 +69,7 @@ esp_err_t esp_nimble_enable(void *host_task)
58
69
* default queue it is just easier to make separate task which does this.
59
70
*/
60
71
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 );
62
73
return ESP_OK ;
63
74
64
75
}
@@ -112,15 +123,15 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn)
112
123
* since it has compatible prototype.
113
124
*/
114
125
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 );
116
127
#endif
117
128
/*
118
129
* Create task where NimBLE host will run. It is not strictly necessary to
119
130
* have separate task for NimBLE host, but since something needs to handle
120
131
* default queue it is just easier to make separate task which does this.
121
132
*/
122
133
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 );
124
135
}
125
136
126
137
void
0 commit comments