Skip to content

Commit

Permalink
drivers/ili9341: provide adaption to disp_dev interface
Browse files Browse the repository at this point in the history
  • Loading branch information
aabadie committed Jan 16, 2020
1 parent e3fb86e commit e7cbd70
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
32 changes: 32 additions & 0 deletions drivers/ili9341/ili9341_disp_dev.c
Original file line number Diff line number Diff line change
@@ -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 <alexandre.abadie@inria.fr>
* @}
*/

#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,
};
37 changes: 37 additions & 0 deletions drivers/ili9341/include/ili9341_disp_dev.h
Original file line number Diff line number Diff line change
@@ -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 <alexandre.abadie@inria.fr>
*/

#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 */
7 changes: 7 additions & 0 deletions drivers/include/ili9341.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit e7cbd70

Please # to comment.