rust-embedded-community / ssd1306

SSD1306 OLED driver
Apache License 2.0
300 stars 68 forks source link

Misc. questions on brightness-related commands #148

Open alvinhochun opened 3 years ago

alvinhochun commented 3 years ago

Description of the problem/feature request/other

  1. Brightness::custom is not exposed as pub, is this by design? I would like to be able to set custom values.
  2. The precharge value is set to either 0x01 or 0x02 in this crate. However, from the SSD1306 datasheet I can find (https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf), the value consists of two nibbles and it is stated that "clocks 0 is invalid entry", which would make both 0x01 and 0x02 invalid. The display datasheet I have (https://files.pine64.org/doc/datasheet/pinecil/1810010328_UG-Univision-Semicon-UG-9616TSWCG02_C88335.pdf) uses 0xF1 as an example.
  3. Can the VCOMH Deselect Level be exposed?
  4. The SSD1306 datasheet only lists 0x00, 0x20 and 0x30 which doesn't seem to match the values used in this crate.
bugadani commented 1 year ago

Not exactly a timely response, but:

Brightness::custom is not exposed as pub, is this by design?

This was done because Brightness::custom couldn't be made const previously and I didn't want to expose the option of setting precharge phase 2 values that are above 15.

183 resolves this

The precharge value is set to either 0x01 or 0x02 in this crate

I had to figure this out myself, too, but we set a 0x11 or 0x12 precharge value, both of which should be valid. We use the value in Brightness as the phase 2 value. https://github.com/jamwaffles/ssd1306/blob/cafc5a112b02d4ff61d23865ad48bd65a61dfe79/src/lib.rs#LL348C18-L348C27

Can the VCOMH Deselect Level be exposed? The SSD1306 datasheet only lists 0x00, 0x20 and 0x30 which doesn't seem to match the values used in this crate.

Probably? The observation is good, and I don't know where 0b100 comes from as the source repository no longer exists.