SSD1306 OLED display driver  1.8.2
This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
ssd1306_generic.h
Go to the documentation of this file.
1 /*
2  MIT License
3 
4  Copyright (c) 2016-2019, Alexey Dynda
5 
6  Permission is hereby granted, free of charge, to any person obtaining a copy
7  of this software and associated documentation files (the "Software"), to deal
8  in the Software without restriction, including without limitation the rights
9  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  copies of the Software, and to permit persons to whom the Software is
11  furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in all
14  copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  SOFTWARE.
23 */
29 #ifndef _SSD1306_GENERIC_H_
30 #define _SSD1306_GENERIC_H_
31 
32 #include "nano_gfx_types.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
39 // GENERIC GRAPH FUNCTIONS
41 
43 #define SSD1306_MORE_CHARS_REQUIRED 0xffff
44 
58 void ssd1306_setPos(uint8_t x, uint8_t y);
59 
67 void ssd1306_setCursor(lcdint_t x, lcdint_t y);
68 
75 void ssd1306_setFixedFont(const uint8_t * progmemFont);
76 
77 #ifndef DOXYGEN_SHOULD_SKIP_THIS
78 void ssd1306_setFixedFont_oldStyle(const uint8_t * progmemFont);
79 #endif
80 
88 void ssd1306_setFreeFont(const uint8_t * progmemFont);
89 
97 void ssd1306_setSecondaryFont(const uint8_t * progmemUnicode);
98 
110 void ssd1306_setFont6x8(const uint8_t * progmemFont) __attribute__ ((deprecated));
111 
125 void ssd1306_getCharBitmap(uint16_t ch, SCharInfo *info);
126 
131 void ssd1306_enableUtf8Mode(void);
132 
136 void ssd1306_enableAsciiMode(void);
137 
138 #ifndef DOXYGEN_SHOULD_SKIP_THIS
139 
145 void ssd1306_setSquixFont(const uint8_t * progmemFont);
146 
154 uint16_t ssd1306_unicode16FromUtf8(uint8_t ch);
155 #endif
156 
163 lcduint_t ssd1306_getTextSize(const char *text, lcduint_t *height);
164 
165 
167 // HIGH-LEVEL GRAPH FUNCTIONS
169 
173 typedef struct
174 {
176  const char **items;
178  uint8_t count;
180  uint8_t selection;
182  uint8_t oldSelection;
184  uint8_t scrollPosition;
185 } SAppMenu;
186 
196 void ssd1306_createMenu(SAppMenu *menu, const char **items, uint8_t count);
197 
206 void ssd1306_showMenu(SAppMenu *menu);
207 
216 void ssd1306_showMenu8(SAppMenu *menu);
217 
226 void ssd1306_showMenu16(SAppMenu *menu);
227 
228 #ifndef DOXYGEN_SHOULD_SKIP_THIS
229 static inline void ssd1331_showMenu8(SAppMenu *menu)
230 {
231  ssd1306_showMenu8(menu);
232 }
233 #endif
234 
241 void ssd1306_updateMenu(SAppMenu *menu);
242 
251 void ssd1306_updateMenu8(SAppMenu *menu);
252 
261 void ssd1306_updateMenu16(SAppMenu *menu);
262 
263 #ifndef DOXYGEN_SHOULD_SKIP_THIS
264 static inline void ssd1331_updateMenu8(SAppMenu *menu)
265 {
266  ssd1306_updateMenu8(menu);
267 }
268 #endif
269 
278 uint8_t ssd1306_menuSelection(SAppMenu *menu);
279 
287 void ssd1306_menuDown(SAppMenu *menu);
288 
296 void ssd1306_menuUp(SAppMenu *menu);
297 
302 void ssd1306_drawProgressBar(int8_t progress);
303 
308 void ssd1306_drawProgressBar8(int8_t progress);
309 
314 #ifdef __cplusplus
315 }
316 #endif
317 
318 #endif // _SSD1306_GENERIC_H_
void ssd1306_setSecondaryFont(const uint8_t *progmemUnicode)
void ssd1306_createMenu(SAppMenu *menu, const char **items, uint8_t count)
Definition: ssd1306_menu.c:49
void ssd1306_updateMenu(SAppMenu *menu)
Definition: ssd1306_menu.c:159
void ssd1306_drawProgressBar8(int8_t progress)
Definition: ssd1306_menu.c:272
void ssd1306_updateMenu16(SAppMenu *menu)
Definition: ssd1306_menu.c:197
void ssd1306_setFixedFont(const uint8_t *progmemFont)
void ssd1306_setFreeFont(const uint8_t *progmemFont)
void ssd1306_drawProgressBar(int8_t progress)
Definition: ssd1306_menu.c:245
void ssd1306_setFont6x8(const uint8_t *progmemFont) __attribute__((deprecated))
void ssd1306_enableAsciiMode(void)
uint8_t selection
currently selected item. Internally updated.
uint8_t scrollPosition
position of menu scrolling. Internally updated
uint8_t count
count of menu items in the menu
void ssd1306_setCursor(lcdint_t x, lcdint_t y)
Sets cursor position for text mode print functions.
lcduint_t ssd1306_getTextSize(const char *text, lcduint_t *height)
void ssd1306_menuDown(SAppMenu *menu)
Definition: ssd1306_menu.c:221
void ssd1306_updateMenu8(SAppMenu *menu)
Definition: ssd1306_menu.c:178
void ssd1306_showMenu8(SAppMenu *menu)
Definition: ssd1306_menu.c:137
void ssd1306_getCharBitmap(uint16_t ch, SCharInfo *info)
returns char data for currently set (active) font.
uint8_t ssd1306_menuSelection(SAppMenu *menu)
Definition: ssd1306_menu.c:216
void ssd1306_showMenu(SAppMenu *menu)
Definition: ssd1306_menu.c:126
void ssd1306_menuUp(SAppMenu *menu)
Definition: ssd1306_menu.c:233
void ssd1306_enableUtf8Mode(void)
void ssd1306_setPos(uint8_t x, uint8_t y)
uint8_t oldSelection
selected item, when last redraw operation was performed. Internally updated.
const char ** items
list of menu items of the menu
void ssd1306_showMenu16(SAppMenu *menu)
Definition: ssd1306_menu.c:148