SSD1306 OLED display driver
1.5.0
This library is developed to control SSD1306/SSD1331 RGB i2c/spi OLED displays and spi PCD8544 LED display
|
i2c/spi initialization functions for different platforms More...
Macros | |
#define | SSD1306_SA 0x3C |
Functions | |
void | ssd1306_i2cInit (void) |
void | ssd1306_i2cInitEx (int8_t scl, int8_t sda, int8_t sa) |
void | ssd1306_i2cCommandStart (void) |
void | ssd1306_i2cDataStart (void) |
void | ssd1306_i2cInit_Embedded (int8_t scl, int8_t sda, uint8_t sa) |
void | ssd1306_i2cConfigure_Wire (int8_t scl, int8_t sda) |
void | ssd1306_i2cInit_Wire (uint8_t sa) |
void | ssd1306_sendCommand (uint8_t command) |
void | ssd1306_spiInit (int8_t cesPin, int8_t dcPin) |
void | ssd1306_spiCommandStart (void) |
void | ssd1306_spiDataStart (void) |
void | ssd1306_spiDataMode (uint8_t mode) |
Variables | |
uint8_t | ssd1306_dcQuickSwitch |
void(* | ssd1306_startTransmission )(void) |
void(* | ssd1306_endTransmission )(void) |
void(* | ssd1306_sendByte )(uint8_t data) |
void(* | ssd1306_closeInterface )(void) |
deinitializes internal resources, allocated for interface. More... | |
void(* | ssd1306_commandStart )(void) |
void(* | ssd1306_dataStart )(void) |
int8_t | s_ssd1306_cs |
int8_t | s_ssd1306_dc |
uint32_t | s_ssd1306_spi_clock |
uint8_t | ssd1306_dcQuickSwitch = 0 |
i2c/spi initialization functions for different platforms
This group of API functions serves to prepare the library to work via specific hardware interface. There are a bunch of functions for different platforms. In general display initialization goes in two steps: hardware interface initialization, and then display driver initialization. But there are functions, which combine 2 steps in single call: ssd1306_128x64_i2c_initEx(), ssd1351_128x128_spi_init(), etc.
#define SSD1306_SA 0x3C |
SSD1306_SA defines default i2c address of LCD display. Please, check your device. If you LCD device has different address, you can set different one via ssd1306_i2cInit_Wire() or ssd1306_i2cInit_Embedded() functions. Write command will be SSD1306_SA<<1 and read will be SSD1306_SA<<1 | 1
Definition at line 47 of file ssd1306_i2c_conf.h.
void ssd1306_i2cCommandStart | ( | void | ) |
Switches i2c chip to command transmission mode.
Definition at line 32 of file ssd1306_i2c_common.c.
void ssd1306_i2cConfigure_Wire | ( | int8_t | scl, |
int8_t | sda | ||
) |
Configures speed for standard Wire library (via Wire.begin()). This function is called by ssd1306_i2cInit().
scl | - i2c clock pin. Use -1 if you don't need to change default pin number |
sda | - i2c data pin. Use -1 if you don't need to change default pin number |
Definition at line 48 of file ssd1306_i2c_wire.cpp.
void ssd1306_i2cDataStart | ( | void | ) |
Switches i2c chip to data transmission mode.
Definition at line 38 of file ssd1306_i2c_common.c.
void ssd1306_i2cInit | ( | void | ) |
Inits display interface to use i2c bus. The function automatically selects available type of i2c implementation
Definition at line 59 of file ssd1306_i2c_common.c.
void ssd1306_i2cInit_Embedded | ( | int8_t | scl, |
int8_t | sda, | ||
uint8_t | sa | ||
) |
Initializes software implementation of i2c. If you do not know i2c parameters, try ssd1306_i2cInit_Embedded(0,0,0).
scl | - i2c clock pin. Use -1 if you don't need to change default pin number |
sda | - i2c data pin. Use -1 if you don't need to change default pin number |
sa | - i2c address of lcd display. Use 0 to leave default |
Definition at line 165 of file ssd1306_i2c_embedded.c.
void ssd1306_i2cInit_Wire | ( | uint8_t | sa | ) |
Initializes ssd1306 library to use Wire lib for i2c. If you do not know i2c parameters, try ssd1306_i2cInit_Wire(0). SCL and SDA pins depend on platform and Wire library implementation.
sa | - i2c address of lcd display. Use 0 to leave default |
Definition at line 94 of file ssd1306_i2c_wire.cpp.
void ssd1306_i2cInitEx | ( | int8_t | scl, |
int8_t | sda, | ||
int8_t | sa | ||
) |
Inits display interface to use i2c bus. The function automatically selects available type of i2c implementation
scl | - i2c clock pin. Use -1 if you don't need to change default pin number |
sda | - i2c data pin. Use -1 if you don't need to change default pin number |
sa | - i2c address of lcd display. Use 0 to leave default |
Definition at line 44 of file ssd1306_i2c_common.c.
void ssd1306_sendCommand | ( | uint8_t | command | ) |
Sends command to SSD1306 device: includes initiating of transaction, sending data and completing transaction.
command | - command to send |
Definition at line 37 of file ssd1306_interface.c.
void ssd1306_spiCommandStart | ( | void | ) |
Switches spi chip to command transmission mode.
Definition at line 53 of file ssd1306_spi.c.
void ssd1306_spiDataMode | ( | uint8_t | mode | ) |
Switches spi to data(1) or command(0) mode.
mode | - 1 data mode 0 command mode |
Definition at line 65 of file ssd1306_spi.c.
void ssd1306_spiDataStart | ( | void | ) |
Switches spi chip to data transmission mode.
Definition at line 59 of file ssd1306_spi.c.
void ssd1306_spiInit | ( | int8_t | cesPin, |
int8_t | dcPin | ||
) |
Inits lcd interface to use hardware spi for communication. The function automatically selects available type of spi implementation
cesPin | - pin, controlling chip enable of LCD |
dcPin | - pin, controlling data/command mode of LCD |
Definition at line 39 of file ssd1306_spi.c.
int8_t s_ssd1306_cs |
chip enable pin to controll lcd display over spi
Definition at line 35 of file ssd1306_spi.c.
int8_t s_ssd1306_dc |
data/command control pin for spi interface of lcd display
Definition at line 36 of file ssd1306_spi.c.
uint32_t s_ssd1306_spi_clock |
maximum SPI clock, supported by OLED display
Definition at line 37 of file ssd1306_spi.c.
void(* ssd1306_closeInterface) (void) |
deinitializes internal resources, allocated for interface.
Deinitializes internal resources, allocated for interface. There is no need to use this function for microcontrollers. In general the function has meaning in Linux-like systems.
Definition at line 35 of file ssd1306_interface.c.
void(* ssd1306_commandStart) (void) |
Starts transaction for sending commands.
Definition at line 33 of file ssd1306_interface.c.
void(* ssd1306_dataStart) (void) |
Starts transaction for sending bitmap data.
Definition at line 34 of file ssd1306_interface.c.
uint8_t ssd1306_dcQuickSwitch = 0 |
Indicates if display driver supports quick switching between data and command modes: 0 means "not supported quick switching", 1 means "quick switching is supported". Quick switching allows to switch driver between data and command modes without reestablishing communication session. For all i2c interfaces quick switching is not supported, because data or command mode is defined by first sent byte in i2c session. All spi interfaces support quick switching.
Definition at line 28 of file ssd1306_interface.c.
uint8_t ssd1306_dcQuickSwitch |
Indicates if display driver supports quick switching between data and command modes: 0 means "not supported quick switching", 1 means "quick switching is supported". Quick switching allows to switch driver between data and command modes without reestablishing communication session. For all i2c interfaces quick switching is not supported, because data or command mode is defined by first sent byte in i2c session. All spi interfaces support quick switching.
Definition at line 69 of file ssd1306_interface.h.
void(* ssd1306_endTransmission) (void) |
Ends communication with SSD1306 display.
Definition at line 31 of file ssd1306_interface.c.
void(* ssd1306_sendByte) (uint8_t data) |
Sends byte to SSD1306 device
data | - byte to send |
Definition at line 32 of file ssd1306_interface.c.
void(* ssd1306_startTransmission) (void) |
Starts communication with SSD1306 display.
Definition at line 30 of file ssd1306_interface.c.