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
587 stars 180 forks source link

st7789: support the chip select pin #549

Closed aykevl closed 1 year ago

aykevl commented 1 year ago

It is needed to control the chip select pin when the st7789 display is wired together with some other SPI device on the same bus, for example if it shares the bus with SPI flash.

This required some refactoring of the code to correctly set the CS pin everywhere. Notably, this removes the public Command, Data, Tx, and Rx methods which poke into private details of the st7789 driver and are therefore best hidden in my opinion.

I've tried to avoid any behavioral changes that might lead to regressions, but considering the size of the diff there is always the possibility of a regression. I tested it on the Gopher Badge and on the PineTime.

deadprogram commented 1 year ago

@aykevl please resolve merge conflict. Thanks!

aykevl commented 1 year ago

Rebased! And also tested the change on my PineTime to be sure there wasn't a regression.

deadprogram commented 1 year ago

Thanks @aykevl now merging.