esp_event_handler_register_with(event_loop_handler, TASK0_BASE, Event_N_1, &Event_Handle, (void *)handle_arg); vTaskDelay(3000 / portTICK_PERIOD_MS); esp_event_handler_register_with(event_loop_handler, TASK1_BASE, Event_N_2, &Event_Handle, (void *)handle_arg); while (true) { ...
3.1 void tcpip_adapter_init(void) 3.2 esp_err_t esp_event_loop_init(system_event_cb_t cb, void *ctx); 3.2.1仔细看esp_event_loop_init的源码 3.2.1.1继续深入,查看esp_event_loop_task,了解该任务主要做什么 3.2.1.1.1对于默认处理esp_event_process_default,继续深入 3.2.1.1.1.1深入查看defualt_...
esp_event_loop_handle_t night_market_loop_handler; esp_event_base_t XINJIANG_BASE = "新疆餐厅"; typedef enum { 羊肉串_辣 = 0, 羊肉串_不辣, 热囊, 烤包子, 薄皮包子, 冰冻啤酒 } bbq_event_t; void consumer_event_handle(void *handler_arg, esp_event_base_t base, int32_t id, void ...
这里需要看两个函数的函数原型,其中一个是esp_event_loop_init(),另一个是需要传递给该函数的回调函数(callback)。 先看esp_event_loop_init(): /** * @brief Initialize event loop * Create the event handler and task * * @param system_event_cb_t cb : application specified event callback, it ...
esp_err_tevent_handler(void*ctx,system_event_t*event){} 需要向esp_event_loop_init()传入一个专门的上下文指针,当使用wifi、以太网、IP协议栈时往往会产生事件,这些事件都会被保存在事件队列中等待收取,每个处理函数都会获取一个指向事件结构体的指针,这个指针用于描述现在队首的事件,这个事件被用联合标注:even...
wifi_power_save首先调用 tcpip_adapter_init();函数对底层库的TCP/IP协议进行调用,然后检测esp_event_loop_init是否初始化完成。 之后便是进行wifi的设置,首先用esp_wifi_init(&cfg)对WIFI的内存空间进行设置,初始化WiFi Alloc资源为WiFi驱动,如WiFi控制结构,RX / TX缓冲区,WiFi NVS结构等,此WiFi也启动WiFi任务...
** esp_event_loop_init(event_handler, NULL) 初始化 事件回调函数,event_handler 函数中主要是实时判断当前wifi的执行状态,用户根据这个函数中的状态标志,对程序进行进一步处理*/staticvoidinitialise_wifi(void){tcpip_adapter_init();s_wifi_event_group=xEventGroupCreate();ESP_ERROR_CHECK(esp_event_loop_...
esp_event_loop_init(event_handler, NULL); 1.3wifi配置初始化与设置 wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); esp_wifi_init(&cfg) ; 1.4wifi模式设置 esp_wifi_set_mode(WIFI_MODE_AP); 1.5AP配置初始化(SSID,PASSWORD,最大连接数,authmode ) ...
If I replace esp_event_loop_create_default with esp_event_loop_init(nullptr, nullptr), which I understand is deprecated, the error goes away and everything still works fine. The strangest thing is that when I created a new project to test this, neither esp_event_loop_create_default nor ...
}staticvoidinitialise_wifi(void){ESP_ERROR_CHECK(esp_netif_init()); s_wifi_event_group =xEventGroupCreate();ESP_ERROR_CHECK(esp_event_loop_create_default());esp_netif_t*sta_netif =esp_netif_create_default_wifi_sta();assert(sta_netif);wifi_init_config_tcfg =WIFI_INIT_CONFIG_DEFAULT()...