From a32d497074b9128f9e2f06a41e2c545b2814945c Mon Sep 17 00:00:00 2001 From: Julian Date: Sun, 21 Jul 2024 16:30:53 +0200 Subject: [PATCH] Fix TouchGFX again --- Core/Src/stm32h7xx_hal_msp.c | 1 - Makefile | 2 +- .../target/generated/TouchGFXGeneratedHAL.cpp | 36 ++++++++++++++++++- steering-wheel.ioc | 5 +-- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Core/Src/stm32h7xx_hal_msp.c b/Core/Src/stm32h7xx_hal_msp.c index 44e7910..e386b11 100644 --- a/Core/Src/stm32h7xx_hal_msp.c +++ b/Core/Src/stm32h7xx_hal_msp.c @@ -20,7 +20,6 @@ /* Includes ------------------------------------------------------------------*/ #include "main.h" - /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ diff --git a/Makefile b/Makefile index f9e4733..513cabf 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Sun Jul 21 12:04:39 CEST 2024] +# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Sun Jul 21 16:29:55 CEST 2024] ########################################################################################################################## # ------------------------------------------------ diff --git a/TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp b/TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp index 4acfc24..6b1e36b 100644 --- a/TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp +++ b/TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -37,7 +38,7 @@ void TouchGFXGeneratedHAL::initialize() { HAL::initialize(); registerEventListener(*(Application::getInstance())); - setFrameBufferStartAddresses((void*)0x24040000, (void*)0x24040000, (void*)0); + setFrameBufferStartAddresses((void*)0x24040000, (void*)0x240A0000, (void*)0); } void TouchGFXGeneratedHAL::configureInterrupts() @@ -123,4 +124,37 @@ void TouchGFXGeneratedHAL::FlushCache() } } +extern "C" +{ + void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef* hltdc) + { + if (!HAL::getInstance()) + { + return; + } + + if (LTDC->LIPCR == lcd_int_active_line) + { + //entering active area + HAL_LTDC_ProgramLineEvent(hltdc, lcd_int_porch_line); + HAL::getInstance()->vSync(); + OSWrappers::signalVSync(); + + // Swap frame buffers immediately instead of waiting for the task to be scheduled in. + // Note: task will also swap when it wakes up, but that operation is guarded and will not have + // any effect if already swapped. + HAL::getInstance()->swapFrameBuffers(); + GPIO::set(GPIO::VSYNC_FREQ); + } + else + { + //exiting active area + HAL_LTDC_ProgramLineEvent(hltdc, lcd_int_active_line); + + // Signal to the framework that display update has finished. + HAL::getInstance()->frontPorchEntered(); + GPIO::clear(GPIO::VSYNC_FREQ); + } + } +} /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/steering-wheel.ioc b/steering-wheel.ioc index d33cc60..9eb7564 100644 --- a/steering-wheel.ioc +++ b/steering-wheel.ioc @@ -577,13 +577,14 @@ STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0_IsAnAzureRtosMw=true STMicroelectronics.X-CUBE-AZRTOS-H7.3.0.0_SwParameter=ThreadXCcRTOSJjThreadXJjCore\:true; STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.ApplicationCcGraphicsJjApplication=TouchGFXOoGenerator STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.GraphicsJjApplication_Checked=true -STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.IPParameters=tgfx_custom_height,ApplicationCcGraphicsJjApplication,tgfx_location,tgfx_address1,tgfx_display_interface,tgfx_buffering_strategy,tgfx_address2 +STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.IPParameters=tgfx_custom_height,tgfx_location,tgfx_address1,tgfx_display_interface,tgfx_buffering_strategy,tgfx_address2,ApplicationCcGraphicsJjApplication,tgfx_vsync STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_address1=0x24040000 -STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_address2=0x24040000 +STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_address2=0x240A0000 STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_buffering_strategy=Double STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_custom_height=480 STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_display_interface=disp_ltdc STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_location=By Address +STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_vsync=vsync_ltdc STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2_IsPackSelfContextualization=true STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2_SwParameter=ApplicationCcGraphicsJjApplication\:TouchGFXOoGenerator; TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1