All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
PCD8544 LCD driver

Driver for PCD8544 LCD displays More...

Detailed Description

Driver for PCD8544 LCD displays

Files

file  pcd8544.h
 Interface definition for the PCD8544 LCD driver.
 
file  pcd8544_internal.h
 Internal definitions for PCD8544 displays.
 

Data Structures

struct  pcd8544_t
 PCD8544 device descriptor. More...
 

Functions

int pcd8544_init (pcd8544_t *dev, spi_t spi, gpio_t cs, gpio_t reset, gpio_t mode)
 Initialize the given display.
 
void pcd8544_set_contrast (const pcd8544_t *dev, uint8_t contrast)
 Set the contrast for the given display.
 
void pcd8544_set_tempcoef (const pcd8544_t *dev, uint8_t coef)
 Set the temperature coefficient for the given display.
 
void pcd8544_set_bias (const pcd8544_t *dev, uint8_t bias)
 Set the internal BIAS for the given display.
 
void pcd8544_write_img (const pcd8544_t *dev, const uint8_t img[])
 Write an image to memory of the given display.
 
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.
 
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.
 
void pcd8544_clear (const pcd8544_t *dev)
 Clear the current display (clear the display memory)
 
void pcd8544_invert (pcd8544_t *dev)
 Invert the display (toggles dark and bright pixels)
 
int pcd8544_is_inverted (const pcd8544_t *dev)
 Get the current inversion status of the display.
 
void pcd8544_poweron (const pcd8544_t *dev)
 Power on the display.
 
void pcd8544_poweroff (const pcd8544_t *dev)
 Poser off the display.
 
void pcd8544_riot (const pcd8544_t *dev)
 I wonder what this does -> find out!
 

Definition of display dimensions

#define PCD8544_RES_X   (84U)
 pixels per row
 
#define PCD8544_RES_Y   (48U)
 pixels per column
 
#define PCD8544_COLS   (14U)
 characters per row
 
#define PCD8544_ROWS   (6U)
 characters per column
 

Default values for temperature compensation and contrast

#define PCD8544_DEFAULT_CONTRAST   (45U)
 
#define PCD8544_DEFAULT_BIAS   (3U)
 
#define PCD8544_DEFAULT_TEMPCOEF   (0U)
 

Macro Definition Documentation

◆ PCD8544_COLS

#define PCD8544_COLS   (14U)

characters per row

Definition at line 40 of file pcd8544.h.

◆ PCD8544_DEFAULT_BIAS

#define PCD8544_DEFAULT_BIAS   (3U)

Definition at line 49 of file pcd8544.h.

◆ PCD8544_DEFAULT_CONTRAST

#define PCD8544_DEFAULT_CONTRAST   (45U)

Definition at line 48 of file pcd8544.h.

◆ PCD8544_DEFAULT_TEMPCOEF

#define PCD8544_DEFAULT_TEMPCOEF   (0U)

Definition at line 50 of file pcd8544.h.

◆ PCD8544_RES_X

#define PCD8544_RES_X   (84U)

pixels per row

Definition at line 38 of file pcd8544.h.

◆ PCD8544_RES_Y

#define PCD8544_RES_Y   (48U)

pixels per column

Definition at line 39 of file pcd8544.h.

◆ PCD8544_ROWS

#define PCD8544_ROWS   (6U)

characters per column

Definition at line 41 of file pcd8544.h.

Function Documentation

◆ pcd8544_clear()

void pcd8544_clear ( const pcd8544_t * dev)

Clear the current display (clear the display memory)

Parameters
[in]devdevice descriptor of display to use

◆ pcd8544_init()

int pcd8544_init ( pcd8544_t * dev,
spi_t spi,
gpio_t cs,
gpio_t reset,
gpio_t mode )

Initialize the given display.

Parameters
[in]devdevice descriptor of display to use
[in]spiSPI bus the display is connected to
[in]csGPIO pin that is connected to the CS pin
[in]resetGPIO pin that is connected to the RESET pin
[in]modeGPIO pin that is connected to the MODE pin
Returns
0 on success
<0 on error

◆ pcd8544_invert()

void pcd8544_invert ( pcd8544_t * dev)

Invert the display (toggles dark and bright pixels)

Parameters
[in]devdevice descriptor of display to use

◆ pcd8544_is_inverted()

int pcd8544_is_inverted ( const pcd8544_t * dev)

Get the current inversion status of the display.

Parameters
[in]devdevice descriptor of display to use
Returns
0 -> display is not inverted
1 -> display is inverted

◆ pcd8544_poweroff()

void pcd8544_poweroff ( const pcd8544_t * dev)

Poser off the display.

Parameters
[in]devdevice descriptor of display to use

◆ pcd8544_poweron()

void pcd8544_poweron ( const pcd8544_t * dev)

Power on the display.

Parameters
[in]devdevice descriptor of display to use

◆ pcd8544_riot()

void pcd8544_riot ( const pcd8544_t * dev)

I wonder what this does -> find out!

Parameters
[in]devdevice descriptor of display to use

◆ pcd8544_set_bias()

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
[in]devdevice descriptor of display to use
[in]biasthe BIAS to use [0 - 7]

◆ pcd8544_set_contrast()

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
[in]devdisplay device descriptor
[in]contrasttargeted contrast value [0 - 127]

◆ pcd8544_set_tempcoef()

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
[in]devdevice descriptor of display to use
[in]coeftemperature coefficient to use [0 - 3]

◆ pcd8544_write_c()

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
[in]devdevice descriptor of display to use
[in]xcolumn to put the character [0 - 13]
[in]yrow to put the character [0 - 5]
[in]cASCII code for the character to write

◆ pcd8544_write_img()

void pcd8544_write_img ( const pcd8544_t * dev,
const uint8_t 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
[in]devdevice descriptor of display to use
[in]imguint8_t array with image data (must be of size := 504)

◆ pcd8544_write_s()

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
[in]devdevice descriptor of display to use
[in]xstarting column of the string [0 - 13]
[in]yrow to write the string to [0 - 5]
[in]strstring to write to the display