Loading...
Searching...
No Matches
disp_dev.h
1/*
2 * SPDX-FileCopyrightText: 2020 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <stdbool.h>
24#include <stdint.h>
25
26#include "board.h"
27
28#ifndef BACKLIGHT_ON
29#define BACKLIGHT_ON
30#endif
31
32#ifndef BACKLIGHT_OFF
33#define BACKLIGHT_OFF
34#endif
35
39typedef struct disp_dev disp_dev_t;
40
44typedef struct {
45 uint16_t x1;
46 uint16_t x2;
47 uint16_t y1;
48 uint16_t y2;
50
54typedef struct {
62 void (*map)(const disp_dev_t *dev,
63 const disp_dev_area_t *area,
64 const uint16_t *color);
65
73 uint16_t (*height)(const disp_dev_t *dev);
74
82 uint16_t (*width)(const disp_dev_t *dev);
83
89 uint8_t (*color_depth)(const disp_dev_t *dev);
90
97 void (*set_invert)(const disp_dev_t *dev, bool invert);
99
103struct disp_dev {
105};
106
115
120
130
140
149 const disp_dev_area_t *area,
150 const uint16_t *color);
151
160
169
176
183void disp_dev_set_invert(const disp_dev_t *dev, bool invert);
184
188static inline void disp_dev_backlight_on(void)
189{
191}
192
196static inline void disp_dev_backlight_off(void)
197{
199}
200
201#ifdef __cplusplus
202}
203#endif
204
#define BACKLIGHT_OFF
Turn backlight off.
Definition board.h:92
#define BACKLIGHT_ON
Turn backlight on.
Definition board.h:91
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:196
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.
struct disp_dev disp_dev_t
Forward declaration for display device struct.
Definition disp_dev.h:39
static void disp_dev_backlight_on(void)
Enable the backlight pin.
Definition disp_dev.h:188
Display area coordinates.
Definition disp_dev.h:44
uint16_t y1
Vertical start position (included)
Definition disp_dev.h:47
uint16_t y2
Vertical end position (included)
Definition disp_dev.h:48
uint16_t x1
Horizontal start position (included)
Definition disp_dev.h:45
uint16_t x2
Horizontal end position (included)
Definition disp_dev.h:46
Generic type for a display driver.
Definition disp_dev.h:54
uint8_t(* color_depth)(const disp_dev_t *dev)
Get the color depth of the display device.
Definition disp_dev.h:89
void(* set_invert)(const disp_dev_t *dev, bool invert)
Invert the display device colors.
Definition disp_dev.h:97
uint16_t(* width)(const disp_dev_t *dev)
Get the width of the display device.
Definition disp_dev.h:82
void(* map)(const disp_dev_t *dev, const disp_dev_area_t *area, const uint16_t *color)
Map an area to display on the device.
Definition disp_dev.h:62
uint16_t(* height)(const disp_dev_t *dev)
Get the height of the display device.
Definition disp_dev.h:73
Disp dev registry entry.
Definition disp_dev.h:110
struct disp_dev_reg * next
pointer to the next display device in the list
Definition disp_dev.h:111
disp_dev_t * dev
pointer to the device descriptor
Definition disp_dev.h:112
uint8_t screen_id
id of the screen this display is attached to
Definition disp_dev.h:113
Generic type for a display device.
Definition disp_dev.h:103
const disp_dev_driver_t * driver
Pointer to driver of the display device.
Definition disp_dev.h:104