Many probably know about such small cheap (less than $ 3) OLED displays, which can be found in a huge range on ebay or aliexpress. There are many different articles on the Internet on how to connect these displays to Arduino and other MCs, but for the STM32f10x it is difficult to find even a library. Therefore, I decided to write this article.| ssd1306_i2c.c ssd1306_i2c.h | Interface for working with I2C |
| ssd1306.c ssd1306.h | Library to work with the display. Represents methods for drawing on the display, outputting text, and outputting everything to oled. |
| fonts.c fonts.h | Fonts for displaying text on the screen. There are three fonts, but you can create any of your own using this program or analogs. |
| Vcc | + 3.3V. Allowable voltage - from 3.3V to 5V |
| GND | GND |
| SCL | PB6 |
| SDA | PB7 |

#include "ssd1306.h" SSD1306_Init(); SSD1306_GotoXY(0, 44); // 0;44. , . SSD1306_Puts("Hello, habrahabr!!", &Font_7x10, SSD1306_COLOR_WHITE); // "Font_7x10" . SSD1306_DrawCircle(10, 33, 7, SSD1306_COLOR_WHITE); // 10;33 7 SSD1306_UpdateScreen(); SSD1306_Fill(SSD1306_COLOR_BLACK); uint8_t SSD1306_Init(); // SSD1306_UpdateScreen(); // SSD1306_ToggleInvert(); // SSD1306_Fill(SSD1306_COLOR_t Color); // SSD1306_DrawPixel(uint16_t x, uint16_t y, SSD1306_COLOR_t color); // SSD1306_GotoXY(uint16_t x, uint16_t y); // SSD1306_Putc(char ch, FontDef_t* Font, SSD1306_COLOR_t color); // h SSD1306_Puts(char* str, FontDef_t* Font, SSD1306_COLOR_t color); // str SSD1306_DrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, SSD1306_COLOR_t c); // SSD1306_DrawRectangle(uint16_t x, uint16_t y, uint16_t w, uint16_t h, SSD1306_COLOR_t c); // SSD1306_DrawFilledRectangle(uint16_t x, uint16_t y, uint16_t w, uint16_t h, SSD1306_COLOR_t c); // SSD1306_DrawTriangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, SSD1306_COLOR_t color); // SSD1306_DrawCircle(int16_t x0, int16_t y0, int16_t r, SSD1306_COLOR_t c); // r SSD1306_DrawFilledCircle(int16_t x0, int16_t y0, int16_t r, SSD1306_COLOR_t c); // Source: https://habr.com/ru/post/313490/
All Articles