mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/esp_common: use generic WIFI_SSID/WIFI_PASS defines
This commit is contained in:
parent
6f6727db82
commit
50802b841d
@ -1561,8 +1561,8 @@ Furthermore, the following configuration parameters have to be defined:
|
||||
|
||||
Parameter | Default | Description
|
||||
:-------------------|:--------------------------|:------------
|
||||
#ESP_WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
#ESP_WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars).
|
||||
#WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
#WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars).
|
||||
#ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
|
||||
|
||||
</center><br>
|
||||
@ -1573,14 +1573,14 @@ line, for example:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
USEMODULE=esp_wifi \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_PASS=\"MyPassphrase\"' \
|
||||
CFLAGS='-DWIFI_SSID=\"MySSID\" -DWIFI_PASS=\"MyPassphrase\"' \
|
||||
make -C examples/gnrc_networking BOARD=...
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@note
|
||||
- Module `esp_wifi` is not enabled automatically when module
|
||||
`netdev_default` is used.
|
||||
- Leave 'ESP_WIFI_PASS' undefined to connect to an open WiFi access point.
|
||||
- Leave 'WIFI_PASS' undefined to connect to an open WiFi access point.
|
||||
- The Wifi network interface (module `esp_wifi`) and the
|
||||
[ESP-NOW network interface](#esp32_esp_now_network_interface) (module `esp_now`)
|
||||
can be used simultaneously, for example, to realize a border router for
|
||||
@ -1612,7 +1612,7 @@ following configuration parameters have to be defined:
|
||||
|
||||
Parameter | Default | Description
|
||||
:-------------------|:----------|:------------
|
||||
#ESP_WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
#WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
ESP_WIFI_EAP_ID | none | Optional anonymous identity used in phase 1 (outer) EAP authentication.[1]
|
||||
ESP_WIFI_EAP_USER | none | User name used in phase 2 (inner) EAP authentication.
|
||||
ESP_WIFI_EAP_PASS | none | Password used in phase 2 (inner) EAP authentication.
|
||||
@ -1630,7 +1630,7 @@ line, for example:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
USEMODULE=esp_wifi_enterprise \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_EAP_ID=\"anonymous\" -DESP_WIFI_EAP_USER=\"MyUserName\" -DESP_WIFI_EAP_PASS=\"MyPassphrase\"' \
|
||||
CFLAGS='-DWIFI_SSID=\"MySSID\" -DESP_WIFI_EAP_ID=\"anonymous\" -DESP_WIFI_EAP_USER=\"MyUserName\" -DESP_WIFI_EAP_PASS=\"MyPassphrase\"' \
|
||||
make -C examples/gnrc_networking BOARD=...
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -1660,8 +1660,8 @@ The following parameters can be configured:
|
||||
|
||||
Parameter | Default | Description
|
||||
:-------------------------|:--------------------------|:-------------
|
||||
#ESP_WIFI_SSID | "RIOT_AP" | Static SSID definition for the SoftAP
|
||||
#ESP_WIFI_PASS | none | The password for the WiFi SoftAP network interface.[1]
|
||||
#WIFI_SSID | "RIOT_AP" | Static SSID definition for the SoftAP
|
||||
#WIFI_PASS | none | The password for the WiFi SoftAP network interface.[1]
|
||||
#ESP_WIFI_SSID_DYNAMIC | 0 | Defines whether dynamic SSID is used for the SoftAP [2].
|
||||
#ESP_WIFI_SSID_HIDDEN | 0 | Defines whether the SoftAP SSID should be hidden.
|
||||
#ESP_WIFI_MAX_CONN | 4 | The maximum number of connections for the SoftAP.
|
||||
@ -1673,7 +1673,7 @@ Parameter | Default | Description
|
||||
[1] If no password is provided, the interface will be "open", otherwise it
|
||||
uses WPA2-PSK authentication mode.<br>
|
||||
[2] If `#ESP_WIFI_SSID_DYNAMIC` is set to 1, a dynamic SSID is generated for the
|
||||
SoftAP by extending the defined SSID (`ESP_WIFI_SSID`) with the MAC address
|
||||
SoftAP by extending the defined SSID (`WIFI_SSID`) with the MAC address
|
||||
of the SoftAP interface used, e.g.: `RIOT_AP_aabbccddeeff`
|
||||
|
||||
These configuration parameter definitions, as well as enabling the `esp_wifi_ap`
|
||||
@ -1682,7 +1682,7 @@ line, for example:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
USEMODULE=esp_wifi_ap \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_PASS=\"MyPassphrase\" -DESP_WIFI_MAX_CONN=1' \
|
||||
CFLAGS='-DWIFI_SSID=\"MySSID\" -DWIFI_PASS=\"MyPassphrase\" -DESP_WIFI_MAX_CONN=1' \
|
||||
make -C examples/gnrc_networking BOARD=...
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -717,8 +717,8 @@ Furthermore, the following configuration parameters have to be defined:
|
||||
|
||||
Parameter | Default | Description
|
||||
:-------------------|:--------------------------|:------------
|
||||
#ESP_WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
#ESP_WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars).
|
||||
#WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
#WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars).
|
||||
#ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT |Stack size used for the WiFi netdev driver thread.
|
||||
|
||||
</center>
|
||||
@ -729,14 +729,14 @@ line, e.g.:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
USEMODULE=esp_wifi \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_PASS=\"MyPassphrase\"' \
|
||||
CFLAGS='-DWIFI_SSID=\"MySSID\" -DWIFI_PASS=\"MyPassphrase\"' \
|
||||
make -C examples/gnrc_networking BOARD=...
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@note
|
||||
- Module `esp_wifi` is not enabled automatically when module
|
||||
`netdev_default` is used.
|
||||
- Leave `ESP_WIFI_PASS` undefined to connect to an open WiFi access point.
|
||||
- Leave `WIFI_PASS` undefined to connect to an open WiFi access point.
|
||||
- The Wifi network interface (module `esp_wifi`) and the
|
||||
[ESP-NOW network interface](#esp8266_esp_now_network_interface)
|
||||
(module `esp_now`) can be used simultaneously, for example, to realize a
|
||||
@ -758,8 +758,8 @@ The following parameters can be configured:
|
||||
|
||||
Parameter | Default | Description
|
||||
:-------------------------|:--------------------------|:-------------
|
||||
#ESP_WIFI_SSID | "RIOT_AP" | Static SSID definition for the SoftAP
|
||||
#ESP_WIFI_PASS | none | The password for the WiFi SoftAP network interface.[1]
|
||||
#WIFI_SSID | "RIOT_AP" | Static SSID definition for the SoftAP
|
||||
#WIFI_PASS | none | The password for the WiFi SoftAP network interface.[1]
|
||||
#ESP_WIFI_SSID_DYNAMIC | 0 | Defines whether dynamic SSID is used for the SoftAP [2].
|
||||
#ESP_WIFI_SSID_HIDDEN | 0 | Defines whether the SoftAP SSID should be hidden.
|
||||
#ESP_WIFI_MAX_CONN | 4 | The maximum number of connections for the SoftAP.
|
||||
@ -771,7 +771,7 @@ Parameter | Default | Description
|
||||
[1] If no password is provided, the interface will be "open", otherwise it
|
||||
uses WPA2-PSK authentication mode.<br>
|
||||
[2] If #ESP_WIFI_SSID_DYNAMIC is set to 1, a dynamic SSID is generated for the
|
||||
SoftAP by extending the defined SSID (`ESP_WIFI_SSID`) with the MAC address
|
||||
SoftAP by extending the defined SSID (`WIFI_SSID`) with the MAC address
|
||||
of the SoftAP interface used, e.g.: `RIOT_AP_aabbccddeeff`
|
||||
|
||||
These configuration parameter definitions, as well as enabling the `esp_wifi_ap`
|
||||
@ -780,7 +780,7 @@ line, for example:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
USEMODULE=esp_wifi_ap \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_PASS=\"MyPassphrase\" -DESP_WIFI_MAX_CONN=1' \
|
||||
CFLAGS='-DWIFI_SSID=\"MySSID\" -DWIFI_PASS=\"MyPassphrase\" -DESP_WIFI_MAX_CONN=1' \
|
||||
make -C examples/gnrc_networking BOARD=...
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -38,8 +38,8 @@ Furthermore, the following configuration parameters have to be defined:
|
||||
|
||||
Parameter | Default | Description
|
||||
:------------------|:--------------------------|:------------
|
||||
ESP_WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
ESP_WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars).
|
||||
WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars).
|
||||
ESP_WIFI_STACKSIZE | #THREAD_STACKSIZE_DEFAULT | Stack size used for the WiFi netdev driver thread.
|
||||
|
||||
</center>
|
||||
@ -50,14 +50,14 @@ line, for example:
|
||||
|
||||
```
|
||||
USEMODULE=esp_wifi \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_PASS=\"MyPassphrase\"' \
|
||||
CFLAGS='-DWIFI_SSID=\"MySSID\" -DWIFI_PASS=\"MyPassphrase\"' \
|
||||
make -C examples/gnrc_networking BOARD=...
|
||||
```
|
||||
|
||||
@note
|
||||
- Module `esp_wifi` is not enabled automatically when module
|
||||
`netdev_default` is used.
|
||||
- Leave 'ESP_WIFI_PASS' undefined to connect to an open WiFi access point.
|
||||
- Leave 'WIFI_PASS' undefined to connect to an open WiFi access point.
|
||||
- The Wifi network interface (module `esp_wifi`) and the
|
||||
ESP-NOW network interface (module `esp_now`)
|
||||
can be used simultaneously, for example, to realize a border router for
|
||||
@ -87,7 +87,7 @@ following configuration parameters have to be defined:
|
||||
|
||||
Parameter | Default | Description
|
||||
:------------------|:----------|:------------
|
||||
ESP_WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
|
||||
ESP_WIFI_EAP_ID | none | Optional anonymous identity used in phase 1 (outer) EAP authentication. If it is not defined, the user name defined for phase 2 (inner) EAP authentication is used as idendity in phase 1.
|
||||
ESP_WIFI_EAP_USER | none | User name used in phase 2 (inner) EAP authentication.
|
||||
ESP_WIFI_EAP_PASS | none | Password used in phase 2 (inner) EAP authentication.
|
||||
@ -101,7 +101,7 @@ line, for example:
|
||||
|
||||
```
|
||||
USEMODULE=esp_wifi_enterprise \
|
||||
CFLAGS='-DESP_WIFI_SSID=\"MySSID\" -DESP_WIFI_EAP_ID=\"anonymous\" -DESP_WIFI_EAP_USER=\"MyUserName\" -DESP_WIFI_EAP_PASS=\"MyPassphrase\"' \
|
||||
CFLAGS='-DWIFI_SSID=\"MySSID\" -DESP_WIFI_EAP_ID=\"anonymous\" -DESP_WIFI_EAP_USER=\"MyUserName\" -DESP_WIFI_EAP_PASS=\"MyPassphrase\"' \
|
||||
make -C examples/gnrc_networking BOARD=...
|
||||
```
|
||||
|
||||
|
@ -797,9 +797,9 @@ static const netdev_driver_t _esp_wifi_driver =
|
||||
*/
|
||||
static wifi_config_t wifi_config_sta = {
|
||||
.sta = {
|
||||
.ssid = ESP_WIFI_SSID,
|
||||
#if !defined(MODULE_ESP_WIFI_ENTERPRISE) && defined(ESP_WIFI_PASS)
|
||||
.password = ESP_WIFI_PASS,
|
||||
.ssid = WIFI_SSID,
|
||||
#if !defined(MODULE_ESP_WIFI_ENTERPRISE) && defined(WIFI_PASS)
|
||||
.password = WIFI_PASS,
|
||||
#endif
|
||||
.channel = 0,
|
||||
.scan_method = WIFI_ALL_CHANNEL_SCAN,
|
||||
@ -830,12 +830,12 @@ static wifi_config_t wifi_config_sta = {
|
||||
*/
|
||||
static wifi_config_t wifi_config_ap = {
|
||||
.ap = {
|
||||
#ifdef ESP_WIFI_SSID
|
||||
.ssid = ESP_WIFI_SSID,
|
||||
.ssid_len = ARRAY_SIZE(ESP_WIFI_SSID) - 1,
|
||||
#ifdef WIFI_SSID
|
||||
.ssid = WIFI_SSID,
|
||||
.ssid_len = sizeof(WIFI_SSID) - 1,
|
||||
#endif
|
||||
#ifdef ESP_WIFI_PASS
|
||||
.password = ESP_WIFI_PASS,
|
||||
#ifdef WIFI_PASS
|
||||
.password = WIFI_PASS,
|
||||
.authmode = WIFI_AUTH_WPA2_PSK,
|
||||
#else
|
||||
.authmode = WIFI_AUTH_OPEN,
|
||||
@ -923,7 +923,7 @@ void esp_wifi_setup (esp_wifi_netdev_t* dev)
|
||||
uint8_t mac[ETHERNET_ADDR_LEN];
|
||||
esp_wifi_get_mac(ESP_MAC_WIFI_SOFTAP, mac);
|
||||
sprintf((char*)wifi_config_ap.ap.ssid, "%s_%02x%02x%02x%02x%02x%02x",
|
||||
ESP_WIFI_SSID, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
WIFI_SSID, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
wifi_config_ap.ap.ssid_len = strlen((char*)wifi_config_ap.ap.ssid);
|
||||
#endif /* IS_ACTIVE(ESP_WIFI_SSID_DYNAMIC) */
|
||||
/* set the SoftAP configuration */
|
||||
|
@ -44,15 +44,23 @@
|
||||
/**
|
||||
* @brief SSID of the AP to be used.
|
||||
*/
|
||||
#ifndef ESP_WIFI_SSID
|
||||
#define ESP_WIFI_SSID "RIOT_AP"
|
||||
#ifndef WIFI_SSID
|
||||
#ifdef ESP_WIFI_SSID
|
||||
#define WIFI_SSID ESP_WIFI_SSID
|
||||
#else
|
||||
#define WIFI_SSID "RIOT_AP"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Passphrase used for the AP as clear text (max. 64 chars).
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
#define ESP_WIFI_PASS "ThisistheRIOTporttoESP"
|
||||
#define WIFI_PASS "ThisistheRIOTporttoESP"
|
||||
#endif
|
||||
|
||||
#if !defined(WIFI_PASS) && defined(ESP_WIFI_PASS)
|
||||
#define WIFI_PASS ESP_WIFI_PASS
|
||||
#endif
|
||||
|
||||
#if defined(MODULE_ESP_WIFI_AP) || defined(DOXYGEN)
|
||||
@ -61,7 +69,7 @@
|
||||
* @brief Use dynamic SSID for the SoftAP
|
||||
*
|
||||
* If set to 1, the SSID for the SoftAP is generated dynamically by extending
|
||||
* the defined SSID (`ESP_WIFI_SSID`) with the MAC address of the SoftAP
|
||||
* the defined SSID (`WIFI_SSID`) with the MAC address of the SoftAP
|
||||
* interface used, e.g.: `RIOT_AP_aabbccddeeff`
|
||||
*/
|
||||
#ifndef ESP_WIFI_SSID_DYNAMIC
|
||||
|
@ -1,2 +1,2 @@
|
||||
CFLAGS += -DESP_WIFI_SSID=\"$(WIFI_SSID)\"
|
||||
CFLAGS += -DESP_WIFI_PASS=\"$(WIFI_PASS)\"
|
||||
CFLAGS += -DWIFI_SSID=\"$(WIFI_SSID)\"
|
||||
CFLAGS += -DWIFI_PASS=\"$(WIFI_PASS)\"
|
||||
|
@ -60,6 +60,6 @@ USEMODULE += ztimer_msec
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
ifneq (,$(filter arch_esp,$(FEATURES_USED)))
|
||||
CFLAGS += -DESP_WIFI_SSID=\"$(WIFI_SSID)\"
|
||||
CFLAGS += -DESP_WIFI_PASS=\"$(WIFI_PASS)\"
|
||||
CFLAGS += -DWIFI_SSID=\"$(WIFI_SSID)\"
|
||||
CFLAGS += -DWIFI_PASS=\"$(WIFI_PASS)\"
|
||||
endif
|
||||
|
@ -8,7 +8,7 @@ ESP32x WiFi interface simultaneously.
|
||||
|
||||
Comile and flash the application with command
|
||||
```
|
||||
CFLAGS='-DESP_WIFI_SSID=\"myssid\" -DESP_WIFI_PASS=\"mypass\"'
|
||||
CFLAGS='-DWIFI_SSID=\"myssid\" -DWIFI_PASS=\"mypass\"'
|
||||
BOARD=esp32-wroom-32 make -C tests/nimble_esp_wifi_coexist flash term
|
||||
```
|
||||
Once the test application is flashed and the WiFi connection is established,
|
||||
|
Loading…
Reference in New Issue
Block a user