Skip to content

drivers/display/ssd1306.py: Add support for 72x40 displays. #7411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

mcauser
Copy link
Contributor

@mcauser mcauser commented Jun 17, 2021

Fix for #7281

The 72x40 OLED requires selecting the internal IREF, as opposed to the default external IREF. This is an undocumented feature in the SSD1306 datasheet, but is present in the SSD1315 datasheet. It's possible this 72x40 OLED is actually using the newer SSD1315 controller. Sending the IREF select command to SSD1306 displays has no effect on them, so I've just added it to the init_display() instead of wrapping in an if width = 72.

it-works

I also have a 128x64 OLED using the SSD1315 controller (smaller ribbon cable) and the proposed change has no effect on the display, as the module comes with the correct current limiting resistor. You can use either internal or external IREF and it works the same.

After testing the various display sizes 128x64, 128x32, 72x40, 64x48, 64x32, I noticed all of the smaller displays use a column address offset which is exactly 1/2 of the remaining pixels. eg.

  • on a 64px wide display, there's 32px offset each side (32+64+32=128)
  • on a 72px wide display, there's 28px offset each side (28+72+28=128)

In show(), rather than hard coding to 32 when the width is 64, I've made it calculate it based on the display width, which was tested on each of the above display dimensions.

@mcauser
Copy link
Contributor Author

mcauser commented Jun 17, 2021

Tests:

128x64-1306

128x64-1315

128x32

72x40

^ pcb silk incorrectly describes this as Dots 70x40, but it's really a 72x40. Fixed on newer pcb revisions.

64x48

64x32

The only display I don't own and haven't tested against is a 96x16.

@dpgeorge
Copy link
Member

Thank you, looks good to me.

@dpgeorge
Copy link
Member

Merged in bc7822d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants