Loading...
Searching...
No Matches
pcd8544.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
20
21#include <stdint.h>
22
23#include "periph/gpio.h"
24#include "periph/spi.h"
25
26#ifdef __cplusplus
27 extern "C" {
28#endif
29
34#define PCD8544_RES_X (84U)
35#define PCD8544_RES_Y (48U)
36#define PCD8544_COLS (14U)
37#define PCD8544_ROWS (6U)
39
44#define PCD8544_DEFAULT_CONTRAST (45U)
45#define PCD8544_DEFAULT_BIAS (3U)
46#define PCD8544_DEFAULT_TEMPCOEF (0U)
48
52typedef struct {
53 spi_t spi;
54 gpio_t cs;
55 gpio_t reset;
56 gpio_t mode;
57 uint8_t inverted;
58} pcd8544_t;
59
72int pcd8544_init(pcd8544_t *dev, spi_t spi, gpio_t cs,
73 gpio_t reset, gpio_t mode);
74
83void pcd8544_set_contrast(const pcd8544_t *dev, uint8_t contrast);
84
93void pcd8544_set_tempcoef(const pcd8544_t *dev, uint8_t coef);
94
104void pcd8544_set_bias(const pcd8544_t *dev, uint8_t bias);
105
119void pcd8544_write_img(const pcd8544_t *dev, const uint8_t img[]);
120
131void pcd8544_write_c(const pcd8544_t *dev, uint8_t x, uint8_t y, const char c);
132
146void pcd8544_write_s(const pcd8544_t *dev, uint8_t x, uint8_t y, const char* str);
147
153void pcd8544_clear(const pcd8544_t *dev);
154
161
171
177void pcd8544_poweron(const pcd8544_t *dev);
178
185
191void pcd8544_riot(const pcd8544_t *dev);
192
193#ifdef __cplusplus
194}
195#endif
196
Low-level GPIO peripheral driver interface definitions.
void pcd8544_riot(const pcd8544_t *dev)
I wonder what this does -> find out!
void pcd8544_set_contrast(const pcd8544_t *dev, uint8_t contrast)
Set the contrast for the given display.
void pcd8544_poweroff(const pcd8544_t *dev)
Poser off the display.
void pcd8544_poweron(const pcd8544_t *dev)
Power on the display.
void pcd8544_set_bias(const pcd8544_t *dev, uint8_t bias)
Set the internal BIAS 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.
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_invert(pcd8544_t *dev)
Invert the display (toggles dark and bright pixels)
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)
int pcd8544_is_inverted(const pcd8544_t *dev)
Get the current inversion status of the display.
void pcd8544_write_img(const pcd8544_t *dev, const uint8_t img[])
Write an image to memory of the given display.
void pcd8544_set_tempcoef(const pcd8544_t *dev, uint8_t coef)
Set the temperature coefficient for the given display.
Low-level SPI peripheral driver interface definition.
PCD8544 device descriptor.
Definition pcd8544.h:52
gpio_t mode
mode pin: low: cmd mode, high: data mode
Definition pcd8544.h:56
spi_t spi
SPI bus the display is connected to.
Definition pcd8544.h:53
gpio_t reset
reset pin, low: active
Definition pcd8544.h:55
uint8_t inverted
internal flag to keep track of inversion state
Definition pcd8544.h:57
gpio_t cs
chip-select pin, low: active
Definition pcd8544.h:54