SSD1306 OLED display driver  1.7.6
This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
ssd1306_8bit.h
Go to the documentation of this file.
1 /*
2  MIT License
3 
4  Copyright (c) 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 */
28 #ifndef _SSD1306_8BIT_H_
29 #define _SSD1306_8BIT_H_
30 
31 #include "nano_gfx_types.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
38 // DIRECT GRAPH FUNCTIONS
40 
60 void ssd1306_setColor(uint16_t color);
61 
73 void ssd1306_setRgbColor(uint8_t r, uint8_t g, uint8_t b);
74 
85 void ssd1306_drawMonoBuffer8(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap);
86 
97 void ssd1306_drawBufferFast8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *data);
98 
104 void ssd1306_fillScreen8(uint8_t fill_Data);
105 
109 void ssd1306_clearScreen8(void);
110 
119 void ssd1306_putPixel8(lcdint_t x, lcdint_t y);
120 
130 void ssd1306_drawVLine8(lcdint_t x1, lcdint_t y1, lcdint_t y2);
131 
141 void ssd1306_drawHLine8(lcdint_t x1, lcdint_t y1, lcdint_t x2);
142 
155 void ssd1306_drawLine8(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2);
156 
169 void ssd1306_drawRect8(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2);
170 
183 void ssd1306_fillRect8(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2);
184 
197 void ssd1306_drawMonoBitmap8(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap);
198 
209 void ssd1306_drawBitmap8(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap);
210 
219 void ssd1306_clearBlock8(uint8_t x, uint8_t y, uint8_t w, uint8_t h);
220 
227 void ssd1306_setCursor8(lcduint_t x, lcduint_t y);
228 
237 void ssd1306_printChar8(uint8_t c);
238 
248 size_t ssd1306_write8(uint8_t ch);
249 
259 size_t ssd1306_print8(const char ch[]);
260 
272 uint8_t ssd1306_printFixed8(lcdint_t x, lcdint_t y, const char *ch, EFontStyle style);
273 
274 
275 #ifndef DOXYGEN_SHOULD_SKIP_THIS
276 
278 // FUNCTIONS BELOW ARE ONLY FOR COMPATIBILITY WITH PREVIOUSE VERSIONS OF LIBRARY
279 
280 static inline void ssd1331_setColor(uint16_t color)
281 {
282  ssd1306_setColor(color);
283 }
284 
285 static inline void ssd1331_setRgbColor(uint8_t r, uint8_t g, uint8_t b)
286 {
287  ssd1306_setRgbColor(r, g, b);
288 }
289 
290 static inline void ssd1331_drawMonoBuffer8(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
291 {
292  ssd1306_drawMonoBuffer8(xpos, ypos, w, h, bitmap);
293 }
294 
295 static inline void ssd1331_drawBufferFast8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *data)
296 {
297  ssd1306_drawBufferFast8(x, y, w, h, data);
298 }
299 
300 static inline void ssd1331_fillScreen8(uint8_t fill_Data)
301 {
302  ssd1306_fillScreen8(fill_Data);
303 }
304 
305 static inline void ssd1331_clearScreen8(void)
306 {
308 }
309 
310 static inline void ssd1331_putPixel8(lcdint_t x, lcdint_t y)
311 {
312  ssd1306_putPixel8(x, y);
313 }
314 
315 static inline void ssd1331_drawVLine8(lcdint_t x1, lcdint_t y1, lcdint_t y2)
316 {
317  ssd1306_drawVLine8(x1, y1, y2);
318 }
319 
320 static inline void ssd1331_drawHLine8(lcdint_t x1, lcdint_t y1, lcdint_t x2)
321 {
322  ssd1306_drawHLine8(x1, y1, x2);
323 }
324 
325 static inline void ssd1331_drawLine8(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
326 {
327  ssd1306_drawLine8(x1, y1, x2, y2);
328 }
329 
330 static inline void ssd1331_drawRect8(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
331 {
332  ssd1306_drawRect8(x1, y1, x2, y2);
333 }
334 
335 static inline void ssd1331_fillRect8(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
336 {
337  ssd1306_fillRect8(x1, y1, x2, y2);
338 }
339 
340 static inline void ssd1331_drawMonoBitmap8(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
341 {
342  ssd1306_drawMonoBitmap8(xpos, ypos, w, h, bitmap);
343 }
344 
345 static inline void ssd1331_drawBitmap8(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
346 {
347  ssd1306_drawBitmap8(xpos, ypos, w, h, bitmap);
348 }
349 
350 static inline void ssd1331_clearBlock8(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
351 {
352  ssd1306_clearBlock8(x, y, w, h);
353 }
354 
355 static inline void ssd1331_setCursor8(lcduint_t x, lcduint_t y)
356 {
357  ssd1306_setCursor8(x, y);
358 }
359 
360 static inline void ssd1331_printChar8(uint8_t c)
361 {
363 }
364 
365 static inline size_t ssd1331_write8(uint8_t ch)
366 {
367  return ssd1306_write8(ch);
368 }
369 
370 static inline size_t ssd1331_print8(const char ch[])
371 {
372  return ssd1306_print8(ch);
373 }
374 
375 static inline uint8_t ssd1331_printFixed8(lcdint_t x, lcdint_t y, const char *ch, EFontStyle style)
376 {
377  return ssd1306_printFixed8(x, y, ch, style);
378 }
379 
380 #endif
381 
386 #ifdef __cplusplus
387 }
388 #endif
389 
390 #endif // _SSD1306_8BIT_H_
void ssd1306_drawMonoBuffer8(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
Definition: ssd1306_8bit.c:53
void ssd1306_setCursor8(lcduint_t x, lcduint_t y)
Definition: ssd1306_8bit.c:265
void ssd1306_drawRect8(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
Definition: ssd1306_8bit.c:184
uint8_t ssd1306_printFixed8(lcdint_t x, lcdint_t y, const char *ch, EFontStyle style)
Definition: ssd1306_8bit.c:347
void ssd1306_drawVLine8(lcdint_t x1, lcdint_t y1, lcdint_t y2)
Definition: ssd1306_8bit.c:119
void ssd1306_printChar8(uint8_t c)
Definition: ssd1306_8bit.c:271
void ssd1306_setColor(uint16_t color)
Sets default color, generated by RGB_COLOR8 or RGB_COLOR16 macros.
Definition: ssd1306_8bit.c:43
void ssd1306_drawLine8(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
Definition: ssd1306_8bit.c:141
void ssd1306_clearBlock8(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
Definition: ssd1306_8bit.c:254
void ssd1306_setRgbColor(uint8_t r, uint8_t g, uint8_t b)
Sets default color.
Definition: ssd1306_8bit.c:48
void ssd1306_putPixel8(lcdint_t x, lcdint_t y)
Definition: ssd1306_8bit.c:112
void ssd1306_drawHLine8(lcdint_t x1, lcdint_t y1, lcdint_t x2)
Definition: ssd1306_8bit.c:130
size_t ssd1306_print8(const char ch[])
Prints null-terminated string to display at current cursor position.
Definition: ssd1306_8bit.c:336
void ssd1306_drawBufferFast8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *data)
Definition: ssd1306_8bit.c:84
void ssd1306_clearScreen8(void)
Definition: ssd1306_8bit.c:107
void ssd1306_drawBitmap8(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
Definition: ssd1306_8bit.c:242
size_t ssd1306_write8(uint8_t ch)
Prints single character to display at current cursor position.
Definition: ssd1306_8bit.c:293
void ssd1306_drawMonoBitmap8(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
Definition: ssd1306_8bit.c:211
void ssd1306_fillRect8(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
Definition: ssd1306_8bit.c:192
EFontStyle
void ssd1306_fillScreen8(uint8_t fill_Data)
Definition: ssd1306_8bit.c:96