File syn_charlcd.c¶
FileList > display > syn_charlcd.c
Go to the source code of this file
Generic Character LCD Driver (HD44780, ST7066, KS0066 over I2C PCF8574 or 4-Bit Parallel GPIO).
#include "syn_charlcd.h"#include "../util/syn_assert.h"#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| void | syn_charlcd_clear (SYN_CharLCD * lcd) Clear LCD screen and reset cursor to home (0,0). |
| void | syn_charlcd_create_char (SYN_CharLCD * lcd, uint8_t slot, const uint8_t charmap) Load a custom 5x8 pixel character into CGRAM. |
| SYN_Status | syn_charlcd_init_gpio (SYN_CharLCD * lcd, SYN_GPIO_Pin rs, SYN_GPIO_Pin en, SYN_GPIO_Pin d4, SYN_GPIO_Pin d5, SYN_GPIO_Pin d6, SYN_GPIO_Pin d7, uint8_t cols, uint8_t rows) Initialize Character LCD in Direct 4-Bit Parallel GPIO mode. |
| SYN_Status | syn_charlcd_init_i2c (SYN_CharLCD * lcd, SYN_GPIO_Pin scl, SYN_GPIO_Pin sda, uint8_t i2c_addr, uint8_t cols, uint8_t rows) Initialize Character LCD in I2C PCF8574 Backpack mode. |
| void | syn_charlcd_print (SYN_CharLCD * lcd, const char * str) Print an ASCII string at current cursor position. |
| void | syn_charlcd_set_backlight (SYN_CharLCD * lcd, bool enable) Turn display backlight ON or OFF (I2C backpack mode). |
| void | syn_charlcd_set_cursor (SYN_CharLCD * lcd, uint8_t col, uint8_t row) Set cursor position. |
Public Static Functions¶
| Type | Name |
|---|---|
| void | send_gpio_byte (SYN_CharLCD * lcd, uint8_t val, bool is_data) |
| void | send_gpio_nibble (SYN_CharLCD * lcd, uint8_t nibble) |
| void | send_i2c_byte (SYN_CharLCD * lcd, uint8_t val, uint8_t mode) |
| void | send_i2c_nibble (SYN_CharLCD * lcd, uint8_t nibble, uint8_t mode) |
| void | write_command (SYN_CharLCD * lcd, uint8_t cmd) |
| void | write_data (SYN_CharLCD * lcd, uint8_t data) |
| void | write_i2c_byte (SYN_SoftI2C * i2c, uint8_t dev_addr, uint8_t byte) |
Macros¶
| Type | Name |
|---|---|
| define | PCF8574_BL 0x08 |
| define | PCF8574_EN 0x04 |
| define | PCF8574_RS 0x01 |
| define | PCF8574_RW 0x02 |
Public Functions Documentation¶
function syn_charlcd_clear¶
Clear LCD screen and reset cursor to home (0,0).
Parameters:
lcdLCD context.
function syn_charlcd_create_char¶
Load a custom 5x8 pixel character into CGRAM.
Parameters:
lcdLCD context.slotCGRAM slot (0 to 7).charmapArray of 8 bytes (each byte represents a 5-bit pixel row).
function syn_charlcd_init_gpio¶
Initialize Character LCD in Direct 4-Bit Parallel GPIO mode.
SYN_Status syn_charlcd_init_gpio (
SYN_CharLCD * lcd,
SYN_GPIO_Pin rs,
SYN_GPIO_Pin en,
SYN_GPIO_Pin d4,
SYN_GPIO_Pin d5,
SYN_GPIO_Pin d6,
SYN_GPIO_Pin d7,
uint8_t cols,
uint8_t rows
)
Parameters:
lcdLCD context.rsRegister Select GPIO pin.enEnable GPIO pin.d4Data Bit 4 GPIO pin.d5Data Bit 5 GPIO pin.d6Data Bit 6 GPIO pin.d7Data Bit 7 GPIO pin.colsColumns (e.g. 16 or 20).rowsRows (e.g. 2 or 4).
Returns:
SYN_OK on success.
function syn_charlcd_init_i2c¶
Initialize Character LCD in I2C PCF8574 Backpack mode.
SYN_Status syn_charlcd_init_i2c (
SYN_CharLCD * lcd,
SYN_GPIO_Pin scl,
SYN_GPIO_Pin sda,
uint8_t i2c_addr,
uint8_t cols,
uint8_t rows
)
Parameters:
lcdLCD context.sclI2C SCL GPIO pin.sdaI2C SDA GPIO pin.i2c_addrPCF8574 I2C address (e.g. 0x27 or 0x3F).colsColumns (e.g. 16 or 20).rowsRows (e.g. 2 or 4).
Returns:
SYN_OK on success.
function syn_charlcd_print¶
Print an ASCII string at current cursor position.
Parameters:
lcdLCD context.strNull-terminated string.
function syn_charlcd_set_backlight¶
Turn display backlight ON or OFF (I2C backpack mode).
Parameters:
lcdLCD context.enableTrue for backlight ON.
function syn_charlcd_set_cursor¶
Set cursor position.
Parameters:
lcdLCD context.colColumn (0 to cols-1).rowRow (0 to rows-1).
Public Static Functions Documentation¶
function send_gpio_byte¶
function send_gpio_nibble¶
function send_i2c_byte¶
function send_i2c_nibble¶
function write_command¶
function write_data¶
function write_i2c_byte¶
Macro Definition Documentation¶
define PCF8574_BL¶
define PCF8574_EN¶
define PCF8574_RS¶
define PCF8574_RW¶
The documentation for this class was generated from the following file src/syntropic/display/syn_charlcd.c