cpu/stm32: add disp_dev interface for LTDC

This commit is contained in:
Alexandre Abadie 2021-12-22 16:06:17 +01:00
parent ed16fe60e4
commit 4e582b360f
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
2 changed files with 48 additions and 0 deletions

View File

@ -28,6 +28,10 @@
#include "periph/gpio.h"
#include "periph_conf.h"
#if IS_USED(MODULE_DISP_DEV)
#include "disp_dev.h"
#endif
#define ENABLE_DEBUG 0
#include "debug.h"
@ -206,3 +210,46 @@ void ltdc_fill(uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2, const uint16_
LTDC->SRCR = LTDC_SRCR_IMR;
}
#if IS_USED(MODULE_DISP_DEV)
static void _ltdc_map(const disp_dev_t *disp_dev, uint16_t x1, uint16_t x2,
uint16_t y1, uint16_t y2, const uint16_t *color)
{
(void)disp_dev;
ltdc_map(x1, x2, y1, y2, color);
}
static uint16_t _ltdc_height(const disp_dev_t *disp_dev)
{
(void)disp_dev;
return LCD_SCREEN_HEIGHT;
}
static uint16_t _ltdc_width(const disp_dev_t *disp_dev)
{
(void)disp_dev;
return LCD_SCREEN_WIDTH;
}
static uint8_t _ltdc_color_depth(const disp_dev_t *disp_dev)
{
(void)disp_dev;
return 16;
}
static void _ltdc_set_invert(const disp_dev_t *disp_dev, bool invert)
{
(void)disp_dev;
(void)invert;
}
const disp_dev_driver_t stm32_ltdc_disp_dev_driver = {
.map = _ltdc_map,
.height = _ltdc_height,
.width = _ltdc_width,
.color_depth = _ltdc_color_depth,
.set_invert = _ltdc_set_invert,
};
#endif

View File

@ -208,6 +208,7 @@ config HAS_PERIPH_LPUART
config HAS_PERIPH_LTDC
bool
select MODULE_PERIPH_LTDC if MODULE_DISP_DEV
help
Indicates that a LTDC peripheral is present.