Skip to content

Commit d25aba8

Browse files
committed
bring in new PBs, new drivers
1 parent bcf1d08 commit d25aba8

25 files changed

+501
-37
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ examples/Wippersnapper_demo/build/
4848
.pio/
4949

5050
# Secrets
51-
data/
51+
data/
52+
53+
# Misc. Data
54+
tests/
55+
venv/

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper
77
category=Communication
88
url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino
99
architectures=*
10-
depends=SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library
10+
depends=SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal

platformio.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ lib_deps =
9191
https://github.com/adafruit/WiFiNINA.git
9292
https://github.com/Starmbi/hp_BH1750.git
9393
https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git
94+
https://github.com/adafruit/Adafruit_LED_Backpack.git
95+
https://github.com/adafruit/Adafruit_LiquidCrystal.git
9496

9597

9698

src/components/i2c/WipperSnapper_I2C.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,20 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
838838
_adt7410->configureDriver(msgDeviceInitReq);
839839
drivers.push_back(_adt7410);
840840
WS_DEBUG_PRINTLN("ADT7410 Initialized Successfully!");
841+
} else if (strcmp("quadalphanum", msgDeviceInitReq->i2c_device_name) == 0) {
842+
_quadAlphaNum = new WipperSnapper_I2C_Driver_Out_QuadAlphaNum(this->_i2c, i2cAddress);
843+
// TODO: Need the I2C PB H updated to call the configure function
844+
// _quadAlphaNum->ConfigureI2CBackpack()
845+
// TODO: ^ Uncomment this!
846+
if (!_quadAlphaNum->begin()) {
847+
WS_DEBUG_PRINTLN("ERROR: Failed to initialize Quad Alphanum. Display!");
848+
_busStatusResponse =
849+
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
850+
return false;
851+
}
852+
//drivers.push_back(_adt7410);
853+
_drivers_out.push_back(_quadAlphaNum);
854+
WS_DEBUG_PRINTLN("Quad Alphanum. Display Initialized Successfully!");
841855
} else {
842856
WS_DEBUG_PRINTLN("ERROR: I2C device type not found!")
843857
_busStatusResponse =
@@ -905,6 +919,9 @@ void WipperSnapper_Component_I2C::deinitI2CDevice(
905919
WS_DEBUG_PRINTLN("I2C Device De-initialized!");
906920
}
907921
}
922+
923+
// TODO: Add an implementation for the drivers_out vector!
924+
908925
_busStatusResponse = wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_SUCCESS;
909926
}
910927

src/components/i2c/WipperSnapper_I2C.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <Wire.h>
2121

2222
#include "drivers/WipperSnapper_I2C_Driver.h"
23+
#include "drivers/WipperSnapper_I2C_Driver_Out.h"
24+
#include "drivers/WipperSnapper_I2C_Driver_Out_QuadAlphaNum.h"
2325
#include "drivers/WipperSnapper_I2C_Driver_ADT7410.h"
2426
#include "drivers/WipperSnapper_I2C_Driver_AHTX0.h"
2527
#include "drivers/WipperSnapper_I2C_Driver_BH1750.h"
@@ -134,7 +136,8 @@ class WipperSnapper_Component_I2C {
134136
int32_t _portNum;
135137
TwoWire *_i2c = nullptr;
136138
wippersnapper_i2c_v1_BusResponse _busStatusResponse;
137-
std::vector<WipperSnapper_I2C_Driver *> drivers; ///< List of sensor drivers
139+
std::vector<WipperSnapper_I2C_Driver *> drivers; ///< List of i2c sensor drivers
140+
std::vector<WipperSnapper_I2C_Driver_Out *> _drivers_out; ///< List of i2c output drivers
138141
// Sensor driver objects
139142
WipperSnapper_I2C_Driver_AHTX0 *_ahtx0 = nullptr;
140143
WipperSnapper_I2C_Driver_DPS310 *_dps310 = nullptr;
@@ -190,6 +193,7 @@ class WipperSnapper_Component_I2C {
190193
WipperSnapper_I2C_Driver_VL6180X *_vl6180x = nullptr;
191194
WipperSnapper_I2C_Driver_MAX17048 *_max17048 = nullptr;
192195
WipperSnapper_I2C_Driver_ADT7410 *_adt7410 = nullptr;
196+
WipperSnapper_I2C_Driver_Out_QuadAlphaNum *_quadAlphaNum = nullptr;
193197
};
194198
extern Wippersnapper WS;
195199

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/*!
2+
* @file WipperSnapper_I2C_Driver_Out.h
3+
*
4+
* Derived class for I2C output driver components
5+
*
6+
* Adafruit invests time and resources providing this open source code,
7+
* please support Adafruit and open-source hardware by purchasing
8+
* products from Adafruit!
9+
*
10+
* Copyright (c) Brent Rubell 2025 for Adafruit Industries.
11+
*
12+
* MIT license, all text here must be included in any redistribution.
13+
*
14+
*/
15+
16+
#ifndef WIPPERSNAPPER_I2C_DRIVER_OUT_H
17+
#define WIPPERSNAPPER_I2C_DRIVER_OUT_H
18+
19+
#include "WipperSnapper_I2C_Driver.h"
20+
#include <Arduino.h>
21+
22+
/*!
23+
@brief Derived class for I2C output component drivers.
24+
*/
25+
class WipperSnapper_I2C_Driver_Out : public WipperSnapper_I2C_Driver {
26+
27+
public:
28+
/*!
29+
@brief Creates a new I2C output component driver.
30+
@param i2c
31+
The I2C hardware interface, default is Wire.
32+
@param sensorAddress
33+
The I2C sensor's unique address.
34+
*/
35+
WipperSnapper_I2C_Driver_Out(TwoWire *i2c, uint16_t sensorAddress):WipperSnapper_I2C_Driver(i2c, sensorAddress) {
36+
// No-op constructor
37+
}
38+
39+
/*!
40+
@brief Destructor for an I2C output component.
41+
*/
42+
virtual ~WipperSnapper_I2C_Driver_Out() {
43+
// No-op destructor
44+
}
45+
46+
/*!
47+
@brief Writes a message to an i2c output device.
48+
@param message
49+
The message to be displayed.
50+
*/
51+
virtual void WriteMessage(const char *message) {
52+
// noop
53+
}
54+
55+
/*!
56+
@brief Writes a floating point value to an i2c output device.
57+
@param value
58+
The value to be displayed. Only the first four digits are
59+
displayed.
60+
*/
61+
virtual void WriteValue(float value) {
62+
// noop
63+
}
64+
65+
/*!
66+
@brief Writes a floating point value to an i2c output device.
67+
@param value
68+
The value to be displayed. Only the first four digits are
69+
displayed.
70+
*/
71+
virtual void WriteValue(int32_t value) {
72+
// noop
73+
}
74+
75+
/*!
76+
@brief Configures a LED backpack.
77+
@param brightness
78+
The brightness of the LED backpack.
79+
@param alignment
80+
The alignment of the LED backpack.
81+
*/
82+
virtual void ConfigureI2CBackpack(int32_t brightness, uint32_t alignment) {
83+
// noop
84+
}
85+
86+
/*!
87+
@brief Sets the brightness of the LED backpack.
88+
@param b
89+
The brightness value, from 0 (off) to 15 (full brightness).
90+
*/
91+
virtual void SetLedBackpackBrightness(uint8_t b) {
92+
// noop
93+
}
94+
95+
96+
/*!
97+
@brief High-level fn, executes a call to the appropriate driver
98+
function(s) based on the message data type to write.
99+
@param msg_backpack_write
100+
Pointer to a wippersnapper_i2c_output_LedBackpackWrite message.
101+
@returns True if the message was written successfully, False otherwise.
102+
*/
103+
bool LedBackpackWrite(
104+
wippersnapper_i2c_output_LedBackpackWrite *msg_backpack_write) {
105+
// Check if we should adjust brightness
106+
if (msg_backpack_write->adjust_brightness)
107+
SetLedBackpackBrightness((uint8_t)msg_backpack_write->brightness);
108+
109+
// Write the message to a LED backpack
110+
switch (msg_backpack_write->which_message) {
111+
case wippersnapper_i2c_output_LedBackpackWrite_text_tag:
112+
WS_DEBUG_PRINTLN("[i2c] Writing text to LED backpack...");
113+
WriteMessage(msg_backpack_write->message.text);
114+
break;
115+
case wippersnapper_i2c_output_LedBackpackWrite_number_int_tag:
116+
WS_DEBUG_PRINTLN("[i2c] Writing int to LED backpack...");
117+
WriteValue(msg_backpack_write->message.number_int);
118+
break;
119+
case wippersnapper_i2c_output_LedBackpackWrite_number_float_tag:
120+
WS_DEBUG_PRINTLN("[i2c] Writing float to LED backpack...");
121+
WriteValue(msg_backpack_write->message.number_float);
122+
break;
123+
default:
124+
WS_DEBUG_PRINTLN("[i2c] ERROR: Unable to determine LED backpack "
125+
"message type!");
126+
return false;
127+
break;
128+
}
129+
return true;
130+
}
131+
132+
};
133+
134+
#endif // WIPPERSNAPPER_I2C_DRIVER_OUT_H
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*!
2+
* @file WipperSnapper_I2C_Driver_Out_QuadAlphaNum.h
3+
*
4+
* Device driver for Quad Alphanumeric Displays w/I2C Backpack
5+
*
6+
* Adafruit invests time and resources providing this open source code,
7+
* please support Adafruit and open-source hardware by purchasing
8+
* products from Adafruit!
9+
*
10+
* Copyright (c) Brent Rubell for Adafruit Industries 2025
11+
*
12+
* MIT license, all text here must be included in any redistribution.
13+
*
14+
*/
15+
16+
#ifndef WIPPERSNAPPER_I2C_DRIVER_OUT_QUADALPHANUM_H
17+
#define WIPPERSNAPPER_I2C_DRIVER_OUT_QUADALPHANUM_H
18+
19+
#include "WipperSnapper_I2C_Driver_Out.h"
20+
#include <Adafruit_LEDBackpack.h>
21+
#include <Arduino.h>
22+
23+
#define LED_BACKPACK_ALIGNMENT_UNSPECIFIED 0 ///< Unspecified alignment
24+
#define LED_BACKPACK_ALIGNMENT_LEFT 1 ///< Left alignment
25+
#define LED_BACKPACK_ALIGNMENT_RIGHT 2 ///< Right alignment
26+
#define LED_BACKPACK_ALIGNMENT_DEFAULT \
27+
LED_BACKPACK_ALIGNMENT_LEFT ///< Default alignment
28+
#define LED_MAX_CHARS \
29+
4 ///< Maximum number of characters to display on the alphanumeric display
30+
31+
32+
/*!
33+
@brief Class that provides a driver interface for Quad Alphanumeric
34+
Displays w/I2C Backpack
35+
*/
36+
class WipperSnapper_I2C_Driver_Out_QuadAlphaNum : public WipperSnapper_I2C_Driver_Out {
37+
38+
public:
39+
/*******************************************************************************/
40+
/*!
41+
@brief Constructor for an MS8607 sensor.
42+
@param i2c
43+
The I2C interface.
44+
@param sensorAddress
45+
7-bit device address.
46+
*/
47+
/*******************************************************************************/
48+
WipperSnapper_I2C_Driver_Out_QuadAlphaNum(TwoWire *i2c, uint16_t sensorAddress) : WipperSnapper_I2C_Driver_Out(i2c, sensorAddress) {
49+
// No-op constructor
50+
}
51+
52+
/*!
53+
@brief Destructor for an MS8607 sensor.
54+
*/
55+
~WipperSnapper_I2C_Driver_Out_QuadAlphaNum() {
56+
if (_alpha4 != nullptr) {
57+
delete _alpha4;
58+
_alpha4 = nullptr;
59+
}
60+
}
61+
62+
/*!
63+
@brief Initializes the drvOutQuadAlphaNum component and begins I2C.
64+
@returns True if initialized successfully, False otherwise.
65+
*/
66+
bool begin() override {
67+
_alpha4 = new Adafruit_AlphaNum4();
68+
bool did_begin = _alpha4->begin(_address, _i2c);
69+
_alpha4->setBrightness(_brightness);
70+
return did_begin;
71+
}
72+
73+
/*!
74+
@brief Configures a LED backpack.
75+
@param brightness
76+
The brightness of the LED backpack.
77+
@param alignment
78+
The alignment of the LED backpack.
79+
*/
80+
void ConfigureI2CBackpack(int32_t brightness, uint32_t alignment) {
81+
if (alignment == LED_BACKPACK_ALIGNMENT_RIGHT) {
82+
_alignment = LED_BACKPACK_ALIGNMENT_RIGHT;
83+
} else {
84+
_alignment = LED_BACKPACK_ALIGNMENT_DEFAULT;
85+
}
86+
_brightness = brightness;
87+
}
88+
89+
90+
91+
protected:
92+
Adafruit_AlphaNum4 *_alpha4 = nullptr; ///< ptr to a 4-digit alphanumeric display object
93+
int32_t _brightness; ///< Brightness of the LED backpack, from 0 (off) to 15
94+
///< (full brightness)
95+
uint32_t _alignment = LED_BACKPACK_ALIGNMENT_DEFAULT; ///< Determines L/R alignment of the message displayed
96+
};
97+
98+
#endif // WIPPERSNAPPER_I2C_DRIVER_OUT_QUADALPHANUM_H

src/wippersnapper/description/v1/description.pb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated nanopb constant definitions */
2-
/* Generated by nanopb-0.4.5-dev at Wed Sep 6 18:22:09 2023. */
2+
/* Generated by nanopb-0.4.5-dev at Wed May 14 16:42:42 2025. */
33

44
#include "wippersnapper/description/v1/description.pb.h"
55
#if PB_PROTO_HEADER_VERSION != 40

src/wippersnapper/description/v1/description.pb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated nanopb header */
2-
/* Generated by nanopb-0.4.5-dev at Wed Sep 6 18:22:09 2023. */
2+
/* Generated by nanopb-0.4.5-dev at Wed May 14 16:42:42 2025. */
33

44
#ifndef PB_WIPPERSNAPPER_DESCRIPTION_V1_WIPPERSNAPPER_DESCRIPTION_V1_DESCRIPTION_PB_H_INCLUDED
55
#define PB_WIPPERSNAPPER_DESCRIPTION_V1_WIPPERSNAPPER_DESCRIPTION_V1_DESCRIPTION_PB_H_INCLUDED

src/wippersnapper/ds18x20/v1/ds18x20.pb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated nanopb constant definitions */
2-
/* Generated by nanopb-0.4.5-dev at Wed Sep 6 18:22:09 2023. */
2+
/* Generated by nanopb-0.4.5-dev at Wed May 14 16:42:42 2025. */
33

44
#include "wippersnapper/ds18x20/v1/ds18x20.pb.h"
55
#if PB_PROTO_HEADER_VERSION != 40

0 commit comments

Comments
 (0)