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 #endif
153 
157 #include "components/pwm/ws_pwm.h"
159 #include "components/uart/ws_uart.h"
160 
161 #if defined(USE_TINYUSB)
162 #include "provisioning/tinyusb/Wippersnapper_FS.h"
163 #endif
164 
165 #if defined(USE_LITTLEFS)
166 #include "provisioning/littlefs/WipperSnapper_LittleFS.h"
167 #endif
168 
169 #define WS_VERSION \
170  "1.0.0-beta.127"
171 
172 // Reserved Adafruit IO MQTT topics
173 #define TOPIC_IO_THROTTLE "/throttle"
174 #define TOPIC_IO_ERRORS "/errors"
175 
176 // Reserved Wippersnapper topics
177 #define TOPIC_WS "/wprsnpr/"
178 #define TOPIC_INFO "/info/"
179 #define TOPIC_SIGNALS "/signals/"
180 #define TOPIC_I2C "/i2c"
181 #define TOPIC_DISPLAY "/display"
182 #define MQTT_TOPIC_PIXELS_DEVICE \
183  "/signals/device/pixel"
184 #define MQTT_TOPIC_PIXELS_BROKER \
185  "/signals/broker/pixel"
186 
187 
188 typedef enum {
189  WS_IDLE = 0, // Waiting for connection establishement
190  WS_NET_DISCONNECTED = 1, // Network disconnected
191  WS_DISCONNECTED = 2, // Disconnected from Adafruit IO
192  WS_FINGERPRINT_UNKOWN = 3, // Unknown WS_SSL_FINGERPRINT
193 
194  WS_NET_CONNECT_FAILED = 10, // Failed to connect to network
195  WS_CONNECT_FAILED = 11, // Failed to connect to Adafruit IO
196  WS_FINGERPRINT_INVALID = 12, // Unknown WS_SSL_FINGERPRINT
197  WS_AUTH_FAILED = 13, // Invalid Adafruit IO login credentials provided.
198  WS_SSID_INVALID =
199  14, // SSID is "" or otherwise invalid, connection not attempted
200 
201  WS_NET_CONNECTED = 20, // Connected to Adafruit IO
202  WS_CONNECTED = 21, // Connected to network
203  WS_CONNECTED_INSECURE = 22, // Insecurely (non-SSL) connected to network
204  WS_FINGERPRINT_UNSUPPORTED = 23, // Unsupported WS_SSL_FINGERPRINT
205  WS_FINGERPRINT_VALID = 24, // Valid WS_SSL_FINGERPRINT
206  WS_BOARD_DESC_INVALID = 25, // Unable to send board description
207  WS_BOARD_RESYNC_FAILED = 26 // Board sync failure
211 typedef enum {
212  WS_MQTT_CONNECTED = 0, // Connected
213  WS_MQTT_INVALID_PROTOCOL = 1, // Invalid mqtt protocol
214  WS_MQTT_INVALID_CID = 2, // Client id rejected
215  WS_MQTT_SERVICE_UNAVALIABLE = 3, // Malformed user/pass
216  WS_MQTT_INVALID_USER_PASS = 4, // Unauthorized access to resource
217  WS_MQTT_UNAUTHORIZED = 5, // MQTT service unavailable
218  WS_MQTT_THROTTLED = 6, // Account throttled
219  WS_MQTT_BANNED = 7 // Account banned
221 
223 typedef enum {
224  WS_BOARD_DEF_IDLE,
225  WS_BOARD_DEF_SEND_FAILED,
226  WS_BOARD_DEF_SENT,
227  WS_BOARD_DEF_OK,
228  WS_BOARD_DEF_INVALID,
229  WS_BOARD_DEF_UNSPECIFIED
231 
233 typedef enum {
234  FSM_NET_IDLE,
235  FSM_NET_CONNECTED,
236  FSM_MQTT_CONNECTED,
237  FSM_NET_CHECK_MQTT,
238  FSM_NET_CHECK_NETWORK,
239  FSM_NET_ESTABLISH_NETWORK,
240  FSM_NET_ESTABLISH_MQTT,
242 
243 #ifdef ARDUINO_ARCH_RP2040
244 #define WS_WDT_TIMEOUT 8388
245 #else
246 #define WS_WDT_TIMEOUT 60000
247 #endif
248 
249 #define WS_MAX_ALT_WIFI_NETWORKS 3
250 /* MQTT Configuration */
251 #define WS_BROKER_KEEPALIVE_MS \
252  11000
253 #define WS_DEVICE_PING_MS \
254  5000
255 
256 #define WS_MQTT_MAX_PAYLOAD_SIZE \
257  512
258 
261 class Wippersnapper_FS;
262 class WipperSnapper_LittleFS;
263 #ifdef ARDUINO_ARCH_ESP32
264 class ws_ledc;
265 #endif
267 class ws_servo;
268 class ws_pwm;
269 class ws_ds18x20;
270 class ws_pixels;
271 class ws_uart;
272 class DisplayController;
273 
274 /**************************************************************************/
279 /**************************************************************************/
280 class Wippersnapper {
281 public:
282  Wippersnapper();
283  virtual ~Wippersnapper();
284 
285  void provision();
287  bool lockStatusNeoPixel;
288  bool lockStatusDotStar;
289  bool lockStatusLED;
292 
294  virtual void set_user_key();
295  virtual void set_ssid_pass(const char *ssid, const char *ssidPassword);
296  virtual void set_ssid_pass();
297  virtual bool check_valid_ssid();
298 
299  virtual void _connect();
300  virtual void _disconnect();
301  void connect();
302  void disconnect();
303 
304  virtual void getMacAddr();
305  virtual int32_t getRSSI();
306  virtual void setupMQTTClient(const char *clientID);
307 
308  virtual ws_status_t networkStatus();
311  bool generateDeviceUID();
312  bool generateWSTopics();
313  bool generateWSErrorTopics();
314 
315  // Registration API
316  bool registerBoard();
318  void decodeRegistrationResp(char *data, uint16_t len);
320  // Configuration API
322 
323  // run() loop
324  ws_status_t run();
325  void processPackets();
326  void publish(const char *topic, uint8_t *payload, uint16_t bLen,
327  uint8_t qos = 0);
328 
329  // Networking helpers
330  void pingBroker();
331  void runNetFSM();
332 
333  // WDT helpers
334  void enableWDT(int timeoutMS = 0);
335  void feedWDT();
336 
337  // Error handling helpers
338  void haltError(String error,
339  ws_led_status_t ledStatusColor = WS_LED_STATUS_ERROR_RUNTIME,
340  int seconds_until_reboot = 25);
341  void errorWriteHang(String error);
342 
343  // MQTT topic callbacks //
344  // Decodes a signal message
345  bool decodeSignalMsg(
346  wippersnapper_signal_v1_CreateSignalRequest *encodedSignalMsg);
347 
348  // Encodes a pin event message
349  bool
350  encodePinEvent(wippersnapper_signal_v1_CreateSignalRequest *outgoingSignalMsg,
351  uint8_t pinName, int pinVal);
352 
353  // Pin configure message
354  bool configureDigitalPinReq(wippersnapper_pin_v1_ConfigurePinRequest *pinMsg);
355  bool configAnalogInPinReq(wippersnapper_pin_v1_ConfigurePinRequest *pinMsg);
356 
357  // I2C
358  std::vector<WipperSnapper_Component_I2C *>
359  i2cComponents;
361  NULL;
363  NULL;
364  bool _isI2CPort0Init =
365  false;
366  bool _isI2CPort1Init =
367  false;
368 
371  uint8_t
374  uint16_t bufSize;
377  WS_BOARD_DEF_IDLE;
378 
379  // TODO: We really should look at making these static definitions, not dynamic
380  // to free up space on the heap
383  Wippersnapper_FS *_fileSystem;
384  WipperSnapper_LittleFS
385  *_littleFS;
393 
394  // TODO: does this really need to be global?
395  uint8_t _macAddr[6];
396  char sUID[13];
397  const char *_airlift_version;
398  const char *_boardId;
399  Adafruit_MQTT *_mqtt;
401  secretsConfig _config;
402  networkConfig _multiNetworks[3];
403  bool _isWiFiMulti = false;
405  // TODO: Does this need to be within this class?
408  char *_topic_description = NULL;
409  char *_topic_signal_device = NULL;
410  char *_topic_signal_i2c_brkr = NULL;
414  char *_topic_signal_servo_brkr = NULL;
419  NULL;
421  NULL;
422  char *_topic_signal_ds18_brkr = NULL;
424  char *_topic_signal_ds18_device = NULL;
428  char *_topic_signal_uart_brkr = NULL;
431  NULL;
433  NULL;
435  wippersnapper_signal_v1_CreateSignalRequest
437  wippersnapper_signal_v1_I2CRequest msgSignalI2C =
438  wippersnapper_signal_v1_I2CRequest_init_zero;
441  // ds signal msg
442  wippersnapper_signal_v1_Ds18x20Request msgSignalDS =
443  wippersnapper_signal_v1_Ds18x20Request_init_zero;
446  // servo message
447  wippersnapper_signal_v1_ServoRequest
449  wippersnapper_signal_v1_PWMRequest msgPWM =
450  wippersnapper_signal_v1_PWMRequest_init_zero;
451 
453  // pixels signal message
454  wippersnapper_signal_v1_PixelsRequest
455  msgPixels;
457  wippersnapper_signal_v1_UARTRequest
460  wippersnapper_signal_v1_DisplayRequest
463  char *throttleMessage;
464  int throttleTime;
467  bool pinCfgCompleted = false;
469 // enable LEDC if esp32
470 #ifdef ARDUINO_ARCH_ESP32
471  ws_ledc *_ledc = nullptr;
472 #endif
473 
474 private:
475  void _init();
476 
477 protected:
478  ws_status_t _status = WS_IDLE;
479  uint32_t _last_mqtt_connect = 0;
482  0;
483  uint32_t _prv_ping = 0;
485  uint32_t _prvKATBlink = 0;
488  // Device information
489  const char *_deviceId;
490  char *_device_uid;
492  // MQTT topics
494  NULL;
500  NULL;
503  char *_topic_signal_brkr = NULL;
504  char *_err_topic = NULL;
505  char *_throttle_topic = NULL;
507  Adafruit_MQTT_Subscribe *_topic_description_sub;
509  Adafruit_MQTT_Publish *_topic_signal_device_pub;
511  Adafruit_MQTT_Subscribe *_topic_signal_brkr_sub;
513  Adafruit_MQTT_Subscribe
515  Adafruit_MQTT_Subscribe
517  Adafruit_MQTT_Subscribe
519  Adafruit_MQTT_Subscribe
521  Adafruit_MQTT_Subscribe
523  Adafruit_MQTT_Subscribe
525  Adafruit_MQTT_Subscribe *_topic_signal_display_sub;
528  Adafruit_MQTT_Subscribe
530  Adafruit_MQTT_Subscribe
531  *_throttle_sub;
533  wippersnapper_signal_v1_CreateSignalRequest
535 };
536 extern Wippersnapper WS;
538 #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:456
wippersnapper_signal_v1_PWMRequest msgPWM
Definition: Wippersnapper.h:479
void disconnect()
Disconnects from Adafruit IO+ Wippersnapper.
Definition: Wippersnapper.cpp:132
char * _topic_signal_uart_brkr
Definition: Wippersnapper.h:458
virtual void setupMQTTClient(const char *clientID)
Sets up the MQTT client session.
Definition: Wippersnapper.cpp:182
const char * _boardId
Definition: Wippersnapper.h:428
ws_mqtt_status_t
Definition: Wippersnapper.h:241
Adafruit_MQTT_Subscribe * _throttle_sub
Definition: Wippersnapper.h:561
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:396
ws_ledc * _ledc
Pointer to LEDC object.
Definition: Wippersnapper.h:501
bool generateWSErrorTopics()
Builds MQTT topics for handling errors returned from the Adafruit IO broker and subscribes to them...
Definition: Wippersnapper.cpp:1788
ws_pixels * _ws_pixelsComponent
ptr to instance of ws_pixels class
Definition: Wippersnapper.h:416
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:422
void 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:2690
char * _topic_signal_pwm_brkr
Definition: Wippersnapper.h:448
void processPackets()
Process all incoming packets from the Adafruit IO MQTT broker. Handles network connectivity.
Definition: Wippersnapper.cpp:2668
const char * _deviceId
Definition: Wippersnapper.h:519
wippersnapper_signal_v1_DisplayRequest msgSignalDisplay
DisplayRequest wrapper message.
Definition: Wippersnapper.h:491
char * _device_uid
Definition: Wippersnapper.h:520
virtual ~Wippersnapper()
Wippersnapper destructor.
Definition: Wippersnapper.cpp:82
ws_led_status_t
Definition: Wippersnapper_StatusLED.h:34
#define WS_MQTT_MAX_PAYLOAD_SIZE
MAXIMUM expected payload size, in bytes.
Definition: Wippersnapper.h:286
void connect()
Connects to Adafruit IO+ Wippersnapper broker.
Definition: Wippersnapper.cpp:2804
uint8_t _buffer[512]
Definition: Wippersnapper.h:399
bool encodePinEvent(wippersnapper_signal_v1_CreateSignalRequest *outgoingSignalMsg, uint8_t pinName, int pinVal)
Handles MQTT messages on signal topic until timeout.
Definition: Wippersnapper.cpp:1663
char * _topic_description_status
Definition: Wippersnapper.h:523
bool generateWSTopics()
Generates device-specific Wippersnapper control topics and subscribes to them.
Definition: Wippersnapper.cpp:1887
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:415
float status_pixel_brightness
(from 0.0 to 1.0)
Definition: Wippersnapper.h:320
void errorWriteHang(String error)
Writes an error message to the serial and the filesystem, blinks WS_LED_STATUS_ERROR_RUNTIME pattern ...
Definition: Wippersnapper.cpp:2403
Adafruit_MQTT_Subscribe * _topic_signal_ds18_sub
Definition: Wippersnapper.h:550
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:465
void provision()
Provisions a WipperSnapper device with its network configuration and Adafruit IO credentials.
Definition: Wippersnapper.cpp:97
Adafruit_MQTT_Subscribe * _topic_signal_i2c_sub
Definition: Wippersnapper.h:544
char * _topic_signal_device
Definition: Wippersnapper.h:439
secretsConfig _config
Definition: Wippersnapper.h:431
uint32_t _last_mqtt_connect
Definition: Wippersnapper.h:509
char * _topic_signal_i2c_device
Definition: Wippersnapper.h:442
char * _topic_signal_pixels_device
Definition: Wippersnapper.h:457
wippersnapper_signal_v1_I2CRequest msgSignalI2C
Definition: Wippersnapper.h:467
Wippersnapper_DigitalGPIO * _digitalGPIO
Instance of digital gpio class.
Definition: Wippersnapper.h:411
ws_status_t
Definition: Wippersnapper.h:218
WipperSnapper_Component_I2C * _i2cPort1
WipperSnapper I2C Component for I2C port #1.
Definition: Wippersnapper.h:392
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:2542
wippersnapper_signal_v1_CreateSignalRequest _incomingSignalMsg
Definition: Wippersnapper.h:466
virtual bool check_valid_ssid()
Performs a scan of local WiFi networks.
Definition: Wippersnapper.cpp:227
Class that provides storage and functions for the Adafruit IO Wippersnapper interface.
Definition: Wippersnapper.h:310
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:291
friend class
Definition: ws_pixels.h:49
ws_status_t run()
Processes incoming commands and handles network connection.
Definition: Wippersnapper.cpp:2906
virtual void _connect()
Connects to wireless network.
Definition: Wippersnapper.cpp:141
const char * _airlift_version
Definition: Wippersnapper.h:427
wippersnapper_signal_v1_CreateSignalRequest _outgoingSignalMsg
Definition: Wippersnapper.h:564
char * _topic_signal_pwm_device
Definition: Wippersnapper.h:450
bool encodePubRegistrationReq()
Encodes hardware registration request message and publishes the message to the Adafruit IO broker...
Definition: Wippersnapper_Register.cpp:27
char * throttleMessage
Definition: Wippersnapper.h:493
uint32_t _prv_ping
Definition: Wippersnapper.h:513
virtual void getMacAddr()
Sets the network interface&#39;s unique identifier, typically the MAC address.
Definition: Wippersnapper.cpp:160
bool generateDeviceUID()
Attempts to generate unique device identifier.
Definition: Wippersnapper.cpp:1846
Adafruit_MQTT_Subscribe * _topic_description_sub
Definition: Wippersnapper.h:537
char sUID[13]
Definition: Wippersnapper.h:426
Wippersnapper WS
Global member variable for callbacks.
Definition: Wippersnapper.cpp:36
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:217
char * _err_topic
Definition: Wippersnapper.h:534
void feedWDT()
Feeds the WDT to prevent hardware reset.
Definition: Wippersnapper.cpp:2642
uint32_t _prvKATBlink
Definition: Wippersnapper.h:515
char * _topic_signal_servo_device
Definition: Wippersnapper.h:446
bool _isWiFiMulti
Definition: Wippersnapper.h:433
Adafruit_MQTT_Subscribe * _topic_signal_pixels_sub
Definition: Wippersnapper.h:552
ws_ds18x20 * _ds18x20Component
Instance of DS18x20 class.
Definition: Wippersnapper.h:419
ws_board_status_t _boardStatus
Hardware&#39;s registration status.
Definition: Wippersnapper.h:406
wippersnapper_signal_v1_UARTRequest msgSignalUART
UARTReq wrapper message.
Definition: Wippersnapper.h:488
void runNetFSM()
Checks network and MQTT connectivity. Handles network re-connection and mqtt re-establishment.
Definition: Wippersnapper.cpp:2427
char * _topic_signal_display_device
Definition: Wippersnapper.h:462
networkConfig _multiNetworks[3]
Definition: Wippersnapper.h:432
bool pinCfgCompleted
Definition: Wippersnapper.h:497
char * _topic_signal_uart_device
Definition: Wippersnapper.h:459
void pingBroker()
Pings the MQTT broker within the keepalive interval to keep the connection alive. Blinks the keepaliv...
Definition: Wippersnapper.cpp:2614
wippersnapper_signal_v1_Ds18x20Request msgSignalDS
Definition: Wippersnapper.h:472
wippersnapper_signal_v1_PixelsRequest msgPixels
PixelsRequest wrapper message.
Definition: Wippersnapper.h:485
void enableWDT(int timeoutMS=0)
Enables the watchdog timer.
Definition: Wippersnapper.cpp:2652
uint16_t _brokerKeepAliveIntervalSeconds
Definition: Wippersnapper.h:511
Adafruit_MQTT_Subscribe * _topic_signal_pwm_sub
Definition: Wippersnapper.h:548
Class that provides an interface with DS18X20-compatible sensors.
Definition: ws_ds18x20.h:48
char * _topic_signal_ds18_brkr
Definition: Wippersnapper.h:452
void publishPinConfigComplete()
Publishes an ACK to the broker that the device has completed its hardware configuration.
Definition: Wippersnapper.cpp:2868
std::vector< WipperSnapper_Component_I2C * > i2cComponents
Vector containing all I2C components.
Definition: Wippersnapper.h:389
uint16_t bufSize
Definition: Wippersnapper.h:404
char * _topic_signal_i2c_brkr
Definition: Wippersnapper.h:440
Adafruit_MQTT_Subscribe * _topic_signal_brkr_sub
Definition: Wippersnapper.h:541
char * _topic_signal_brkr
Definition: Wippersnapper.h:533
int32_t totalDigitalPins
Definition: Wippersnapper.h:436
Interface for WipperSnapper PWM.
Definition: ws_pwm.h:34
char * _topic_signal_display_brkr
Definition: Wippersnapper.h:460
ws_status_t _status
Definition: Wippersnapper.h:508
ws_board_status_t
Definition: Wippersnapper.h:253
uint8_t _macAddr[6]
Definition: Wippersnapper.h:425
ws_pwm * _pwmComponent
Instance of pwm class.
Definition: Wippersnapper.h:417
fsm_net_t
Definition: Wippersnapper.h:263
bool lockStatusLED
True if status LED is using the built-in LED.
Definition: Wippersnapper.h:319
Wippersnapper_FS * _fileSystem
Instance of Filesystem (native USB)
Definition: Wippersnapper.h:413
Adafruit_MQTT_Subscribe * _topic_signal_uart_sub
Definition: Wippersnapper.h:554
Adafruit_MQTT * _mqtt
Definition: Wippersnapper.h:429
#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:192
char * _topic_device_pin_config_complete
Definition: Wippersnapper.h:529
char * _topic_signal_servo_brkr
Definition: Wippersnapper.h:444
Wippersnapper_AnalogIO * _analogIO
Instance of analog io class.
Definition: Wippersnapper.h:412
char * _topic_description_status_complete
Definition: Wippersnapper.h:526
void pollRegistrationResp()
Polls the broker for the hardware registration response message.
Definition: Wippersnapper_Register.cpp:78
ws_board_status_t getBoardStatus()
Returns the board definition status.
Definition: Wippersnapper.cpp:2605
Adafruit_MQTT_Subscribe * _topic_signal_display_sub
Definition: Wippersnapper.h:555
bool configAnalogInPinReq(wippersnapper_pin_v1_ConfigurePinRequest *pinMsg)
Configures an analog input pin according to a wippersnapper_pin_v1_ConfigurePinRequest message...
Definition: Wippersnapper.cpp:254
bool lockStatusDotStar
True if status LED is using the status dotstar.
Definition: Wippersnapper.h:318
wippersnapper_signal_v1_ServoRequest msgServo
ServoRequest wrapper message.
Definition: Wippersnapper.h:478
uint8_t _buffer_outgoing[512]
Definition: Wippersnapper.h:402
char * _throttle_topic
Definition: Wippersnapper.h:535
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:98
bool lockStatusNeoPixel
True if status LED is using the status neopixel.
Definition: Wippersnapper.h:317
Adafruit_MQTT_Subscribe * _topic_signal_servo_sub
Definition: Wippersnapper.h:546
WipperSnapper_Component_I2C * _i2cPort0
WipperSnapper I2C Component for I2C port #0.
Definition: Wippersnapper.h:390
bool registerBoard()
Attempts to register hardware with Adafruit.io WipperSnapper.
Definition: Wippersnapper.cpp:2581
int throttleTime
Definition: Wippersnapper.h:494
Adafruit_MQTT_Subscribe * _err_sub
Definition: Wippersnapper.h:559
char * _topic_signal_ds18_device
Definition: Wippersnapper.h:454
bool _isI2CPort0Init
True if I2C port 0 has been initialized, False otherwise.
Definition: Wippersnapper.h:394
virtual int32_t getRSSI()
Gets the network&#39;s RSSI.
Definition: Wippersnapper.cpp:170
virtual void _disconnect()
Disconnect Wippersnapper MQTT session and network.
Definition: Wippersnapper.cpp:150
ws_servo * _servoComponent
Instance of servo class.
Definition: Wippersnapper.h:418
Adafruit_MQTT_Publish * _topic_signal_device_pub
Definition: Wippersnapper.h:539
ws_uart * _uartComponent
Instance of UART class.
Definition: Wippersnapper.h:420
char * _topic_description
Definition: Wippersnapper.h:438
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:239