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.124"
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_KEEPALIVE_INTERVAL_MS \
252  5000
254 #define WS_MQTT_MAX_PAYLOAD_SIZE \
255  512
256 
259 class Wippersnapper_FS;
260 class WipperSnapper_LittleFS;
261 #ifdef ARDUINO_ARCH_ESP32
262 class ws_ledc;
263 #endif
265 class ws_servo;
266 class ws_pwm;
267 class ws_ds18x20;
268 class ws_pixels;
269 class ws_uart;
270 class DisplayController;
271 
272 /**************************************************************************/
277 /**************************************************************************/
278 class Wippersnapper {
279 public:
280  Wippersnapper();
281  virtual ~Wippersnapper();
282 
283  void provision();
285  bool lockStatusNeoPixel;
286  bool lockStatusDotStar;
287  bool lockStatusLED;
290 
292  virtual void set_user_key();
293  virtual void set_ssid_pass(const char *ssid, const char *ssidPassword);
294  virtual void set_ssid_pass();
295  virtual bool check_valid_ssid();
296 
297  virtual void _connect();
298  virtual void _disconnect();
299  void connect();
300  void disconnect();
301 
302  virtual void getMacAddr();
303  virtual int32_t getRSSI();
304  virtual void setupMQTTClient(const char *clientID);
305 
306  virtual ws_status_t networkStatus();
309  bool generateDeviceUID();
310  bool generateWSTopics();
311  bool generateWSErrorTopics();
312 
313  // Registration API
314  bool registerBoard();
316  void decodeRegistrationResp(char *data, uint16_t len);
318  // Configuration API
320 
321  // run() loop
322  ws_status_t run();
323  void processPackets();
324  void publish(const char *topic, uint8_t *payload, uint16_t bLen,
325  uint8_t qos = 0);
326 
327  // Networking helpers
328  void pingBroker();
329  void runNetFSM();
330 
331  // WDT helpers
332  void enableWDT(int timeoutMS = 0);
333  void feedWDT();
334 
335  // Error handling helpers
336  void haltError(String error,
337  ws_led_status_t ledStatusColor = WS_LED_STATUS_ERROR_RUNTIME,
338  int seconds_until_reboot = 25);
339  void errorWriteHang(String error);
340 
341  // MQTT topic callbacks //
342  // Decodes a signal message
343  bool decodeSignalMsg(
344  wippersnapper_signal_v1_CreateSignalRequest *encodedSignalMsg);
345 
346  // Encodes a pin event message
347  bool
348  encodePinEvent(wippersnapper_signal_v1_CreateSignalRequest *outgoingSignalMsg,
349  uint8_t pinName, int pinVal);
350 
351  // Pin configure message
352  bool configureDigitalPinReq(wippersnapper_pin_v1_ConfigurePinRequest *pinMsg);
353  bool configAnalogInPinReq(wippersnapper_pin_v1_ConfigurePinRequest *pinMsg);
354 
355  // I2C
356  std::vector<WipperSnapper_Component_I2C *>
357  i2cComponents;
359  NULL;
361  NULL;
362  bool _isI2CPort0Init =
363  false;
364  bool _isI2CPort1Init =
365  false;
366 
369  uint8_t
372  uint16_t bufSize;
375  WS_BOARD_DEF_IDLE;
376 
377  // TODO: We really should look at making these static definitions, not dynamic
378  // to free up space on the heap
381  Wippersnapper_FS *_fileSystem;
382  WipperSnapper_LittleFS
383  *_littleFS;
391 
392  // TODO: does this really need to be global?
393  uint8_t _macAddr[6];
394  char sUID[13];
395  const char *_airlift_version;
396  const char *_boardId;
397  Adafruit_MQTT *_mqtt;
399  secretsConfig _config;
400  networkConfig _multiNetworks[3];
401  bool _isWiFiMulti = false;
403  // TODO: Does this need to be within this class?
406  char *_topic_description = NULL;
407  char *_topic_signal_device = NULL;
408  char *_topic_signal_i2c_brkr = NULL;
412  char *_topic_signal_servo_brkr = NULL;
417  NULL;
419  NULL;
420  char *_topic_signal_ds18_brkr = NULL;
422  char *_topic_signal_ds18_device = NULL;
426  char *_topic_signal_uart_brkr = NULL;
429  NULL;
431  NULL;
433  wippersnapper_signal_v1_CreateSignalRequest
435  wippersnapper_signal_v1_I2CRequest msgSignalI2C =
436  wippersnapper_signal_v1_I2CRequest_init_zero;
439  // ds signal msg
440  wippersnapper_signal_v1_Ds18x20Request msgSignalDS =
441  wippersnapper_signal_v1_Ds18x20Request_init_zero;
444  // servo message
445  wippersnapper_signal_v1_ServoRequest
447  wippersnapper_signal_v1_PWMRequest msgPWM =
448  wippersnapper_signal_v1_PWMRequest_init_zero;
449 
451  // pixels signal message
452  wippersnapper_signal_v1_PixelsRequest
453  msgPixels;
455  wippersnapper_signal_v1_UARTRequest
458  wippersnapper_signal_v1_DisplayRequest
461  char *throttleMessage;
462  int throttleTime;
465  bool pinCfgCompleted = false;
467 // enable LEDC if esp32
468 #ifdef ARDUINO_ARCH_ESP32
469  ws_ledc *_ledc = nullptr;
470 #endif
471 
472 private:
473  void _init();
474 
475 protected:
476  ws_status_t _status = WS_IDLE;
477  uint32_t _last_mqtt_connect = 0;
479  uint32_t _prv_ping = 0;
481  uint32_t _prvKATBlink = 0;
484  // Device information
485  const char *_deviceId;
486  char *_device_uid;
488  // MQTT topics
490  NULL;
496  NULL;
499  char *_topic_signal_brkr = NULL;
500  char *_err_topic = NULL;
501  char *_throttle_topic = NULL;
503  Adafruit_MQTT_Subscribe *_topic_description_sub;
505  Adafruit_MQTT_Publish *_topic_signal_device_pub;
507  Adafruit_MQTT_Subscribe *_topic_signal_brkr_sub;
509  Adafruit_MQTT_Subscribe
511  Adafruit_MQTT_Subscribe
513  Adafruit_MQTT_Subscribe
515  Adafruit_MQTT_Subscribe
517  Adafruit_MQTT_Subscribe
519  Adafruit_MQTT_Subscribe
521  Adafruit_MQTT_Subscribe *_topic_signal_display_sub;
524  Adafruit_MQTT_Subscribe
526  Adafruit_MQTT_Subscribe
527  *_throttle_sub;
529  wippersnapper_signal_v1_CreateSignalRequest
531 };
532 extern Wippersnapper WS;
534 #endif // ADAFRUIT_WIPPERSNAPPER_H
Class that provides an interface with the I2C bus.
Definition: WipperSnapper_I2C.h:109
char * _topic_signal_pixels_brkr
Definition: Wippersnapper.h:454
wippersnapper_signal_v1_PWMRequest msgPWM
Definition: Wippersnapper.h:477
void disconnect()
Disconnects from Adafruit IO+ Wippersnapper.
Definition: Wippersnapper.cpp:132
char * _topic_signal_uart_brkr
Definition: Wippersnapper.h:456
virtual void setupMQTTClient(const char *clientID)
Sets up the MQTT client session.
Definition: Wippersnapper.cpp:182
const char * _boardId
Definition: Wippersnapper.h:426
ws_mqtt_status_t
Definition: Wippersnapper.h:241
Adafruit_MQTT_Subscribe * _throttle_sub
Definition: Wippersnapper.h:557
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:394
ws_ledc * _ledc
Pointer to LEDC object.
Definition: Wippersnapper.h:499
bool generateWSErrorTopics()
Builds MQTT topics for handling errors returned from the Adafruit IO broker and subscribes to them...
Definition: Wippersnapper.cpp:1775
ws_pixels * _ws_pixelsComponent
ptr to instance of ws_pixels class
Definition: Wippersnapper.h:414
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:420
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:2678
char * _topic_signal_pwm_brkr
Definition: Wippersnapper.h:446
void processPackets()
Process all incoming packets from the Adafruit IO MQTT broker. Handles network connectivity.
Definition: Wippersnapper.cpp:2656
const char * _deviceId
Definition: Wippersnapper.h:515
wippersnapper_signal_v1_DisplayRequest msgSignalDisplay
DisplayRequest wrapper message.
Definition: Wippersnapper.h:489
char * _device_uid
Definition: Wippersnapper.h:516
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:284
void connect()
Connects to Adafruit IO+ Wippersnapper broker.
Definition: Wippersnapper.cpp:2792
uint8_t _buffer[512]
Definition: Wippersnapper.h:397
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:519
bool generateWSTopics()
Generates device-specific Wippersnapper control topics and subscribes to them.
Definition: Wippersnapper.cpp:1874
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:413
float status_pixel_brightness
(from 0.0 to 1.0)
Definition: Wippersnapper.h:318
void errorWriteHang(String error)
Writes an error message to the serial and the filesystem, blinks WS_LED_STATUS_ERROR_RUNTIME pattern ...
Definition: Wippersnapper.cpp:2390
Adafruit_MQTT_Subscribe * _topic_signal_ds18_sub
Definition: Wippersnapper.h:546
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:540
char * _topic_signal_device
Definition: Wippersnapper.h:437
secretsConfig _config
Definition: Wippersnapper.h:429
uint32_t _last_mqtt_connect
Definition: Wippersnapper.h:507
char * _topic_signal_i2c_device
Definition: Wippersnapper.h:440
char * _topic_signal_pixels_device
Definition: Wippersnapper.h:455
wippersnapper_signal_v1_I2CRequest msgSignalI2C
Definition: Wippersnapper.h:465
Wippersnapper_DigitalGPIO * _digitalGPIO
Instance of digital gpio class.
Definition: Wippersnapper.h:409
ws_status_t
Definition: Wippersnapper.h:218
WipperSnapper_Component_I2C * _i2cPort1
WipperSnapper I2C Component for I2C port #1.
Definition: Wippersnapper.h:390
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:2529
wippersnapper_signal_v1_CreateSignalRequest _incomingSignalMsg
Definition: Wippersnapper.h:464
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:308
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:2892
virtual void _connect()
Connects to wireless network.
Definition: Wippersnapper.cpp:141
const char * _airlift_version
Definition: Wippersnapper.h:425
wippersnapper_signal_v1_CreateSignalRequest _outgoingSignalMsg
Definition: Wippersnapper.h:560
char * _topic_signal_pwm_device
Definition: Wippersnapper.h:448
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:491
uint32_t _prv_ping
Definition: Wippersnapper.h:509
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:1833
Adafruit_MQTT_Subscribe * _topic_description_sub
Definition: Wippersnapper.h:533
char sUID[13]
Definition: Wippersnapper.h:424
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:530
void feedWDT()
Feeds the WDT to prevent hardware reset.
Definition: Wippersnapper.cpp:2630
uint32_t _prvKATBlink
Definition: Wippersnapper.h:511
char * _topic_signal_servo_device
Definition: Wippersnapper.h:444
bool _isWiFiMulti
Definition: Wippersnapper.h:431
Adafruit_MQTT_Subscribe * _topic_signal_pixels_sub
Definition: Wippersnapper.h:548
ws_ds18x20 * _ds18x20Component
Instance of DS18x20 class.
Definition: Wippersnapper.h:417
ws_board_status_t _boardStatus
Hardware&#39;s registration status.
Definition: Wippersnapper.h:404
wippersnapper_signal_v1_UARTRequest msgSignalUART
UARTReq wrapper message.
Definition: Wippersnapper.h:486
void runNetFSM()
Checks network and MQTT connectivity. Handles network re-connection and mqtt re-establishment.
Definition: Wippersnapper.cpp:2414
char * _topic_signal_display_device
Definition: Wippersnapper.h:460
networkConfig _multiNetworks[3]
Definition: Wippersnapper.h:430
bool pinCfgCompleted
Definition: Wippersnapper.h:495
char * _topic_signal_uart_device
Definition: Wippersnapper.h:457
void pingBroker()
Pings the MQTT broker within the keepalive interval to keep the connection alive. Blinks the keepaliv...
Definition: Wippersnapper.cpp:2601
wippersnapper_signal_v1_Ds18x20Request msgSignalDS
Definition: Wippersnapper.h:470
wippersnapper_signal_v1_PixelsRequest msgPixels
PixelsRequest wrapper message.
Definition: Wippersnapper.h:483
void enableWDT(int timeoutMS=0)
Enables the watchdog timer.
Definition: Wippersnapper.cpp:2640
Adafruit_MQTT_Subscribe * _topic_signal_pwm_sub
Definition: Wippersnapper.h:544
Class that provides an interface with DS18X20-compatible sensors.
Definition: ws_ds18x20.h:48
char * _topic_signal_ds18_brkr
Definition: Wippersnapper.h:450
void publishPinConfigComplete()
Publishes an ACK to the broker that the device has completed its hardware configuration.
Definition: Wippersnapper.cpp:2854
std::vector< WipperSnapper_Component_I2C * > i2cComponents
Vector containing all I2C components.
Definition: Wippersnapper.h:387
uint16_t bufSize
Definition: Wippersnapper.h:402
char * _topic_signal_i2c_brkr
Definition: Wippersnapper.h:438
Adafruit_MQTT_Subscribe * _topic_signal_brkr_sub
Definition: Wippersnapper.h:537
char * _topic_signal_brkr
Definition: Wippersnapper.h:529
int32_t totalDigitalPins
Definition: Wippersnapper.h:434
Interface for WipperSnapper PWM.
Definition: ws_pwm.h:34
char * _topic_signal_display_brkr
Definition: Wippersnapper.h:458
ws_status_t _status
Definition: Wippersnapper.h:506
ws_board_status_t
Definition: Wippersnapper.h:253
uint8_t _macAddr[6]
Definition: Wippersnapper.h:423
ws_pwm * _pwmComponent
Instance of pwm class.
Definition: Wippersnapper.h:415
fsm_net_t
Definition: Wippersnapper.h:263
bool lockStatusLED
True if status LED is using the built-in LED.
Definition: Wippersnapper.h:317
Wippersnapper_FS * _fileSystem
Instance of Filesystem (native USB)
Definition: Wippersnapper.h:411
Adafruit_MQTT_Subscribe * _topic_signal_uart_sub
Definition: Wippersnapper.h:550
Adafruit_MQTT * _mqtt
Definition: Wippersnapper.h:427
#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:525
char * _topic_signal_servo_brkr
Definition: Wippersnapper.h:442
Wippersnapper_AnalogIO * _analogIO
Instance of analog io class.
Definition: Wippersnapper.h:410
char * _topic_description_status_complete
Definition: Wippersnapper.h:522
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:2592
Adafruit_MQTT_Subscribe * _topic_signal_display_sub
Definition: Wippersnapper.h:551
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:316
wippersnapper_signal_v1_ServoRequest msgServo
ServoRequest wrapper message.
Definition: Wippersnapper.h:476
uint8_t _buffer_outgoing[512]
Definition: Wippersnapper.h:400
char * _throttle_topic
Definition: Wippersnapper.h:531
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:315
Adafruit_MQTT_Subscribe * _topic_signal_servo_sub
Definition: Wippersnapper.h:542
WipperSnapper_Component_I2C * _i2cPort0
WipperSnapper I2C Component for I2C port #0.
Definition: Wippersnapper.h:388
bool registerBoard()
Attempts to register hardware with Adafruit.io WipperSnapper.
Definition: Wippersnapper.cpp:2568
int throttleTime
Definition: Wippersnapper.h:492
Adafruit_MQTT_Subscribe * _err_sub
Definition: Wippersnapper.h:555
char * _topic_signal_ds18_device
Definition: Wippersnapper.h:452
bool _isI2CPort0Init
True if I2C port 0 has been initialized, False otherwise.
Definition: Wippersnapper.h:392
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:416
Adafruit_MQTT_Publish * _topic_signal_device_pub
Definition: Wippersnapper.h:535
ws_uart * _uartComponent
Instance of UART class.
Definition: Wippersnapper.h:418
char * _topic_description
Definition: Wippersnapper.h:436
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