Jump to content

STM32LTDC 2nd layer support and ARGB


inmarket

Recommended Posts

Support has just been added to the STM32LTDC driver for its 2nd layer.

To support this change the default device pixel format has been changed to RGB888 instead of RGB565. If you want the old device pixel format (but not the 2nd layer support which requires RGB888) you can define GDISP_LTDC_USE_RGB565 as TRUE in your gfxconf.h.

The background LTDC layer is the first display (as it always has been). The 2nd display is the LTDC foreground layer.

To access the 2nd display uGFX's multiple display support must be turned on. If you have no other non-LTDC displays the easiest way to do this is to add #define GDISP_TOTAL_DISPLAYS 2 into your gfxconf.h. Note that as this requires multiple display support this currently can't be built using the single-file-make option. You need to use the makefile build method.

All the existing known STM32LTDC board files in the boards/base directory have been updated with the correct LTDC initialisation tables to support 2 full size overlapping layers. This may of course be customised for your own project. The use of the 2nd layer increases the bandwidth requirements for your framebuffer RAM so also make sure that you have enough RAM bandwidth to make this work particularly for larger displays. If you define smaller layers in your layer initialisation tables uGFX will handle it. The layers don't need to be the same size or even start at the same origin.

As alpha support is required for the foreground layer, ARGB support has been hacked into uGFX. At the moment this is only a hack. Full ARGB pixel formats will be supported as of uGFX V3.

The current limitations for alpha support are:

  1. It only works with GDISP_PIXELFORMAT = GDISP_PIXELFORMAT_RGB888.
  2. It uses unused bits in the RGB888 pixel format to encode the alpha value. Note that this encoding does NOT match the standard ARGB format so don't try to hard code color values - they are unlikely to work correctly.
  3. The AHTML2COLOR() and ARGB2COLOR() macros have been added to correctly encode any semi-transparent value. The normal RGB color macros such as RGB2COLOR() and HTML2COLOR() work as per normal producing fully opaque colors. Note: an alpha value of 0 is fully transparent, an alpha value of 255 is fully opaque. This means that ARGB2COLOR(255, r, g, b) produces exactly the same fully opaque color that RGB(r, g, b) produces. Similarly AHTML2COLOR(0xFF00FF00) produces the same as HTML2COLOR(0x00FF00). Note: AHTML2COLOR(0x00FF00) produces a fully TRANSPARENT color!

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...