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 PDC8544_H
23 #define PDC8544_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(pcd8544_t *dev, uint8_t contrast);
88 
97 void pcd8544_set_tempcoef(pcd8544_t *dev, uint8_t coef);
98 
108 void pcd8544_set_bias(pcd8544_t *dev, uint8_t bias);
109 
123 void pcd8544_write_img(pcd8544_t *dev, const char img[]);
124 
135 void pcd8544_write_c(pcd8544_t *dev, uint8_t x, uint8_t y, const char c);
136 
150 void pcd8544_write_s(pcd8544_t *dev, uint8_t x, uint8_t y, const char* str);
151 
157 void pcd8544_clear(pcd8544_t *dev);
158 
164 void pcd8544_invert(pcd8544_t *dev);
165 
175 
181 void pcd8544_poweron(pcd8544_t *dev);
182 
188 void pcd8544_poweroff(pcd8544_t *dev);
189 
195 void pcd8544_riot(pcd8544_t *dev);
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif /* PDC8544_H */
202 
void pcd8544_write_c(pcd8544_t *dev, uint8_t x, uint8_t y, const char c)
Write a single ASCII character to the display.
PCD8544 device descriptor.
Definition: pcd8544.h:56
void pcd8544_riot(pcd8544_t *dev)
I wonder what this does -> find out!
spi_t spi
SPI bus the display is connected to.
Definition: pcd8544.h:57
Low-level GPIO peripheral driver interface definitions.
uint8_t inverted
internal flag to keep track of inversion state
Definition: pcd8544.h:61
void pcd8544_set_tempcoef(pcd8544_t *dev, uint8_t coef)
Set the temperature coefficient for the given display.
void pcd8544_set_contrast(pcd8544_t *dev, uint8_t contrast)
Set the contrast for the given display.
int pcd8544_init(pcd8544_t *dev, spi_t spi, gpio_t cs, gpio_t reset, gpio_t mode)
Initialize the given display.
gpio_t mode
mode pin: low: cmd mode, high: data mode
Definition: pcd8544.h:60
void pcd8544_poweroff(pcd8544_t *dev)
Poser off the display.
void pcd8544_write_img(pcd8544_t *dev, const char img[])
Write an image to memory of the given display.
Low-level SPI peripheral driver interface definition.
int pcd8544_is_inverted(pcd8544_t *dev)
Get the current inversion status of the display.
gpio_t reset
reset pin, low: active
Definition: pcd8544.h:59
void pcd8544_poweron(pcd8544_t *dev)
Power on the display.
void pcd8544_invert(pcd8544_t *dev)
Invert the display (toggles dark and bright pixels)
void pcd8544_clear(pcd8544_t *dev)
Clear the current display (clear the display memory)
void pcd8544_set_bias(pcd8544_t *dev, uint8_t bias)
Set the internal BIAS for the given display.
void pcd8544_write_s(pcd8544_t *dev, uint8_t x, uint8_t y, const char *str)
Write a string to a given position on the display.
unsigned int spi_t
Default type for SPI devices.
Definition: spi.h:105
gpio_t cs
chip-select pin, low: active
Definition: pcd8544.h:58