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
9#pragma once
10
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <stdbool.h>
27#include <stdint.h>
28
29#include "board.h"
30
31#ifndef BACKLIGHT_ON
32#define BACKLIGHT_ON
33#endif
34
35#ifndef BACKLIGHT_OFF
36#define BACKLIGHT_OFF
37#endif
38
42typedef struct disp_dev disp_dev_t;
43
47typedef struct {
48 uint16_t x1;
49 uint16_t x2;
50 uint16_t y1;
51 uint16_t y2;
53
57typedef struct {
65 void (*map)(const disp_dev_t *dev,
66 const disp_dev_area_t *area,
67 const uint16_t *color);
68
76 uint16_t (*height)(const disp_dev_t *dev);
77
85 uint16_t (*width)(const disp_dev_t *dev);
86
92 uint8_t (*color_depth)(const disp_dev_t *dev);
93
100 void (*set_invert)(const disp_dev_t *dev, bool invert);
102
106struct disp_dev {
108};
109
118
123
133
143
152 const disp_dev_area_t *area,
153 const uint16_t *color);
154
163
172
179
186void disp_dev_set_invert(const disp_dev_t *dev, bool invert);
187
191static inline void disp_dev_backlight_on(void)
192{
194}
195
199static inline void disp_dev_backlight_off(void)
200{
202}
203
204#ifdef __cplusplus
205}
206#endif
207
#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:199
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.
disp_dev_reg_t * disp_dev_reg
Export the display device registry as global variable.
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:191
Display area coordinates.
Definition disp_dev.h:47
uint16_t y1
Vertical start position (included)
Definition disp_dev.h:50
uint16_t y2
Vertical end position (included)
Definition disp_dev.h:51
uint16_t x1
Horizontal start position (included)
Definition disp_dev.h:48
uint16_t x2
Horizontal end position (included)
Definition disp_dev.h:49
Generic type for a display driver.
Definition disp_dev.h:57
Disp dev registry entry.
Definition disp_dev.h:113
struct disp_dev_reg * next
pointer to the next display device in the list
Definition disp_dev.h:114
disp_dev_t * dev
pointer to the device descriptor
Definition disp_dev.h:115
uint8_t screen_id
id of the screen this display is attached to
Definition disp_dev.h:116
Generic type for a display device.
Definition disp_dev.h:106
const disp_dev_driver_t * driver
Pointer to driver of the display device.
Definition disp_dev.h:107