cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476RG with Nucleo-GFX01M2 transparent font background

Snowcone_engineer
Associate II

I purchased the NUCLEO-L476RG and X-NUCLEO-GFX01M2 boards and connected them together.

I downloaded the STM32L476 LCD Example project (I think I found in X-CUBE-DISPLAY v3.0.0 projects), compiled and loaded the code onto the NUCLEO-L476RG. The example worked great with a couple minor changes like HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin).

The provided images (.H const char arrays) displayed correctly and the text strings with various size fonts worked as well. Text strings are displayed at x/y position with selected color and background color. But when text strings are positioned over an image, there is no way to make the text character background transparent using the supplied evaluation code. I tried using the different layers of the Nucleo-GFX01M2, but only one default layer seems to be supported by the supplied software driver. See "SetLayer" below.

Snowcone_engineer_0-1760031147309.png

It seems the STM32L476RG eval board cannot support two graphic layers for the Nucleo-GFX01M2, or STM did not bother writing the additional drivers to support two layers.

I wanted to see if I could modify the existing code/drivers to display text strings with transparent font backgrounds.

So, I started by modifying "DrawChar" to add two function calls.

static void DrawChar(uint32_t Xpos, uint32_t Ypos, const uint8_t *pData)

Then I added two functions to first determine if a font pixel overlayed an image pixel.

bool UTIL_LCD_PixelImageArea(uint32_t Xpos, uint32_t Ypos, image_t *image)

If the selected font pixel was within the image area, the second function reads the pixel color from the image file that overlays the font pixel background and writes it to the display.

uint16_t UTIL_LCD_ImagePixel(uint32_t X_text, uint32_t Y_text, image_t *image)

This all worked great for writing text strings on top of displayed images with transparent font backgrounds.

The X-NUCLEO-GFX01M2 has a lot of graphic capabilities, but I'm not sure the STM32L476RG has enough resources to support these features.

 

 

 

 

 

0 REPLIES 0