tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
585 stars 180 forks source link

[HUB75] ABC/ABCDE panels support #630

Open funkycode opened 6 months ago

funkycode commented 6 months ago

https://github.com/tinygo-org/drivers/blob/fd21e6ac9b4a5c3bd906ed8a82783a972be6d4ca/hub75/hub75.go#L60

The implementation supports only ABCD panels, while there are some panels that have only ABC and moreover from my understanding there are also panels with ABCDE pins.

I have ABC only panel on it's way from AliExpress that I want to test, if needed to adjust this implementation and make a PR once it is working.

Should we have multiple implementations or should we add something like ENUM to define which type it is?

Here is thread for reference on differences and implementation o other project that I am going to use as help to adjust tinygo implementation for ABC only support (can't make ABCDE one as I lack the led matrix of that type)

conejoninja commented 6 months ago

Depending on how much difference there are between versions.

Personally, I would add a new constructor... like func NewABC(b drivers.SPI, latPin, oePin, aPin, bPin, cPin machine.Pin) Device {

and use some sort of variable to keep track which panel type is and how to handle the pins. That's assuming there is not much difference and we could use the hub75 package for both. If there's a major difference on how to handle the code, then I'll vote for hub75 (as is) and a new hub75abc driver

funkycode commented 6 months ago

Well, at the end one I got utilizes all 4 channels. I have another matrix that is on the way, in case it will use only ABC I will try to implement it, in case not - unfortunately i would not be able to do so as I would need HW to test implementation :(