This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.8.0 to add support to
AmebaD RRL8720DN
### Release v1.8.0 1. Add support to Realtek RTL8720DN, RTL8722DM and RTL8722CSM using [AmebaD core](https://github.com/ambiot/ambd_arduino) and [FlashStorage_RTL8720 library](https://github.com/khoih-prog/FlashStorage_RTL8720). RTL8720DN WiFi can use either 2.4GHz or 5GHz band. 2. Restructure library 3. Add and Update examples 4. Update `Packages' Patches`
- Loading branch information
1 parent
6f33d92
commit 24dd98c
Showing
29 changed files
with
1,183 additions
and
211 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
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
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
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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/**************************************************************************************************************************** | ||
Credentials.h | ||
For RTL8720DN, RTL8722DM and RTL8722CSM WiFi shields | ||
WiFiManager_Generic_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards | ||
(https://github.com/khoih-prog/WiFiManager_Generic_Lite) to enable store Credentials in EEPROM/LittleFS for easy | ||
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding. | ||
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_Generic_Lite | ||
Licensed under MIT license | ||
*****************************************************************************************************************************/ | ||
|
||
#ifndef Credentials_h | ||
#define Credentials_h | ||
|
||
#include "defines.h" | ||
|
||
/// Start Default Config Data ////////////////// | ||
|
||
/* | ||
#define SSID_MAX_LEN 32 | ||
//From v1.0.3, WPA2 passwords can be up to 63 characters long. | ||
#define PASS_MAX_LEN 64 | ||
typedef struct | ||
{ | ||
char wifi_ssid[SSID_MAX_LEN]; | ||
char wifi_pw [PASS_MAX_LEN]; | ||
} WiFi_Credentials; | ||
#define NUM_WIFI_CREDENTIALS 2 | ||
// Configurable items besides fixed Header, just add board_name | ||
#define NUM_CONFIGURABLE_ITEMS ( ( 2 * NUM_WIFI_CREDENTIALS ) + 1 ) | ||
//////////////// | ||
typedef struct Configuration | ||
{ | ||
char header [16]; | ||
WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]; | ||
char board_name [24]; | ||
int checkSum; | ||
} WIFI_GENERIC_Configuration; | ||
*/ | ||
|
||
#define TO_LOAD_DEFAULT_CONFIG_DATA false | ||
|
||
#if TO_LOAD_DEFAULT_CONFIG_DATA | ||
|
||
// This feature is primarily used in development to force a known set of values as Config Data | ||
// It will NOT force the Config Portal to activate. Use DRD or erase Config Data with Blynk.clearConfigData() | ||
|
||
// Used mostly for development and debugging. FORCES default values to be loaded each run. | ||
// Config Portal data input will be ignored and overridden by DEFAULT_CONFIG_DATA | ||
//bool LOAD_DEFAULT_CONFIG_DATA = true; | ||
|
||
// Used mostly once debugged. Assumes good data already saved in device. | ||
// Config Portal data input will be override DEFAULT_CONFIG_DATA | ||
bool LOAD_DEFAULT_CONFIG_DATA = false; | ||
|
||
|
||
WIFI_GENERIC_Configuration defaultConfig = | ||
{ | ||
//char header[16], dummy, not used | ||
"WIFI_GENERIC", | ||
// WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]; | ||
// WiFi_Credentials.wifi_ssid and WiFi_Credentials.wifi_pw | ||
"SSID1", "password1", | ||
"SSID2", "password2", | ||
//char board_name [24]; | ||
"SAMD-Control", | ||
// terminate the list | ||
//int checkSum, dummy, not used | ||
0 | ||
/////////// End Default Config Data ///////////// | ||
}; | ||
|
||
#else | ||
|
||
bool LOAD_DEFAULT_CONFIG_DATA = false; | ||
|
||
WIFI_GENERIC_Configuration defaultConfig; | ||
|
||
#endif // TO_LOAD_DEFAULT_CONFIG_DATA | ||
|
||
/////////// End Default Config Data ///////////// | ||
|
||
|
||
#endif //Credentials_h |
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 |
---|---|---|
@@ -0,0 +1,166 @@ | ||
/**************************************************************************************************************************** | ||
RTL8720_WiFi.ino | ||
For RTL8720DN, RTL8722DM and RTL8722CSM WiFi shields | ||
WiFiManager_Generic_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards | ||
(https://github.com/khoih-prog/WiFiManager_Generic_Lite) to enable store Credentials in EEPROM/LittleFS for easy | ||
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding. | ||
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_Generic_Lite | ||
Licensed under MIT license | ||
*****************************************************************************************************************************/ | ||
|
||
#include "defines.h" | ||
#include "Credentials.h" | ||
#include "dynamicParams.h" | ||
|
||
WiFiManager_Generic_Lite* WiFiManager_Generic; | ||
|
||
void heartBeatPrint(void) | ||
{ | ||
static int num = 1; | ||
|
||
if (WiFiManager_Generic->isConfigMode()) | ||
Serial.print("C"); // C means in Config Mode | ||
else | ||
{ | ||
if (WiFi.status() == WL_CONNECTED) | ||
{ | ||
Serial.print("H"); // H means connected to WiFi | ||
// Bad bug or RTL8720 => if WiFi lost, WiFi.status() still is WL_CONNECTED and WiFi.RSSI() still OK. | ||
// Similar bug in Portenta_H7 without workaround as in Portenta_H7, WiFi.RSSI() => 0 | ||
//Serial.print(WiFi.RSSI()); | ||
} | ||
else | ||
Serial.print("F"); // F means not connected to WiFi | ||
} | ||
|
||
if (num == 80) | ||
{ | ||
Serial.println(); | ||
num = 1; | ||
} | ||
else if (num++ % 10 == 0) | ||
{ | ||
Serial.print(F(" ")); | ||
} | ||
} | ||
|
||
void check_status() | ||
{ | ||
static unsigned long checkstatus_timeout = 0; | ||
|
||
//KH | ||
#define HEARTBEAT_INTERVAL 20000L | ||
// Print hearbeat every HEARTBEAT_INTERVAL (20) seconds. | ||
if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0)) | ||
{ | ||
heartBeatPrint(); | ||
checkstatus_timeout = millis() + HEARTBEAT_INTERVAL; | ||
} | ||
} | ||
|
||
#if USING_CUSTOMS_STYLE | ||
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\ | ||
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>"; | ||
#endif | ||
|
||
void setup() | ||
{ | ||
// Debug console | ||
Serial.begin(115200); | ||
while (!Serial && millis() < 5000); | ||
|
||
delay(200); | ||
|
||
Serial.print(F("\nStart RTL8720_WiFi on ")); Serial.println(BOARD_NAME); | ||
Serial.println(WIFI_MANAGER_GENERIC_LITE_VERSION); | ||
|
||
if (WiFi.status() == WL_NO_SHIELD) | ||
{ | ||
Serial.println(F("WiFi shield not present")); | ||
// don't continue | ||
while (true); | ||
} | ||
|
||
String fv = WiFi.firmwareVersion(); | ||
|
||
Serial.print("Current Firmware Version = "); Serial.println(fv); | ||
|
||
if (fv != LATEST_RTL8720_FIRMWARE) | ||
{ | ||
Serial.println("Please upgrade the firmware"); | ||
} | ||
|
||
WiFiManager_Generic = new WiFiManager_Generic_Lite(); | ||
|
||
// Optional to change default AP IP(192.168.4.1) and channel(10) | ||
//WiFiManager_Generic->setConfigPortalIP(IPAddress(192, 168, 120, 1)); | ||
WiFiManager_Generic->setConfigPortalChannel(0); | ||
|
||
#if USING_CUSTOMS_STYLE | ||
WiFiManager_Generic->setCustomsStyle(NewCustomsStyle); | ||
#endif | ||
|
||
#if USING_CUSTOMS_HEAD_ELEMENT | ||
WiFiManager_Generic->setCustomsHeadElement("<style>html{filter: invert(10%);}</style>"); | ||
#endif | ||
|
||
#if USING_CORS_FEATURE | ||
WiFiManager_Generic->setCORSHeader("Your Access-Control-Allow-Origin"); | ||
#endif | ||
|
||
// Set customized DHCP HostName | ||
WiFiManager_Generic->begin(HOST_NAME); | ||
//Or use default Hostname "SAMD-WIFI-XXXXXX" | ||
//WiFiManager_Generic->begin(); | ||
|
||
} | ||
|
||
#if USE_DYNAMIC_PARAMETERS | ||
void displayCredentials() | ||
{ | ||
Serial.println(F("\nYour stored Credentials :")); | ||
|
||
for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++) | ||
{ | ||
Serial.print(myMenuItems[i].displayName); | ||
Serial.print(F(" = ")); | ||
Serial.println(myMenuItems[i].pdata); | ||
} | ||
} | ||
|
||
void displayCredentialsInLoop() | ||
{ | ||
static bool displayedCredentials = false; | ||
|
||
if (!displayedCredentials) | ||
{ | ||
for (int i = 0; i < NUM_MENU_ITEMS; i++) | ||
{ | ||
if (!strlen(myMenuItems[i].pdata)) | ||
{ | ||
break; | ||
} | ||
|
||
if ( i == (NUM_MENU_ITEMS - 1) ) | ||
{ | ||
displayedCredentials = true; | ||
displayCredentials(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
#endif | ||
|
||
void loop() | ||
{ | ||
WiFiManager_Generic->run(); | ||
check_status(); | ||
|
||
#if USE_DYNAMIC_PARAMETERS | ||
displayCredentialsInLoop(); | ||
#endif | ||
} |
Oops, something went wrong.