diff --git a/drivers/ili9341/ili9341_disp_dev.c b/drivers/ili9341/ili9341_disp_dev.c new file mode 100644 index 0000000000000..e3e33157ac5fc --- /dev/null +++ b/drivers/ili9341/ili9341_disp_dev.c @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/** + * @ingroup drivers_ili9341 + * @{ + * + * @file + * @brief Driver adaption to disp_dev generic interface + * + * @author Alexandre Abadie + * @} + */ + +#include "ili9341.h" +#include "ili9341_disp_dev.h" + +void _ili9341_map(disp_dev_t *dev, uint16_t x1, uint16_t x2, + uint16_t y1, uint16_t y2, const uint16_t *color) +{ + ili9341_t *ili9341 = (ili9341_t *)dev; + ili9341_pixmap(ili9341, x1, x2, y1, y2, color); +} + +const disp_dev_driver_t ili9341_disp_dev_driver = { + .map = _ili9341_map, +}; diff --git a/drivers/ili9341/include/ili9341_disp_dev.h b/drivers/ili9341/include/ili9341_disp_dev.h new file mode 100644 index 0000000000000..25751524cfda2 --- /dev/null +++ b/drivers/ili9341/include/ili9341_disp_dev.h @@ -0,0 +1,37 @@ +/* + * 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. + */ + +/** + * @ingroup drivers_ili9341 + * @{ + * + * @file + * @brief Definition of the driver for the disp_dev generic interface + * + * @author Alexandre Abadie + */ + +#ifndef ILI9341_DISP_DEV_H +#define ILI9341_DISP_DEV_H + +#include "disp_dev.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Reference to the display device driver struct + */ +extern const disp_dev_driver_t ili9341_disp_dev_driver; + +#ifdef __cplusplus +} +#endif + +#endif /* ILI9341_DISP_DEV_H */ diff --git a/drivers/include/ili9341.h b/drivers/include/ili9341.h index d7c565f3b121b..c73929046029f 100644 --- a/drivers/include/ili9341.h +++ b/drivers/include/ili9341.h @@ -36,6 +36,10 @@ #include "periph/spi.h" #include "periph/gpio.h" +#ifdef MODULE_DISP_DEV +#include "disp_dev.h" +#endif + #ifdef __cplusplus extern "C" { #endif @@ -98,6 +102,9 @@ typedef struct { * @brief Device descriptor for a ili9341 */ typedef struct { +#ifdef MODULE_DISP_DEV + disp_dev_t *dev; /**< Pointer to the generic display device */ +#endif const ili9341_params_t *params; /**< Device initialization parameters */ } ili9341_t;