From e3fb86eb05ff45cf4fae88f3e1096bf800ce3587 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Tue, 14 Jan 2020 16:12:02 +0100 Subject: [PATCH] sys: add interface for generic display device --- makefiles/pseudomodules.inc.mk | 1 + sys/include/disp_dev.h | 62 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 sys/include/disp_dev.h diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 620365e0be0ec..aae149b23ddf7 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -12,6 +12,7 @@ PSEUDOMODULES += cortexm_fpu PSEUDOMODULES += cpu_check_address PSEUDOMODULES += devfs_% PSEUDOMODULES += dhcpv6_% +PSEUDOMODULES += disp_dev PSEUDOMODULES += ecc_% PSEUDOMODULES += emb6_router PSEUDOMODULES += event_% diff --git a/sys/include/disp_dev.h b/sys/include/disp_dev.h new file mode 100644 index 0000000000000..8aa4f0bed9c45 --- /dev/null +++ b/sys/include/disp_dev.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2019 Inria + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @defgroup sys_disp_dev Display device generic API + * @ingroup sys + * @brief Define the generic API of a display device + * @{ + * + * @author Alexandre Abadie + */ + +#ifndef DISP_DEV_H +#define DISP_DEV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Forward declaration for display device struct + */ +typedef struct disp_dev disp_dev_t; + +/** + * @brief Generic type for a display driver + */ +typedef struct { + /** + * @brief Map an area to display on the device + * + * @param[in] dev Pointer to the display device + * @param[in] x1 Left coordinate + * @param[in] x2 Right coordinate + * @param[in] y1 Top coordinate + * @param[in] y2 Bottom coordinate + * @param[in] color Array of color to map to the display + */ + void (*map)(disp_dev_t *dev, + uint16_t x1, uint16_t x2, + uint16_t y1, uint16_t y2, + const uint16_t *color); +} disp_dev_driver_t; + +/** + * @brief Generic type for a display device + */ +struct disp_dev { + const disp_dev_driver_t *driver; /**< Pointer to driver of the display device */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* DISP_DEV_H */ +/** @} */