diff options
author | inmarket <andrewh@inmarket.com.au> | 2017-10-01 18:00:49 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2017-10-01 18:00:49 +1000 |
commit | 82047b1ac6e56361abac0c4b01f06c405e941d19 (patch) | |
tree | 85c199ec82a65f0db2e944f309a93b2b7655724f /drivers/gdisp/STM32LTDC/board_STM32LTDC_template.h | |
parent | 70222f8c8ddaccf1362f97f4c595d1d06ef680ef (diff) | |
download | uGFX-82047b1ac6e56361abac0c4b01f06c405e941d19.tar.gz uGFX-82047b1ac6e56361abac0c4b01f06c405e941d19.tar.bz2 uGFX-82047b1ac6e56361abac0c4b01f06c405e941d19.zip |
STM32LTDC 2nd layer support with alpha
Diffstat (limited to 'drivers/gdisp/STM32LTDC/board_STM32LTDC_template.h')
-rw-r--r-- | drivers/gdisp/STM32LTDC/board_STM32LTDC_template.h | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/drivers/gdisp/STM32LTDC/board_STM32LTDC_template.h b/drivers/gdisp/STM32LTDC/board_STM32LTDC_template.h index 0596fe7b..8164c166 100644 --- a/drivers/gdisp/STM32LTDC/board_STM32LTDC_template.h +++ b/drivers/gdisp/STM32LTDC/board_STM32LTDC_template.h @@ -8,6 +8,8 @@ #ifndef _GDISP_LLD_BOARD_H #define _GDISP_LLD_BOARD_H +#define ALLOW_2ND_LAYER TRUE + static const ltdcConfig driverCfg = { 480, 272, // Width, Height (pixels) 41, 10, // Horizontal, Vertical sync (pixels) @@ -17,14 +19,14 @@ static const ltdcConfig driverCfg = { 0x000000, // Clear color (RGB888) { // Background layer config - (LLDCOLOR_TYPE *)SDRAM_DEVICE_ADDR, // Frame buffer address + (LLDCOLOR_TYPE *)SDRAM_DEVICE_ADDR, // Frame buffer address 480, 272, // Width, Height (pixels) 480 * LTDC_PIXELBYTES, // Line pitch (bytes) LTDC_PIXELFORMAT, // Pixel format 0, 0, // Start pixel position (x, y) 480, 272, // Size of virtual layer (cx, cy) - LTDC_COLOR_FUCHSIA, // Default color (ARGB8888) - 0x980088, // Color key (RGB888) + 0x00000000, // Default color (ARGB8888) + 0x000000, // Color key (RGB888) LTDC_BLEND_FIX1_FIX2, // Blending factors 0, // Palette (RGB888, can be NULL) 0, // Palette length @@ -32,28 +34,47 @@ static const ltdcConfig driverCfg = { LTDC_LEF_ENABLE // Layer configuration flags }, - LTDC_UNUSED_LAYER_CONFIG // Foreground layer config +#if ALLOW_2ND_LAYER + { // Foreground layer config (if turned on) + (LLDCOLOR_TYPE *)(SDRAM_DEVICE_ADDR+(480 * 272 * LTDC_PIXELBYTES)), // Frame buffer address + 480, 272, // Width, Height (pixels) + 480 * LTDC_PIXELBYTES, // Line pitch (bytes) + LTDC_PIXELFORMAT, // Pixel format + 0, 0, // Start pixel position (x, y) + 480, 272, // Size of virtual layer (cx, cy) + 0x00000000, // Default color (ARGB8888) + 0x000000, // Color key (RGB888) + LTDC_BLEND_MOD1_MOD2, // Blending factors + 0, // Palette (RGB888, can be NULL) + 0, // Palette length + 0xFF, // Constant alpha factor + LTDC_LEF_ENABLE // Layer configuration flags + } +#else + LTDC_UNUSED_LAYER_CONFIG +#endif }; static GFXINLINE 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; - } + // This is function only called once with the display for the background layer. + (void)g; } static GFXINLINE void post_init_board(GDisplay* g) { + // This is function may be called twice - once for the background display and once + // for the foreground display. + // Note: It doesn't get called for the foreground display unless gfxconf.h has been + // setup for two displays on this controller. (void)g; } static GFXINLINE void set_backlight(GDisplay* g, uint8_t percent) { + // This is function may be called with the display for either the foreground + // or the background layer. + // Note: It can't be called for the foreground display unless gfxconf.h has been + // setup for two displays on this controller. (void)g; (void)percent; } |