forked from espressif/arduino-esp32
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix psram crash pico d4 (espressif#110)
- Loading branch information
Showing
4 changed files
with
95 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
#include <WiFi.h> //Wifi library | ||
#include "esp_wpa2.h" //wpa2 library for connections to Enterprise networks | ||
#define EAP_IDENTITY "login" //if connecting from another corporation, use [email protected] in Eduroam | ||
#define EAP_USERNAME "login" //oftentimes just a repeat of the identity | ||
#define EAP_PASSWORD "password" //your Eduroam password | ||
const char* ssid = "eduroam"; // Eduroam SSID | ||
const char* host = "arduino.php5.sk"; //external server domain for HTTP connection after authentification | ||
int counter = 0; | ||
|
||
// NOTE: For some systems, various certification keys are required to connect to the wifi system. | ||
// Usually you are provided these by the IT department of your organization when certs are required | ||
// and you can't connect with just an identity and password. | ||
// Most eduroam setups we have seen do not require this level of authentication, but you should contact | ||
// your IT department to verify. | ||
// You should uncomment these and populate with the contents of the files if this is required for your scenario (See Example 2 and Example 3 below). | ||
//const char *ca_pem = "insert your CA cert from your .pem file here"; | ||
//const char *client_cert = "insert your client cert from your .crt file here"; | ||
//const char *client_key = "insert your client key from your .key file here"; | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
delay(10); | ||
|
@@ -13,11 +25,17 @@ void setup() { | |
Serial.println(ssid); | ||
WiFi.disconnect(true); //disconnect form wifi to set new wifi connection | ||
WiFi.mode(WIFI_STA); //init wifi mode | ||
esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide identity | ||
esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide username --> identity and username is same | ||
esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)); //provide password | ||
esp_wifi_sta_wpa2_ent_enable(); | ||
WiFi.begin(ssid); //connect to wifi | ||
|
||
// Example1 (most common): a cert-file-free eduroam with PEAP (or TTLS) | ||
WiFi.begin(ssid, WPA2_AUTH_PEAP, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD); | ||
|
||
// Example 2: a cert-file WPA2 Enterprise with PEAP | ||
//WiFi.begin(ssid, WPA2_AUTH_PEAP, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD, ca_pem, client_cert, client_key); | ||
|
||
// Example 3: TLS with cert-files and no password | ||
//WiFi.begin(ssid, WPA2_AUTH_TLS, EAP_IDENTITY, NULL, NULL, ca_pem, client_cert, client_key); | ||
|
||
|
||
while (WiFi.status() != WL_CONNECTED) { | ||
delay(500); | ||
Serial.print("."); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters