Six months ago II stumbled on a project by Stefan Wagner which exploits a nice feature of the OLED controller, once it's properly configured, you can write 8 bits row (called PAGE0 to PAGE7) at the same time for every column (SEG0 to SEG127).

The brilliant solution of Stefan was to use a very compact 5x8 pixel font. In this way, you can write characters on the display with just five 1 byte length write. The controller is smart enough to auto increment the next location (column) without the need to re-send the address.

Sending characters to the display in this manner is fast, compact, and reliable, you can even use low-speed I2C and have a very good display update rate. If the display is used to show scalar values like showed in the pictures you just need to write the new values instead to update the entire video memory.

The driver was designed to run on the ATtiny family, and the original character magnification was quite crude, I believe the original author was more focused on the overall footprint of the driver.

In any case, the project was a great starting point, the source code has been rearranged to be easily integrated into the STM32 Cube IDE to be used with the STM32 CPU family. It uses the standard HAL I2C write function.

The character generation was improved, now the driver has the ability to draw three different character sizes: basic 5x8, 10x16 which is very readable, but still compact, and a 15x24 ideal for clock application.

The character set can be expanded with custom symbols to draw some basic graphics like in the old MS-DOS era...

The driver includes basic additional functions to control contrast and switch the display on-off. The screen can be easily flipped by changing the SSD1306_INIT_LEN to 20

The project is licensed with its original one: Creative Commons Attribution-ShareAlike 3.0