[SD] Move to ws_adapters naming scheme to allow flexibility for offline devices too and eventual cellular
This commit is contained in:
parent
a7c20d1edc
commit
c67318012f
17 changed files with 37 additions and 31 deletions
|
|
@ -30,7 +30,7 @@
|
|||
#define WIFI_PASS "YOUR_WIFI_PASSWORD"
|
||||
|
||||
#include "Wippersnapper_Networking.h"
|
||||
Wippersnapper_WiFi wipper(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
|
||||
ws_adapter_wifi wipper(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
|
||||
|
||||
void setup() {
|
||||
// Provisioning must occur prior to serial init.
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// All text above must be included in any redistribution.
|
||||
|
||||
#include "Wippersnapper_Networking.h"
|
||||
Wippersnapper_WiFi wipper;
|
||||
ws_adapter_wifi wipper;
|
||||
|
||||
// Enable debug output for beta builds
|
||||
#define WS_DEBUG
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Brent Rubell for Adafruit Industries, 2021 - 2023
|
||||
|
||||
#include "Wippersnapper_Networking.h"
|
||||
Wippersnapper_WiFi wipper;
|
||||
ws_adapter_wifi wipper;
|
||||
|
||||
// Enable debug output for beta builds
|
||||
#define WS_DEBUG
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "ws_manager.h"
|
||||
//#include "Wippersnapper_Networking.h"
|
||||
//Wippersnapper_WiFi wipper;
|
||||
//ws_adapter_wifi wipper;
|
||||
Wippersnapper_Manager manager;
|
||||
|
||||
// Enable debug output for beta builds
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#define API_PIN 0
|
||||
#include "ws_manager.h"
|
||||
//#include "Wippersnapper_Networking.h"
|
||||
//Wippersnapper_WiFi wipper;
|
||||
//ws_adapter_wifi wipper;
|
||||
Wippersnapper_Manager manager;
|
||||
Wippersnapper_WiFiV2 wipper(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, "io.adafruit.com", 8883);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,31 +15,37 @@
|
|||
|
||||
#ifndef WS_ADAPTERS_H
|
||||
#define WS_ADAPTERS_H
|
||||
|
||||
/**
|
||||
* The following are adapters for use with WiFi modules.
|
||||
*/
|
||||
// Adafruit AirLift (ESP32) networking adapter
|
||||
#if defined(ADAFRUIT_METRO_M4_EXPRESS) || \
|
||||
defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) || defined(ADAFRUIT_PYPORTAL) || \
|
||||
defined(ADAFRUIT_PYPORTAL_M4_TITANO) || defined(USE_AIRLIFT)
|
||||
#include "network_interfaces/Wippersnapper_AIRLIFT.h"
|
||||
/** Nina-FW (adafruit fork) networking class */
|
||||
typedef Wippersnapper_AIRLIFT Wippersnapper_WiFi;
|
||||
#include "adapters/network_interfaces/Wippersnapper_AIRLIFT.h"
|
||||
typedef Wippersnapper_AIRLIFT ws_adapter_wifi;
|
||||
// ESP8266 networking adapter
|
||||
#elif defined(ARDUINO_ARCH_ESP8266)
|
||||
#include "network_interfaces/Wippersnapper_ESP8266.h"
|
||||
/** ESP8266's networking class */
|
||||
typedef Wippersnapper_ESP8266 Wippersnapper_WiFi;
|
||||
#include "adapters/network_interfaces/Wippersnapper_ESP8266.h"
|
||||
typedef Wippersnapper_ESP8266 ws_adapter_wifi;
|
||||
// ESP32 networking adapter
|
||||
#elif defined(ARDUINO_ARCH_ESP32)
|
||||
#include "network_interfaces/Wippersnapper_ESP32.h"
|
||||
/** ESP32's networking class */
|
||||
typedef Wippersnapper_ESP32 Wippersnapper_WiFi;
|
||||
#include "adapters/network_interfaces/Wippersnapper_ESP32.h"
|
||||
typedef Wippersnapper_ESP32 ws_adapter_wifi;
|
||||
// Networking adapters for Raspberry Pi Pico W-series
|
||||
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
|
||||
#include "network_interfaces/ws_networking_pico.h"
|
||||
typedef ws_networking_pico Wippersnapper_WiFi;
|
||||
#elif defined(RASPBERRY_PI_PICO) || defined(RASPBERRY_PI_PICO_2)
|
||||
#include "network_interfaces/ws_nonet_pico.h"
|
||||
typedef ws_nonet_pico Wippersnapper_WiFi;
|
||||
#include "adapters/network_interfaces/ws_networking_pico.h"
|
||||
typedef ws_networking_pico ws_adapter_wifi;
|
||||
// Networking adapter for Arduino Nano 33 IoT and MKR WiFi 1010
|
||||
#elif defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRWIFI1010)
|
||||
/** Nina-FW (arduino) networking class */
|
||||
#include "network_interfaces/Wippersnapper_WIFININA.h"
|
||||
typedef Wippersnapper_WIFININA Wippersnapper_WiFi;
|
||||
#include "adapters/network_interfaces/Wippersnapper_WIFININA.h"
|
||||
typedef Wippersnapper_WIFININA ws_adapter_wifi;
|
||||
/**
|
||||
* The following are adapters for use with non-networked devices.
|
||||
*/
|
||||
#elif defined(RASPBERRY_PI_PICO) || defined(RASPBERRY_PI_PICO_2)
|
||||
#include "adapters/network_interfaces/ws_nonet_pico.h"
|
||||
typedef ws_nonet_pico ws_adapter_offline;
|
||||
#else
|
||||
#warning "Must define network interface in config.h!"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -69,10 +69,10 @@ void Wippersnapper_Manager::checkAPIVersion(int pinNum) {
|
|||
// NOTE: For debugging right now, we are forcing the API version
|
||||
readButton = true;
|
||||
if (readButton) { // API version 2 if D12 is high
|
||||
ws_instance_v2 = new Wippersnapper_WiFiV2();
|
||||
ws_instance_v2 = new ws_adapter_offline_v2();
|
||||
_api_version = 2;
|
||||
} else { // API version 1 if D12 is low
|
||||
ws_instance = new Wippersnapper_WiFi();
|
||||
ws_instance = new ws_adapter_offline();
|
||||
_api_version = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef WIPPERSNAPPER_MANAGER_H
|
||||
#define WIPPERSNAPPER_MANAGER_H
|
||||
|
||||
#include "network_interfaces/ws_nonet_pico.h"
|
||||
typedef ws_nonet_pico Wippersnapper_WiFi;
|
||||
#include "network_interfaces/ws_nonet_pico_v2.h"
|
||||
typedef ws_nonet_pico_v2 Wippersnapper_WiFiV2;
|
||||
#include "adapters/network_interfaces/ws_nonet_pico.h"
|
||||
typedef ws_nonet_pico ws_adapter_offline;
|
||||
#include "adapters/network_interfaces/ws_nonet_pico_v2.h"
|
||||
typedef ws_nonet_pico_v2 ws_adapter_offline_v2;
|
||||
|
||||
/****************************************************************************/
|
||||
/*!
|
||||
|
|
@ -27,8 +27,8 @@ public:
|
|||
void run();
|
||||
|
||||
protected:
|
||||
Wippersnapper_WiFi *ws_instance; ///< Instance of Wippersnapper API v1
|
||||
Wippersnapper_WiFiV2 *ws_instance_v2; ///< Instance of Wippersnapper API v2
|
||||
ws_adapter_offline *ws_instance; ///< Instance of Wippersnapper API v1
|
||||
ws_adapter_offline_v2 *ws_instance_v2; ///< Instance of Wippersnapper API v2
|
||||
private:
|
||||
int _api_version;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue