Skip to content

[API v2]: Add support for I2C Output Components #749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: migrate-api-v2
Choose a base branch
from

Conversation

brentru
Copy link
Member

@brentru brentru commented May 13, 2025

This pull request enhances core I2C functionality by adding support for I2C output devices.

The following I2C Output Devices are supported by this pull request:

  • 7-Segment LED numeric matrix with Adafruit I2C backpack (HT16K33)
  • 14-Segment LED alphanumeric display with Adafruit I2C backpack (HT16K33)
  • Character Displays with "i2c / SPI character LCD backpack - STEMMA QT / Qwiic"

Pull Request Notes

  • Added a new factory I2cFactoryOutput for creating I2C output drivers, including support for devices like LED backpacks and character LCDs (src/components/i2c/controller.cpp).
  • Added Handle_I2cDeviceOutputWrite to process I2C output write messages, supporting operations like writing to LED backpacks or character LCDs (src/components/i2c/controller.cpp).
  • Introduced CreateI2cOutputDrv function to create i2c output drivers from the factory (src/components/i2c/controller.cpp).
  • Updated RemoveDriver(), Handle_I2cDeviceAddOrReplace() to include i2c output drivers.
  • Added derived class for handling writing to I2C output drivers (src/components/i2c/drivers/drvOutputBase.h)
    • Added three i2c output drivers for 7-segment display, quad alphanumeric display and character LCD (src/components/i2c/drivers/drvOutput7Seg.h, src/components/i2c/drivers/drvQuadAlphaNum.h, src/components/i2c/drivers/drvOutCharLcd.h)

Addresses #742

@brentru brentru requested a review from tyeth May 13, 2025 19:43
@brentru brentru marked this pull request as ready for review May 13, 2025 19:43
@brentru
Copy link
Member Author

brentru commented May 13, 2025

@tyeth This pull request is ready for review at your convenience.

Comment on lines +193 to +197
void WriteValue(int32_t value) {
char message[LED_MAX_CHARS + 1];
snprintf(message, sizeof(message), "%ld", value);
WriteMessage(message);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this could be base classed, but I see now each wants it's own length of floats so unless that get's specified too it can't be in the base unlike integer (although most people would accept 3significant figures).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's defined within https://github.com/adafruit/Adafruit_Wippersnapper_Arduino/pull/749/files#diff-c724b4fcb9880bb228afb12673a0b6c0db2fada900f120f5467d7a5cc4210a16R66

but I see what you're saying - move this code into the drvOutBase class. Even for floats, the WriteMessage will deal with the truncation/length in the loop where it writes the characters.

Comment on lines +92 to +93
https://github.com/adafruit/Adafruit_LED_Backpack.git
https://github.com/adafruit/Adafruit_LiquidCrystal.git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these are actually in the platformIO registry:
https://registry.platformio.org/libraries/adafruit/Adafruit%20LED%20Backpack%20Library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants