Skip to content

Conversation

@mjcross
Copy link
Contributor

@mjcross mjcross commented Dec 29, 2025

Add an example of how to attach one of the widely available small OLED displays based on the SSD1309 controller via SPI, complementing the existing SSD1306 example that uses i2c. In fact the two controllers have the same command set so the example should work on either (but I don't have an SSD1306 to test).
For many applications the SPI interface might be a better bet, as it runs a lot faster (10Mbit/sec).

@mjcross
Copy link
Contributor Author

mjcross commented Dec 29, 2025

Incidentally I've also created a similar version that uses a frame buffer updated via DMA direct to the SPI peripheral; but I'll submit that as a separate PR. This version is much easier to understand.



int main() {
stdio_init_all();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example doesn't seem to actually use stdio?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct - but I thought it might be wise to enable it in case of runtime error messages... What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this one up to @peterharperuk 🙂

@peterharperuk peterharperuk self-assigned this Dec 30, 2025
@lurch
Copy link
Contributor

lurch commented Dec 30, 2025

Thank you for the high-quality example 👍
Sorry if I went a bit overboard on the number of comments.

@mjcross
Copy link
Contributor Author

mjcross commented Dec 30, 2025

Thank you for the high-quality example 👍 Sorry if I went a bit overboard on the number of comments.

You're more than welcome! I wanted to use one of these displays in a current project, and writing it up as an example encourages me to do a better job. Your comments are really helpful and always on point :-)

I'll be interested to see what you think of the DMA frame-buffer version, which should be ready in the next day or two. First time I've dipped my toe into using DMA and it's a really well designed API 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants