Adafruit sell an I2C 4-digit alphanumeric LED display which I’d like to use with ESPHome. I’d need to create a custom component for it as it’s not currently supported, but I’m not sure where to start.
The I2C custom component examples given in the ESPHome docs are very brief, and say to read up on the custom sensor component. Most of that makes sense to me, but I’m not sure how to adapt it for a display component.
There is an existing Arduino library for this display, in fact the library also caters for a number of LED displays (dot matrix, bargraph, 7-segment) that all use the same HT16K33 I2C interface IC.
How difficult would this be? Should I just put in a new feature request for it, or is it something that I could do with a few pointers / guidance? I do have some python and C programming skills, but a bit rusty on OOP! - Thanks!
#include "esphome.h"
class CustomQuadAlpha : public Component {
public:
void setup() override {
Wire.begin();
}
void loop() override {
// Example: write the value 0x42 to register 0x78 of device with address 0x70
Wire.beginTransmission(0x70);
Wire.write(0x78);
Wire.write(0x42);
Wire.endTransmission();
}
};
I know the class definition isn’t correct, pretty sure I need something after public Component, but not sure what. Basically needs to accept the characters from the it.print("") statement. I also know I need to expand the loop code, but just trying to get the structure correct first.