pcd8544.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef PCD8544_H
23 #define PCD8544_H
24 
25 #include <stdint.h>
26 
27 #include "periph/gpio.h"
28 #include "periph/spi.h"
29 
30 #ifdef __cplusplus
31  extern "C" {
32 #endif
33 
38 #define PCD8544_RES_X (84U)
39 #define PCD8544_RES_Y (48U)
40 #define PCD8544_COLS (14U)
41 #define PCD8544_ROWS (6U)
48 #define PCD8544_DEFAULT_CONTRAST (45U)
49 #define PCD8544_DEFAULT_BIAS (3U)
50 #define PCD8544_DEFAULT_TEMPCOEF (0U)
51 
56 typedef struct {
58  gpio_t cs;
59  gpio_t reset;
60  gpio_t mode;
61  uint8_t inverted;
62 } pcd8544_t;
63 
76 int pcd8544_init(pcd8544_t *dev, spi_t spi, gpio_t cs,
77  gpio_t reset, gpio_t mode);
78 
87 void pcd8544_set_contrast(const pcd8544_t *dev, uint8_t contrast);
88 
97 void pcd8544_set_tempcoef(const pcd8544_t *dev, uint8_t coef);
98 
108 void pcd8544_set_bias(const pcd8544_t *dev, uint8_t bias);
109 
123 void pcd8544_write_img(const pcd8544_t *dev, const uint8_t img[]);
124 
135 void pcd8544_write_c(const pcd8544_t *dev, uint8_t x, uint8_t y, const char c);
136 
150 void pcd8544_write_s(const pcd8544_t *dev, uint8_t x, uint8_t y, const char* str);
151 
157 void pcd8544_clear(const pcd8544_t *dev);
158 
164 void pcd8544_invert(pcd8544_t *dev);
165 
174 int pcd8544_is_inverted(const pcd8544_t *dev);
175 
181 void pcd8544_poweron(const pcd8544_t *dev);
182 
188 void pcd8544_poweroff(const pcd8544_t *dev);
189 
195 void pcd8544_riot(const pcd8544_t *dev);
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif /* PCD8544_H */
202 
pcd8544_t::cs
gpio_t cs
chip-select pin, low: active
Definition: pcd8544.h:58
pcd8544_poweroff
void pcd8544_poweroff(const pcd8544_t *dev)
Poser off the display.
spi.h
Low-level SPI peripheral driver interface definition.
pcd8544_set_tempcoef
void pcd8544_set_tempcoef(const pcd8544_t *dev, uint8_t coef)
Set the temperature coefficient for the given display.
pcd8544_t::mode
gpio_t mode
mode pin: low: cmd mode, high: data mode
Definition: pcd8544.h:60
pcd8544_t::spi
spi_t spi
SPI bus the display is connected to.
Definition: pcd8544.h:57
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.
pcd8544_write_img
void pcd8544_write_img(const pcd8544_t *dev, const uint8_t img[])
Write an image to memory of the given display.
pcd8544_t::inverted
uint8_t inverted
internal flag to keep track of inversion state
Definition: pcd8544.h:61
pcd8544_poweron
void pcd8544_poweron(const pcd8544_t *dev)
Power on the display.
pcd8544_t::reset
gpio_t reset
reset pin, low: active
Definition: pcd8544.h:59
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.
pcd8544_is_inverted
int pcd8544_is_inverted(const pcd8544_t *dev)
Get the current inversion status of the display.
pcd8544_t
PCD8544 device descriptor.
Definition: pcd8544.h:56
pcd8544_set_bias
void pcd8544_set_bias(const pcd8544_t *dev, uint8_t bias)
Set the internal BIAS for the given display.
pcd8544_init
int pcd8544_init(pcd8544_t *dev, spi_t spi, gpio_t cs, gpio_t reset, gpio_t mode)
Initialize the given display.
gpio.h
Low-level GPIO peripheral driver interface definitions.
pcd8544_set_contrast
void pcd8544_set_contrast(const pcd8544_t *dev, uint8_t contrast)
Set the contrast for the given display.
pcd8544_riot
void pcd8544_riot(const pcd8544_t *dev)
I wonder what this does -> find out!
pcd8544_clear
void pcd8544_clear(const pcd8544_t *dev)
Clear the current display (clear the display memory)
pcd8544_invert
void pcd8544_invert(pcd8544_t *dev)
Invert the display (toggles dark and bright pixels)
spi_t
unsigned int spi_t
Default type for SPI devices.
Definition: spi.h:118