Adafruit Library
Classes | Macros | Enumerations | Variables
Wippersnapper.h File Reference
#include <vector>
#include <nanopb/pb_common.h>
#include <nanopb/pb_decode.h>
#include <nanopb/pb_encode.h>
#include <pb.h>
#include <wippersnapper/description/v1/description.pb.h>
#include <wippersnapper/signal/v1/signal.pb.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_SleepyDog.h"
#include "Arduino.h"
#include <SPI.h>
#include "Wippersnapper_Boards.h"
#include "components/statusLED/Wippersnapper_StatusLED.h"
#include "provisioning/ConfigJson.h"
#include <nanopb/ws_pb_helpers.h>
#include "components/analogIO/Wippersnapper_AnalogIO.h"
#include "components/digitalIO/Wippersnapper_DigitalGPIO.h"
#include "components/i2c/WipperSnapper_I2C.h"
#include "components/ledc/ws_ledc.h"
#include <Esp.h>
#include "display/ws_display_driver.h"
#include "display/ws_display_ui_helper.h"
#include "components/ds18x20/ws_ds18x20.h"
#include "components/pixels/ws_pixels.h"
#include "components/pwm/ws_pwm.h"
#include "components/servo/ws_servo.h"
#include "components/uart/ws_uart.h"
#include "provisioning/tinyusb/Wippersnapper_FS.h"

Go to the source code of this file.

Classes

class  Wippersnapper
 Class that provides storage and functions for the Adafruit IO Wippersnapper interface. More...
 

Macros

#define WS_DEBUG
 Define to enable debugging to serial terminal.
 
#define WS_PRINTER   Serial
 Where debug messages will be printed.
 
#define WS_DEBUG_PRINT(...)   { WS_PRINTER.print(__VA_ARGS__); }
 Prints debug output.
 
#define WS_DEBUG_PRINTLN(...)   { WS_PRINTER.println(__VA_ARGS__); }
 Prints line from debug output.
 
#define WS_DEBUG_PRINTHEX(...)   { WS_PRINTER.print(__VA_ARGS__, HEX); }
 Prints debug output.
 
#define WS_DELAY_WITH_WDT(timeout)
 Delay function. More...
 
#define RETRY_FUNCTION_UNTIL_TIMEOUT(func, result_type, result_var, condition, timeout, interval, ...)
 Retry a function until a condition is met or a timeout is reached. More...
 
#define WS_VERSION   "1.0.0-beta.96"
 WipperSnapper app. version (semver-formatted)
 
#define TOPIC_IO_THROTTLE   "/throttle"
 Adafruit IO Throttle MQTT Topic.
 
#define TOPIC_IO_ERRORS   "/errors"
 Adafruit IO Error MQTT Topic.
 
#define TOPIC_WS   "/wprsnpr/"
 WipperSnapper topic.
 
#define TOPIC_INFO   "/info/"
 Registration sub-topic.
 
#define TOPIC_SIGNALS   "/signals/"
 Signals sub-topic.
 
#define TOPIC_I2C   "/i2c"
 I2C sub-topic.
 
#define MQTT_TOPIC_PIXELS_DEVICE   "/signals/device/pixel"
 Pixels device->broker topic.
 
#define MQTT_TOPIC_PIXELS_BROKER   "/signals/broker/pixel"
 Pixels broker->device topic.
 
#define WS_WDT_TIMEOUT   60000
 WDT timeout.
 
#define WS_MAX_ALT_WIFI_NETWORKS   3
 Maximum number of alternative networks.
 
#define WS_KEEPALIVE_INTERVAL_MS   5000
 Session keepalive interval time, in milliseconds.
 
#define WS_MQTT_MAX_PAYLOAD_SIZE   512
 MAXIMUM expected payload size, in bytes.
 

Enumerations

enum  ws_status_t {
  WS_IDLE = 0, WS_NET_DISCONNECTED = 1, WS_DISCONNECTED = 2, WS_FINGERPRINT_UNKOWN = 3,
  WS_NET_CONNECT_FAILED = 10, WS_CONNECT_FAILED = 11, WS_FINGERPRINT_INVALID = 12, WS_AUTH_FAILED = 13,
  WS_SSID_INVALID, WS_NET_CONNECTED = 20, WS_CONNECTED = 21, WS_CONNECTED_INSECURE = 22,
  WS_FINGERPRINT_UNSUPPORTED = 23, WS_FINGERPRINT_VALID = 24, WS_BOARD_DESC_INVALID = 25, WS_BOARD_RESYNC_FAILED = 26
}
 
enum  ws_mqtt_status_t {
  WS_MQTT_CONNECTED = 0, WS_MQTT_INVALID_PROTOCOL = 1, WS_MQTT_INVALID_CID = 2, WS_MQTT_SERVICE_UNAVALIABLE = 3,
  WS_MQTT_INVALID_USER_PASS = 4, WS_MQTT_UNAUTHORIZED = 5, WS_MQTT_THROTTLED = 6, WS_MQTT_BANNED = 7
}
 
enum  ws_board_status_t {
  WS_BOARD_DEF_IDLE, WS_BOARD_DEF_SEND_FAILED, WS_BOARD_DEF_SENT, WS_BOARD_DEF_OK,
  WS_BOARD_DEF_INVALID, WS_BOARD_DEF_UNSPECIFIED
}
 
enum  fsm_net_t {
  FSM_NET_IDLE, FSM_NET_CONNECTED, FSM_MQTT_CONNECTED, FSM_NET_CHECK_MQTT,
  FSM_NET_CHECK_NETWORK, FSM_NET_ESTABLISH_NETWORK, FSM_NET_ESTABLISH_MQTT
}
 

Variables

Wippersnapper WS
 Global member variable for callbacks. More...
 

Detailed Description

This is the documentation for Adafruit's Wippersnapper firmware for the Arduino platform. It is designed specifically to work with Adafruit IO Wippersnapper IoT platform.

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Copyright (c) Brent Rubell 2020-2024 for Adafruit Industries.

BSD license, all text here must be included in any redistribution.

Macro Definition Documentation

◆ WS_DELAY_WITH_WDT

#define WS_DELAY_WITH_WDT (   timeout)
Value:
{ \
unsigned long start = millis(); \
while (millis() - start < timeout) { \
delay(10); \
yield(); \
feedWDT(); \
if (millis() < start) { \
start = millis(); /* if rollover */ \
} \
} \
}

Delay function.

◆ RETRY_FUNCTION_UNTIL_TIMEOUT

#define RETRY_FUNCTION_UNTIL_TIMEOUT (   func,
  result_type,
  result_var,
  condition,
  timeout,
  interval,
  ... 
)
Value:
{ \
unsigned long startTime = millis(); \
while (millis() - startTime < timeout) { \
result_type result_var = func(__VA_ARGS__); \
if (condition(result_var)) { \
break; \
} \
if (startTime > millis()) { \
startTime = millis(); /* if rollover */ \
} \
WS_DELAY_WITH_WDT(interval); \
} \
}

Retry a function until a condition is met or a timeout is reached.

Parameters
funcThe function to retry.
result_typeThe type of the result of the function.
result_varThe variable to store the last result of the function.
conditionThe condition to check the result against.
timeoutThe maximum time to retry the function.
intervalThe time to wait between retries.
...The arguments to pass to the function.Retry a function until a condition is met or a timeout is reached.

Enumeration Type Documentation

◆ ws_status_t

Defines the Adafruit IO connection status

◆ ws_mqtt_status_t

Defines the Adafruit IO MQTT broker's connection return codes

◆ ws_board_status_t

Defines the Wippersnapper client's hardware registration status

◆ fsm_net_t

enum fsm_net_t

Defines the Wippersnapper client's network status

Variable Documentation

◆ WS

Global member variable for callbacks.

Wippersnapper variable.