A simple library for using an I2C SH1106 display with STM32.
(Ignoring HAL autogenerated code)
int main(void)
{
char text[] = "Hello World";
SH1106_Init();
SH1106_DrawHollowRect(29, 23, 97, 41, 1, BLUE);
SH1106_WriteChars(32, 25, text, sizeof(text) - 1, Arial_12pt);
}
You can also turn ON/OFF the display with
SH1106_DisplayON()
and SH1106_DisplayOFF()
. For other functions, see the library header file Inc/sh1106.h
.
"The Dot Factory" has been used to generate the fonts (http://www.eran.io/the-dot-factory-an-lcd-font-and-image-generator/). With this program, you can generate bitmaps for any font you like. The only setting that you have to modify is "rotation": you have to put it to "90°", otherwise the font won't be printed correctly. Everything else can be left as-is - for more info check the readme file in Src
.
You can use any program to generate bitmaps for an image. For this project, I specifically used "LCD Assistant". The byte orientation has to be set to Vertical, with 8 pixels per byte. For more info check the readme file in Src
.