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
24 extern "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 
43 typedef struct disp_dev disp_dev_t;
44 
48 typedef struct {
59  void (*map)(const disp_dev_t *dev,
60  uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2,
61  const uint16_t *color);
62 
70  uint16_t (*height)(const disp_dev_t *dev);
71 
79  uint16_t (*width)(const disp_dev_t *dev);
80 
86  uint8_t (*color_depth)(const disp_dev_t *dev);
87 
94  void (*set_invert)(const disp_dev_t *dev, bool invert);
96 
100 struct disp_dev {
102 };
103 
114 void disp_dev_map(const disp_dev_t *dev,
115  uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2,
116  const uint16_t *color);
117 
125 uint16_t disp_dev_height(const disp_dev_t *dev);
126 
134 uint16_t disp_dev_width(const disp_dev_t *dev);
135 
141 uint8_t disp_dev_color_depth(const disp_dev_t *dev);
142 
149 void disp_dev_set_invert(const disp_dev_t *dev, bool invert);
150 
154 static inline void disp_dev_backlight_on(void)
155 {
156  BACKLIGHT_ON;
157 }
158 
162 static inline void disp_dev_backlight_off(void)
163 {
164  BACKLIGHT_OFF;
165 }
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #endif /* DISP_DEV_H */
172 
disp_dev_backlight_on
static void disp_dev_backlight_on(void)
Enable the backlight pin.
Definition: disp_dev.h:154
disp_dev_set_invert
void disp_dev_set_invert(const disp_dev_t *dev, bool invert)
Invert the display device colors.
disp_dev_driver_t
Generic type for a display driver.
Definition: disp_dev.h:48
disp_dev
Generic type for a display device.
Definition: disp_dev.h:100
disp_dev_height
uint16_t disp_dev_height(const disp_dev_t *dev)
Get the height of the display device.
disp_dev_backlight_off
static void disp_dev_backlight_off(void)
Disable the backlight pin.
Definition: disp_dev.h:162
disp_dev::driver
const disp_dev_driver_t * driver
Pointer to driver of the display device.
Definition: disp_dev.h:101
disp_dev_color_depth
uint8_t disp_dev_color_depth(const disp_dev_t *dev)
Get the color depth of the display device.
disp_dev_map
void disp_dev_map(const disp_dev_t *dev, uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2, const uint16_t *color)
Map an area to display on the device.
disp_dev_width
uint16_t disp_dev_width(const disp_dev_t *dev)
Get the width of the display device.