objc

drivers_uc8151.h
Go to the documentation of this file.
1 
12 #pragma once
13 #include <runtime-hw/hw.h>
14 #include <stdbool.h>
15 #include <stdint.h>
16 
18 // TYPES
19 
24 typedef enum {
30 
35 typedef enum {
39 
44 typedef struct {
45  uint16_t x;
46  uint16_t y;
47  uint16_t width;
48  uint16_t height;
50 
60 typedef struct driver_uc8151_t {
65  uint16_t width;
66  uint16_t height;
69  bool inverted;
70  bool blocking;
72 
74 // LIFECYCLE
75 
97  uint8_t reset_pin, uint8_t busy_pin,
98  uint16_t width, uint16_t height);
99 
109 
111 // PROPERTIES
112 
119 static inline bool driver_uc8151_valid(driver_uc8151_t *uc8151) {
120  return uc8151 && uc8151->spi && hw_spi_valid(uc8151->spi) &&
121  uc8151->width > 0 && uc8151->height > 0;
122 }
123 
125 // CONFIGURATION
126 
136 
146 
155 
164 
172 
174 // DISPLAY OPERATIONS
175 
183 
190 
197 
204 
213 bool driver_uc8151_update(driver_uc8151_t *uc8151, const void *data,
214  size_t size);
215 
226 bool driver_uc8151_partial_update(driver_uc8151_t *uc8151, const uint8_t *data,
227  size_t size, driver_uc8151_rect_t rect);
UC8151 display rectangle for partial updates.
static bool driver_uc8151_valid(driver_uc8151_t *uc8151)
Check if a UC8151 driver structure is valid.
void driver_uc8151_busy_wait(driver_uc8151_t *uc8151)
Wait for the UC8151 display to become ready.
void driver_uc8151_finalize(driver_uc8151_t *uc8151)
Finalize and release a UC8151 display driver.
UC8151 display driver structure.
bool driver_uc8151_partial_update(driver_uc8151_t *uc8151, const uint8_t *data, size_t size, driver_uc8151_rect_t rect)
Update a partial region of the UC8151 display.
uint16_t height
Display height in pixels.
struct driver_uc8151_t driver_uc8151_t
UC8151 display driver structure.
driver_uc8151_t driver_uc8151_init(hw_spi_t *spi, uint8_t dc_pin, uint8_t reset_pin, uint8_t busy_pin, uint16_t width, uint16_t height)
Initialize a UC8151 display driver using the SPI interface.
driver_uc8151_update_speed_t
UC8151 update speed modes.
driver_uc8151_update_speed_t update_speed
Current update speed.
uint16_t x
X coordinate (pixels)
bool driver_uc8151_update(driver_uc8151_t *uc8151, const void *data, size_t size)
Update the entire UC8151 display with new framebuffer data.
bool driver_uc8151_is_busy(driver_uc8151_t *uc8151)
Check if the UC8151 display is busy.
bool driver_uc8151_set_rotation(driver_uc8151_t *uc8151, driver_uc8151_rotation_t rotation)
Set the rotation of the UC8151 display.
void driver_uc8151_reset(driver_uc8151_t *uc8151)
Reset the UC8151 display.
bool driver_uc8151_set_blocking(driver_uc8151_t *uc8151, bool blocking)
Set the blocking mode of the UC8151 display.
driver_uc8151_rotation_t
UC8151 rotation modes.
Hardware interface abstraction layer.
hw_gpio_t reset
Reset pin.
uint16_t width
Display width in pixels.
void driver_uc8151_power_off(driver_uc8151_t *uc8151)
Turn off the UC8151 display.
bool blocking
Blocking mode flag.
uint16_t y
Y coordinate (pixels)
bool inverted
Color inversion flag.
uint32_t driver_uc8151_get_update_time(driver_uc8151_t *uc8151)
Get the estimated update time for the current speed setting.
hw_gpio_t busy
Busy pin.
hw_spi_t * spi
Pointer to the SPI interface.
bool driver_uc8151_set_inverted(driver_uc8151_t *uc8151, bool inverted)
Set the color inversion of the UC8151 display.
uint16_t width
Width (pixels)
driver_uc8151_rotation_t rotation
Display rotation.
static bool hw_spi_valid(hw_spi_t *spi)
Get true if the SPI interface is valid.
Definition: spi.h:111
180-degree rotation
uint16_t height
Height (pixels)
SPI adapter.
Definition: spi.h:25
GPIO logical pin structure.
Definition: gpio.h:60
bool driver_uc8151_set_update_speed(driver_uc8151_t *uc8151, driver_uc8151_update_speed_t speed)
Set the update speed of the UC8151 display.
hw_gpio_t dc
Data/Command pin.