OLED #rp2040 C++ library gets a blocking boost

I’m continuing to refine my OLED I2C library. I sped up the library 10X by the simple expedient of increasing the baudrate of the I2C transfer. Transferring a whole 128×64 bitmap to OLED still took about 12ms.

I wanted more speed! So introduced a function called ssd1306_display_cell(), which transfers a “cell” at a time: basically an 8×8 grid of pixels. A cell transfer takes 117us, which is a vast improvement over the 100ms that my original version was using.

Now, admittedly, the original transferred the whole screen in a oner, whereas the new function would need several rounds in the loop for a whole screen. But it has the advantage that you can round-robin other tasks in your main polling loop without hideous blocking by the screen function.

I hope that someone finds it of use. I certainly plan on using it for my synth project for the Pico. Perhaps things can be sped up even more by using DMA, but I’m somewhat fearful of opening that particular can of worms. I’ve managed to get memory-to-memory DMA working on the Pico, so I’m hoping that communicating with a peripheral won’t be too much harder.

About mcturra2000

Computer programmer living in Scotland.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s