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
605 stars 188 forks source link

SH1106 OLED Driver #362

Closed jeffmhastings closed 1 year ago

jeffmhastings commented 2 years ago

I didn't see a driver for the SH1106 OLED display driver/controller.

I'm interested in working with an Adafruit Macropad RP2040 in tinygo. This board has an SH1106 OLED display connected to one of the SPI busses on the rp2040.

I'm probably going to start playing around with this, and I found some documentation for tinygo drivers which seems like a good starting point. Are there any other similar device drivers that might be a good reference for how to implement the driver for the SH1106?

sago35 commented 2 years ago

@jeffmhastings For example, the following may be helpful.

jeffmhastings commented 2 years ago

Thanks for the examples. I've got something working, and I'd like to clean it up a bit before submitting a PR. I also have a few questions about some design considerations.

  1. Is there an interface or other API specification that an OLED driver should conform to? It looks like both of those have a SetPixel function, and it looks like this is currently the only display function used in tinydraw. Is that the only function that should be implemented for an initial contribution? I also see ClearBuffer, ClearDisplay, Display, FillScreen, FillRectangle, etc. I'm just looking for some guidance on what sort of API should be implemented for this driver.

    Edit: I found the Displayer interface. I'll implement this.

  2. The other difference I noticed between the two examples is that the ssd1306 uses a buffer, but the ssd1351 doesn't. What are the considerations when deciding whether or not to use a buffer for the display data?

sago35 commented 2 years ago

Edit: I found the Displayer interface. I'll implement this.

👍

The other difference I noticed between the two examples is that the ssd1306 uses a buffer, but the ssd1351 doesn't. What are > the considerations when deciding whether or not to use a buffer for the display data?

I don't know the right reason. However, I think the following is an important point.

sago35 commented 2 years ago

376

jeffmhastings commented 1 year ago

Closing as there's now an SH1106 driver introduced in #376.