Adafruit Library
Wippersnapper.h
Go to the documentation of this file.
1 
18 #ifndef WIPPERSNAPPER_H
19 #define WIPPERSNAPPER_H
20 
21 // Cpp STD
22 #include <math.h>
23 
24 #include <vector>
25 
26 // Nanopb dependencies
27 #include <nanopb/pb_common.h>
28 #include <nanopb/pb_decode.h>
29 #include <nanopb/pb_encode.h>
30 #include <pb.h>
31 
32 #include <wippersnapper/description/v1/description.pb.h> // description.proto
33 #include <wippersnapper/signal/v1/signal.pb.h> // signal.proto
34 
35 // External libraries
36 #include "Adafruit_MQTT.h" // MQTT Client
37 #include "Adafruit_SleepyDog.h" // Watchdog
38 #include "Arduino.h" // Wiring
39 #include <SPI.h> // SPI
40 
41 // Wippersnapper API Helpers
42 #include "Wippersnapper_Boards.h"
44 #include "provisioning/ConfigJson.h"
45 
46 #define WS_DEBUG
47 #define WS_PRINTER Serial
48 
49 // Define actual debug output functions when necessary.
50 #ifdef WS_DEBUG
51 
52 #ifdef ARDUINO_ARCH_ESP8266
53 // ESP8266: Use F() macro to store string literals in Flash (PROGMEM) instead
54 // of RAM. This saves precious RAM on memory-constrained ESP8266 devices.
55 // NOTE: WS_DEBUG_PRINT/PRINTLN only accept string literals on ESP8266.
56 // Use WS_DEBUG_PRINTVAR/PRINTLNVAR for variables.
57 #define WS_DEBUG_PRINT(x) \
58  { WS_PRINTER.print(F(x)); }
59 #define WS_DEBUG_PRINTLN(x) \
60  { WS_PRINTER.println(F(x)); }
61 #else
62 // Other platforms: Standard variadic macros
63 #define WS_DEBUG_PRINT(...) \
64  { WS_PRINTER.print(__VA_ARGS__); }
65 #define WS_DEBUG_PRINTLN(...) \
66  { WS_PRINTER.println(__VA_ARGS__); }
67 #endif
68 
69 // Variable printing macros - use for non-string-literal arguments
70 #define WS_DEBUG_PRINTVAR(...) \
71  { WS_PRINTER.print(__VA_ARGS__); }
72 #define WS_DEBUG_PRINTLNVAR(...) \
73  { WS_PRINTER.println(__VA_ARGS__); }
74 #define WS_DEBUG_PRINTHEX(...) \
75  { WS_PRINTER.print(__VA_ARGS__, HEX); }
76 
77 #else
78 #define WS_DEBUG_PRINT(...) \
79  {}
80 #define WS_DEBUG_PRINTLN(...) \
81  {}
82 #define WS_DEBUG_PRINTVAR(...) \
83  {}
84 #define WS_DEBUG_PRINTLNVAR(...) \
85  {}
86 #define WS_DEBUG_PRINTHEX(...) \
87  {}
88 #define WS_DEBUG_HEAP(label) \
89  {}
90 #endif
91 
92 #define WS_DELAY_WITH_WDT(timeout) \
93  { \
94  unsigned long start = millis(); \
95  while (millis() - start < timeout) { \
96  delay(10); \
97  yield(); \
98  feedWDT(); \
99  if (millis() < start) { \
100  start = millis(); /* if rollover */ \
101  } \
102  } \
103  }
104 
105 /**************************************************************************/
123 /**************************************************************************/
124 #define RETRY_FUNCTION_UNTIL_TIMEOUT(func, result_type, result_var, condition, \
125  timeout, interval, ...) \
126  { \
127  unsigned long startTime = millis(); \
128  while (millis() - startTime < timeout) { \
129  result_type result_var = func(__VA_ARGS__); \
130  if (condition(result_var)) { \
131  break; \
132  } \
133  if (startTime > millis()) { \
134  startTime = millis(); /* if rollover */ \
135  } \
136  WS_DELAY_WITH_WDT(interval); \
137  } \
138  }
139 
140 // Wippersnapper pb helpers
141 #include <nanopb/ws_pb_helpers.h>
142 
143 // Wippersnapper components
147 
148 // Includes for ESP32-only
149 #ifdef ARDUINO_ARCH_ESP32
150 #include "components/ledc/ws_ledc.h"
151 #include <Esp.h>
152 #include <esp_task_wdt.h>
153 #endif
154 
158 #include "components/pwm/ws_pwm.h"
160 #include "components/uart/ws_uart.h"
161 
162 #if defined(USE_TINYUSB)
163 #include "provisioning/tinyusb/Wippersnapper_FS.h"
164 #endif
165 
166 #if defined(USE_LITTLEFS)
167 #include "provisioning/littlefs/WipperSnapper_LittleFS.h"
168 #endif
169 
170 #define WS_VERSION \
171  "1.0.0-beta.132"
172 
173 // Reserved Adafruit IO MQTT topics
174 #define TOPIC_IO_THROTTLE "/throttle"
175 #define TOPIC_IO_ERRORS "/errors"
176 
177 // Reserved Wippersnapper topics
178 #define TOPIC_WS "/wprsnpr/"
179 #define TOPIC_INFO "/info/"
180 #define TOPIC_SIGNALS "/signals/"
181 #define TOPIC_I2C "/i2c"
182 #define TOPIC_DISPLAY "/display"
183 #define MQTT_TOPIC_PIXELS_DEVICE \
184  "/signals/device/pixel"
185 #define MQTT_TOPIC_PIXELS_BROKER \
186  "/signals/broker/pixel"
187 
188 
189 typedef enum {
190  WS_IDLE = 0, // Waiting for connection establishement
191  WS_NET_DISCONNECTED = 1, // Network disconnected
192  WS_DISCONNECTED = 2, // Disconnected from Adafruit IO
193  WS_FINGERPRINT_UNKOWN = 3, // Unknown WS_SSL_FINGERPRINT
194 
195  WS_NET_CONNECT_FAILED = 10, // Failed to connect to network
196  WS_CONNECT_FAILED = 11, // Failed to connect to Adafruit IO
197  WS_FINGERPRINT_INVALID = 12, // Unknown WS_SSL_FINGERPRINT
198  WS_AUTH_FAILED = 13, // Invalid Adafruit IO login credentials provided.
199  WS_SSID_INVALID =
200  14, // SSID is "" or otherwise invalid, connection not attempted
201 
202  WS_NET_CONNECTED = 20, // Connected to Adafruit IO
203  WS_CONNECTED = 21, // Connected to network
204  WS_CONNECTED_INSECURE = 22, // Insecurely (non-SSL) connected to network
205  WS_FINGERPRINT_UNSUPPORTED = 23, // Unsupported WS_SSL_FINGERPRINT
206  WS_FINGERPRINT_VALID = 24, // Valid WS_SSL_FINGERPRINT
207  WS_BOARD_DESC_INVALID = 25, // Unable to send board description
208  WS_BOARD_RESYNC_FAILED = 26 // Board sync failure
212 typedef enum {
213  WS_MQTT_CONNECTED = 0, // Connected
214  WS_MQTT_INVALID_PROTOCOL = 1, // Invalid mqtt protocol
215  WS_MQTT_INVALID_CID = 2, // Client id rejected
216  WS_MQTT_SERVICE_UNAVALIABLE = 3, // Malformed user/pass
217  WS_MQTT_INVALID_USER_PASS = 4, // Unauthorized access to resource
218  WS_MQTT_UNAUTHORIZED = 5, // MQTT service unavailable
219  WS_MQTT_THROTTLED = 6, // Account throttled
220  WS_MQTT_BANNED = 7 // Account banned
222 
224 typedef enum {
225  WS_BOARD_DEF_IDLE,
226  WS_BOARD_DEF_SEND_FAILED,
227  WS_BOARD_DEF_SENT,
228  WS_BOARD_DEF_OK,
229  WS_BOARD_DEF_INVALID,
230  WS_BOARD_DEF_UNSPECIFIED
232 
234 typedef enum {
235  FSM_NET_IDLE,
236  FSM_NET_CONNECTED,
237  FSM_MQTT_CONNECTED,
238  FSM_NET_CHECK_MQTT,
239  FSM_NET_CHECK_NETWORK,
240  FSM_NET_ESTABLISH_NETWORK,
241  FSM_NET_ESTABLISH_MQTT,
243 
244 #ifdef ARDUINO_ARCH_RP2040
245 #define WS_WDT_TIMEOUT 8388
246 #else
247 #define WS_WDT_TIMEOUT 60000
248 #endif
249 
250 #define WS_MAX_ALT_WIFI_NETWORKS 3
251 /* MQTT Configuration */
252 #define WS_BROKER_KEEPALIVE_MS \
253  11000
254 #define WS_DEVICE_PING_MS \
255  5000
256 
257 #define WS_MQTT_MAX_PAYLOAD_SIZE \
258  512
259 
262 class Wippersnapper_FS;
263 class WipperSnapper_LittleFS;
264 #ifdef ARDUINO_ARCH_ESP32
265 class ws_ledc;
266 #endif
268 class ws_servo;
269 class ws_pwm;
270 class ws_ds18x20;
271 class ws_pixels;
272 class ws_uart;
273 class DisplayController;
274 
275 /**************************************************************************/
280 /**************************************************************************/
281 class Wippersnapper {
282 public:
283  Wippersnapper();
284  virtual ~Wippersnapper();
285 
286  void provision();
288  bool lockStatusNeoPixel;
289  bool lockStatusDotStar;
290  bool lockStatusLED;
293 
295  virtual void set_user_key();
296  virtual void set_ssid_pass(const char *ssid, const char *ssidPassword);
297  virtual void set_ssid_pass();
298  virtual bool check_valid_ssid();
299 
300  virtual void _connect();
301  virtual void _disconnect();
302  void connect();
303  void disconnect();
304 
305  virtual void getMacAddr();
306  virtual int32_t getRSSI();
307  virtual void setupMQTTClient(const char *clientID);
308 
309  virtual ws_status_t networkStatus();
312  bool generateDeviceUID();
313  bool generateWSTopics();
314  bool generateWSErrorTopics();
315 
316  // Registration API
317  bool registerBoard();
319  void decodeRegistrationResp(char *data, uint16_t len);
321  // Configuration API
323 
324  // run() loop
325  ws_status_t run();
326  void processPackets();
327  bool publish(const char *topic, uint8_t *payload, uint16_t bLen,
328  uint8_t qos = 0);
329 
330  // Networking helpers
331  void pingBroker();
332  void runNetFSM();
333 
334  // WDT helpers
335  void enableWDT(int timeoutMS = 0);
336  void feedWDT();
337 
338  // Error handling helpers
339  void haltError(String error,
340  ws_led_status_t ledStatusColor = WS_LED_STATUS_ERROR_RUNTIME,
341  int seconds_until_reboot = 25);
342  void errorWriteHang(String error);
343 
344  // MQTT topic callbacks //
345  // Decodes a signal message
346  bool decodeSignalMsg(
347  wippersnapper_signal_v1_CreateSignalRequest *encodedSignalMsg);
348 
349  // Encodes a pin event message
350  bool
351  encodePinEvent(wippersnapper_signal_v1_CreateSignalRequest *outgoingSignalMsg,
352  uint8_t pinName, int pinVal);
353 
354  // Pin configure message
355  bool configureDigitalPinReq(wippersnapper_pin_v1_ConfigurePinRequest *pinMsg);
356  bool configAnalogInPinReq(wippersnapper_pin_v1_ConfigurePinRequest *pinMsg);
357 
358  // I2C
359  std::vector<WipperSnapper_Component_I2C *>
360  i2cComponents;
362  NULL;
364  NULL;
365  bool _isI2CPort0Init =
366  false;
367  bool _isI2CPort1Init =
368  false;
369 
372  uint8_t
375  uint16_t bufSize;
378  WS_BOARD_DEF_IDLE;
379 
380  // TODO: We really should look at making these static definitions, not dynamic
381  // to free up space on the heap
384  Wippersnapper_FS *_fileSystem;
385  WipperSnapper_LittleFS
386  *_littleFS;
394 
395  // TODO: does this really need to be global?
396  uint8_t _macAddr[6];
397  char sUID[13];
398  const char *_airlift_version;
399  const char *_boardId;
400  Adafruit_MQTT *_mqtt;
402  secretsConfig _config;
403  networkConfig _multiNetworks[3];
404  bool _isWiFiMulti = false;
406  // TODO: Does this need to be within this class?
409  char *_topic_description = NULL;
410  char *_topic_signal_device = NULL;
411  char *_topic_signal_i2c_brkr = NULL;
415  char *_topic_signal_servo_brkr = NULL;
420  NULL;
422  NULL;
423  char *_topic_signal_ds18_brkr = NULL;
425  char *_topic_signal_ds18_device = NULL;
429  char *_topic_signal_uart_brkr = NULL;
432  NULL;
434  NULL;
436  wippersnapper_signal_v1_CreateSignalRequest
438  wippersnapper_signal_v1_I2CRequest msgSignalI2C =
439  wippersnapper_signal_v1_I2CRequest_init_zero;
442  // ds signal msg
443  wippersnapper_signal_v1_Ds18x20Request msgSignalDS =
444  wippersnapper_signal_v1_Ds18x20Request_init_zero;
447  // servo message
448  wippersnapper_signal_v1_ServoRequest
450  wippersnapper_signal_v1_PWMRequest msgPWM =
451  wippersnapper_signal_v1_PWMRequest_init_zero;
452 
454  // pixels signal message
455  wippersnapper_signal_v1_PixelsRequest
456  msgPixels;
458  wippersnapper_signal_v1_UARTRequest
461  wippersnapper_signal_v1_DisplayRequest
464  char *throttleMessage;
465  int throttleTime;
468  bool pinCfgCompleted = false;
470 // enable LEDC if esp32
471 #ifdef ARDUINO_ARCH_ESP32
472  ws_ledc *_ledc = nullptr;
473 #endif
474 
475 private:
476  void _init();
477 #ifdef ARDUINO_ARCH_ESP32
478  bool _isEsp32WdtSet = false;
479 #endif
483 
484 protected:
485  ws_status_t _status = WS_IDLE;
486  uint32_t _last_mqtt_connect = 0;
489  0;
490  uint32_t _prv_ping = 0;
492  uint32_t _prvKATBlink = 0;
495  // Device information
496  const char *_deviceId;
497  char *_device_uid;
499  // MQTT topics
501  NULL;
507  NULL;
510  char *_topic_signal_brkr = NULL;
511  char *_err_topic = NULL;
512  char *_throttle_topic = NULL;
514  Adafruit_MQTT_Subscribe *_topic_description_sub;
516  Adafruit_MQTT_Publish *_topic_signal_device_pub;
518  Adafruit_MQTT_Subscribe *_topic_signal_brkr_sub;
520  Adafruit_MQTT_Subscribe
522  Adafruit_MQTT_Subscribe
524  Adafruit_MQTT_Subscribe
526  Adafruit_MQTT_Subscribe
528  Adafruit_MQTT_Subscribe
530  Adafruit_MQTT_Subscribe
532  Adafruit_MQTT_Subscribe *_topic_signal_display_sub;
535  Adafruit_MQTT_Subscribe
537  Adafruit_MQTT_Subscribe
538  *_throttle_sub;
540  wippersnapper_signal_v1_CreateSignalRequest
542 };
543 
544 // Include networking to get the platform-specific Wippersnapper_WiFi typedef
547 // Global WS instance - defined as platform-specific type in Wippersnapper.cpp
549 #endif // ADAFRUIT_WIPPERSNAPPER_H
Class that provides an interface with the I2C bus.
Definition: WipperSnapper_I2C.h:115
char * _topic_signal_pixels_brkr
Definition: Wippersnapper.h:457
wippersnapper_signal_v1_PWMRequest msgPWM
Definition: Wippersnapper.h:480
void disconnect()
Disconnects from Adafruit IO+ Wippersnapper.
Definition: Wippersnapper.cpp:137
char * _topic_signal_uart_brkr
Definition: Wippersnapper.h:459
virtual void setupMQTTClient(const char *clientID)
Sets up the MQTT client session.
Definition: Wippersnapper.cpp:187
const char * _boardId
Definition: Wippersnapper.h:429
ws_mqtt_status_t
Definition: Wippersnapper.h:242
Adafruit_MQTT_Subscribe * _throttle_sub
Definition: Wippersnapper.h:568
High-level interface for the ESP32/ESP32-Sx/ESP32-Cx LED Control (LEDC) peripheral. Instead of specifying a timer or channel, this class automatically allocates a channel and associates it with a pin. Underlying esp32-hal-ledc performs timer management and handles the low-level LEDC peripheral API calls.
Definition: ws_ledc.h:37
bool _isI2CPort1Init
True if I2C port 1 has been initialized, False otherwise.
Definition: Wippersnapper.h:397
ws_ledc * _ledc
Pointer to LEDC object.
Definition: Wippersnapper.h:502
bool generateWSErrorTopics()
Builds MQTT topics for handling errors returned from the Adafruit IO broker and subscribes to them...
Definition: Wippersnapper.cpp:1791
Class that provides functions for reading and interacting with digital inputs and outputs...
Definition: Wippersnapper_DigitalGPIO.h:38
DisplayController * _displayController
Instance of display controller class.
Definition: Wippersnapper.h:423
char * _topic_signal_pwm_brkr
Definition: Wippersnapper.h:449
void processPackets()
Process all incoming packets from the Adafruit IO MQTT broker. Handles network connectivity.
Definition: Wippersnapper.cpp:2690
const char * _deviceId
Definition: Wippersnapper.h:526
wippersnapper_signal_v1_DisplayRequest msgSignalDisplay
DisplayRequest wrapper message.
Definition: Wippersnapper.h:492
bool publish(const char *topic, uint8_t *payload, uint16_t bLen, uint8_t qos=0)
Publishes a message to the Adafruit IO MQTT broker. Handles network connectivity. ...
Definition: Wippersnapper.cpp:2713
char * _device_uid
Definition: Wippersnapper.h:527
virtual ~Wippersnapper()
Wippersnapper destructor.
Definition: Wippersnapper.cpp:87
ws_led_status_t
Definition: Wippersnapper_StatusLED.h:34
#define WS_MQTT_MAX_PAYLOAD_SIZE
MAXIMUM expected payload size, in bytes.
Definition: Wippersnapper.h:287
void connect()
Connects to Adafruit IO+ Wippersnapper broker.
Definition: Wippersnapper.cpp:2848
ws_pixels * _pixelsComponent
ptr to instance of ws_pixels class
Definition: Wippersnapper.h:417
uint8_t _buffer[512]
Definition: Wippersnapper.h:400
bool encodePinEvent(wippersnapper_signal_v1_CreateSignalRequest *outgoingSignalMsg, uint8_t pinName, int pinVal)
Handles MQTT messages on signal topic until timeout.
Definition: Wippersnapper.cpp:1666
char * _topic_description_status
Definition: Wippersnapper.h:530
bool generateWSTopics()
Generates device-specific Wippersnapper control topics and subscribes to them.
Definition: Wippersnapper.cpp:1890
Class that provides an interface for reading and controlling analog pins. Stores information about an...
Definition: Wippersnapper_AnalogIO.h:43
WipperSnapper_LittleFS * _littleFS
Instance of LittleFS Filesystem (non-native USB)
Definition: Wippersnapper.h:416
float status_pixel_brightness
(from 0.0 to 1.0)
Definition: Wippersnapper.h:321
void errorWriteHang(String error)
Writes an error message to the serial and the filesystem, blinks WS_LED_STATUS_ERROR_RUNTIME pattern ...
Definition: Wippersnapper.cpp:2406
Adafruit_MQTT_Subscribe * _topic_signal_ds18_sub
Definition: Wippersnapper.h:557
bool decodeSignalMsg(wippersnapper_signal_v1_CreateSignalRequest *encodedSignalMsg)
Decodes a signal buffer protobuf message. NOTE: Should be executed in-order after a new _buffer is re...
Definition: Wippersnapper.cpp:470
void provision()
Provisions a WipperSnapper device with its network configuration and Adafruit IO credentials.
Definition: Wippersnapper.cpp:102
Adafruit_MQTT_Subscribe * _topic_signal_i2c_sub
Definition: Wippersnapper.h:551
char * _topic_signal_device
Definition: Wippersnapper.h:440
secretsConfig _config
Definition: Wippersnapper.h:432
uint32_t _last_mqtt_connect
Definition: Wippersnapper.h:516
char * _topic_signal_i2c_device
Definition: Wippersnapper.h:443
char * _topic_signal_pixels_device
Definition: Wippersnapper.h:458
wippersnapper_signal_v1_I2CRequest msgSignalI2C
Definition: Wippersnapper.h:468
Wippersnapper_DigitalGPIO * _digitalGPIO
Instance of digital gpio class.
Definition: Wippersnapper.h:412
ws_status_t
Definition: Wippersnapper.h:219
WipperSnapper_Component_I2C * _i2cPort1
WipperSnapper I2C Component for I2C port #1.
Definition: Wippersnapper.h:393
void haltError(String error, ws_led_status_t ledStatusColor=WS_LED_STATUS_ERROR_RUNTIME, int seconds_until_reboot=25)
Prints an error to the serial and halts the hardware until the WDT bites.
Definition: Wippersnapper.cpp:2545
wippersnapper_signal_v1_CreateSignalRequest _incomingSignalMsg
Definition: Wippersnapper.h:467
virtual bool check_valid_ssid()
Performs a scan of local WiFi networks.
Definition: Wippersnapper.cpp:232
Class that provides storage and functions for the Adafruit IO Wippersnapper interface.
Definition: Wippersnapper.h:311
Interface for WipperSnapper servo control.
Definition: ws_servo.h:61
bool configureDigitalPinReq(wippersnapper_pin_v1_ConfigurePinRequest *pinMsg)
Configures a pin according to a wippersnapper_pin_v1_ConfigurePinRequest message. ...
Definition: Wippersnapper.cpp:296
friend class
Definition: ws_pixels.h:49
ws_status_t run()
Processes incoming commands and handles network connection.
Definition: Wippersnapper.cpp:2950
virtual void _connect()
Connects to wireless network.
Definition: Wippersnapper.cpp:146
const char * _airlift_version
Definition: Wippersnapper.h:428
wippersnapper_signal_v1_CreateSignalRequest _outgoingSignalMsg
Definition: Wippersnapper.h:571
char * _topic_signal_pwm_device
Definition: Wippersnapper.h:451
bool encodePubRegistrationReq()
Encodes hardware registration request message and publishes the message to the Adafruit IO broker...
Definition: Wippersnapper_Register.cpp:25
char * throttleMessage
Definition: Wippersnapper.h:494
uint32_t _prv_ping
Definition: Wippersnapper.h:520
virtual void getMacAddr()
Sets the network interface&#39;s unique identifier, typically the MAC address.
Definition: Wippersnapper.cpp:165
bool generateDeviceUID()
Attempts to generate unique device identifier.
Definition: Wippersnapper.cpp:1849
Adafruit_MQTT_Subscribe * _topic_description_sub
Definition: Wippersnapper.h:544
char sUID[13]
Definition: Wippersnapper.h:427
Forward declaration.
Definition: controller.h:30
virtual void set_ssid_pass()
Sets the device&#39;s wireless network credentials from the secrets.json configuration file...
Definition: Wippersnapper.cpp:222
char * _err_topic
Definition: Wippersnapper.h:541
void feedWDT()
Feeds the WDT to prevent hardware reset.
Definition: Wippersnapper.cpp:2645
uint32_t _prvKATBlink
Definition: Wippersnapper.h:522
char * _topic_signal_servo_device
Definition: Wippersnapper.h:447
bool _isWiFiMulti
Definition: Wippersnapper.h:434
Adafruit_MQTT_Subscribe * _topic_signal_pixels_sub
Definition: Wippersnapper.h:559
ws_ds18x20 * _ds18x20Component
Instance of DS18x20 class.
Definition: Wippersnapper.h:420
ws_board_status_t _boardStatus
Hardware&#39;s registration status.
Definition: Wippersnapper.h:407
wippersnapper_signal_v1_UARTRequest msgSignalUART
UARTReq wrapper message.
Definition: Wippersnapper.h:489
void runNetFSM()
Checks network and MQTT connectivity. Handles network re-connection and mqtt re-establishment.
Definition: Wippersnapper.cpp:2430
char * _topic_signal_display_device
Definition: Wippersnapper.h:463
networkConfig _multiNetworks[3]
Definition: Wippersnapper.h:433
bool pinCfgCompleted
Definition: Wippersnapper.h:498
char * _topic_signal_uart_device
Definition: Wippersnapper.h:460
void pingBroker()
Pings the MQTT broker within the keepalive interval to keep the connection alive. Blinks the keepaliv...
Definition: Wippersnapper.cpp:2617
wippersnapper_signal_v1_Ds18x20Request msgSignalDS
Definition: Wippersnapper.h:473
wippersnapper_signal_v1_PixelsRequest msgPixels
PixelsRequest wrapper message.
Definition: Wippersnapper.h:486
void enableWDT(int timeoutMS=0)
Enables the watchdog timer.
Definition: Wippersnapper.cpp:2665
uint16_t _brokerKeepAliveIntervalSeconds
Definition: Wippersnapper.h:518
Adafruit_MQTT_Subscribe * _topic_signal_pwm_sub
Definition: Wippersnapper.h:555
Class that provides an interface with DS18X20-compatible sensors.
Definition: ws_ds18x20.h:48
char * _topic_signal_ds18_brkr
Definition: Wippersnapper.h:453
void publishPinConfigComplete()
Publishes an ACK to the broker that the device has completed its hardware configuration.
Definition: Wippersnapper.cpp:2912
std::vector< WipperSnapper_Component_I2C * > i2cComponents
Vector containing all I2C components.
Definition: Wippersnapper.h:390
uint16_t bufSize
Definition: Wippersnapper.h:405
char * _topic_signal_i2c_brkr
Definition: Wippersnapper.h:441
Adafruit_MQTT_Subscribe * _topic_signal_brkr_sub
Definition: Wippersnapper.h:548
char * _topic_signal_brkr
Definition: Wippersnapper.h:540
int32_t totalDigitalPins
Definition: Wippersnapper.h:437
Interface for WipperSnapper PWM.
Definition: ws_pwm.h:34
char * _topic_signal_display_brkr
Definition: Wippersnapper.h:461
ws_status_t _status
Definition: Wippersnapper.h:515
ws_board_status_t
Definition: Wippersnapper.h:254
uint8_t _macAddr[6]
Definition: Wippersnapper.h:426
ws_pwm * _pwmComponent
Instance of pwm class.
Definition: Wippersnapper.h:418
fsm_net_t
Definition: Wippersnapper.h:264
bool lockStatusLED
True if status LED is using the built-in LED.
Definition: Wippersnapper.h:320
Wippersnapper_FS * _fileSystem
Instance of Filesystem (native USB)
Definition: Wippersnapper.h:414
Adafruit_MQTT_Subscribe * _topic_signal_uart_sub
Definition: Wippersnapper.h:561
Adafruit_MQTT * _mqtt
Definition: Wippersnapper.h:430
#define STATUS_PIXEL_BRIGHTNESS_DEFAULT
Default status pixel brightness.
Definition: Wippersnapper_StatusLED.h:59
virtual ws_status_t networkStatus()
Returns the network&#39;s connection status.
Definition: Wippersnapper.cpp:197
char * _topic_device_pin_config_complete
Definition: Wippersnapper.h:536
char * _topic_signal_servo_brkr
Definition: Wippersnapper.h:445
Wippersnapper_AnalogIO * _analogIO
Instance of analog io class.
Definition: Wippersnapper.h:413
char * _topic_description_status_complete
Definition: Wippersnapper.h:533
void pollRegistrationResp()
Polls the broker for the hardware registration response message.
Definition: Wippersnapper_Register.cpp:76
ws_board_status_t getBoardStatus()
Returns the board definition status.
Definition: Wippersnapper.cpp:2608
Adafruit_MQTT_Subscribe * _topic_signal_display_sub
Definition: Wippersnapper.h:562
bool configAnalogInPinReq(wippersnapper_pin_v1_ConfigurePinRequest *pinMsg)
Configures an analog input pin according to a wippersnapper_pin_v1_ConfigurePinRequest message...
Definition: Wippersnapper.cpp:259
bool lockStatusDotStar
True if status LED is using the status dotstar.
Definition: Wippersnapper.h:319
wippersnapper_signal_v1_ServoRequest msgServo
ServoRequest wrapper message.
Definition: Wippersnapper.h:479
uint8_t _buffer_outgoing[512]
Definition: Wippersnapper.h:403
char * _throttle_topic
Definition: Wippersnapper.h:542
void decodeRegistrationResp(char *data, uint16_t len)
Decodes hardware registration response message from the Adafruit IO MQTT broker and initializes hardw...
Definition: Wippersnapper_Register.cpp:96
bool lockStatusNeoPixel
True if status LED is using the status neopixel.
Definition: Wippersnapper.h:318
Adafruit_MQTT_Subscribe * _topic_signal_servo_sub
Definition: Wippersnapper.h:553
WipperSnapper_Component_I2C * _i2cPort0
WipperSnapper I2C Component for I2C port #0.
Definition: Wippersnapper.h:391
bool registerBoard()
Attempts to register hardware with Adafruit.io WipperSnapper.
Definition: Wippersnapper.cpp:2584
int throttleTime
Definition: Wippersnapper.h:495
Adafruit_MQTT_Subscribe * _err_sub
Definition: Wippersnapper.h:566
char * _topic_signal_ds18_device
Definition: Wippersnapper.h:455
bool _isI2CPort0Init
True if I2C port 0 has been initialized, False otherwise.
Definition: Wippersnapper.h:395
virtual int32_t getRSSI()
Gets the network&#39;s RSSI.
Definition: Wippersnapper.cpp:175
virtual void _disconnect()
Disconnect Wippersnapper MQTT session and network.
Definition: Wippersnapper.cpp:155
ws_servo * _servoComponent
Instance of servo class.
Definition: Wippersnapper.h:419
Adafruit_MQTT_Publish * _topic_signal_device_pub
Definition: Wippersnapper.h:546
ws_uart * _uartComponent
Instance of UART class.
Definition: Wippersnapper.h:421
char * _topic_description
Definition: Wippersnapper.h:439
Class that provides an interface between WipperSnapper&#39;s app and the device&#39;s UART bus...
Definition: ws_uart.h:29
virtual void set_user_key()
Configures the device&#39;s Adafruit IO credentials. This method should be used only if filesystem-backed...
Definition: Wippersnapper.cpp:244