SSD1306 OLED display driver 1.7.8 This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays

ssd1306_1bit.h
Go to the documentation of this file.
1 /*
2 MIT License
3
4 Copyright (c) 2016-2018, 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_1BIT_H_
30 #define _SSD1306_1BIT_H_
31
32 #include "nano_gfx_types.h"
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
39 // DIRECT GRAPH FUNCTIONS
41
60 void ssd1306_setPos(uint8_t x, uint8_t y);
61
65 void ssd1306_fillScreen(uint8_t fill_Data);
66
70 void ssd1306_clearScreen(void);
71
76 void ssd1306_negativeMode(void);
77
82 void ssd1306_positiveMode(void);
83
98 uint8_t ssd1306_printFixed(uint8_t xpos, uint8_t y, const char *ch, EFontStyle style);
99
115 uint8_t ssd1306_printFixed2x(uint8_t xpos, uint8_t y, const char ch[], EFontStyle style) __attribute__ ((deprecated));
116
136 uint8_t ssd1306_printFixedN(uint8_t xpos, uint8_t y, const char ch[], EFontStyle style, uint8_t factor);
137
145 size_t ssd1306_write(uint8_t ch);
146
154 size_t ssd1306_print(const char ch[]);
155
165 uint8_t ssd1306_charF6x8(uint8_t x, uint8_t y,
166 const char ch[],
167 EFontStyle style
168 #ifdef __cplusplus
169 = STYLE_NORMAL
170 #endif
171 ) __attribute__ ((deprecated));
172
182 uint8_t ssd1306_charF12x16(uint8_t xpos,
183 uint8_t y,
184 const char ch[],
185 EFontStyle style) __attribute__ ((deprecated));
186
187
201 uint8_t ssd1306_charF6x8_eol(uint8_t left,
202 uint8_t y,
203 const char ch[],
204 EFontStyle style,
205 uint8_t right) __attribute__ ((deprecated));
206
219 void ssd1306_putPixel(uint8_t x, uint8_t y);
220
235 void ssd1306_putPixels(uint8_t x, uint8_t y, uint8_t pixels);
236
244 void ssd1306_drawRect(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2);
245
258 void ssd1306_drawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2);
259
266 void ssd1306_drawHLine(uint8_t x1, uint8_t y1, uint8_t x2);
267
274 void ssd1306_drawVLine(uint8_t x1, uint8_t y1, uint8_t y2);
275
292 void ssd1306_drawBuffer(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *buf);
293
312 void ssd1306_drawBufferFast(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buf);
313
317 #define ssd1306_drawCanvas(x, y, w, h, buf) ssd1306_drawBuffer(x, y, w, h, buf)
318
328 void ssd1306_drawBitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *buf);
329
339 void gfx_drawMonoBitmap(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buf);
340
349 void ssd1306_clearBlock(uint8_t x, uint8_t y, uint8_t w, uint8_t h);
350
358 void ssd1306_drawSpriteEx(uint8_t x, uint8_t y, uint8_t w, const uint8_t *sprite);
359
365 void ssd1306_drawSprite(SPRITE *sprite);
366
371 void ssd1306_eraseSprite(SPRITE *sprite);
372
377 void ssd1306_eraseTrace(SPRITE *sprite);
378
387 SPRITE ssd1306_createSprite(uint8_t x, uint8_t y, uint8_t w, const uint8_t *data);
388
395 void ssd1306_replaceSprite(SPRITE *sprite, const uint8_t *data);
396
398 // HIGH-LEVEL GRAPH FUNCTIONS
400
404 typedef struct
405 {
407 const char **items;
409 uint8_t count;
411 uint8_t selection;
413 uint8_t oldSelection;
415 uint8_t scrollPosition;
416 } SAppMenu;
417
427 void ssd1306_createMenu(SAppMenu *menu, const char **items, uint8_t count);
428
437 void ssd1306_showMenu(SAppMenu *menu);
438
447 void ssd1306_showMenu8(SAppMenu *menu);
448
449 #ifndef DOXYGEN_SHOULD_SKIP_THIS
450 static inline void ssd1331_showMenu8(SAppMenu *menu)
451 {
452 ssd1306_showMenu8(menu);
453 }
454 #endif
455
462 void ssd1306_updateMenu(SAppMenu *menu);
463
472 void ssd1306_updateMenu8(SAppMenu *menu);
473
474 #ifndef DOXYGEN_SHOULD_SKIP_THIS
475 static inline void ssd1331_updateMenu8(SAppMenu *menu)
476 {
477 ssd1306_updateMenu8(menu);
478 }
479 #endif
480
489 uint8_t ssd1306_menuSelection(SAppMenu *menu);
490
498 void ssd1306_menuDown(SAppMenu *menu);
499
507 void ssd1306_menuUp(SAppMenu *menu);
508
513 #ifdef __cplusplus
514 }
515 #endif
516
517 #endif // _SSD1306_1BIT_H_
ssd1306_drawBuffer
void ssd1306_drawBuffer(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *buf)
Definition: ssd1306_1bit.c:657
ssd1306_charF6x8
uint8_t ssd1306_charF6x8(uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) __attribute__((deprecated))
Definition: ssd1306_1bit.c:388
ssd1306_putPixels
void ssd1306_putPixels(uint8_t x, uint8_t y, uint8_t pixels)
Definition: ssd1306_1bit.c:531
ssd1306_positiveMode
void ssd1306_positiveMode(void)
Definition: ssd1306_1bit.c:875
ssd1306_createMenu
void ssd1306_createMenu(SAppMenu *menu, const char **items, uint8_t count)
Definition: ssd1306_menu.c:41
ssd1306_createSprite
SPRITE ssd1306_createSprite(uint8_t x, uint8_t y, uint8_t w, const uint8_t *data)
Definition: ssd1306_1bit.c:860
ssd1306_printFixed2x
uint8_t ssd1306_printFixed2x(uint8_t xpos, uint8_t y, const char ch[], EFontStyle style) __attribute__((deprecated))
Definition: ssd1306_1bit.c:161
ssd1306_drawLine
void ssd1306_drawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2)
Definition: ssd1306_1bit.c:558
ssd1306_printFixed
uint8_t ssd1306_printFixed(uint8_t xpos, uint8_t y, const char *ch, EFontStyle style)
Definition: ssd1306_1bit.c:78
ssd1306_drawSprite
void ssd1306_drawSprite(SPRITE *sprite)
Definition: ssd1306_1bit.c:775
ssd1306_drawRect
void ssd1306_drawRect(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2)
Definition: ssd1306_1bit.c:636
ssd1306_fillScreen
void ssd1306_fillScreen(uint8_t fill_Data)
Definition: ssd1306_1bit.c:49
ssd1306_menuSelection
uint8_t ssd1306_menuSelection(SAppMenu *menu)
Definition: ssd1306_menu.c:151
ssd1306_eraseTrace
void ssd1306_eraseTrace(SPRITE *sprite)
Definition: ssd1306_1bit.c:823
ssd1306_showMenu
void ssd1306_showMenu(SAppMenu *menu)
Definition: ssd1306_menu.c:91
ssd1306_updateMenu
void ssd1306_updateMenu(SAppMenu *menu)
Definition: ssd1306_menu.c:113
ssd1306_drawBitmap
void ssd1306_drawBitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *buf)
Definition: ssd1306_1bit.c:672
gfx_drawMonoBitmap
void gfx_drawMonoBitmap(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buf)
Definition: ssd1306_1bit.c:690
SPRITE
Definition: nano_gfx_types.h:135
ssd1306_print
size_t ssd1306_print(const char ch[])
Prints null-terminated string to display at current cursor position.
Definition: ssd1306_1bit.c:377
ssd1306_charF12x16
uint8_t ssd1306_charF12x16(uint8_t xpos, uint8_t y, const char ch[], EFontStyle style) __attribute__((deprecated))
Definition: ssd1306_1bit.c:434
ssd1306_eraseSprite
void ssd1306_eraseSprite(SPRITE *sprite)
Definition: ssd1306_1bit.c:801
ssd1306_drawVLine
void ssd1306_drawVLine(uint8_t x1, uint8_t y1, uint8_t y2)
Definition: ssd1306_1bit.c:612
nano_gfx_types.h
ssd1306_menuUp
void ssd1306_menuUp(SAppMenu *menu)
Definition: ssd1306_menu.c:168
ssd1306_drawSpriteEx
void ssd1306_drawSpriteEx(uint8_t x, uint8_t y, uint8_t w, const uint8_t *sprite)
Definition: ssd1306_1bit.c:763
ssd1306_updateMenu8
void ssd1306_updateMenu8(SAppMenu *menu)
Definition: ssd1306_menu.c:132
ssd1306_menuDown
void ssd1306_menuDown(SAppMenu *menu)
Definition: ssd1306_menu.c:156
ssd1306_printFixedN
uint8_t ssd1306_printFixedN(uint8_t xpos, uint8_t y, const char ch[], EFontStyle style, uint8_t factor)
Definition: ssd1306_1bit.c:242
ssd1306_setPos
void ssd1306_setPos(uint8_t x, uint8_t y)
ssd1306_drawHLine
void ssd1306_drawHLine(uint8_t x1, uint8_t y1, uint8_t x2)
Definition: ssd1306_1bit.c:602
ssd1306_clearBlock
void ssd1306_clearBlock(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
Definition: ssd1306_1bit.c:747
ssd1306_showMenu8
void ssd1306_showMenu8(SAppMenu *menu)
Definition: ssd1306_menu.c:102
ssd1306_charF6x8_eol
uint8_t ssd1306_charF6x8_eol(uint8_t left, uint8_t y, const char ch[], EFontStyle style, uint8_t right) __attribute__((deprecated))
Definition: ssd1306_1bit.c:509
ssd1306_clearScreen
void ssd1306_clearScreen(void)
Definition: ssd1306_1bit.c:64
ssd1306_replaceSprite
void ssd1306_replaceSprite(SPRITE *sprite, const uint8_t *data)
Definition: ssd1306_1bit.c:865
EFontStyle
EFontStyle
Definition: nano_gfx_types.h:58
ssd1306_drawBufferFast
void ssd1306_drawBufferFast(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buf)
Definition: ssd1306_1bit.c:644
ssd1306_negativeMode
void ssd1306_negativeMode(void)
Definition: ssd1306_1bit.c:870
ssd1306_putPixel
void ssd1306_putPixel(uint8_t x, uint8_t y)
Definition: ssd1306_1bit.c:524
ssd1306_write
size_t ssd1306_write(uint8_t ch)
Prints single character to display at current cursor position.
Definition: ssd1306_1bit.c:343