Skip to content

Commit e7cbd70

Browse files
committed
drivers/ili9341: provide adaption to disp_dev interface
1 parent e3fb86e commit e7cbd70

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

drivers/ili9341/ili9341_disp_dev.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (C) 2019 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+
/**
10+
* @ingroup drivers_ili9341
11+
* @{
12+
*
13+
* @file
14+
* @brief Driver adaption to disp_dev generic interface
15+
*
16+
* @author Alexandre Abadie <[email protected]>
17+
* @}
18+
*/
19+
20+
#include "ili9341.h"
21+
#include "ili9341_disp_dev.h"
22+
23+
void _ili9341_map(disp_dev_t *dev, uint16_t x1, uint16_t x2,
24+
uint16_t y1, uint16_t y2, const uint16_t *color)
25+
{
26+
ili9341_t *ili9341 = (ili9341_t *)dev;
27+
ili9341_pixmap(ili9341, x1, x2, y1, y2, color);
28+
}
29+
30+
const disp_dev_driver_t ili9341_disp_dev_driver = {
31+
.map = _ili9341_map,
32+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (C) 2019 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+
/**
10+
* @ingroup drivers_ili9341
11+
* @{
12+
*
13+
* @file
14+
* @brief Definition of the driver for the disp_dev generic interface
15+
*
16+
* @author Alexandre Abadie <[email protected]>
17+
*/
18+
19+
#ifndef ILI9341_DISP_DEV_H
20+
#define ILI9341_DISP_DEV_H
21+
22+
#include "disp_dev.h"
23+
24+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
28+
/**
29+
* @brief Reference to the display device driver struct
30+
*/
31+
extern const disp_dev_driver_t ili9341_disp_dev_driver;
32+
33+
#ifdef __cplusplus
34+
}
35+
#endif
36+
37+
#endif /* ILI9341_DISP_DEV_H */

drivers/include/ili9341.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
#include "periph/spi.h"
3737
#include "periph/gpio.h"
3838

39+
#ifdef MODULE_DISP_DEV
40+
#include "disp_dev.h"
41+
#endif
42+
3943
#ifdef __cplusplus
4044
extern "C" {
4145
#endif
@@ -98,6 +102,9 @@ typedef struct {
98102
* @brief Device descriptor for a ili9341
99103
*/
100104
typedef struct {
105+
#ifdef MODULE_DISP_DEV
106+
disp_dev_t *dev; /**< Pointer to the generic display device */
107+
#endif
101108
const ili9341_params_t *params; /**< Device initialization parameters */
102109
} ili9341_t;
103110

0 commit comments

Comments
 (0)