Merge branch 'feature/enable_wifi_provisioning_for_esp32c3' into 'master'

wifi_provisioning: enable component build for ESP32-C3

Closes IDF-2251

See merge request espressif/esp-idf!11749
This commit is contained in:
Mahavir Jain 2021-01-14 17:35:12 +08:00
commit 569ebc181a
13 changed files with 21 additions and 22 deletions

View File

@ -1,8 +1,3 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "esp32c3")
return()
endif()
set(srcs "src/wifi_config.c" set(srcs "src/wifi_config.c"
"src/wifi_scan.c" "src/wifi_scan.c"
"src/manager.c" "src/manager.c"

View File

@ -268,7 +268,7 @@ static cJSON* wifi_prov_get_info_json(void)
/* Declare the internal event handler */ /* Declare the internal event handler */
static void wifi_prov_mgr_event_handler_internal(void* arg, esp_event_base_t event_base, static void wifi_prov_mgr_event_handler_internal(void* arg, esp_event_base_t event_base,
int event_id, void* event_data); int32_t event_id, void* event_data);
static esp_err_t wifi_prov_mgr_start_service(const char *service_name, const char *service_key) static esp_err_t wifi_prov_mgr_start_service(const char *service_name, const char *service_key)
{ {
@ -801,7 +801,7 @@ esp_err_t wifi_prov_mgr_event_handler(void *ctx, system_event_t *event)
} }
static void wifi_prov_mgr_event_handler_internal( static void wifi_prov_mgr_event_handler_internal(
void* arg, esp_event_base_t event_base, int event_id, void* event_data) void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data)
{ {
if (!prov_ctx_lock) { if (!prov_ctx_lock) {
ESP_LOGE(TAG, "Provisioning manager not initialized"); ESP_LOGE(TAG, "Provisioning manager not initialized");

View File

@ -28,7 +28,7 @@ static const char *TAG = "app";
static void start_ble_provisioning(void); static void start_ble_provisioning(void);
static void event_handler(void* arg, esp_event_base_t event_base, static void event_handler(void* arg, esp_event_base_t event_base,
int event_id, void* event_data) int32_t event_id, void* event_data)
{ {
static int s_retry_num_ap_not_found = 0; static int s_retry_num_ap_not_found = 0;
static int s_retry_num_ap_auth_fail = 0; static int s_retry_num_ap_auth_fail = 0;

View File

@ -15,6 +15,7 @@
#include <nvs.h> #include <nvs.h>
#include <esp_bt.h> #include <esp_bt.h>
#include <esp_event.h> #include <esp_event.h>
#include <esp_timer.h>
#ifdef CONFIG_BT_NIMBLE_ENABLED #ifdef CONFIG_BT_NIMBLE_ENABLED
#include "esp_nimble_hci.h" #include "esp_nimble_hci.h"
@ -35,7 +36,7 @@ static const char *TAG = "app_prov";
static const char *ssid_prefix = "PROV_"; static const char *ssid_prefix = "PROV_";
/* Handler for catching WiFi events */ /* Handler for catching WiFi events */
static void app_prov_event_handler(void* handler_arg, esp_event_base_t base, int id, void* data); static void app_prov_event_handler(void* handler_arg, esp_event_base_t base, int32_t id, void* data);
/* Handlers for wifi_config provisioning endpoint */ /* Handlers for wifi_config provisioning endpoint */
extern wifi_prov_config_handlers_t wifi_prov_handlers; extern wifi_prov_config_handlers_t wifi_prov_handlers;
@ -198,7 +199,7 @@ static void _stop_prov_cb(void * arg)
/* Event handler for starting/stopping provisioning */ /* Event handler for starting/stopping provisioning */
static void app_prov_event_handler(void* handler_arg, esp_event_base_t event_base, static void app_prov_event_handler(void* handler_arg, esp_event_base_t event_base,
int event_id, void* event_data) int32_t event_id, void* event_data)
{ {
/* If pointer to provisioning application data is NULL /* If pointer to provisioning application data is NULL
* then provisioning is not running */ * then provisioning is not running */

View File

@ -26,7 +26,7 @@
static const char *TAG = "app"; static const char *TAG = "app";
static void event_handler(void* arg, esp_event_base_t event_base, static void event_handler(void* arg, esp_event_base_t event_base,
int event_id, void* event_data) int32_t event_id, void* event_data)
{ {
static int s_retry_num = 0; static int s_retry_num = 0;

View File

@ -14,6 +14,7 @@
#include <nvs_flash.h> #include <nvs_flash.h>
#include <nvs.h> #include <nvs.h>
#include <esp_event.h> #include <esp_event.h>
#include <esp_timer.h>
#include <protocomm.h> #include <protocomm.h>
#include <protocomm_console.h> #include <protocomm_console.h>
@ -26,7 +27,7 @@
static const char *TAG = "app_prov"; static const char *TAG = "app_prov";
/* Handler for catching WiFi events */ /* Handler for catching WiFi events */
static void app_prov_event_handler(void* handler_arg, esp_event_base_t base, int id, void* data); static void app_prov_event_handler(void* handler_arg, esp_event_base_t base, int32_t id, void* data);
/* Handlers for wifi_config provisioning endpoint */ /* Handlers for wifi_config provisioning endpoint */
extern wifi_prov_config_handlers_t wifi_prov_handlers; extern wifi_prov_config_handlers_t wifi_prov_handlers;
@ -136,7 +137,7 @@ static void _stop_prov_cb(void * arg)
/* Event handler for starting/stopping provisioning */ /* Event handler for starting/stopping provisioning */
static void app_prov_event_handler(void* handler_arg, esp_event_base_t event_base, static void app_prov_event_handler(void* handler_arg, esp_event_base_t event_base,
int event_id, void* event_data) int32_t event_id, void* event_data)
{ {
/* If pointer to provisioning application data is NULL /* If pointer to provisioning application data is NULL
* then provisioning is not running */ * then provisioning is not running */

View File

@ -26,7 +26,7 @@
static const char *TAG = "app"; static const char *TAG = "app";
static void event_handler(void* arg, esp_event_base_t event_base, static void event_handler(void* arg, esp_event_base_t event_base,
int event_id, void* event_data) int32_t event_id, void* event_data)
{ {
static int s_retry_num = 0; static int s_retry_num = 0;

View File

@ -14,6 +14,7 @@
#include <nvs_flash.h> #include <nvs_flash.h>
#include <nvs.h> #include <nvs.h>
#include <esp_event.h> #include <esp_event.h>
#include <esp_timer.h>
#include <protocomm.h> #include <protocomm.h>
#include <protocomm_httpd.h> #include <protocomm_httpd.h>
@ -27,7 +28,7 @@
static const char *TAG = "app_prov"; static const char *TAG = "app_prov";
/* Handler for catching WiFi events */ /* Handler for catching WiFi events */
static void app_prov_event_handler(void* handler_arg, esp_event_base_t base, int id, void* data); static void app_prov_event_handler(void* handler_arg, esp_event_base_t base, int32_t id, void* data);
/* Handlers for provisioning endpoints */ /* Handlers for provisioning endpoints */
extern wifi_prov_config_handlers_t wifi_prov_handlers; extern wifi_prov_config_handlers_t wifi_prov_handlers;
@ -152,7 +153,7 @@ static void _stop_prov_cb(void * arg)
/* Event handler for starting/stopping provisioning */ /* Event handler for starting/stopping provisioning */
static void app_prov_event_handler(void* handler_arg, esp_event_base_t event_base, static void app_prov_event_handler(void* handler_arg, esp_event_base_t event_base,
int event_id, void* event_data) int32_t event_id, void* event_data)
{ {
/* If pointer to provisioning application data is NULL /* If pointer to provisioning application data is NULL
* then provisioning is not running */ * then provisioning is not running */

View File

@ -26,7 +26,7 @@
static const char *TAG = "app"; static const char *TAG = "app";
static void event_handler(void* arg, esp_event_base_t event_base, static void event_handler(void* arg, esp_event_base_t event_base,
int event_id, void* event_data) int32_t event_id, void* event_data)
{ {
static int s_retry_num = 0; static int s_retry_num = 0;

View File

@ -14,6 +14,7 @@
#include <nvs_flash.h> #include <nvs_flash.h>
#include <nvs.h> #include <nvs.h>
#include <esp_event.h> #include <esp_event.h>
#include <esp_timer.h>
#include <protocomm.h> #include <protocomm.h>
#include <protocomm_httpd.h> #include <protocomm_httpd.h>
@ -26,7 +27,7 @@
static const char *TAG = "app_prov"; static const char *TAG = "app_prov";
/* Handler for catching WiFi events */ /* Handler for catching WiFi events */
static void app_prov_event_handler(void* handler_arg, esp_event_base_t base, int id, void* data); static void app_prov_event_handler(void* handler_arg, esp_event_base_t base, int32_t id, void* data);
/* Handlers for wifi_config provisioning endpoint */ /* Handlers for wifi_config provisioning endpoint */
extern wifi_prov_config_handlers_t wifi_prov_handlers; extern wifi_prov_config_handlers_t wifi_prov_handlers;
@ -138,7 +139,7 @@ static void _stop_prov_cb(void * arg)
/* Event handler for starting/stopping provisioning */ /* Event handler for starting/stopping provisioning */
static void app_prov_event_handler(void* handler_arg, esp_event_base_t event_base, static void app_prov_event_handler(void* handler_arg, esp_event_base_t event_base,
int event_id, void* event_data) int32_t event_id, void* event_data)
{ {
/* If pointer to provisioning application data is NULL /* If pointer to provisioning application data is NULL
* then provisioning is not running */ * then provisioning is not running */

View File

@ -2,6 +2,7 @@ menu "Example Configuration"
choice EXAMPLE_PROV_TRANSPORT choice EXAMPLE_PROV_TRANSPORT
bool "Provisioning Transport" bool "Provisioning Transport"
default EXAMPLE_PROV_TRANSPORT_SOFTAP if IDF_TARGET_ESP32S2
default EXAMPLE_PROV_TRANSPORT_BLE default EXAMPLE_PROV_TRANSPORT_BLE
help help
Wi-Fi provisioning component offers both, SoftAP and BLE transports. Choose any one. Wi-Fi provisioning component offers both, SoftAP and BLE transports. Choose any one.
@ -9,7 +10,6 @@ menu "Example Configuration"
config EXAMPLE_PROV_TRANSPORT_BLE config EXAMPLE_PROV_TRANSPORT_BLE
bool "BLE" bool "BLE"
select BT_ENABLED select BT_ENABLED
depends on IDF_TARGET_ESP32
config EXAMPLE_PROV_TRANSPORT_SOFTAP config EXAMPLE_PROV_TRANSPORT_SOFTAP
bool "Soft AP" bool "Soft AP"
endchoice endchoice

View File

@ -37,7 +37,7 @@ static EventGroupHandle_t wifi_event_group;
/* Event handler for catching system events */ /* Event handler for catching system events */
static void event_handler(void* arg, esp_event_base_t event_base, static void event_handler(void* arg, esp_event_base_t event_base,
int event_id, void* event_data) int32_t event_id, void* event_data)
{ {
if (event_base == WIFI_PROV_EVENT) { if (event_base == WIFI_PROV_EVENT) {
switch (event_id) { switch (event_id) {

View File

@ -2,4 +2,4 @@
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, 0x9000, 0x6000, nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000, phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1200000, factory, app, factory, 0x10000, 1300000,

1 # Name, Type, SubType, Offset, Size, Flags
2 # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
3 nvs, data, nvs, 0x9000, 0x6000,
4 phy_init, data, phy, 0xf000, 0x1000,
5 factory, app, factory, 0x10000, 1200000, factory, app, factory, 0x10000, 1300000,