Переглянути джерело

header: callbacks use "void *" as arguments

Wu Jian Gang 9 роки тому
батько
коміт
c56a790f64

+ 2 - 2
components/esp32/cpu_start.c

@@ -198,7 +198,7 @@ static void do_global_ctors(void) {
         (*p)();
 }
 
-extern esp_err_t app_main();
+extern esp_err_t app_main(void *param);
 
 void user_start_cpu0(void) {
 	ets_setup_syscalls();
@@ -223,7 +223,7 @@ void user_start_cpu0(void) {
 #include "esp_wifi.h"
 	esp_wifi_startup(app_main);
 #else
-	app_main();
+	app_main(NULL);
 #endif
 
 	ets_printf("Starting scheduler on PRO CPU.\n");

+ 3 - 4
components/esp32/include/esp_event.h

@@ -108,12 +108,12 @@ typedef struct {
 /**
   * @brief  Application specified event callback function
   *
-  * @param  system_event_t *event : event type defined in this file
+  * @param  void *param : parameter passed to callback function
   *
   * @return ESP_OK : succeed
   * @return others : fail
   */
-typedef esp_err_t (*system_event_cb_t)(system_event_t *event);
+typedef esp_err_t (*system_event_cb_t)(void *param);
 
 /**
   * @brief  Set application specified event callback function
@@ -123,8 +123,7 @@ typedef esp_err_t (*system_event_cb_t)(system_event_t *event);
   *
   * @param  system_event_cb_t cb : callback
   *
-  * @return ESP_OK : succeed
-  * @return others : fail
+  * @return system_event_cb_t : old callback
   */
 system_event_cb_t esp_event_set_cb(system_event_cb_t cb);
 

+ 1 - 1
components/esp32/include/esp_wifi.h

@@ -153,7 +153,7 @@ typedef enum {
   * @return ESP_OK : succeed
   * @return others : fail
   */
-typedef esp_err_t (* wifi_startup_cb_t)(void);
+typedef esp_err_t (* wifi_startup_cb_t)(void *param);
 void esp_wifi_startup(wifi_startup_cb_t cb);
 
 typedef struct {

+ 1 - 1
components/esp32/wifi.c

@@ -54,7 +54,7 @@ static void esp_wifi_task(void *pvParameters)
         }
 
         if (startup_cb) {
-            err = (*startup_cb)();
+            err = (*startup_cb)(NULL);
             if (err != ESP_OK) {
                 WIFI_DEBUG("startup_cb fail, ret=%d\n", err);
                 break;