PCD8544 LCD driver¶
Driver for PCD8544 LCD displays.
-
PCD8544_RES_X
¶ pixels per row
1
(84U)
-
PCD8544_RES_Y
¶ pixels per column
1
(48U)
-
PCD8544_COLS
¶ characters per row
1
(14U)
-
PCD8544_ROWS
¶ characters per column
1
(6U)
-
PCD8544_DEFAULT_CONTRAST
¶ 1
(45U)
-
PCD8544_DEFAULT_BIAS
¶ 1
(3U)
-
PCD8544_DEFAULT_TEMPCOEF
¶ 1
(0U)
-
int
pcd8544_init
(pcd8544_t * dev,spi.h::spi_t
spi,gpio.h::gpio_t
cs,gpio.h::gpio_t
reset,gpio.h::gpio_t
mode)¶ Initialize the given display.
Parameters
dev: device descriptor of display to use spi: SPI bus the display is connected to cs: GPIO pin that is connected to the CS pin reset: GPIO pin that is connected to the RESET pin mode: GPIO pin that is connected to the MODE pin Return values
- 0 on success
- <0 on error
-
void
pcd8544_set_contrast
(const pcd8544_t * dev, uint8_t contrast)¶ Set the contrast for the given display.
Note
A contrast value of 45 yields good results for 3V3
Parameters
dev: display device descriptor contrast: targeted contrast value [0 - 127]
-
void
pcd8544_set_tempcoef
(const pcd8544_t * dev, uint8_t coef)¶ Set the temperature coefficient for the given display.
Note
Look at the datasheet for more information
Parameters
dev: device descriptor of display to use coef: temperature coefficient to use [0 - 3]
-
void
pcd8544_set_bias
(const pcd8544_t * dev, uint8_t bias)¶ Set the internal BIAS for the given display.
Note
Look at the datasheet for more information
Parameters
dev: device descriptor of display to use bias: the BIAS to use [0 - 7]
-
void
pcd8544_write_img
(const pcd8544_t * dev, const char img)¶ Write an image to memory of the given display.
The image must be given as a char array with 504 elements. Each bit in the array represents one pixel on the display. Each byte in the array contains 8 stacked pixels, from top to bottom. So byte[0] contains the pixels from (0,0) to (0,7), byte[1] (1,0) to (1,7) and byte[503] the pixels from (83,40) to (83,47) -> see the ‘horizontal addressing’ section in the datasheet.
Parameters
dev: device descriptor of display to use img: char array with image data (must be of size := 504)
-
void
pcd8544_write_c
(const pcd8544_t * dev, uint8_t x, uint8_t y, const char c)¶ Write a single ASCII character to the display.
The position of the character is specified in columns (x) and rows (y)
Parameters
dev: device descriptor of display to use x: column to put the character [0 - 13] y: row to put the character [0 - 5] c: ASCII code for the character to write
-
void
pcd8544_write_s
(const pcd8544_t * dev, uint8_t x, uint8_t y, const char * str)¶ Write a string to a given position on the display.
This function prints a given string to the given position on the display. The position is given in terms of columns (x) and rows (y). If a string does not fit completely in the given position (it overflows its row), the overflowing part of the string is cut off.
Parameters
dev: device descriptor of display to use x: starting column of the string [0 - 13] y: row to write the string to [0 - 5] str: string to write to the display
-
void
pcd8544_clear
(const pcd8544_t * dev)¶ Clear the current display (clear the display memory)
Parameters
dev: device descriptor of display to use
-
void
pcd8544_invert
(pcd8544_t * dev)¶ Invert the display (toggles dark and bright pixels)
Parameters
dev: device descriptor of display to use
-
int
pcd8544_is_inverted
(const pcd8544_t * dev)¶ Get the current inversion status of the display.
Parameters
dev: device descriptor of display to use Return values
- 0 -> display is not inverted
- 1 -> display is inverted
-
void
pcd8544_poweron
(const pcd8544_t * dev)¶ Power on the display.
Parameters
dev: device descriptor of display to use
-
void
pcd8544_poweroff
(const pcd8544_t * dev)¶ Poser off the display.
Parameters
dev: device descriptor of display to use
-
void
pcd8544_riot
(const pcd8544_t * dev)¶ I wonder what this does -> find out!
Parameters
dev: device descriptor of display to use
-
struct
pcd8544_t
¶ PCD8544 device descriptor.
-
spi.h::spi_t
spi
¶ SPI bus the display is connected to.
-
gpio.h::gpio_t
cs
¶ chip-select pin, low: active
-
gpio.h::gpio_t
reset
¶ reset pin, low: active
-
gpio.h::gpio_t
mode
¶ mode pin: low: cmd mode, high: data mode
-
uint8_t
inverted
¶ internal flag to keep track of inversion state
-