19
19
#include " Adafruit_MQTT.h"
20
20
#include " Adafruit_MQTT_Client.h"
21
21
22
- // Configure the pins used for the ESP32 connection
22
+ // Configure some pins used for the ESP32 connection
23
23
#if !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
24
24
#define BOARDEF 1
25
25
#define SPIWIFI SPI
26
- #define SPIWIFI_SS airlift_ss // Chip select pin
27
- #define SPIWIFI_ACK airlift_ack // a.k.a BUSY or READY pin
28
- #define ESP32_RESETN airlift_rst // Reset pin
29
26
#define ESP32_GPIO0 -1 // Not connected
30
27
#endif
31
28
@@ -109,14 +106,23 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
109
106
return " AIRLIFT" ;
110
107
}
111
108
112
- void airLiftPins (uint16_t ss, uint16_t ack, uint16_t rst)
109
+ /* *************************************************************************/
110
+ /* !
111
+ @brief Defines pins for the ESP32's chip select, busy pin and reset pin.
112
+ GPIO0 is not defined as it is disconnected by default.
113
+ @param ss
114
+ ESP32 chip select pin.
115
+ @param ack
116
+ ESP32 BUSY/READY pin.
117
+ @param rst
118
+ ESP32 RESET pin.
119
+ */
120
+ /* *************************************************************************/
121
+ void setAirLiftPins (uint16_t ss, uint16_t ack, uint16_t rst)
113
122
{
114
- airlift_ss = ss;
115
- airlift_ack = ack;
116
- airlift_rst = rst;
123
+ WiFi.setPins (ss, ack, rst, ESP32_GPIO0, &SPIWIFI);
117
124
}
118
125
119
- uint16_t airlift_ss, airlift_ack, airlift_rst;
120
126
121
127
protected:
122
128
const char *_ssid;
@@ -125,8 +131,6 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
125
131
WiFiSSLClient *_http_client;
126
132
WiFiSSLClient *_mqtt_client;
127
133
128
-
129
-
130
134
/* *************************************************************************/
131
135
/* !
132
136
@brief Attempts to establish a WiFi connection with the wireless network,
@@ -135,11 +139,6 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
135
139
/* *************************************************************************/
136
140
void _connect ()
137
141
{
138
- // for breakouts, check if the pins would be externally defined
139
- #ifdef BOARDEF
140
- WiFi.setPins (SPIWIFI_SS, SPIWIFI_ACK, ESP32_RESETN, ESP32_GPIO0, &SPIWIFI);
141
- #endif
142
-
143
142
// check esp32 module status
144
143
if (WiFi.status () == WL_NO_MODULE)
145
144
{
0 commit comments