aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-11-05 19:32:47 +1000
committerinmarket <andrewh@inmarket.com.au>2014-11-05 19:32:47 +1000
commitb6d183832e2301ae5bef577f27f97ae5d8e7ee7f (patch)
tree5b9625acebcfc1ff3185d1e7840b04a95a977b60 /drivers
parent804fcc7c6ab8f2e0932c65a0fc7a967337f431d6 (diff)
downloaduGFX-b6d183832e2301ae5bef577f27f97ae5d8e7ee7f.tar.gz
uGFX-b6d183832e2301ae5bef577f27f97ae5d8e7ee7f.tar.bz2
uGFX-b6d183832e2301ae5bef577f27f97ae5d8e7ee7f.zip
STM32F429i-Discovery board is now a supported board with an example project.
New gdisp driver (currently non-accelerated) Mouse and other drivers still to come. The board file is currently ChibiOS specific however the gdisp driver is suitable for any OS.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gdisp/STM32F429iDiscovery/board_STM32F429iDiscovery_template.h66
-rw-r--r--drivers/gdisp/STM32F429iDiscovery/driver.mk2
-rw-r--r--drivers/gdisp/STM32F429iDiscovery/gdisp_lld_STM32F429iDiscovery.c410
-rw-r--r--drivers/gdisp/STM32F429iDiscovery/gdisp_lld_config.h24
-rw-r--r--drivers/gdisp/STM32F429iDiscovery/ili9341.h412
-rw-r--r--drivers/gdisp/STM32F429iDiscovery/readme.txt11
-rw-r--r--drivers/gdisp/STM32F429iDiscovery/stm32_ltdc.h551
7 files changed, 1476 insertions, 0 deletions
diff --git a/drivers/gdisp/STM32F429iDiscovery/board_STM32F429iDiscovery_template.h b/drivers/gdisp/STM32F429iDiscovery/board_STM32F429iDiscovery_template.h
new file mode 100644
index 00000000..54c797af
--- /dev/null
+++ b/drivers/gdisp/STM32F429iDiscovery/board_STM32F429iDiscovery_template.h
@@ -0,0 +1,66 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+#ifndef _GDISP_LLD_BOARD_H
+#define _GDISP_LLD_BOARD_H
+
+static const ltdcConfig driverCfg = {
+ 240, 320,
+ 10, 2,
+ 20, 2,
+ 10, 4,
+ 0,
+ 0x000000,
+ {
+ (LLDCOLOR_TYPE *)SDRAM_BANK_ADDR, // frame
+ 240, 320, // width, height
+ 240 * LTDC_PIXELBYTES, // pitch
+ LTDC_PIXELFORMAT, // fmt
+ 0, 0, // x, y
+ 240, 320, // cx, cy
+ LTDC_COLOR_FUCHSIA, // defcolor
+ 0x980088, // keycolor
+ LTDC_BLEND_FIX1_FIX2, // blending
+ 0, // palette
+ 0, // palettelen
+ 0xFF, // alpha
+ LTDC_LEF_ENABLE // flags
+ },
+ LTDC_UNUSED_LAYER_CONFIG
+};
+
+static inline void init_board(GDisplay *g) {
+
+ // As we are not using multiple displays we set g->board to NULL as we don't use it.
+ g->board = 0;
+
+ switch(g->controllerdisplay) {
+ case 0: // Set up for Display 0
+ // Your init here
+ break;
+ }
+}
+
+static inline void post_init_board(GDisplay *g) {
+}
+
+static inline void set_backlight(GDisplay *g, uint8_t percent) {
+}
+
+static inline void acquire_bus(GDisplay *g) {
+}
+
+static inline void release_bus(GDisplay *g) {
+}
+
+static inline void write_index(GDisplay *g, uint8_t index) {
+}
+
+static inline void write_data(GDisplay *g, uint8_t data) {
+}
+
+#endif /* _GDISP_LLD_BOARD_H */
diff --git a/drivers/gdisp/STM32F429iDiscovery/driver.mk b/drivers/gdisp/STM32F429iDiscovery/driver.mk
new file mode 100644
index 00000000..afad5b85
--- /dev/null
+++ b/drivers/gdisp/STM32F429iDiscovery/driver.mk
@@ -0,0 +1,2 @@
+GFXINC += $(GFXLIB)/drivers/gdisp/STM32F429iDiscovery
+GFXSRC += $(GFXLIB)/drivers/gdisp/STM32F429iDiscovery/gdisp_lld_STM32F429iDiscovery.c
diff --git a/drivers/gdisp/STM32F429iDiscovery/gdisp_lld_STM32F429iDiscovery.c b/drivers/gdisp/STM32F429iDiscovery/gdisp_lld_STM32F429iDiscovery.c
new file mode 100644
index 00000000..aae21a8e
--- /dev/null
+++ b/drivers/gdisp/STM32F429iDiscovery/gdisp_lld_STM32F429iDiscovery.c
@@ -0,0 +1,410 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+#include "gfx.h"
+
+#if GFX_USE_GDISP
+
+#if defined(GDISP_SCREEN_HEIGHT)
+ #warning "GDISP: This low level driver does not support setting a screen size. It is being ignored."
+ #undef GISP_SCREEN_HEIGHT
+#endif
+#if defined(GDISP_SCREEN_WIDTH)
+ #warning "GDISP: This low level driver does not support setting a screen size. It is being ignored."
+ #undef GDISP_SCREEN_WIDTH
+#endif
+
+#define GDISP_DRIVER_VMT GDISPVMT_STM32F429iDiscovery
+#include "drivers/gdisp/STM32F429iDiscovery/gdisp_lld_config.h"
+#include "src/gdisp/driver.h"
+
+#include "stm32_ltdc.h"
+
+typedef struct ltdcLayerConfig {
+ // frame
+ LLDCOLOR_TYPE *frame; // Frame buffer address
+ coord_t width, height; // Frame size in pixels
+ coord_t pitch; // Line pitch, in bytes
+ ltdc_pixfmt_t fmt; // Pixel format in LTDC format
+
+ // window
+ coord_t x, y; // Start pixel position of the virtual layer
+ coord_t cx, cy; // Size of the virtual layer
+
+ uint32_t defcolor; // Default color, ARGB8888
+ uint32_t keycolor; // Color key, RGB888
+ uint32_t blending; // Blending factors
+ const uint32_t *palette; // The palette, RGB888 (can be NULL)
+ uint16_t palettelen; // Palette length
+ uint8_t alpha; // Constant alpha factor
+ uint8_t layerflags; // Layer configuration
+} ltdcLayerConfig;
+
+#define LTDC_UNUSED_LAYER_CONFIG { 0, 1, 1, 1, LTDC_FMT_L8, 0, 0, 1, 1, 0x000000, 0x000000, LTDC_BLEND_FIX1_FIX2, 0, 0, 0, 0 }
+
+typedef struct ltdcConfig {
+ coord_t width, height; // Screen size
+ coord_t hsync, vsync; // Horizontal and Vertical sync pixels
+ coord_t hbackporch, vbackporch; // Horizontal and Vertical back porch pixels
+ coord_t hfrontporch, vfrontporch; // Horizontal and Vertical front porch pixels
+ uint8_t syncflags; // Sync flags
+ uint32_t bgcolor; // Clear screen color RGB888
+
+ ltdcLayerConfig bglayer; // Background layer config
+ ltdcLayerConfig fglayer; // Foreground layer config
+} ltdcConfig;
+
+#if GDISP_LLD_PIXELFORMAT == GDISP_PIXELFORMAT_RGB565
+ #define LTDC_PIXELFORMAT LTDC_FMT_RGB565
+ #define LTDC_PIXELBYTES 2
+ #define LTDC_PIXELBITS 16
+#elif GDISP_LLD_PIXELFORMAT == GDISP_PIXELFORMAT_RGB888
+ #define LTDC_PIXELFORMAT LTDC_FMT_RGB888
+ #define LTDC_PIXELBYTES 3
+ #define LTDC_PIXELBITS 24
+#else
+ #error "GDISP: STM32F4iDiscovery - unsupported pixel format"
+#endif
+
+#include "board_STM32F429iDiscovery.h"
+
+#include "ili9341.h"
+
+/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+#ifndef GDISP_INITIAL_CONTRAST
+ #define GDISP_INITIAL_CONTRAST 50
+#endif
+#ifndef GDISP_INITIAL_BACKLIGHT
+ #define GDISP_INITIAL_BACKLIGHT 100
+#endif
+
+/*===========================================================================*/
+/* Driver local routines . */
+/*===========================================================================*/
+
+#define PIXIL_POS(g, x, y) ((y) * driverCfg.bglayer.pitch + (x) * LTDC_PIXELBYTES)
+#define PIXEL_ADDR(g, pos) ((LLDCOLOR_TYPE *)((uint8_t *)driverCfg.bglayer.frame+pos))
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
+static void InitController(GDisplay *g) {
+ #define REG_TYPEMASK 0xFF00
+ #define REG_DATAMASK 0x00FF
+
+ #define REG_DATA 0x0000
+ #define REG_COMMAND 0x0100
+ #define REG_DELAY 0x0200
+
+ static const uint16_t initdata[] = {
+ REG_COMMAND | ILI9341_CMD_RESET,
+ REG_DELAY | 5,
+ REG_COMMAND | ILI9341_CMD_DISPLAY_OFF,
+ REG_COMMAND | ILI9341_SET_FRAME_CTL_NORMAL, 0x00, 0x1B,
+ REG_COMMAND | ILI9341_SET_FUNCTION_CTL, 0x0A, 0xA2,
+ REG_COMMAND | ILI9341_SET_POWER_CTL_1, 0x10,
+ REG_COMMAND | ILI9341_SET_POWER_CTL_2, 0x10,
+ REG_COMMAND | ILI9341_SET_VCOM_CTL_1, 0x45, 0x15,
+ REG_COMMAND | ILI9341_SET_VCOM_CTL_2, 0x90,
+ REG_COMMAND | ILI9341_SET_MEM_ACS_CTL, 0xC8,
+ REG_COMMAND | ILI9341_SET_RGB_IF_SIG_CTL, 0xC2,
+ REG_COMMAND | ILI9341_SET_FUNCTION_CTL, 0x0A, 0xA7, 0x27, 0x04,
+ REG_COMMAND | ILI9341_SET_COL_ADDR, 0x00, 0x00, 0x00, 0xEF,
+ REG_COMMAND | ILI9341_SET_PAGE_ADDR, 0x00, 0x00, 0x01, 0x3F,
+ REG_COMMAND | ILI9341_SET_IF_CTL, 0x01, 0x00, 0x06,
+ REG_COMMAND | ILI9341_SET_GAMMA, 0x01,
+ REG_COMMAND | ILI9341_SET_PGAMMA,
+ 0x0F, 0x29, 0x24, 0x0C, 0x0E, 0x09, 0x4E, 0x78,
+ 0x3C, 0x09, 0x13, 0x05, 0x17, 0x11, 0x00,
+ REG_COMMAND | ILI9341_SET_NGAMMA,
+ 0x00, 0x16, 0x1B, 0x04, 0x11, 0x07, 0x31, 0x33,
+ 0x42, 0x05, 0x0C, 0x0A, 0x28, 0x2F, 0x0F,
+ REG_COMMAND | ILI9341_CMD_SLEEP_OFF,
+ REG_DELAY | 10,
+ REG_COMMAND | ILI9341_CMD_DISPLAY_ON,
+ REG_COMMAND | ILI9341_SET_MEM
+ };
+
+ const uint16_t *p;
+
+ acquire_bus(g);
+ for(p = initdata; p < &initdata[sizeof(initdata)/sizeof(initdata[0])]; p++) {
+ switch(*p & REG_TYPEMASK) {
+ case REG_DATA: write_data(g, *p); break;
+ case REG_COMMAND: write_index(g, *p); break;
+ case REG_DELAY: gfxSleepMilliseconds(*p & 0xFF); break;
+ }
+ }
+ release_bus(g);
+}
+
+static void LTDC_Reload(void) {
+ LTDC->SRCR |= LTDC_SRCR_IMR;
+ while (LTDC->SRCR & (LTDC_SRCR_IMR | LTDC_SRCR_VBR))
+ gfxYield();
+}
+
+static void LTDC_LayerInit(LTDC_Layer_TypeDef *pLayReg, const ltdcLayerConfig * pCfg) {
+ static const uint8_t fmt2Bpp[] = {
+ 4, /* LTDC_FMT_ARGB8888 */
+ 3, /* LTDC_FMT_RGB888 */
+ 2, /* LTDC_FMT_RGB565 */
+ 2, /* LTDC_FMT_ARGB1555 */
+ 2, /* LTDC_FMT_ARGB4444 */
+ 1, /* LTDC_FMT_L8 */
+ 1, /* LTDC_FMT_AL44 */
+ 2 /* LTDC_FMT_AL88 */
+ };
+ uint32_t start, stop;
+
+ // Set the framebuffer dimensions and format
+ pLayReg->PFCR = (pLayReg->PFCR & ~LTDC_LxPFCR_PF) | ((uint32_t)pCfg->fmt & LTDC_LxPFCR_PF);
+ pLayReg->CFBAR = (uint32_t)pCfg->frame & LTDC_LxCFBAR_CFBADD;
+ pLayReg->CFBLR = ((((uint32_t)pCfg->pitch << 16) & LTDC_LxCFBLR_CFBP) | (((uint32_t)fmt2Bpp[pCfg->fmt] * pCfg->width + 3) & LTDC_LxCFBLR_CFBLL));
+ pLayReg->CFBLNR = (uint32_t)pCfg->height & LTDC_LxCFBLNR_CFBLNBR;
+
+ // Set the display window boundaries
+ start = (uint32_t)pCfg->x + driverCfg.hsync + driverCfg.hbackporch;
+ stop = start + pCfg->cx - 1;
+ pLayReg->WHPCR = ((start << 0) & LTDC_LxWHPCR_WHSTPOS) | ((stop << 16) & LTDC_LxWHPCR_WHSPPOS);
+ start = (uint32_t)pCfg->y + driverCfg.vsync + driverCfg.vbackporch;
+ stop = start + pCfg->cy - 1;
+ pLayReg->WVPCR = ((start << 0) & LTDC_LxWVPCR_WVSTPOS) | ((stop << 16) & LTDC_LxWVPCR_WVSPPOS);
+
+ // Set colors
+ pLayReg->DCCR = pCfg->defcolor;
+ pLayReg->CKCR = (pLayReg->CKCR & ~0x00FFFFFF) | (pCfg->keycolor & 0x00FFFFFF);
+ pLayReg->CACR = (pLayReg->CACR & ~LTDC_LxCACR_CONSTA) | ((uint32_t)pCfg->alpha & LTDC_LxCACR_CONSTA);
+ pLayReg->BFCR = (pLayReg->BFCR & ~(LTDC_LxBFCR_BF1 | LTDC_LxBFCR_BF2)) | ((uint32_t)pCfg->blending & (LTDC_LxBFCR_BF1 | LTDC_LxBFCR_BF2));
+ for (start = 0; start < pCfg->palettelen; start++)
+ pLayReg->CLUTWR = ((uint32_t)start << 24) | (pCfg->palette[start] & 0x00FFFFFF);
+
+ // Final flags
+ pLayReg->CR = (pLayReg->CR & ~LTDC_LEF_MASK) | ((uint32_t)pCfg->layerflags & LTDC_LEF_MASK);
+}
+
+static void LTDC_Init(void) {
+ // Set up the display scanning
+ uint32_t hacc, vacc;
+
+ /* Reset the LTDC hardware module.*/
+ RCC->APB2RSTR |= RCC_APB2RSTR_LTDCRST;
+ RCC->APB2RSTR = 0;
+
+ /* Enable the LTDC clock.*/
+ RCC->DCKCFGR = (RCC->DCKCFGR & ~RCC_DCKCFGR_PLLSAIDIVR) | (2 << 16); /* /8 */
+
+ // Enable the module
+ RCC->APB2ENR |= RCC_APB2ENR_LTDCEN;
+
+ // Turn off the controller and its interrupts.
+ LTDC->GCR = 0;
+ LTDC->IER = 0;
+ LTDC_Reload();
+
+ // Set synchronization params
+ hacc = driverCfg.hsync - 1;
+ vacc = driverCfg.vsync - 1;
+ LTDC->SSCR = ((hacc << 16) & LTDC_SSCR_HSW) | ((vacc << 0) & LTDC_SSCR_VSH);
+
+ // Set accumulated back porch params
+ hacc += driverCfg.hbackporch;
+ vacc += driverCfg.vbackporch;
+ LTDC->BPCR = ((hacc << 16) & LTDC_BPCR_AHBP) | ((vacc << 0) & LTDC_BPCR_AVBP);
+
+ // Set accumulated active params
+ hacc += driverCfg.width;
+ vacc += driverCfg.height;
+ LTDC->AWCR = ((hacc << 16) & LTDC_AWCR_AAW) | ((vacc << 0) & LTDC_AWCR_AAH);
+
+ // Set accumulated total params
+ hacc += driverCfg.hfrontporch;
+ vacc += driverCfg.vfrontporch;
+ LTDC->TWCR = ((hacc << 16) & LTDC_TWCR_TOTALW) | ((vacc << 0) & LTDC_TWCR_TOTALH);
+
+ // Set signal polarities and other flags
+ LTDC->GCR = driverCfg.syncflags & (LTDC_EF_MASK & ~LTDC_EF_ENABLE);
+
+ // Set background color
+ LTDC->BCCR = (LTDC->BCCR & ~0x00FFFFFF) | (driverCfg.bgcolor & 0x00FFFFFF);
+
+ // Load the background layer
+ LTDC_LayerInit(LTDC_Layer1, &driverCfg.bglayer);
+
+ // Load the foreground layer
+ LTDC_LayerInit(LTDC_Layer2, &driverCfg.fglayer);
+
+ // Interrupt handling
+ //nvicEnableVector(STM32_LTDC_EV_NUMBER, CORTEX_PRIORITY_MASK(STM32_LTDC_EV_IRQ_PRIORITY));
+ //nvicEnableVector(STM32_LTDC_ER_NUMBER, CORTEX_PRIORITY_MASK(STM32_LTDC_ER_IRQ_PRIORITY));
+ // Possible flags - LTDC_IER_RRIE, LTDC_IER_LIE, LTDC_IER_FUIE, LTDC_IER_TERRIE etc
+ LTDC->IER = 0;
+
+ // Set everything going
+ LTDC_Reload();
+ LTDC->GCR |= LTDC_GCR_LTDCEN;
+ LTDC_Reload();
+}
+
+LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
+
+ // Initialize the private structure
+ g->priv = 0;
+ g->board = 0;
+ //if (!(g->priv = gfxAlloc(sizeof(fbPriv))))
+ // gfxHalt("GDISP Framebuffer: Failed to allocate private memory");
+
+ // Init the board
+ init_board(g);
+ //((fbPriv *)g->priv)->fbi.cfg = init_board(g);
+
+ // Initialise the ILI9341 controller
+ InitController(g);
+
+ // Initialise the LTDC controller
+ LTDC_Init();
+
+ // Initialise DMA2D
+ //dma2dStart(&DMA2DD1, &dma2d_cfg);
+ //dma2d_test();
+
+ // Finish Init the board
+ post_init_board(g);
+
+ /* Turn on the back-light */
+ set_backlight(g, GDISP_INITIAL_BACKLIGHT);
+
+ /* Initialise the GDISP structure */
+ g->g.Width = driverCfg.bglayer.width;
+ g->g.Height = driverCfg.bglayer.height;
+ g->g.Orientation = GDISP_ROTATE_0;
+ g->g.Powermode = powerOn;
+ g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
+ g->g.Contrast = GDISP_INITIAL_CONTRAST;
+ return TRUE;
+}
+
+LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
+ unsigned pos;
+
+ #if GDISP_NEED_CONTROL
+ switch(g->g.Orientation) {
+ case GDISP_ROTATE_0:
+ default:
+ pos = PIXIL_POS(g, g->p.x, g->p.y);
+ break;
+ case GDISP_ROTATE_90:
+ pos = PIXIL_POS(g, g->p.y, g->g.Width-g->p.x-1);
+ break;
+ case GDISP_ROTATE_180:
+ pos = PIXIL_POS(g, g->g.Width-g->p.x-1, g->g.Height-g->p.y-1);
+ break;
+ case GDISP_ROTATE_270:
+ pos = PIXIL_POS(g, g->g.Height-g->p.y-1, g->p.x);
+ break;
+ }
+ #else
+ pos = PIXIL_POS(g, g->p.x, g->p.y);
+ #endif
+
+ PIXEL_ADDR(g, pos)[0] = gdispColor2Native(g->p.color);
+}
+
+LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
+ unsigned pos;
+ LLDCOLOR_TYPE color;
+
+ #if GDISP_NEED_CONTROL
+ switch(g->g.Orientation) {
+ case GDISP_ROTATE_0:
+ default:
+ pos = PIXIL_POS(g, g->p.x, g->p.y);
+ break;
+ case GDISP_ROTATE_90:
+ pos = PIXIL_POS(g, g->p.y, g->g.Width-g->p.x-1);
+ break;
+ case GDISP_ROTATE_180:
+ pos = PIXIL_POS(g, g->g.Width-g->p.x-1, g->g.Height-g->p.y-1);
+ break;
+ case GDISP_ROTATE_270:
+ pos = PIXIL_POS(g, g->g.Height-g->p.y-1, g->p.x);
+ break;
+ }
+ #else
+ pos = PIXIL_POS(g, g->p.x, g->p.y);
+ #endif
+
+ color = PIXEL_ADDR(g, pos)[0];
+ return gdispNative2Color(color);
+}
+
+#if GDISP_NEED_CONTROL
+ LLDSPEC void gdisp_lld_control(GDisplay *g) {
+ switch(g->p.x) {
+ case GDISP_CONTROL_POWER:
+ if (g->g.Powermode == (powermode_t)g->p.ptr)
+ return;
+ switch((powermode_t)g->p.ptr) {
+ case powerOff: case powerOn: case powerSleep: case powerDeepSleep:
+ board_power(g, (powermode_t)g->p.ptr);
+ break;
+ default:
+ return;
+ }
+ g->g.Powermode = (powermode_t)g->p.ptr;
+ return;
+
+ case GDISP_CONTROL_ORIENTATION:
+ if (g->g.Orientation == (orientation_t)g->p.ptr)
+ return;
+ switch((orientation_t)g->p.ptr) {
+ case GDISP_ROTATE_0:
+ case GDISP_ROTATE_180:
+ if (g->g.Orientation == GDISP_ROTATE_90 || g->g.Orientation == GDISP_ROTATE_270) {
+ coord_t tmp;
+
+ tmp = g->g.Width;
+ g->g.Width = g->g.Height;
+ g->g.Height = tmp;
+ }
+ break;
+ case GDISP_ROTATE_90:
+ case GDISP_ROTATE_270:
+ if (g->g.Orientation == GDISP_ROTATE_0 || g->g.Orientation == GDISP_ROTATE_180) {
+ coord_t tmp;
+
+ tmp = g->g.Width;
+ g->g.Width = g->g.Height;
+ g->g.Height = tmp;
+ }
+ break;
+ default:
+ return;
+ }
+ g->g.Orientation = (orientation_t)g->p.ptr;
+ return;
+
+ case GDISP_CONTROL_BACKLIGHT:
+ if ((unsigned)g->p.ptr > 100) g->p.ptr = (void *)100;
+ board_backlight(g, (unsigned)g->p.ptr);
+ g->g.Backlight = (unsigned)g->p.ptr;
+ return;
+
+ case GDISP_CONTROL_CONTRAST:
+ if ((unsigned)g->p.ptr > 100) g->p.ptr = (void *)100;
+ board_contrast(g, (unsigned)g->p.ptr);
+ g->g.Contrast = (unsigned)g->p.ptr;
+ return;
+ }
+ }
+#endif
+
+#endif /* GFX_USE_GDISP */
diff --git a/drivers/gdisp/STM32F429iDiscovery/gdisp_lld_config.h b/drivers/gdisp/STM32F429iDiscovery/gdisp_lld_config.h
new file mode 100644
index 00000000..29e016ce
--- /dev/null
+++ b/drivers/gdisp/STM32F429iDiscovery/gdisp_lld_config.h
@@ -0,0 +1,24 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+#ifndef _GDISP_LLD_CONFIG_H
+#define _GDISP_LLD_CONFIG_H
+
+#if GFX_USE_GDISP
+
+/*===========================================================================*/
+/* Driver hardware support. */
+/*===========================================================================*/
+
+#define GDISP_HARDWARE_DRAWPIXEL TRUE
+#define GDISP_HARDWARE_PIXELREAD TRUE
+#define GDISP_HARDWARE_CONTROL TRUE
+#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB565
+
+#endif /* GFX_USE_GDISP */
+
+#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/drivers/gdisp/STM32F429iDiscovery/ili9341.h b/drivers/gdisp/STM32F429iDiscovery/ili9341.h
new file mode 100644
index 00000000..17ad488c
--- /dev/null
+++ b/drivers/gdisp/STM32F429iDiscovery/ili9341.h
@@ -0,0 +1,412 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+#ifndef ILI9341_H
+#define ILI9341_H
+
+// ILI9341 commands
+#define ILI9341_CMD_NOP 0x00 /**< No operation.*/
+#define ILI9341_CMD_RESET 0x01 /**< Software reset.*/
+#define ILI9341_GET_ID_INFO 0x04 /**< Get ID information.*/
+#define ILI9341_GET_STATUS 0x09 /**< Get status.*/
+#define ILI9341_GET_PWR_MODE 0x0A /**< Get power mode.*/
+#define ILI9341_GET_MADCTL 0x0B /**< Get MADCTL.*/
+#define ILI9341_GET_PIX_FMT 0x0C /**< Get pixel format.*/
+#define ILI9341_GET_IMG_FMT 0x0D /**< Get image format.*/
+#define ILI9341_GET_SIG_MODE 0x0E /**< Get signal mode.*/
+#define ILI9341_GET_SELF_DIAG 0x0F /**< Get self-diagnostics.*/
+#define ILI9341_CMD_SLEEP_ON 0x10 /**< Enter sleep mode.*/
+#define ILI9341_CMD_SLEEP_OFF 0x11 /**< Exist sleep mode.*/
+#define ILI9341_CMD_PARTIAL_ON 0x12 /**< Enter partial mode.*/
+#define ILI9341_CMD_PARTIAL_OFF 0x13 /**< Exit partial mode.*/
+#define ILI9341_CMD_INVERT_ON 0x20 /**< Enter inverted mode.*/
+#define ILI9341_CMD_INVERT_OFF 0x21 /**< Exit inverted mode.*/
+#define ILI9341_SET_GAMMA 0x26 /**< Set gamma params.*/
+#define ILI9341_CMD_DISPLAY_OFF 0x28 /**< Disable display.*/
+#define ILI9341_CMD_DISPLAY_ON 0x29 /**< Enable display.*/
+#define ILI9341_SET_COL_ADDR 0x2A /**< Set column address.*/
+#define ILI9341_SET_PAGE_ADDR 0x2B /**< Set page address.*/
+#define ILI9341_SET_MEM 0x2C /**< Set memory.*/
+#define ILI9341_SET_COLOR 0x2D /**< Set color.*/
+#define ILI9341_GET_MEM 0x2E /**< Get memory.*/
+#define ILI9341_SET_PARTIAL_AREA 0x30 /**< Set partial area.*/
+#define ILI9341_SET_VSCROLL 0x33 /**< Set vertical scroll def.*/
+#define ILI9341_CMD_TEARING_ON 0x34 /**< Tearing line enabled.*/
+#define ILI9341_CMD_TEARING_OFF 0x35 /**< Tearing line disabled.*/
+#define ILI9341_SET_MEM_ACS_CTL 0x36 /**< Set mem access ctl.*/
+#define ILI9341_SET_VSCROLL_ADDR 0x37 /**< Set vscroll start addr.*/
+#define ILI9341_CMD_IDLE_OFF 0x38 /**< Exit idle mode.*/
+#define ILI9341_CMD_IDLE_ON 0x39 /**< Enter idle mode.*/
+#define ILI9341_SET_PIX_FMT 0x3A /**< Set pixel format.*/
+#define ILI9341_SET_MEM_CONT 0x3C /**< Set memory continue.*/
+#define ILI9341_GET_MEM_CONT 0x3E /**< Get memory continue.*/
+#define ILI9341_SET_TEAR_SCANLINE 0x44 /**< Set tearing scanline.*/
+#define ILI9341_GET_TEAR_SCANLINE 0x45 /**< Get tearing scanline.*/
+#define ILI9341_SET_BRIGHTNESS 0x51 /**< Set brightness.*/
+#define ILI9341_GET_BRIGHTNESS 0x52 /**< Get brightness.*/
+#define ILI9341_SET_DISPLAY_CTL 0x53 /**< Set display ctl.*/
+#define ILI9341_GET_DISPLAY_CTL 0x54 /**< Get display ctl.*/
+#define ILI9341_SET_CABC 0x55 /**< Set CABC.*/
+#define ILI9341_GET_CABC 0x56 /**< Get CABC.*/
+#define ILI9341_SET_CABC_MIN 0x5E /**< Set CABC min.*/
+#define ILI9341_GET_CABC_MIN 0x5F /**< Set CABC max.*/
+#define ILI9341_GET_ID1 0xDA /**< Get ID1.*/
+#define ILI9341_GET_ID2 0xDB /**< Get ID2.*/
+#define ILI9341_GET_ID3 0xDC /**< Get ID3.*/
+
+// ILI9341 extended commands
+#define ILI9341_SET_RGB_IF_SIG_CTL 0xB0 /**< RGB IF signal ctl.*/
+#define ILI9341_SET_FRAME_CTL_NORMAL 0xB1 /**< Set frame ctl (normal).*/
+#define ILI9341_SET_FRAME_CTL_IDLE 0xB2 /**< Set frame ctl (idle).*/
+#define ILI9341_SET_FRAME_CTL_PARTIAL 0xB3 /**< Set frame ctl (partial).*/
+#define ILI9341_SET_INVERSION_CTL 0xB4 /**< Set inversion ctl.*/
+#define ILI9341_SET_BLANKING_PORCH_CTL 0xB5 /**< Set blanking porch ctl.*/
+#define ILI9341_SET_FUNCTION_CTL 0xB6 /**< Set function ctl.*/
+#define ILI9341_SET_ENTRY_MODE 0xB7 /**< Set entry mode.*/
+#define ILI9341_SET_LIGHT_CTL_1 0xB8 /**< Set backlight ctl 1.*/
+#define ILI9341_SET_LIGHT_CTL_2 0xB9 /**< Set backlight ctl 2.*/
+#define ILI9341_SET_LIGHT_CTL_3 0xBA /**< Set backlight ctl 3.*/
+#define ILI9341_SET_LIGHT_CTL_4 0xBB /**< Set backlight ctl 4.*/
+#define ILI9341_SET_LIGHT_CTL_5 0xBC /**< Set backlight ctl 5.*/
+#define ILI9341_SET_LIGHT_CTL_7 0xBE /**< Set backlight ctl 7.*/
+#define ILI9341_SET_LIGHT_CTL_8 0xBF /**< Set backlight ctl 8.*/
+#define ILI9341_SET_POWER_CTL_1 0xC0 /**< Set power ctl 1.*/
+#define ILI9341_SET_POWER_CTL_2 0xC1 /**< Set power ctl 2.*/
+#define ILI9341_SET_VCOM_CTL_1 0xC5 /**< Set VCOM ctl 1.*/
+#define ILI9341_SET_VCOM_CTL_2 0xC6 /**< Set VCOM ctl 2.*/
+#define ILI9341_SET_NVMEM 0xD0 /**< Set NVMEM data.*/
+#define ILI9341_GET_NVMEM_KEY 0xD1 /**< Get NVMEM protect key.*/
+#define ILI9341_GET_NVMEM_STATUS 0xD2 /**< Get NVMEM status.*/
+#define ILI9341_GET_ID4 0xD3 /**< Get ID4.*/
+#define ILI9341_SET_PGAMMA 0xE0 /**< Set positive gamma.*/
+#define ILI9341_SET_NGAMMA 0xE1 /**< Set negative gamma.*/
+#define ILI9341_SET_DGAMMA_CTL_1 0xE2 /**< Set digital gamma ctl 1.*/
+#define ILI9341_SET_DGAMMA_CTL_2 0xE3 /**< Set digital gamma ctl 2.*/
+#define ILI9341_SET_IF_CTL 0xF6 /**< Set interface control.*/
+
+// ILI9341 interface modes
+#define ILI9341_IM_3LSI_1 0x5 /**< 3-line serial, mode 1.*/
+#define ILI9341_IM_3LSI_2 0xD /**< 3-line serial, mode 2.*/
+#define ILI9341_IM_4LSI_1 0x6 /**< 4-line serial, mode 1.*/
+#define ILI9341_IM_4LSI_2 0xE /**< 4-line serial, mode 2.*/
+
+// ILI9341 command params (little endian)
+
+#pragma pack(push, 1)
+
+typedef union {
+ struct ILI9341ParamBits_GET_ID_INFO {
+ uint8_t reserved_;
+ uint8_t ID1;
+ uint8_t ID2;
+ uint8_t ID3;
+ } bits;
+ uint8_t bytes[4];
+} ILI9341Params_GET_ID_INFO;
+
+typedef union {
+ struct ILI9341ParamBits_GET_STATUS {
+ unsigned _reserved_1 : 5; /* D[ 4: 0] */
+ unsigned tearing_mode : 1; /* D[ 5] */
+ unsigned gamma_curve : 3; /* D[ 8: 6] */
+ unsigned tearing : 1; /* D[ 9] */
+ unsigned display : 1; /* D[10] */
+ unsigned all_on : 1; /* D[11] */
+ unsigned all_off : 1; /* D[12] */
+ unsigned invert : 1; /* D[13] */
+ unsigned _reserved_2 : 1; /* D[14] */
+ unsigned vscroll : 1; /* D[15] */
+ unsigned normal : 1; /* D[16] */
+ unsigned sleep : 1; /* D[17] */
+ unsigned partial : 1; /* D[18] */
+ unsigned idle : 1; /* D[19] */
+ unsigned pixel_format : 3; /* D[22:20] */
+ unsigned _reserved_3 : 2; /* D[24:23] */
+ unsigned hrefr_rtl_nltr : 1; /* D[25] */
+ unsigned bgr_nrgb : 1; /* D[26] */
+ unsigned vrefr_btt_nttb : 1; /* D[27] */
+ unsigned transpose : 1; /* D[28] */
+ unsigned coladr_rtl_nltr : 1; /* D[29] */
+ unsigned rowadr_btt_nttb : 1; /* D[30] */
+ unsigned booster : 1; /* D[31] */
+ } bits;
+ uint8_t bytes[4];
+} ILI9341Params_GET_STATUS;
+
+typedef union {
+ struct ILI9341ParamBits_GET_PWR_MODE {
+ unsigned _reserved_1 : 2; /* D[1:0] */
+ unsigned display : 1; /* D[2] */
+ unsigned normal : 1; /* D[3] */
+ unsigned sleep : 1; /* D[4] */
+ unsigned partial : 1; /* D[5] */
+ unsigned idle : 1; /* D[6] */
+ unsigned booster : 1; /* D[7] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_PWR_MODE;
+
+typedef union {
+ struct ILI9341ParamBits_GET_MADCTL {
+ unsigned _reserved_1 : 2; /* D[1:0] */
+ unsigned refr_rtl_nltr : 1; /* D[2] */
+ unsigned bgr_nrgb : 1; /* D[3] */
+ unsigned refr_btt_nttb : 1; /* D[4] */
+ unsigned invert : 1; /* D[5] */
+ unsigned rtl_nltr : 1; /* D[6] */
+ unsigned btt_nttb : 1; /* D[7] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_MADCTL;
+
+typedef union {
+ struct ILI9341ParamBits_GET_PIX_FMT {
+ unsigned DBI : 3; /* D[2:0] */
+ unsigned _reserved_1 : 1; /* D[3] */
+ unsigned DPI : 3; /* D[6:4] */
+ unsigned RIM : 1; /* D[7] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_PIX_FMT;
+
+typedef union {
+ struct ILI9341ParamBits_GET_IMG_FMT {
+ unsigned gamma_curve : 3; /* D[2:0] */
+ unsigned _reserved_1 : 5; /* D[7:3] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_IMG_FMT;
+
+typedef union {
+ struct ILI9341ParamBits_GET_SIG_MODE {
+ unsigned _reserved_1 : 2; /* D[1:0] */
+ unsigned data_enable : 1; /* D[2] */
+ unsigned pixel_clock : 1; /* D[3] */
+ unsigned vsync : 1; /* D[4] */
+ unsigned hsync : 1; /* D[5] */
+ unsigned tearing_mode : 1; /* D[6] */
+ unsigned tearing : 1; /* D[7] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_SIG_MODE;
+
+typedef union {
+ struct ILI9341ParamBits_GET_SELF_DIAG {
+ unsigned _reserved_1 : 6; /* D[5:0] */
+ unsigned func_err : 1; /* D[6] */
+ unsigned reg_err : 1; /* D[7] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_SELF_DIAG;
+
+typedef union {
+ struct ILI9341ParamBits_SET_GAMMA {
+ uint8_t gamma_curve; /* D[7:0] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_SET_GAMMA;
+
+typedef union {
+ struct ILI9341ParamBits_SET_COL_ADDR {
+ uint8_t SC_15_8; /* D[ 7: 0] */
+ uint8_t SC_7_0; /* D[15: 8] */
+ uint8_t EC_15_8; /* D[23:16] */
+ uint8_t EC_7_0; /* D[31:24] */
+ } bits;
+ uint8_t bytes[4];
+} ILI9341Params_SET_COL_ADDR;
+
+typedef union {
+ struct ILI9341ParamBits_SET_PAGE_ADDR {
+ uint8_t SP_15_8; /* D[ 7: 0] */
+ uint8_t SP_7_0; /* D[15: 8] */
+ uint8_t EP_15_8; /* D[23:16] */
+ uint8_t EP_7_0; /* D[31:24] */
+ } bits;
+ uint8_t bytes[4];
+} ILI9341Params_SET_PAGE_ADDR;
+
+typedef union {
+ struct ILI9341ParamBits_SET_PARTIAL_AREA {
+ uint8_t SR_15_8; /* D[ 7: 0] */
+ uint8_t SR_7_0; /* D[15: 8] */
+ uint8_t ER_15_8; /* D[23:16] */
+ uint8_t ER_7_0; /* D[31:24] */
+ } bits;
+ uint8_t bytes[4];
+} ILI9341Params_SET_PARTIAL_AREA;
+
+typedef union {
+ struct ILI9341ParamBits_SET_VSCROLL {
+ uint8_t TFA_15_8; /* D[ 7: 0] */
+ uint8_t TFA_7_0; /* D[15: 8] */
+ uint8_t VSA_15_8; /* D[23:16] */
+ uint8_t VSA_7_0; /* D[31:24] */
+ uint8_t BFA_15_8; /* D[39:32] */
+ uint8_t BFA_7_0; /* D[47:40] */
+ } bits;
+ uint8_t bytes[6];
+} ILI9341Params_SET_VSCROLL;
+
+typedef union {
+ struct ILI9341ParamBits_CMD_TEARING_ON {
+ unsigned M : 1; /* D[0] */
+ unsigned _reserved_1 : 7; /* D[7:1] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_CMD_TEARING_ON;
+
+typedef union {
+ struct ILI9341ParamBits_SET_MEM_ACS_CTL {
+ unsigned _reserved_1 : 2; /* D[1:0] */
+ unsigned MH : 1; /* D[2] */
+ unsigned BGR : 1; /* D[3] */
+ unsigned ML : 1; /* D[4] */
+ unsigned MV : 1; /* D[5] */
+ unsigned MX : 1; /* D[6] */
+ unsigned MY : 1; /* D[7] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_SET_MEM_ACS_CTL;
+
+typedef union {
+ struct ILI9341ParamBits_SET_VSCROLL_ADDR {
+ uint8_t VSP_15_8; /* D[ 7: 0] */
+ uint8_t VSP_7_0; /* D[15: 8] */
+ } bits;
+ uint8_t bytes[2];
+} ILI9341Params_SET_VSCROLL_ADDR;
+
+typedef union {
+ struct ILI9341ParamBits_SET_PIX_FMT {
+ unsigned DBI : 3; /* D[2:0] */
+ unsigned _reserved_1 : 1; /* D[3] */
+ unsigned DPI : 3; /* D[4:6] */
+ unsigned _reserved_2 : 1; /* D[7] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_SET_PIX_FMT;
+
+typedef union {
+ struct ILI9341ParamBits_SET_TEAR_SCANLINE {
+ uint8_t STS_8; /* D[ 7: 0] */
+ uint8_t STS_7_0; /* D[15: 8] */
+ } bits;
+ uint8_t bytes[4];
+} ILI9341Params_SET_TEAR_SCANLINE;
+
+typedef union {
+ struct ILI9341ParamBits_GET_TEAR_SCANLINE {
+ uint8_t GTS_9_8; /* D[ 7: 0] */
+ uint8_t GTS_7_0; /* D[15: 8] */
+ } bits;
+ uint8_t bytes[2];
+} ILI9341Params_GET_TEAR_SCANLINE;
+
+typedef union {
+ struct ILI9341ParamBits_SET_BRIGHTNESS {
+ uint8_t DBV; /* D[7:0] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_SET_BRIGHTNESS;
+
+typedef union {
+ struct ILI9341ParamBits_GET_BRIGHTNESS {
+ uint8_t DBV; /* D[7:0] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_BRIGHTNESS;
+
+typedef union {
+ struct ILI9341ParamBits_SET_DISPLAY_CTL {
+ unsigned _reserved_1 : 2; /* D[1:0] */
+ unsigned BL : 1; /* D[2] */
+ unsigned DD : 1; /* D[3] */
+ unsigned _reserved_2 : 1; /* D[4] */
+ unsigned BCTRL : 1; /* D[5] */
+ unsigned _reserved_3 : 1; /* D[7:6] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_SET_DISPLAY_CTL;
+
+typedef union {
+ struct ILI9341ParamBits_GET_DISPLAY_CTL {
+ unsigned _reserved_1 : 2; /* D[1:0] */
+ unsigned BL : 1; /* D[2] */
+ unsigned DD : 1; /* D[3] */
+ unsigned _reserved_2 : 1; /* D[4] */
+ unsigned BCTRL : 1; /* D[5] */
+ unsigned _reserved_3 : 1; /* D[7:6] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_DISPLAY_CTL;
+
+typedef union {
+ struct ILI9341ParamBits_SET_CABC {
+ unsigned C : 2; /* D[1:0] */
+ unsigned _reserved_1 : 6; /* D[7:2] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_SET_CABC;
+
+typedef union {
+ struct ILI9341ParamBits_GET_CABC {
+ unsigned C : 2; /* D[1:0] */
+ unsigned _reserved_1 : 6; /* D[7:2] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_CABC;
+
+typedef union {
+ struct ILI9341ParamBits_SET_CABC_MIN {
+ uint8_t CMB; /* D[7:0] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_SET_CABC_MIN;
+
+typedef union {
+ struct ILI9341ParamBits_GET_CABC_MIN {
+ uint8_t CMB; /* D[7:0] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_GET_CABC_MIN;
+
+#if 0 /* TODO: Extended command structs.*/
+
+typedef union {
+ struct ILI9341ParamBits {
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_;
+
+typedef union {
+ struct ILI9341ParamBits {
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ unsigned : 1; /* D[] */
+ } bits;
+ uint8_t bytes[1];
+} ILI9341Params_;
+
+#endif /*0*/
+
+#pragma pack(pop)
+
+#endif /* ILI9341_H */
diff --git a/drivers/gdisp/STM32F429iDiscovery/readme.txt b/drivers/gdisp/STM32F429iDiscovery/readme.txt
new file mode 100644
index 00000000..ce2dd03b
--- /dev/null
+++ b/drivers/gdisp/STM32F429iDiscovery/readme.txt
@@ -0,0 +1,11 @@
+To use this driver:
+
+1. Add in your gfxconf.h:
+ a) #define GFX_USE_GDISP TRUE
+
+2. To your makefile add the following lines:
+ include $(GFXLIB)/gfx.mk
+ include $(GFXLIB)/drivers/gdisp/STM32F429iDiscovery/driver.mk
+
+3. Add a board_STM32F429iDiscovery.h to you project directory (or board directory)
+ base on one of the templates.
diff --git a/drivers/gdisp/STM32F429iDiscovery/stm32_ltdc.h b/drivers/gdisp/STM32F429iDiscovery/stm32_ltdc.h
new file mode 100644
index 00000000..dd7c94e8
--- /dev/null
+++ b/drivers/gdisp/STM32F429iDiscovery/stm32_ltdc.h
@@ -0,0 +1,551 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+#ifndef STM32_LTDC_H
+#define STM32_LTDC_H
+
+// LTDC enable flags
+#define LTDC_EF_ENABLE (1 << 0) /**< LTDC enabled.*/
+#define LTDC_EF_DITHER (1 << 16) /**< Dithering enabled.*/
+#define LTDC_EF_PIXCLK_INVERT (1 << 28) /**< Inverted pixel clock.*/
+#define LTDC_EF_DATAEN_HIGH (1 << 29) /**< Active-high data enable.*/
+#define LTDC_EF_VSYNC_HIGH (1 << 30) /**< Active-high vsync.*/
+#define LTDC_EF_HSYNC_HIGH (1 << 31) /**< Active-high hsync.*/
+
+#define LTDC_EF_MASK (LTDC_EF_ENABLE | LTDC_EF_DITHER | LTDC_EF_PIXCLK_INVERT | LTDC_EF_DATAEN_HIGH | LTDC_EF_VSYNC_HIGH | LTDC_EF_HSYNC_HIGH)
+
+// LTDC layer enable flags
+#define LTDC_LEF_ENABLE (1 << 0) /**< Layer enabled*/
+#define LTDC_LEF_KEYING (1 << 1) /**< Color keying enabled.*/
+#define LTDC_LEF_PALETTE (1 << 4) /**< Palette enabled.*/
+
+#define LTDC_LEF_MASK (LTDC_LEF_ENABLE | LTDC_LEF_KEYING | LTDC_LEF_PALETTE)
+
+// LTDC pixel formats
+#define LTDC_FMT_ARGB8888 0 /**< ARGB-8888 format.*/
+#define LTDC_FMT_RGB888 1 /**< RGB-888 format.*/
+#define LTDC_FMT_RGB565 2 /**< RGB-565 format.*/
+#define LTDC_FMT_ARGB1555 3 /**< ARGB-1555 format.*/
+#define LTDC_FMT_ARGB4444 4 /**< ARGB-4444 format.*/
+#define LTDC_FMT_L8 5 /**< L-8 format.*/
+#define LTDC_FMT_AL44 6 /**< AL-44 format.*/
+#define LTDC_FMT_AL88 7 /**< AL-88 format.*/
+
+// LTDC pixel format aliased raw masks
+#define LTDC_XMASK_ARGB8888 0xFFFFFFFF /**< ARGB-8888 aliased mask.*/
+#define LTDC_XMASK_RGB888 0x00FFFFFF /**< RGB-888 aliased mask.*/
+#define LTDC_XMASK_RGB565 0x00F8FCF8 /**< RGB-565 aliased mask.*/
+#define LTDC_XMASK_ARGB1555 0x80F8F8F8 /**< ARGB-1555 aliased mask.*/
+#define LTDC_XMASK_ARGB4444 0xF0F0F0F0 /**< ARGB-4444 aliased mask.*/
+#define LTDC_XMASK_L8 0x000000FF /**< L-8 aliased mask.*/
+#define LTDC_XMASK_AL44 0xF00000F0 /**< AL-44 aliased mask.*/
+#define LTDC_XMASK_AL88 0xFF0000FF /**< AL-88 aliased mask.*/
+
+// LTDC blending factors
+#define LTDC_BLEND_FIX1_FIX2 0x0405 /**< cnst1; 1 - cnst2 */
+#define LTDC_BLEND_FIX1_MOD2 0x0407 /**< cnst1; 1 - a2 * cnst2 */
+#define LTDC_BLEND_MOD1_FIX2 0x0605 /**< a1 * cnst1; 1 - cnst2 */
+#define LTDC_BLEND_MOD1_MOD2 0x0607 /**< a1 * cnst1; 1 - a2 * cnst2 */
+
+// LTDC parameter bounds
+#define LTDC_MIN_SCREEN_WIDTH 1
+#define LTDC_MIN_SCREEN_HEIGHT 1
+#define LTDC_MAX_SCREEN_WIDTH 800
+#define LTDC_MAX_SCREEN_HEIGHT 600
+
+#define LTDC_MIN_HSYNC_WIDTH 1
+#define LTDC_MIN_VSYNC_HEIGHT 1
+#define LTDC_MAX_HSYNC_WIDTH (1 << 12)
+#define LTDC_MAX_VSYNC_HEIGHT (1 << 11)
+
+#define LTDC_MIN_HBP_WIDTH 0
+#define LTDC_MIN_VBP_HEIGHT 0
+#define LTDC_MAX_HBP_WIDTH (1 << 12)
+#define LTDC_MAX_VBP_HEIGHT (1 << 11)
+
+#define LTDC_MIN_ACC_HBP_WIDTH 1
+#define LTDC_MIN_ACC_VBP_HEIGHT 1
+#define LTDC_MAX_ACC_HBP_WIDTH (1 << 12)
+#define LTDC_MAX_ACC_VBP_HEIGHT (1 << 11)
+
+#define LTDC_MIN_HFP_WIDTH 0
+#define LTDC_MIN_VFP_HEIGHT 0
+#define LTDC_MAX_HFP_WIDTH (1 << 12)
+#define LTDC_MAX_VFP_HEIGHT (1 << 11)
+
+#define LTDC_MIN_ACTIVE_WIDTH 0
+#define LTDC_MIN_ACTIVE_HEIGHT 0
+#define LTDC_MAX_ACTIVE_WIDTH (1 << 12)
+#define LTDC_MAX_ACTIVE_HEIGHT (1 << 11)
+
+#define LTDC_MIN_ACC_ACTIVE_WIDTH 1
+#define LTDC_MIN_ACC_ACTIVE_HEIGHT 1
+#define LTDC_MAX_ACC_ACTIVE_WIDTH (1 << 12)
+#define LTDC_MAX_ACC_ACTIVE_HEIGHT (1 << 11)
+
+#define LTDC_MIN_ACC_TOTAL_WIDTH 1
+#define LTDC_MIN_ACC_TOTAL_HEIGHT 1
+#define LTDC_MAX_ACC_TOTAL_WIDTH (1 << 12)
+#define LTDC_MAX_ACC_TOTAL_HEIGHT (1 << 11)
+
+#define LTDC_MIN_LINE_INTERRUPT_POS 0
+#define LTDC_MAX_LINE_INTERRUPT_POS ((1 << 11) - 1)
+
+#define LTDC_MIN_WINDOW_HSTART 0
+#define LTDC_MIN_WINDOW_HSTART 0
+#define LTDC_MAX_WINDOW_HSTOP ((1 << 12) - 1)
+#define LTDC_MAX_WINDOW_HSTOP ((1 << 12) - 1)
+
+#define LTDC_MIN_WINDOW_VSTART 0
+#define LTDC_MIN_WINDOW_VSTART 0
+#define LTDC_MAX_WINDOW_VSTOP ((1 << 11) - 1)
+#define LTDC_MAX_WINDOW_VSTOP ((1 << 11) - 1)
+
+#define LTDC_MIN_FRAME_WIDTH_BYTES 0
+#define LTDC_MIN_FRAME_HEIGHT_LINES 0
+#define LTDC_MIN_FRAME_PITCH_BYTES 0
+#define LTDC_MAX_FRAME_WIDTH_BYTES ((1 << 13) - 1 - 3)
+#define LTDC_MAX_FRAME_HEIGHT_LINES ((1 << 11) - 1)
+#define LTDC_MAX_FRAME_PITCH_BYTES ((1 << 13) - 1)
+
+#define LTDC_MIN_PIXFMT_ID 0
+#define LTDC_MAX_PIXFMT_ID 7
+
+#define LTDC_MAX_PALETTE_LENGTH 256
+
+// LTDC basic ARGB-8888 colors.
+#define LTDC_COLOR_BLACK 0xFF000000
+#define LTDC_COLOR_MAROON 0xFF800000
+#define LTDC_COLOR_GREEN 0xFF008000
+#define LTDC_COLOR_OLIVE 0xFF808000
+#define LTDC_COLOR_NAVY 0xFF000080
+#define LTDC_COLOR_PURPLE 0xFF800080
+#define LTDC_COLOR_TEAL 0xFF008080
+#define LTDC_COLOR_SILVER 0xFFC0C0C0
+#define LTDC_COLOR_GRAY 0xFF808080
+#define LTDC_COLOR_RED 0xFFFF0000
+#define LTDC_COLOR_LIME 0xFF00FF00
+#define LTDC_COLOR_YELLOW 0xFFFFFF00
+#define LTDC_COLOR_BLUE 0xFF0000FF
+#define LTDC_COLOR_FUCHSIA 0xFFFF00FF
+#define LTDC_COLOR_AQUA 0xFF00FFFF
+#define LTDC_COLOR_WHITE 0xFFFFFFFF
+
+/**/
+#define STM32_LTDC_EV_HANDLER LTDC_EV_IRQHandler
+#define STM32_LTDC_ER_HANDLER LTDC_ER_IRQHandler
+#define STM32_LTDC_EV_NUMBER LTDC_IRQn
+#define STM32_LTDC_ER_NUMBER LTDC_ER_IRQn
+#define LTDC_EV_IRQHandler Vector1A0
+#define LTDC_ER_IRQHandler Vector1A4
+
+#define STM32_LTDC_EV_IRQ_PRIORITY 11
+#define STM32_LTDC_ER_IRQ_PRIORITY 11
+#define LTDC_USE_WAIT TRUE
+#define LTDC_USE_SOFTWARE_CONVERSIONS TRUE
+
+#ifndef STM32F429_439xx
+#error "Currently only STM32F429xx and STM32F439xx are supported"
+#endif
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+/* Complex types forwarding.*/
+typedef union ltdc_coloralias_t ltdc_coloralias_t;
+typedef struct ltdc_window_t ltdc_window_t;
+typedef struct ltdc_frame_t ltdc_frame_t;
+typedef struct ltdc_laycfg_t ltdc_laycfg_t;
+typedef struct LTDCConfig LTDCConfig;
+typedef enum ltdc_state_t ltdc_state_t;
+typedef struct LTDCDriver LTDCDriver;
+
+/**
+ * @name LTDC Data types
+ * @{
+ */
+
+/**
+ * @brief LTDC generic color.
+ */
+typedef uint32_t ltdc_color_t;
+
+/**
+ * @brief LTDC color aliases.
+ * @detail Mapped with ARGB-8888, except for luminance (L mapped onto B).
+ * Padding fields prefixed with <tt>'x'</tt>, which should be clear
+ * (all 0) before compression and set (all 1) after expansion.
+ */
+typedef union ltdc_coloralias_t {
+ struct {
+ unsigned b : 8;
+ unsigned g : 8;
+ unsigned r : 8;
+ unsigned a : 8;
+ } argb8888; /**< Mapped ARGB-8888 bits.*/
+ struct {
+ unsigned b : 8;
+ unsigned g : 8;
+ unsigned r : 8;
+ unsigned xa : 8;
+ } rgb888; /**< Mapped RGB-888 bits.*/
+ struct {
+ unsigned xb : 3;
+ unsigned b : 5;
+ unsigned xg : 2;
+ unsigned g : 6;
+ unsigned xr : 3;
+ unsigned r : 5;
+ unsigned xa : 8;
+ } rgb565; /**< Mapped RGB-565 bits.*/
+ struct {
+ unsigned xb : 3;
+ unsigned b : 5;
+ unsigned xg : 3;
+ unsigned g : 5;
+ unsigned xr : 3;
+ unsigned r : 5;
+ unsigned xa : 7;
+ unsigned a : 1;
+ } argb1555; /**< Mapped ARGB-1555 values.*/
+ struct {
+ unsigned xb : 4;
+ unsigned b : 4;
+ unsigned xg : 4;
+ unsigned g : 4;
+ unsigned xr : 4;
+ unsigned r : 4;
+ unsigned xa : 4;
+ unsigned a : 4;
+ } argb4444; /**< Mapped ARGB-4444 values.*/
+ struct {
+ unsigned l : 8;
+ unsigned x : 16;
+ unsigned xa : 8;
+ } l8; /**< Mapped L-8 bits.*/
+ struct {
+ unsigned xl : 4;
+ unsigned l : 4;
+ unsigned x : 16;
+ unsigned xa : 4;
+ unsigned a : 4;
+ } al44; /**< Mapped AL-44 bits.*/
+ struct {
+ unsigned l : 8;
+ unsigned x : 16;
+ unsigned a : 8;
+ } al88; /**< Mapped AL-88 bits.*/
+ ltdc_color_t aliased; /**< Aliased raw bits.*/
+} ltdc_coloralias_t;
+
+/**
+ * @brief LTDC layer identifier.
+ */
+typedef uint32_t ltdc_layerid_t;
+
+/**
+ * @brief LTDC pixel format.
+ */
+typedef uint32_t ltdc_pixfmt_t;
+
+/**
+ * @brief LTDC blending factor.
+ */
+typedef uint32_t ltdc_blendf_t;
+
+/**
+ * @brief LTDC ISR callback.
+ */
+typedef void (*ltdc_isrcb_t)(LTDCDriver *ltdcp);
+
+/**
+ * @brief LTDC window specifications.
+ */
+typedef struct ltdc_window_t {
+ uint16_t hstart; /**< Horizontal start pixel (left).*/
+ uint16_t hstop; /**< Horizontal stop pixel (right).*/
+ uint16_t vstart; /**< Vertical start pixel (top).*/
+ uint16_t vstop; /**< Vertical stop pixel (bottom).*/
+} ltdc_window_t;
+
+/**
+ * @brief LTDC frame specifications.
+ */
+typedef struct ltdc_frame_t {
+ void *bufferp; /**< Frame buffer address.*/
+ uint16_t width; /**< Frame width, in pixels.*/
+ uint16_t height; /**< Frame height, in pixels.*/
+ size_t pitch; /**< Line pitch, in bytes.*/
+ ltdc_pixfmt_t fmt; /**< Pixel format.*/
+} ltdc_frame_t;
+
+/**
+ * @brief LTDC configuration flags.
+ */
+typedef uint8_t ltdc_flags_t;
+
+/**
+ * @brief LTDC startup layer configuration.
+ */
+typedef struct ltdc_laycfg_t {
+ const ltdc_frame_t *frame; /**< Frame buffer specifications.*/
+ const ltdc_window_t *window; /**< Window specifications.*/
+ ltdc_color_t def_color; /**< Default color, ARGB-8888.*/
+ uint8_t const_alpha; /**< Constant alpha factor.*/
+ ltdc_color_t key_color; /**< Color key.*/
+ const ltdc_color_t *pal_colors; /**< Palette colors, or @p NULL.*/
+ uint16_t pal_length; /**< Palette length, or @p 0.*/
+ ltdc_blendf_t blending; /**< Blending factors.*/
+ ltdc_flags_t flags; /**< Layer configuration flags.*/
+} ltdc_laycfg_t;
+
+/**
+ * @brief LTDC driver configuration.
+ */
+typedef struct LTDCConfig {
+ /* Display specifications.*/
+ uint16_t screen_width; /**< Screen pixel width.*/
+ uint16_t screen_height; /**< Screen pixel height.*/
+ uint16_t hsync_width; /**< Horizontal sync pixel width.*/
+ uint16_t vsync_height; /**< Vertical sync pixel height.*/
+ uint16_t hbp_width; /**< Horizontal back porch pixel width.*/
+ uint16_t vbp_height; /**< Vertical back porch pixel height.*/
+ uint16_t hfp_width; /**< Horizontal front porch pixel width.*/
+ uint16_t vfp_height; /**< Vertical front porch pixel height.*/
+ ltdc_flags_t flags; /**< Driver configuration flags.*/
+
+ /* ISR callbacks.*/
+ ltdc_isrcb_t line_isr; /**< Line Interrupt ISR, or @p NULL.*/
+ ltdc_isrcb_t rr_isr; /**< Register Reload ISR, or @p NULL.*/
+ ltdc_isrcb_t fuerr_isr; /**< FIFO Underrun ISR, or @p NULL.*/
+ ltdc_isrcb_t terr_isr; /**< Transfer Error ISR, or @p NULL.*/
+
+ /* Layer and color settings.*/
+ ltdc_color_t clear_color; /**< Clear screen color, RGB-888.*/
+ const ltdc_laycfg_t *bg_laycfg; /**< Background layer specs, or @p NULL.*/
+ const ltdc_laycfg_t *fg_laycfg; /**< Foreground layer specs, or @p NULL.*/
+} LTDCConfig;
+
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/**
+ * @brief Makes an ARGB-8888 value from byte components.
+ *
+ * @param[in] a alpha byte component
+ * @param[in] r red byte component
+ * @param[in] g green byte component
+ * @param[in] b blue byte component
+ *
+ * @return color in ARGB-8888 format
+ *
+ * @api
+ */
+#define ltdcMakeARGB8888(a, r, g, b) \
+ ((((ltdc_color_t)(a) & 0xFF) << 24) | \
+ (((ltdc_color_t)(r) & 0xFF) << 16) | \
+ (((ltdc_color_t)(g) & 0xFF) << 8) | \
+ (((ltdc_color_t)(b) & 0xFF) << 0))
+
+/**
+ * @brief Compute bytes per pixel.
+ * @details Computes the bytes per pixel for the specified pixel format.
+ * Rounds to the ceiling.
+ *
+ * @param[in] fmt pixel format
+ *
+ * @return bytes per pixel
+ *
+ * @api
+ */
+#define ltdcBytesPerPixel(fmt) \
+ ((ltdcBitsPerPixel(fmt) + 7) >> 3)
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+ /* Global methods.*/
+ ltdc_flags_t ltdcGetEnableFlagsI(LTDCDriver *ltdcp);
+ ltdc_flags_t ltdcGetEnableFlags(LTDCDriver *ltdcp);
+ void ltdcSetEnableFlagsI(LTDCDriver *ltdcp, ltdc_flags_t flags);
+ void ltdcSetEnableFlags(LTDCDriver *ltdcp, ltdc_flags_t flags);
+ bool_t ltdcIsReloadingI(LTDCDriver *ltdcp);
+ bool_t ltdcIsReloading(LTDCDriver *ltdcp);
+ void ltdcStartReloadI(LTDCDriver *ltdcp, bool_t immediately);
+ void ltdcStartReload(LTDCDriver *ltdcp, bool_t immediately);
+ void ltdcReloadS(LTDCDriver *ltdcp, bool_t immediately);
+ void ltdcReload(LTDCDriver *ltdcp, bool_t immediately);
+ bool_t ltdcIsDitheringEnabledI(LTDCDriver *ltdcp);
+ bool_t ltdcIsDitheringEnabled(LTDCDriver *ltdcp);
+ void ltdcEnableDitheringI(LTDCDriver *ltdcp);
+ void ltdcEnableDithering(LTDCDriver *ltdcp);
+ void ltdcDisableDitheringI(LTDCDriver *ltdcp);
+ void ltdcDisableDithering(LTDCDriver *ltdcp);
+ ltdc_color_t ltdcGetClearColorI(LTDCDriver *ltdcp);
+ ltdc_color_t ltdcGetClearColor(LTDCDriver *ltdcp);
+ void ltdcSetClearColorI(LTDCDriver *ltdcp, ltdc_color_t c);
+ void ltdcSetClearColor(LTDCDriver *ltdcp, ltdc_color_t c);
+ uint16_t ltdcGetLineInterruptPosI(LTDCDriver *ltdcp);
+ uint16_t ltdcGetLineInterruptPos(LTDCDriver *ltdcp);
+ void ltdcSetLineInterruptPosI(LTDCDriver *ltdcp, uint16_t line);
+ void ltdcSetLineInterruptPos(LTDCDriver *ltdcp, uint16_t line);
+ bool_t ltdcIsLineInterruptEnabledI(LTDCDriver *ltdcp);
+ bool_t ltdcIsLineInterruptEnabled(LTDCDriver *ltdcp);
+ void ltdcEnableLineInterruptI(LTDCDriver *ltdcp);
+ void ltdcEnableLineInterrupt(LTDCDriver *ltdcp);
+ void ltdcDisableLineInterruptI(LTDCDriver *ltdcp);
+ void ltdcDisableLineInterrupt(LTDCDriver *ltdcp);
+ void ltdcGetCurrentPosI(LTDCDriver *ltdcp, uint16_t *xp, uint16_t *yp);
+ void ltdcGetCurrentPos(LTDCDriver *ltdcp, uint16_t *xp, uint16_t *yp);
+
+ /* Background layer methods.*/
+ ltdc_flags_t ltdcBgGetEnableFlagsI(LTDCDriver *ltdcp);
+ ltdc_flags_t ltdcBgGetEnableFlags(LTDCDriver *ltdcp);
+ void ltdcBgSetEnableFlagsI(LTDCDriver *ltdcp, ltdc_flags_t flags);
+ void ltdcBgSetEnableFlags(LTDCDriver *ltdcp, ltdc_flags_t flags);
+ bool_t ltdcBgIsEnabledI(LTDCDriver *ltdcp);
+ bool_t ltdcBgIsEnabled(LTDCDriver *ltdcp);
+ void ltdcBgEnableI(LTDCDriver *ltdcp);
+ void ltdcBgEnable(LTDCDriver *ltdcp);
+ void ltdcBgDisableI(LTDCDriver *ltdcp);
+ void ltdcBgDisable(LTDCDriver *ltdcp);
+ bool_t ltdcBgIsPaletteEnabledI(LTDCDriver *ltdcp);
+ bool_t ltdcBgIsPaletteEnabled(LTDCDriver *ltdcp);
+ void ltdcBgEnablePaletteI(LTDCDriver *ltdcp);
+ void ltdcBgEnablePalette(LTDCDriver *ltdcp);
+ void ltdcBgDisablePaletteI(LTDCDriver *ltdcp);
+ void ltdcBgDisablePalette(LTDCDriver *ltdcp);
+ void ltdcBgSetPaletteColorI(LTDCDriver *ltdcp, uint8_t slot, ltdc_color_t c);
+ void ltdcBgSetPaletteColor(LTDCDriver *ltdcp, uint8_t slot, ltdc_color_t c);
+ void ltdcBgSetPaletteI(LTDCDriver *ltdcp, const ltdc_color_t colors[],
+ uint16_t length);
+ void ltdcBgSetPalette(LTDCDriver *ltdcp, const ltdc_color_t colors[],
+ uint16_t length);
+ ltdc_pixfmt_t ltdcBgGetPixelFormatI(LTDCDriver *ltdcp);
+ ltdc_pixfmt_t ltdcBgGetPixelFormat(LTDCDriver *ltdcp);
+ void ltdcBgSetPixelFormatI(LTDCDriver *ltdcp, ltdc_pixfmt_t fmt);
+ void ltdcBgSetPixelFormat(LTDCDriver *ltdcp, ltdc_pixfmt_t fmt);
+ bool_t ltdcBgIsKeyingEnabledI(LTDCDriver *ltdcp);
+ bool_t ltdcBgIsKeyingEnabled(LTDCDriver *ltdcp);
+ void ltdcBgEnableKeyingI(LTDCDriver *ltdcp);
+ void ltdcBgEnableKeying(LTDCDriver *ltdcp);
+ void ltdcBgDisableKeyingI(LTDCDriver *ltdcp);
+ void ltdcBgDisableKeying(LTDCDriver *ltdcp);
+ ltdc_color_t ltdcBgGetKeyingColorI(LTDCDriver *ltdcp);
+ ltdc_color_t ltdcBgGetKeyingColor(LTDCDriver *ltdcp);
+ void ltdcBgSetKeyingColorI(LTDCDriver *ltdcp, ltdc_color_t c);
+ void ltdcBgSetKeyingColor(LTDCDriver *ltdcp, ltdc_color_t c);
+ uint8_t ltdcBgGetConstantAlphaI(LTDCDriver *ltdcp);
+ uint8_t ltdcBgGetConstantAlpha(LTDCDriver *ltdcp);
+ void ltdcBgSetConstantAlphaI(LTDCDriver *ltdcp, uint8_t a);
+ void ltdcBgSetConstantAlpha(LTDCDriver *ltdcp, uint8_t a);
+ ltdc_color_t ltdcBgGetDefaultColorI(LTDCDriver *ltdcp);
+ ltdc_color_t ltdcBgGetDefaultColor(LTDCDriver *ltdcp);
+ void ltdcBgSetDefaultColorI(LTDCDriver *ltdcp, ltdc_color_t c);
+ void ltdcBgSetDefaultColor(LTDCDriver *ltdcp, ltdc_color_t c);
+ ltdc_blendf_t ltdcBgGetBlendingFactorsI(LTDCDriver *ltdcp);
+ ltdc_blendf_t ltdcBgGetBlendingFactors(LTDCDriver *ltdcp);
+ void ltdcBgSetBlendingFactorsI(LTDCDriver *ltdcp, ltdc_blendf_t bf);
+ void ltdcBgSetBlendingFactors(LTDCDriver *ltdcp, ltdc_blendf_t bf);
+ void ltdcBgGetWindowI(LTDCDriver *ltdcp, ltdc_window_t *windowp);
+ void ltdcBgGetWindow(LTDCDriver *ltdcp, ltdc_window_t *windowp);
+ void ltdcBgSetWindowI(LTDCDriver *ltdcp, const ltdc_window_t *windowp);
+ void ltdcBgSetWindow(LTDCDriver *ltdcp, const ltdc_window_t *windowp);
+ void ltdcBgSetInvalidWindowI(LTDCDriver *ltdcp);
+ void ltdcBgSetInvalidWindow(LTDCDriver *ltdcp);
+ void ltdcBgGetFrameI(LTDCDriver *ltdcp, ltdc_frame_t *framep);
+ void ltdcBgGetFrame(LTDCDriver *ltdcp, ltdc_frame_t *framep);
+ void ltdcBgSetFrameI(LTDCDriver *ltdcp, const ltdc_frame_t *framep);
+ void ltdcBgSetFrame(LTDCDriver *ltdcp, const ltdc_frame_t *framep);
+ void *ltdcBgGetFrameAddressI(LTDCDriver *ltdcp);
+ void *ltdcBgGetFrameAddress(LTDCDriver *ltdcp);
+ void ltdcBgSetFrameAddressI(LTDCDriver *ltdcp, void *bufferp);
+ void ltdcBgSetFrameAddress(LTDCDriver *ltdcp, void *bufferp);
+ void ltdcBgGetLayerI(LTDCDriver *ltdcp, ltdc_laycfg_t *cfgp);
+ void ltdcBgGetLayer(LTDCDriver *ltdcp, ltdc_laycfg_t *cfgp);
+ void ltdcBgSetConfigI(LTDCDriver *ltdcp, const ltdc_laycfg_t *cfgp);
+ void ltdcBgSetConfig(LTDCDriver *ltdcp, const ltdc_laycfg_t *cfgp);
+
+ /* Foreground layer methods.*/
+ ltdc_flags_t ltdcFgGetEnableFlagsI(LTDCDriver *ltdcp);
+ ltdc_flags_t ltdcFgGetEnableFlags(LTDCDriver *ltdcp);
+ void ltdcFgSetEnableFlagsI(LTDCDriver *ltdcp, ltdc_flags_t flags);
+ void ltdcFgSetEnableFlags(LTDCDriver *ltdcp, ltdc_flags_t flags);
+ bool_t ltdcFgIsEnabledI(LTDCDriver *ltdcp);
+ bool_t ltdcFgIsEnabled(LTDCDriver *ltdcp);
+ void ltdcFgEnableI(LTDCDriver *ltdcp);
+ void ltdcFgEnable(LTDCDriver *ltdcp);
+ void ltdcFgDisableI(LTDCDriver *ltdcp);
+ void ltdcFgDisable(LTDCDriver *ltdcp);
+ bool_t ltdcFgIsPaletteEnabledI(LTDCDriver *ltdcp);
+ bool_t ltdcFgIsPaletteEnabled(LTDCDriver *ltdcp);
+ void ltdcFgEnablePaletteI(LTDCDriver *ltdcp);
+ void ltdcFgEnablePalette(LTDCDriver *ltdcp);
+ void ltdcFgDisablePaletteI(LTDCDriver *ltdcp);
+ void ltdcFgDisablePalette(LTDCDriver *ltdcp);
+ void ltdcFgSetPaletteColorI(LTDCDriver *ltdcp, uint8_t slot, ltdc_color_t c);
+ void ltdcFgSetPaletteColor(LTDCDriver *ltdcp, uint8_t slot, ltdc_color_t c);
+ void ltdcFgSetPaletteI(LTDCDriver *ltdcp, const ltdc_color_t colors[],
+ uint16_t length);
+ void ltdcFgSetPalette(LTDCDriver *ltdcp, const ltdc_color_t colors[],
+ uint16_t length);
+ ltdc_pixfmt_t ltdcFgGetPixelFormatI(LTDCDriver *ltdcp);
+ ltdc_pixfmt_t ltdcFgGetPixelFormat(LTDCDriver *ltdcp);
+ void ltdcFgSetPixelFormatI(LTDCDriver *ltdcp, ltdc_pixfmt_t fmt);
+ void ltdcFgSetPixelFormat(LTDCDriver *ltdcp, ltdc_pixfmt_t fmt);
+ bool_t ltdcFgIsKeyingEnabledI(LTDCDriver *ltdcp);
+ bool_t ltdcFgIsKeyingEnabled(LTDCDriver *ltdcp);
+ void ltdcFgEnableKeyingI(LTDCDriver *ltdcp);
+ void ltdcFgEnableKeying(LTDCDriver *ltdcp);
+ void ltdcFgDisableKeyingI(LTDCDriver *ltdcp);
+ void ltdcFgDisableKeying(LTDCDriver *ltdcp);
+ ltdc_color_t ltdcFgGetKeyingColorI(LTDCDriver *ltdcp);
+ ltdc_color_t ltdcFgGetKeyingColor(LTDCDriver *ltdcp);
+ void ltdcFgSetKeyingColorI(LTDCDriver *ltdcp, ltdc_color_t c);
+ void ltdcFgSetKeyingColor(LTDCDriver *ltdcp, ltdc_color_t c);
+ uint8_t ltdcFgGetConstantAlphaI(LTDCDriver *ltdcp);
+ uint8_t ltdcFgGetConstantAlpha(LTDCDriver *ltdcp);
+ void ltdcFgSetConstantAlphaI(LTDCDriver *ltdcp, uint8_t a);
+ void ltdcFgSetConstantAlpha(LTDCDriver *ltdcp, uint8_t a);
+ ltdc_color_t ltdcFgGetDefaultColorI(LTDCDriver *ltdcp);
+ ltdc_color_t ltdcFgGetDefaultColor(LTDCDriver *ltdcp);
+ void ltdcFgSetDefaultColorI(LTDCDriver *ltdcp, ltdc_color_t c);
+ void ltdcFgSetDefaultColor(LTDCDriver *ltdcp, ltdc_color_t c);
+ ltdc_blendf_t ltdcFgGetBlendingFactorsI(LTDCDriver *ltdcp);
+ ltdc_blendf_t ltdcFgGetBlendingFactors(LTDCDriver *ltdcp);
+ void ltdcFgSetBlendingFactorsI(LTDCDriver *ltdcp, ltdc_blendf_t bf);
+ void ltdcFgSetBlendingFactors(LTDCDriver *ltdcp, ltdc_blendf_t bf);
+ void ltdcFgGetWindowI(LTDCDriver *ltdcp, ltdc_window_t *windowp);
+ void ltdcFgGetWindow(LTDCDriver *ltdcp, ltdc_window_t *windowp);
+ void ltdcFgSetWindowI(LTDCDriver *ltdcp, const ltdc_window_t *windowp);
+ void ltdcFgSetWindow(LTDCDriver *ltdcp, const ltdc_window_t *windowp);
+ void ltdcFgSetInvalidWindowI(LTDCDriver *ltdcp);
+ void ltdcFgSetInvalidWindow(LTDCDriver *ltdcp);
+ void ltdcFgGetFrameI(LTDCDriver *ltdcp, ltdc_frame_t *framep);
+ void ltdcFgGetFrame(LTDCDriver *ltdcp, ltdc_frame_t *framep);
+ void ltdcFgSetFrameI(LTDCDriver *ltdcp, const ltdc_frame_t *framep);
+ void ltdcFgSetFrame(LTDCDriver *ltdcp, const ltdc_frame_t *framep);
+ void *ltdcFgGetFrameAddressI(LTDCDriver *ltdcp);
+ void *ltdcFgGetFrameAddress(LTDCDriver *ltdcp);
+ void ltdcFgSetFrameAddressI(LTDCDriver *ltdcp, void *bufferp);
+ void ltdcFgSetFrameAddress(LTDCDriver *ltdcp, void *bufferp);
+ void ltdcFgGetLayerI(LTDCDriver *ltdcp, ltdc_laycfg_t *cfgp);
+ void ltdcFgGetLayer(LTDCDriver *ltdcp, ltdc_laycfg_t *cfgp);
+ void ltdcFgSetConfigI(LTDCDriver *ltdcp, const ltdc_laycfg_t *cfgp);
+ void ltdcFgSetConfig(LTDCDriver *ltdcp, const ltdc_laycfg_t *cfgp);
+
+ /* Helper functions.*/
+ size_t ltdcBitsPerPixel(ltdc_pixfmt_t fmt);
+#if LTDC_USE_SOFTWARE_CONVERSIONS || defined(__DOXYGEN__)
+ ltdc_color_t ltdcFromARGB8888(ltdc_color_t c, ltdc_pixfmt_t fmt);
+ ltdc_color_t ltdcToARGB8888(ltdc_color_t c, ltdc_pixfmt_t fmt);
+#endif /* LTDC_USE_SOFTWARE_CONVERSIONS */
+
+#endif /* STM32_LTDC_H */