Browse Source

update head files for nimble
Remove some useless error printing display

GengYuchao 3 years ago
parent
commit
ee13e58b16

+ 12 - 4
components/bt/porting/nimble/include/nimble/nimble_port.h

@@ -41,14 +41,22 @@ void nimble_port_deinit(void);
 void nimble_port_run(void);
 int nimble_port_stop(void);
 
-struct ble_npl_eventq *nimble_port_get_dflt_eventq(void);
-
+/**
+ * @brief esp_nimble_init - Initialize the NimBLE host stack
+ *
+ * @return esp_err_t
+ */
 esp_err_t esp_nimble_init(void);
-esp_err_t esp_nimble_enable(void *host_task);
 
-esp_err_t esp_nimble_disable(void);
+/**
+ * @brief esp_nimble_deinit - Deinitialize the NimBLE host stack
+ *
+ * @return esp_err_t
+ */
 esp_err_t esp_nimble_deinit(void);
 
+struct ble_npl_eventq *nimble_port_get_dflt_eventq(void);
+
 
 #ifdef __cplusplus
 }

+ 16 - 0
components/bt/porting/npl/freertos/include/nimble/nimble_port_freertos.h

@@ -15,6 +15,22 @@
 extern "C" {
 #endif
 
+
+/**
+ * @brief esp_nimble_enable - Initialize the NimBLE host task
+ *
+ * @param host_task
+ * @return esp_err_t
+ */
+esp_err_t esp_nimble_enable(void *host_task);
+
+/**
+ * @brief esp_nimble_disable - Disable the NimBLE host task
+ *
+ * @return esp_err_t
+ */
+esp_err_t esp_nimble_disable(void);
+
 void nimble_port_freertos_init(TaskFunction_t host_task_fn);
 void nimble_port_freertos_deinit(void);
 void npl_freertos_funcs_init(void);

+ 9 - 5
components/bt/porting/npl/freertos/src/npl_os_freertos.c

@@ -762,12 +762,16 @@ IRAM_ATTR npl_freertos_callout_deinit(struct ble_npl_callout *co)
     BLE_LL_ASSERT(callout->handle);
 
 #if CONFIG_BT_NIMBLE_USE_ESP_TIMER
-    if(esp_timer_stop(callout->handle))
-        ESP_LOGW(TAG, "Timer not stopped");
-
-    if(esp_timer_delete(callout->handle))
+    esp_err_t err = esp_timer_stop(callout->handle);
+    if(err != ESP_OK) {
+        if (err != ESP_ERR_INVALID_STATE) { // ESP_ERR_INVALID_STATE is expected when timer is already stopped
+            ESP_LOGW(TAG, "Timer not stopped");
+        }
+    }
+    err = esp_timer_delete(callout->handle);
+    if(err != ESP_OK) {
         ESP_LOGW(TAG, "Timer not deleted");
-
+    }
 #else
 
     xTimerDelete(callout->handle, portMAX_DELAY);