Loading...
Searching...
No Matches
epd_bw_spi.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Silke Hofstra
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
30
31#include "periph/spi.h"
32#include "periph/gpio.h"
33
34#ifdef MODULE_DISP_DEV
35#include "disp_dev.h"
36#endif
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42#define EPD_BW_SPI_COLOR_WHITE (0xFF)
43#define EPD_BW_SPI_COLOR_BLACK (0x00)
44
56
60enum {
61 EPD_BW_SPI_DC_FAIL = -5,
62 EPD_BW_SPI_RST_FAIL = -6,
63 EPD_BW_SPI_BUSY_FAIL = -7,
64};
65
69typedef struct {
70 uint8_t vcom;
71 const uint16_t size_x;
72 const uint16_t size_y;
73 const uint8_t lut_size;
74 const uint8_t *lut_full;
75 const uint8_t *lut_part;
77
98
102typedef struct {
103 #ifdef MODULE_DISP_DEV
104 disp_dev_t *dev;
105 #endif
110
118
125
132
139
146
153
160
167
174
181
192void epd_bw_spi_fill(epd_bw_spi_t *dev, uint8_t x1, uint8_t x2, uint16_t y1,
193 uint16_t y2,
194 uint8_t color);
195
209void epd_bw_spi_fill_pixels(epd_bw_spi_t *dev, uint8_t x1, uint8_t x2,
210 uint16_t y1, uint16_t y2,
211 uint8_t *px);
212
222void epd_bw_spi_set_area(epd_bw_spi_t *dev, uint8_t x1, uint8_t x2, uint16_t y1,
223 uint16_t y2);
224
235void epd_bw_spi_write_buffer(epd_bw_spi_t *dev, const uint8_t *buf, size_t len);
236
246
255
265
266#ifdef __cplusplus
267}
268#endif
spi_clk_t
Definition periph_cpu.h:348
Low-level GPIO peripheral driver interface definitions.
struct disp_dev disp_dev_t
Forward declaration for display device struct.
Definition disp_dev.h:39
void epd_bw_spi_update_auto(epd_bw_spi_t *dev)
Update the display with an automatic partial/full refresh.
void epd_bw_spi_swreset(epd_bw_spi_t *dev)
Perform a soft reset of the device.
void epd_bw_spi_update_full(epd_bw_spi_t *dev)
Update the display with a full refresh.
void epd_bw_spi_init_part(epd_bw_spi_t *dev)
Initialise the display for a partial refresh.
void epd_bw_spi_update_part(epd_bw_spi_t *dev)
Update the display with a partial refresh.
void epd_bw_spi_wake(epd_bw_spi_t *dev)
Wake the device.
void epd_bw_spi_fill_pixels(epd_bw_spi_t *dev, uint8_t x1, uint8_t x2, uint16_t y1, uint16_t y2, uint8_t *px)
Fill an area with an array of pixels.
void epd_bw_spi_deactivate(epd_bw_spi_t *dev)
Deactivate the display.
int epd_bw_spi_init(epd_bw_spi_t *dev, const epd_bw_spi_params_t *params)
Initialise the display.
void epd_bw_spi_sleep(epd_bw_spi_t *dev)
Set the display to deep sleep mode.
void epd_bw_spi_init_full(epd_bw_spi_t *dev)
Initialise the display for a full refresh.
void epd_bw_spi_fill(epd_bw_spi_t *dev, uint8_t x1, uint8_t x2, uint16_t y1, uint16_t y2, uint8_t color)
Fill an area with a single color.
void epd_bw_spi_init_auto(epd_bw_spi_t *dev)
Initialise the display for an automatic partial/full refresh.
void epd_bw_spi_clear(epd_bw_spi_t *dev)
Clear the entire display.
void epd_bw_spi_set_area(epd_bw_spi_t *dev, uint8_t x1, uint8_t x2, uint16_t y1, uint16_t y2)
Set the area in which can be drawn.
epd_bw_spi_entry_mode_t
Data entry mode settings.
Definition epd_bw_spi.h:50
void epd_bw_spi_activate(epd_bw_spi_t *dev)
Activate the display.
void epd_bw_spi_write_buffer(epd_bw_spi_t *dev, const uint8_t *buf, size_t len)
Write to the RAM of the epd_bw_spi controller.
@ EPD_BW_SPI_Y_DEC_X_DEC
Y decrement, X decrement.
Definition epd_bw_spi.h:51
@ EPD_BW_SPI_Y_INC_X_INC
Y increment, X increment.
Definition epd_bw_spi.h:54
@ EPD_BW_SPI_Y_DEC_X_INC
Y decrement, X increment.
Definition epd_bw_spi.h:52
@ EPD_BW_SPI_Y_INC_X_DEC
Y increment, X decrement.
Definition epd_bw_spi.h:53
Low-level SPI peripheral driver interface definition.
Display controller parameters.
Definition epd_bw_spi.h:69
const uint8_t lut_size
size of the waveform lookup table
Definition epd_bw_spi.h:73
const uint16_t size_x
supported number of horizontal pixels
Definition epd_bw_spi.h:71
const uint8_t * lut_part
lookup table for a partial display refresh
Definition epd_bw_spi.h:75
const uint8_t * lut_full
lookup table for a full display refresh
Definition epd_bw_spi.h:74
uint8_t vcom
VCOM voltage level.
Definition epd_bw_spi.h:70
const uint16_t size_y
supported number of vertical pixels
Definition epd_bw_spi.h:72
SPI display device initialisation parameters.
Definition epd_bw_spi.h:81
gpio_t busy_pin
pin connected to the busy line (optional)
Definition epd_bw_spi.h:87
epd_bw_spi_entry_mode_t entry_mode
data entry mode
Definition epd_bw_spi.h:92
bool dummy
if device requires a dummy cycle before read
Definition epd_bw_spi.h:90
gpio_t dc_pin
pin connected to the DC line
Definition epd_bw_spi.h:85
uint16_t partial_refresh_max
maximum number of partial refreshes to perform before triggering a full refresh
Definition epd_bw_spi.h:95
spi_t spi
SPI device that the display is connected to.
Definition epd_bw_spi.h:82
uint16_t size_x
number of horizontal pixels in the display
Definition epd_bw_spi.h:93
bool busy_value
expected value for the busy pin when the display is busy
Definition epd_bw_spi.h:88
epd_bw_spi_controller_t controller
display controller of the e-Paper display
Definition epd_bw_spi.h:91
gpio_t rst_pin
pin connected to the reset line (optional)
Definition epd_bw_spi.h:86
spi_clk_t spi_clk
SPI clock speed to use.
Definition epd_bw_spi.h:83
gpio_t cs_pin
pin connected to the CHIP SELECT line
Definition epd_bw_spi.h:84
uint16_t size_y
number of vertical pixels in the display
Definition epd_bw_spi.h:94
Device initialisation parameters.
Definition epd_bw_spi.h:102
uint16_t partial_refresh_count
number of partial refreshes since the last full refresh
Definition epd_bw_spi.h:107
epd_bw_spi_params_t params
SPI display parameters.
Definition epd_bw_spi.h:106