Skip to content

Commit d3aab91

Browse files
author
brentru
committed
automatically select which AdafruitIO_WiFi based on USE_AIRLIFT or USE_WINC1500
1 parent a1a43c2 commit d3aab91

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

examples/adafruitio_00_publish/config.h

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,31 @@
2020
#define WIFI_SSID "your_ssid"
2121
#define WIFI_PASS "your_pass"
2222

23-
// uncomment the following line if you are using airlift,
23+
// uncomment the following line if you are using airlift
2424
// #define USE_AIRLIFT
2525

26-
// uncomment the following line if you are using winc1500,
26+
// uncomment the following line if you are using winc1500
2727
// #define USE_WINC1500
2828

29-
// comment out the following two lines if you are using fona or ethernet
29+
// comment out the following lines if you are using fona or ethernet
3030
#include "AdafruitIO_WiFi.h"
3131

32-
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
33-
34-
// uncomment the following line if you are using airlift
35-
// and comment out the AdafruitIO_WiFi client above
36-
// AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, SPIWIFI_SS, SPIWIFI_ACK, ESP32_RESETN, ESP32_GPIO0, &SPIWIFI);
37-
32+
#ifdef USE_AIRLIFT
33+
// Configure the pins used for the ESP32 connection
34+
#if !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
35+
// Don't change the names of these #define's! they match the variant ones
36+
#define SPIWIFI SPI
37+
#define SPIWIFI_SS 10 // Chip select pin
38+
#define SPIWIFI_ACK 9 // a.k.a BUSY or READY pin
39+
#define ESP32_RESETN 6 // Reset pin
40+
#define ESP32_GPIO0 -1 // Not connected
41+
#endif
42+
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, SPIWIFI_SS, SPIWIFI_ACK, ESP32_RESETN, ESP32_GPIO0, &SPIWIFI);
43+
#elif USE_WINC1500
44+
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, WINC_CS, WINC_IRQ, WINC_RST, WINC_EN);
45+
#else
46+
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
47+
#endif
3848
/******************************* FONA **************************************/
3949

4050
// the AdafruitIO_FONA client will work with the following boards:

0 commit comments

Comments
 (0)