From a912f459612c2d46ac479cef42ad1a575c557305 Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Mon, 6 Nov 2023 20:41:48 +0100 Subject: [PATCH 1/2] Move styleguide to docs --- README.md | 2 +- style_guide.md => docs/style_guide.md | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename style_guide.md => docs/style_guide.md (100%) diff --git a/README.md b/README.md index 284570e..f1f006e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ This way we can keep the code clean. [tasks_and_taskowners.md](tasks_and_taskowners.md) ## Style Guide -To maintain a consistent and clean codebase, follow the [style guide](style_guide.md). This document provides detailed instructions on naming conventions, code structure, and commenting practices. +To maintain a consistent and clean codebase, follow the [style guide](docs/style_guide.md). This document provides detailed instructions on naming conventions, code structure, and commenting practices. Please read the [style_guide.md](style_guide.md) carefully before making contributions. diff --git a/style_guide.md b/docs/style_guide.md similarity index 100% rename from style_guide.md rename to docs/style_guide.md From f22d7c69f1b5cc1ed39e009e16916f3c65147c13 Mon Sep 17 00:00:00 2001 From: L-diy Date: Wed, 8 Nov 2023 16:07:39 +0100 Subject: [PATCH 2/2] Fix BSP_LCD_DrawBitmap function to account for padding in bitmap images --- .../stm32746g_discovery_lcd.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/project/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.c b/project/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.c index 369c2af..8133fff 100644 --- a/project/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.c +++ b/project/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.c @@ -1021,7 +1021,7 @@ void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code) */ void BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp) { - uint32_t index = 0, width = 0, height = 0, bit_pixel = 0; + uint32_t index = 0, width = 0, height = 0, bit_pixel = 0, row_size = 0; uint32_t address; uint32_t input_color_mode = 0; @@ -1039,6 +1039,9 @@ void BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp) /* Set the address */ address = hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (((BSP_LCD_GetXSize()*Ypos) + Xpos)*(4)); + + /* Calculate the row size in byte */ + row_size = ((bit_pixel*width + 31)/32) * 4; /* Get the layer pixel format */ if ((bit_pixel/8) == 4) @@ -1053,20 +1056,20 @@ void BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp) { input_color_mode = CM_RGB888; } - + /* Bypass the bitmap header */ - pbmp += (index + (width * (height - 1) * (bit_pixel/8))); - + pbmp += (index + (row_size * (height - 1))); + /* Convert picture to ARGB8888 pixel format */ for(index=0; index < height; index++) { /* Pixel format conversion */ LL_ConvertLineToARGB8888((uint32_t *)pbmp, (uint32_t *)address, width, input_color_mode); - + /* Increment the source and destination buffers */ - address+= (BSP_LCD_GetXSize()*4); - pbmp -= width*(bit_pixel/8); - } + address += (BSP_LCD_GetXSize()*4); + pbmp -= row_size; + } } /**