Graphic Display v1.0.0
Control any mochrome display, with any microcontroller, in any amount.
Loading...
Searching...
No Matches
ssd1306.h
Go to the documentation of this file.
1/*
2 * ssd1306.h
3 *
4 * Created on: Jun 29, 2024
5 * Author: pablo-jean
6 */
7
8#ifndef DRIVERS_SSD1306_SSD1306_H_
9#define DRIVERS_SSD1306_SSD1306_H_
10
11/*
12 * Includes
13 */
14
15#include <assert.h>
16#include <malloc.h>
17#include <stdint.h>
18#include <stdio.h>
19#include <stdlib.h>
20#include <stddef.h>
21#include <stdbool.h>
22#include <string.h>
23
24#include "ssd1306_defs.h"
25
26/*
27 * Macros
28 */
29
30#define SSD1306_OK 0
31#define SSD1306_FAIL 1
32
33#define SSD1306_COLOR_BLACK 0
34#define SSD1306_COLOR_WHITE 1
35
36/*
37 * Enumerates
38 */
39
44
45/*
46 * Structs
47 */
48
49typedef void (*fxnDelay_ms)(uint32_t ms);
50typedef void (*fxn1306_mtxLock)(void);
51typedef void (*fxn1306_mtxunlock)(void);
52
53typedef uint8_t (*fxn1306i2c_write)(uint8_t i2cAddr, uint8_t reg, uint8_t *buff, uint32_t len);
54
55typedef void (*fxn1306spi_cs)(uint8_t Signal);
56typedef void (*fxn1306spi_dc)(uint8_t Signal);
57typedef void (*fxn1306spi_reset)(uint8_t Signal);
58typedef uint8_t (*fxn1306spi_write)(uint8_t *buff, uint32_t len);
59
86
112
113/*
114 * Publics
115 */
116
117uint8_t SSD1306_Init(ssd1306_t *ssd1306, ssd1306_params_t *params);
118
119uint8_t SSD1306_SetFrameBuffer(ssd1306_t *ssd1306, uint8_t *pu8FrameBuffer);
120
121uint8_t SSD1306_SetContrast(ssd1306_t *ssd1306, uint8_t level);
122
123uint8_t SSD1306_SetDisplayOn(ssd1306_t *ssd1306, bool on);
124
125uint8_t SSD1306_Refresh(ssd1306_t *ssd1306);
126
127uint8_t SSD1306_Write(ssd1306_t *ssd1306, uint32_t x, uint32_t y, bool color);
128
129uint8_t SSD1306_Fill(ssd1306_t *ssd1306, uint8_t color);
130
131#endif /* DRIVERS_SSD1306_SSD1306_H_ */
void(* fxn1306spi_dc)(uint8_t Signal)
Definition ssd1306.h:56
uint8_t SSD1306_Write(ssd1306_t *ssd1306, uint32_t x, uint32_t y, bool color)
Definition ssd1306.c:321
uint8_t(* fxn1306spi_write)(uint8_t *buff, uint32_t len)
Definition ssd1306.h:58
void(* fxn1306spi_reset)(uint8_t Signal)
Definition ssd1306.h:57
void(* fxnDelay_ms)(uint32_t ms)
Definition ssd1306.h:49
uint8_t SSD1306_SetDisplayOn(ssd1306_t *ssd1306, bool on)
Definition ssd1306.c:273
void(* fxn1306_mtxunlock)(void)
Definition ssd1306.h:51
uint8_t SSD1306_SetContrast(ssd1306_t *ssd1306, uint8_t level)
Definition ssd1306.c:259
uint8_t SSD1306_Fill(ssd1306_t *ssd1306, uint8_t color)
Definition ssd1306.c:349
uint8_t SSD1306_Init(ssd1306_t *ssd1306, ssd1306_params_t *params)
Definition ssd1306.c:112
uint8_t SSD1306_Refresh(ssd1306_t *ssd1306)
Definition ssd1306.c:289
void(* fxn1306_mtxLock)(void)
Definition ssd1306.h:50
void(* fxn1306spi_cs)(uint8_t Signal)
Definition ssd1306.h:55
ssd1306_mode_e
Definition ssd1306.h:40
@ SSD1306_MODE_I2C
Definition ssd1306.h:41
@ SSD1306_MODE_SPI
Definition ssd1306.h:42
uint8_t SSD1306_SetFrameBuffer(ssd1306_t *ssd1306, uint8_t *pu8FrameBuffer)
Definition ssd1306.c:247
uint8_t(* fxn1306i2c_write)(uint8_t i2cAddr, uint8_t reg, uint8_t *buff, uint32_t len)
Definition ssd1306.h:53
Definition ssd1306.h:87
uint32_t u32Width
Definition ssd1306.h:90
fxn1306i2c_write i2cWrite
Definition ssd1306.h:105
ssd1306_mode_e Mode
Definition ssd1306.h:88
bool bMirrorHorz
Definition ssd1306.h:95
uint32_t u32Heigth
Definition ssd1306.h:91
fxn1306_mtxLock mtxLock
Definition ssd1306.h:102
fxn1306spi_cs spiCs
Definition ssd1306.h:107
fxn1306spi_reset spiReset
Definition ssd1306.h:109
bool bUseExternalFrameBuffer
Definition ssd1306.h:93
bool bInverseColor
Definition ssd1306.h:96
fxnDelay_ms delayMs
Definition ssd1306.h:100
uint32_t u32Offset
Definition ssd1306.h:89
fxn1306spi_dc spiDc
Definition ssd1306.h:108
fxn1306spi_write spiWrite
Definition ssd1306.h:110
fxn1306_mtxunlock mtxUnlock
Definition ssd1306.h:103
uint8_t u8I2CAddr
Definition ssd1306.h:92
bool bMirrorVert
Definition ssd1306.h:94
Definition ssd1306.h:60
fxn1306spi_cs spiCs
Definition ssd1306.h:71
fxn1306_mtxunlock mtxUnlock
Definition ssd1306.h:67
uint32_t u32Heigth
Definition ssd1306.h:81
fxn1306spi_dc spiDc
Definition ssd1306.h:72
bool bInitialized
Definition ssd1306.h:77
fxn1306spi_reset spiReset
Definition ssd1306.h:73
ssd1306_mode_e Mode
Definition ssd1306.h:61
uint8_t u8I2CAddr
Definition ssd1306.h:83
fxn1306_mtxLock mtxLock
Definition ssd1306.h:66
uint32_t u32Offset
Definition ssd1306.h:82
fxnDelay_ms delayMs
Definition ssd1306.h:64
uint32_t u32Width
Definition ssd1306.h:80
fxn1306spi_write spiWrite
Definition ssd1306.h:74
uint8_t * pu8FrameBuffer
Definition ssd1306.h:79
fxn1306i2c_write i2cWrite
Definition ssd1306.h:69
uint32_t u32FrameSize
Definition ssd1306.h:78