Loading...
Searching...
No Matches
disp_dev.h
1/*
2 * Copyright (C) 2020 Inria
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
20#ifndef DISP_DEV_H
21#define DISP_DEV_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include <stdbool.h>
28#include <stdint.h>
29
30#include "board.h"
31
32#ifndef BACKLIGHT_ON
33#define BACKLIGHT_ON
34#endif
35
36#ifndef BACKLIGHT_OFF
37#define BACKLIGHT_OFF
38#endif
39
43typedef struct disp_dev disp_dev_t;
44
48typedef struct {
49 uint16_t x1;
50 uint16_t x2;
51 uint16_t y1;
52 uint16_t y2;
54
58typedef struct {
66 void (*map)(const disp_dev_t *dev,
67 const disp_dev_area_t *area,
68 const uint16_t *color);
69
77 uint16_t (*height)(const disp_dev_t *dev);
78
86 uint16_t (*width)(const disp_dev_t *dev);
87
93 uint8_t (*color_depth)(const disp_dev_t *dev);
94
101 void (*set_invert)(const disp_dev_t *dev, bool invert);
103
107struct disp_dev {
109};
110
119
124
134
144
153 const disp_dev_area_t *area,
154 const uint16_t *color);
155
164
173
180
187void disp_dev_set_invert(const disp_dev_t *dev, bool invert);
188
192static inline void disp_dev_backlight_on(void)
193{
195}
196
200static inline void disp_dev_backlight_off(void)
201{
203}
204
205#ifdef __cplusplus
206}
207#endif
208
209#endif /* DISP_DEV_H */
#define BACKLIGHT_OFF
Turn backlight off.
Definition board.h:96
#define BACKLIGHT_ON
Turn backlight on.
Definition board.h:95
uint8_t disp_dev_color_depth(const disp_dev_t *dev)
Get the color depth of the display device.
disp_dev_reg_t * disp_dev_reg_find_screen(uint8_t screen_id)
Find the display device that is attached to a given screen.
uint16_t disp_dev_height(const disp_dev_t *dev)
Get the height of the display device.
void disp_dev_map(const disp_dev_t *dev, const disp_dev_area_t *area, const uint16_t *color)
Map an area to display on the device.
static void disp_dev_backlight_off(void)
Disable the backlight pin.
Definition disp_dev.h:200
int disp_dev_reg_add(disp_dev_reg_t *dev)
Add pointer to a display device item to the list of display items.
uint16_t disp_dev_width(const disp_dev_t *dev)
Get the width of the display device.
void disp_dev_set_invert(const disp_dev_t *dev, bool invert)
Invert the display device colors.
struct disp_dev_reg disp_dev_reg_t
Disp dev registry entry.
static void disp_dev_backlight_on(void)
Enable the backlight pin.
Definition disp_dev.h:192
Display area coordinates.
Definition disp_dev.h:48
uint16_t y1
Vertical start position (included)
Definition disp_dev.h:51
uint16_t y2
Vertical end position (included)
Definition disp_dev.h:52
uint16_t x1
Horizontal start position (included)
Definition disp_dev.h:49
uint16_t x2
Horizontal end position (included)
Definition disp_dev.h:50
Generic type for a display driver.
Definition disp_dev.h:58
Disp dev registry entry.
Definition disp_dev.h:114
struct disp_dev_reg * next
pointer to the next display device in the list
Definition disp_dev.h:115
disp_dev_t * dev
pointer to the device descriptor
Definition disp_dev.h:116
uint8_t screen_id
id of the screen this display is attached to
Definition disp_dev.h:117
Generic type for a display device.
Definition disp_dev.h:107
const disp_dev_driver_t * driver
Pointer to driver of the display device.
Definition disp_dev.h:108