Skip to content

Commit 531adcf

Browse files
authored
Merge branch 'master' into feature/i2s_sr
2 parents cb5a4aa + 7438c6e commit 531adcf

File tree

9 files changed

+399
-136
lines changed

9 files changed

+399
-136
lines changed

.github/scripts/on-release.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ echo "Cleaning up folders ..."
191191
find "$PKG_DIR" -name '*.DS_Store' -exec rm -f {} \;
192192
find "$PKG_DIR" -name '*.git*' -type f -delete
193193

194+
##
195+
## TEMP WORKAROUND FOR RV32 LONG PATH ON WINDOWS
196+
##
197+
RVTC_NAME="riscv32-esp-elf-gcc"
198+
RVTC_NEW_NAME="esp-rv32"
199+
194200
# Replace tools locations in platform.txt
195201
echo "Generating platform.txt..."
196202
cat "$GITHUB_WORKSPACE/platform.txt" | \
@@ -200,7 +206,7 @@ sed 's/tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-es
200206
sed 's/tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf/tools.xtensa-esp32s2-elf-gcc.path=\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \
201207
sed 's/tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf/tools.xtensa-esp32s3-elf-gcc.path=\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \
202208
sed 's/tools.xtensa-esp-elf-gdb.path={runtime.platform.path}\/tools\/xtensa-esp-elf-gdb/tools.xtensa-esp-elf-gdb.path=\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
203-
sed 's/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\{runtime.tools.riscv32-esp-elf-gcc.path\}/g' | \
209+
sed "s/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\\/tools\\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \
204210
sed 's/tools.riscv32-esp-elf-gdb.path={runtime.platform.path}\/tools\/riscv32-esp-elf-gdb/tools.riscv32-esp-elf-gdb.path=\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
205211
sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \
206212
sed 's/debug.server.openocd.path={runtime.platform.path}\/tools\/openocd-esp32\/bin\/openocd/debug.server.openocd.path=\{runtime.tools.openocd-esp32.path\}\/bin\/openocd/g' | \
@@ -302,6 +308,20 @@ cat "$PACKAGE_JSON_TEMPLATE" | jq "$libs_jq_arg" > "$OUTPUT_DIR/package-$LIBS_PR
302308
# Overwrite the template location with the newly edited one
303309
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-$LIBS_PROJ_NAME.json"
304310

311+
##
312+
## TEMP WORKAROUND FOR RV32 LONG PATH ON WINDOWS
313+
##
314+
RVTC_VERSION=`cat $PACKAGE_JSON_TEMPLATE | jq -r ".packages[0].platforms[0].toolsDependencies[] | select(.name == \"$RVTC_NAME\") | .version" | cut -d '_' -f 2`
315+
# RVTC_VERSION=`date -j -f '%Y%m%d' "$RVTC_VERSION" '+%y%m'` # MacOS
316+
RVTC_VERSION=`date -d "$RVTC_VERSION" '+%y%m'`
317+
rvtc_jq_arg="\
318+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$RVTC_NAME\")).version = \"$RVTC_VERSION\" |\
319+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\" |\
320+
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).version = \"$RVTC_VERSION\" |\
321+
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\""
322+
cat "$PACKAGE_JSON_TEMPLATE" | jq "$rvtc_jq_arg" > "$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json"
323+
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json"
324+
305325
##
306326
## PACKAGE JSON
307327
##

boards.txt

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3678,6 +3678,8 @@ lilygo_t_display.upload.maximum_size=1310720
36783678
lilygo_t_display.upload.maximum_data_size=327680
36793679
lilygo_t_display.upload.wait_for_upload_port=true
36803680
lilygo_t_display.upload.speed=460800
3681+
lilygo_t_display.upload.flags=
3682+
lilygo_t_display.upload.extra_flags=
36813683

36823684
lilygo_t_display.bootloader.tool=esptool_py
36833685
lilygo_t_display.bootloader.tool.default=esptool_py
@@ -5749,6 +5751,171 @@ sparkfun_esp32_iot_redboard.menu.EraseFlash.all.upload.erase_cmd=-e
57495751

57505752
##############################################################
57515753

5754+
sparkfun_esp32c6_qwiic_pocket.name=SparkFun ESP32-C6 Qwiic Pocket
5755+
sparkfun_esp32c6_qwiic_pocket.vid.0=0x303a
5756+
sparkfun_esp32c6_qwiic_pocket.pid.0=0x1001
5757+
5758+
sparkfun_esp32c6_qwiic_pocket.bootloader.tool=esptool_py
5759+
sparkfun_esp32c6_qwiic_pocket.bootloader.tool.default=esptool_py
5760+
5761+
sparkfun_esp32c6_qwiic_pocket.upload.tool=esptool_py
5762+
sparkfun_esp32c6_qwiic_pocket.upload.tool.default=esptool_py
5763+
sparkfun_esp32c6_qwiic_pocket.upload.tool.network=esp_ota
5764+
5765+
sparkfun_esp32c6_qwiic_pocket.upload.maximum_size=1310720
5766+
sparkfun_esp32c6_qwiic_pocket.upload.maximum_data_size=327680
5767+
sparkfun_esp32c6_qwiic_pocket.upload.flags=
5768+
sparkfun_esp32c6_qwiic_pocket.upload.extra_flags=
5769+
sparkfun_esp32c6_qwiic_pocket.upload.use_1200bps_touch=false
5770+
sparkfun_esp32c6_qwiic_pocket.upload.wait_for_upload_port=false
5771+
5772+
sparkfun_esp32c6_qwiic_pocket.serial.disableDTR=false
5773+
sparkfun_esp32c6_qwiic_pocket.serial.disableRTS=false
5774+
5775+
sparkfun_esp32c6_qwiic_pocket.build.tarch=riscv32
5776+
sparkfun_esp32c6_qwiic_pocket.build.target=esp
5777+
sparkfun_esp32c6_qwiic_pocket.build.mcu=esp32c6
5778+
sparkfun_esp32c6_qwiic_pocket.build.core=esp32
5779+
sparkfun_esp32c6_qwiic_pocket.build.variant=sparkfun_esp32c6_qwiic_pocket
5780+
sparkfun_esp32c6_qwiic_pocket.build.board=ESP32C6_QWIIC_POCKET
5781+
sparkfun_esp32c6_qwiic_pocket.build.bootloader_addr=0x0
5782+
5783+
sparkfun_esp32c6_qwiic_pocket.build.cdc_on_boot=0
5784+
sparkfun_esp32c6_qwiic_pocket.build.f_cpu=160000000L
5785+
sparkfun_esp32c6_qwiic_pocket.build.flash_size=4MB
5786+
sparkfun_esp32c6_qwiic_pocket.build.flash_freq=80m
5787+
sparkfun_esp32c6_qwiic_pocket.build.flash_mode=qio
5788+
sparkfun_esp32c6_qwiic_pocket.build.boot=qio
5789+
sparkfun_esp32c6_qwiic_pocket.build.partitions=default
5790+
sparkfun_esp32c6_qwiic_pocket.build.defines=
5791+
5792+
## IDE 2.0 Seems to not update the value
5793+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.default=Disabled
5794+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.default.build.copy_jtag_files=0
5795+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.builtin=Integrated USB JTAG
5796+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.builtin.build.openocdscript=esp32c6-builtin.cfg
5797+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.builtin.build.copy_jtag_files=1
5798+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.external=FTDI Adapter
5799+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.external.build.openocdscript=esp32c6-ftdi.cfg
5800+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.external.build.copy_jtag_files=1
5801+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.bridge=ESP USB Bridge
5802+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.bridge.build.openocdscript=esp32c6-bridge.cfg
5803+
sparkfun_esp32c6_qwiic_pocket.menu.JTAGAdapter.bridge.build.copy_jtag_files=1
5804+
5805+
sparkfun_esp32c6_qwiic_pocket.menu.CDCOnBoot.default=Enabled
5806+
sparkfun_esp32c6_qwiic_pocket.menu.CDCOnBoot.default.build.cdc_on_boot=1
5807+
sparkfun_esp32c6_qwiic_pocket.menu.CDCOnBoot.cdc=Disabled
5808+
sparkfun_esp32c6_qwiic_pocket.menu.CDCOnBoot.cdc.build.cdc_on_boot=0
5809+
5810+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
5811+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.default.build.partitions=default
5812+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
5813+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
5814+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS)
5815+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
5816+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
5817+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
5818+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.minimal.build.partitions=minimal
5819+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
5820+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.no_ota.build.partitions=no_ota
5821+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
5822+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
5823+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
5824+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
5825+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
5826+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
5827+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
5828+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
5829+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
5830+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
5831+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
5832+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.huge_app.build.partitions=huge_app
5833+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
5834+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
5835+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
5836+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
5837+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS)
5838+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.fatflash.build.partitions=ffat
5839+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
5840+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
5841+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
5842+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
5843+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.rainmaker=RainMaker
5844+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
5845+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
5846+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.custom=Custom
5847+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.custom.build.partitions=
5848+
sparkfun_esp32c6_qwiic_pocket.menu.PartitionScheme.custom.upload.maximum_size=16777216
5849+
5850+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.160=160MHz (WiFi)
5851+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.160.build.f_cpu=160000000L
5852+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.80=80MHz (WiFi)
5853+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.80.build.f_cpu=80000000L
5854+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.40=40MHz
5855+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.40.build.f_cpu=40000000L
5856+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.20=20MHz
5857+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.20.build.f_cpu=20000000L
5858+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.10=10MHz
5859+
sparkfun_esp32c6_qwiic_pocket.menu.CPUFreq.10.build.f_cpu=10000000L
5860+
5861+
sparkfun_esp32c6_qwiic_pocket.menu.FlashMode.qio=QIO
5862+
sparkfun_esp32c6_qwiic_pocket.menu.FlashMode.qio.build.flash_mode=dio
5863+
sparkfun_esp32c6_qwiic_pocket.menu.FlashMode.qio.build.boot=qio
5864+
sparkfun_esp32c6_qwiic_pocket.menu.FlashMode.dio=DIO
5865+
sparkfun_esp32c6_qwiic_pocket.menu.FlashMode.dio.build.flash_mode=dio
5866+
sparkfun_esp32c6_qwiic_pocket.menu.FlashMode.dio.build.boot=dio
5867+
5868+
sparkfun_esp32c6_qwiic_pocket.menu.FlashFreq.80=80MHz
5869+
sparkfun_esp32c6_qwiic_pocket.menu.FlashFreq.80.build.flash_freq=80m
5870+
sparkfun_esp32c6_qwiic_pocket.menu.FlashFreq.40=40MHz
5871+
sparkfun_esp32c6_qwiic_pocket.menu.FlashFreq.40.build.flash_freq=40m
5872+
5873+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.4M=4MB (32Mb)
5874+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.4M.build.flash_size=4MB
5875+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.8M=8MB (64Mb)
5876+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.8M.build.flash_size=8MB
5877+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.8M.build.partitions=default_8MB
5878+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.2M=2MB (16Mb)
5879+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.2M.build.flash_size=2MB
5880+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.2M.build.partitions=minimal
5881+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.16M=16MB (128Mb)
5882+
sparkfun_esp32c6_qwiic_pocket.menu.FlashSize.16M.build.flash_size=16MB
5883+
5884+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.921600=921600
5885+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.921600.upload.speed=921600
5886+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.115200=115200
5887+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.115200.upload.speed=115200
5888+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.256000.windows=256000
5889+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.256000.upload.speed=256000
5890+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.230400.windows.upload.speed=256000
5891+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.230400=230400
5892+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.230400.upload.speed=230400
5893+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.460800.linux=460800
5894+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.460800.macosx=460800
5895+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.460800.upload.speed=460800
5896+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.512000.windows=512000
5897+
sparkfun_esp32c6_qwiic_pocket.menu.UploadSpeed.512000.upload.speed=512000
5898+
5899+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.none=None
5900+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.none.build.code_debug=0
5901+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.error=Error
5902+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.error.build.code_debug=1
5903+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.warn=Warn
5904+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.warn.build.code_debug=2
5905+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.info=Info
5906+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.info.build.code_debug=3
5907+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.debug=Debug
5908+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.debug.build.code_debug=4
5909+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.verbose=Verbose
5910+
sparkfun_esp32c6_qwiic_pocket.menu.DebugLevel.verbose.build.code_debug=5
5911+
5912+
sparkfun_esp32c6_qwiic_pocket.menu.EraseFlash.none=Disabled
5913+
sparkfun_esp32c6_qwiic_pocket.menu.EraseFlash.none.upload.erase_cmd=
5914+
sparkfun_esp32c6_qwiic_pocket.menu.EraseFlash.all=Enabled
5915+
sparkfun_esp32c6_qwiic_pocket.menu.EraseFlash.all.upload.erase_cmd=-e
5916+
5917+
##############################################################
5918+
57525919
nina_w10.name=u-blox NINA-W10 series (ESP32)
57535920

57545921
nina_w10.bootloader.tool=esptool_py

libraries/HTTPClient/examples/HTTPClientEnterprise/HTTPClientEnterprise.ino

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
/*|----------------------------------------------------------|*/
66
#include <WiFi.h>
77
#include <HTTPClient.h>
8+
#if __has_include ("esp_eap_client.h")
9+
#include "esp_eap_client.h"
10+
#else
811
#include "esp_wpa2.h"
12+
#endif
913
#include <Wire.h>
1014
#define EAP_IDENTITY "identity" //if connecting from another corporation, use identity@organisation.domain in Eduroam
1115
#define EAP_PASSWORD "password" //your Eduroam password
@@ -42,10 +46,17 @@ void setup() {
4246
Serial.println(ssid);
4347
WiFi.disconnect(true); //disconnect form wifi to set new wifi connection
4448
WiFi.mode(WIFI_STA); //init wifi mode
49+
#if __has_include ("esp_eap_client.h")
50+
esp_eap_client_set_identity((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide identity
51+
esp_eap_client_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide username
52+
esp_eap_client_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)); //provide password
53+
esp_wifi_sta_enterprise_enable();
54+
#else
4555
esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide identity
4656
esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide username --> identity and username is same
4757
esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)); //provide password
4858
esp_wifi_sta_wpa2_ent_enable();
59+
#endif
4960
WiFi.begin(ssid); //connect to wifi
5061
while (WiFi.status() != WL_CONNECTED) {
5162
delay(500);

libraries/WiFi/examples/WiFiClientEnterprise/WiFiClientEnterprise.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <WiFi.h> //Wifi library
2-
#include "esp_wpa2.h" //wpa2 library for connections to Enterprise networks
32
#define EAP_IDENTITY "login" //if connecting from another corporation, use identity@organisation.domain in Eduroam
43
#define EAP_USERNAME "login" //oftentimes just a repeat of the identity
54
#define EAP_PASSWORD "password" //your Eduroam password

libraries/WiFi/src/WiFiSTA.cpp

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "WiFiGeneric.h"
2727
#include "WiFiSTA.h"
2828

29-
extern "C" {
3029
#include <stdint.h>
3130
#include <stdbool.h>
3231
#include <stdio.h>
@@ -42,9 +41,13 @@ extern "C" {
4241
#include "lwip/dns.h"
4342
#include <esp_smartconfig.h>
4443
#include <esp_netif.h>
45-
#include "esp_wpa2.h"
4644
#include "esp_mac.h"
47-
}
45+
46+
#if __has_include ("esp_eap_client.h")
47+
#include "esp_eap_client.h"
48+
#else
49+
#include "esp_wpa2.h"
50+
#endif
4851

4952
// -----------------------------------------------------------------------------------------------------------------------
5053
// ---------------------------------------------------- Private functions ------------------------------------------------
@@ -193,19 +196,40 @@ wl_status_t WiFiSTAClass::begin(const char* wpa2_ssid, wpa2_auth_method_t method
193196
}
194197

195198
if(ca_pem) {
199+
#if __has_include ("esp_eap_client.h")
200+
esp_eap_client_set_ca_cert((uint8_t *)ca_pem, strlen(ca_pem));
201+
#else
196202
esp_wifi_sta_wpa2_ent_set_ca_cert((uint8_t *)ca_pem, strlen(ca_pem));
203+
#endif
197204
}
198205

199206
if(client_crt) {
207+
#if __has_include ("esp_eap_client.h")
208+
esp_eap_client_set_certificate_and_key((uint8_t *)client_crt, strlen(client_crt), (uint8_t *)client_key, strlen(client_key), NULL, 0);
209+
#else
200210
esp_wifi_sta_wpa2_ent_set_cert_key((uint8_t *)client_crt, strlen(client_crt), (uint8_t *)client_key, strlen(client_key), NULL, 0);
211+
#endif
201212
}
202213

214+
#if __has_include ("esp_eap_client.h")
215+
esp_eap_client_set_identity((uint8_t *)wpa2_identity, strlen(wpa2_identity));
216+
#else
203217
esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)wpa2_identity, strlen(wpa2_identity));
218+
#endif
204219
if(method == WPA2_AUTH_PEAP || method == WPA2_AUTH_TTLS) {
220+
#if __has_include ("esp_eap_client.h")
221+
esp_eap_client_set_username((uint8_t *)wpa2_username, strlen(wpa2_username));
222+
esp_eap_client_set_password((uint8_t *)wpa2_password, strlen(wpa2_password));
223+
#else
205224
esp_wifi_sta_wpa2_ent_set_username((uint8_t *)wpa2_username, strlen(wpa2_username));
206225
esp_wifi_sta_wpa2_ent_set_password((uint8_t *)wpa2_password, strlen(wpa2_password));
226+
#endif
207227
}
228+
#if __has_include ("esp_eap_client.h")
229+
esp_wifi_sta_enterprise_enable(); //set config settings to enable function
230+
#else
208231
esp_wifi_sta_wpa2_ent_enable(); //set config settings to enable function
232+
#endif
209233
WiFi.begin(wpa2_ssid); //connect to wifi
210234

211235
return status();

libraries/WiFiClientSecure/examples/WiFiClientSecureEnterprise/WiFiClientSecureEnterprise.ino

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515

1616
#include <WiFi.h>
1717
#include <WiFiClientSecure.h>
18+
#if __has_include ("esp_eap_client.h")
19+
#include "esp_eap_client.h"
20+
#else
1821
#include "esp_wpa2.h"
22+
#endif
1923
#include <Wire.h>
2024
#define EAP_ANONYMOUS_IDENTITY "anonymous@example.com" //anonymous identity
2125
#define EAP_IDENTITY "id@example.com" //user identity
@@ -64,10 +68,17 @@ void setup() {
6468
Serial.println(ssid);
6569
WiFi.disconnect(true); //disconnect form wifi to set new wifi connection
6670
WiFi.mode(WIFI_STA); //init wifi mode
71+
#if __has_include ("esp_eap_client.h")
72+
esp_eap_client_set_identity((uint8_t *)EAP_ANONYMOUS_IDENTITY, strlen(EAP_ANONYMOUS_IDENTITY)); //provide identity
73+
esp_eap_client_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide username
74+
esp_eap_client_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)); //provide password
75+
esp_wifi_sta_enterprise_enable();
76+
#else
6777
esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_ANONYMOUS_IDENTITY, strlen(EAP_ANONYMOUS_IDENTITY)); //provide identity
6878
esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide username
6979
esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)); //provide password
7080
esp_wifi_sta_wpa2_ent_enable();
81+
#endif
7182
WiFi.begin(ssid); //connect to wifi
7283
while (WiFi.status() != WL_CONNECTED) {
7384
delay(500);

0 commit comments

Comments
 (0)