diff --git a/Makefile b/Makefile index 0d66b3b..f9e4733 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ########################################################################################################################## -# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Tue Jun 11 19:23:32 CEST 2024] +# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Sun Jul 21 12:04:39 CEST 2024] ########################################################################################################################## # ------------------------------------------------ diff --git a/TouchGFX/steering-wheel.touchgfx b/TouchGFX/steering-wheel.touchgfx index 22ae7b9..fd0abda 100644 --- a/TouchGFX/steering-wheel.touchgfx +++ b/TouchGFX/steering-wheel.touchgfx @@ -1005,7 +1005,6 @@ { "Type": "CustomContainerInstance", "Name": "statusTS_R2D", - "X": 1, "Width": 65, "Height": 33, "CustomContainerDefinitionName": "DriverViewStatusItem" @@ -1053,7 +1052,7 @@ { "Type": "CustomContainerInstance", "Name": "statusLV", - "X": 389, + "X": 390, "Width": 65, "Height": 33, "CustomContainerDefinitionName": "DriverViewStatusItem" diff --git a/TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp b/TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp index 202118f..4acfc24 100644 --- a/TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp +++ b/TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp @@ -23,37 +23,47 @@ #include #include "stm32h7xx.h" +#include "stm32h7xx_hal_ltdc.h" using namespace touchgfx; namespace { -// Use the section "TouchGFX_Framebuffer" in the linker script to specify the placement of the buffer -LOCATION_PRAGMA_NOLOAD("TouchGFX_Framebuffer") -uint32_t frameBuf[(320 * 480 * 2 + 3) / 4] LOCATION_ATTRIBUTE_NOLOAD("TouchGFX_Framebuffer"); +static uint16_t lcd_int_active_line; +static uint16_t lcd_int_porch_line; } void TouchGFXGeneratedHAL::initialize() { HAL::initialize(); registerEventListener(*(Application::getInstance())); - setFrameBufferStartAddresses((void*)frameBuf, (void*)0, (void*)0); + setFrameBufferStartAddresses((void*)0x24040000, (void*)0x24040000, (void*)0); } void TouchGFXGeneratedHAL::configureInterrupts() { + NVIC_SetPriority(LTDC_IRQn, 9); } void TouchGFXGeneratedHAL::enableInterrupts() { + NVIC_EnableIRQ(LTDC_IRQn); } void TouchGFXGeneratedHAL::disableInterrupts() { + NVIC_DisableIRQ(LTDC_IRQn); } void TouchGFXGeneratedHAL::enableLCDControllerInterrupt() { + lcd_int_active_line = (LTDC->BPCR & 0x7FF) - 1; + lcd_int_porch_line = (LTDC->AWCR & 0x7FF) - 1; + + /* Sets the Line Interrupt position */ + LTDC->LIPCR = lcd_int_active_line; + /* Line Interrupt Enable */ + LTDC->IER |= LTDC_IER_LIE; } bool TouchGFXGeneratedHAL::beginFrame() @@ -66,21 +76,17 @@ void TouchGFXGeneratedHAL::endFrame() HAL::endFrame(); } -inline uint8_t* TouchGFXGeneratedHAL::advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect) const -{ - // Advance vertically Advance horizontally - fbPtr += rect.y * lcd().framebufferStride() + rect.x * 2; - return fbPtr; -} - uint16_t* TouchGFXGeneratedHAL::getTFTFrameBuffer() const { - return (uint16_t*)frameBuf; + return (uint16_t*)LTDC_Layer1->CFBAR; } void TouchGFXGeneratedHAL::setTFTFrameBuffer(uint16_t* adr) { - //setTFTFrameBuffer() not used for selected display interface + LTDC_Layer1->CFBAR = (uint32_t)adr; + + /* Reload immediate */ + LTDC->SRCR = (uint32_t)LTDC_SRCR_IMR; } void TouchGFXGeneratedHAL::flushFrameBuffer(const touchgfx::Rect& rect) diff --git a/TouchGFX/target/generated/TouchGFXGeneratedHAL.hpp b/TouchGFX/target/generated/TouchGFXGeneratedHAL.hpp index cb182c3..d95324c 100644 --- a/TouchGFX/target/generated/TouchGFXGeneratedHAL.hpp +++ b/TouchGFX/target/generated/TouchGFXGeneratedHAL.hpp @@ -156,24 +156,6 @@ public: * Called when a rendering pass is completed. */ virtual void endFrame(); - /** - * - * @fn inline uint8_t* TouchGFXGeneratedHAL::advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect) const; - * - * @brief This function calculates the offset in the framebuffer address according to "rect" coordinates. - * - * This function is typically for users who need to transfer framebuffer data to - * a display from within flushFrameBuffer(Rect& rect). While HAL::lockFrameBuffer() - * returns a pointer to the current drawing framebuffer, users must manually calculate - * the offset from that pointer to the Rect to transfer. This function will advance the offset - * in the framebuffer equal to the rect's upper left corner (x, y). - * - * - * @param fbPtr Pointer to the start of the framebuffer, coordinates (0, 0) - * @param rect The area of the screen expressed in absolute coordinates, which has to be transformed to address. - * - */ - inline uint8_t* advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect) const; protected: /** diff --git a/steering-wheel.ioc b/steering-wheel.ioc index b865496..d33cc60 100644 --- a/steering-wheel.ioc +++ b/steering-wheel.ioc @@ -153,8 +153,8 @@ Mcu.Pin70=VP_SYS_VS_tim6 Mcu.Pin71=VP_TIM1_VS_ClockSourceINT Mcu.Pin72=VP_TIM2_VS_ClockSourceINT Mcu.Pin73=VP_TIM17_VS_ClockSourceINT -Mcu.Pin74=VP_STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0 -Mcu.Pin75=VP_STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.23.2 +Mcu.Pin74=VP_STMicroelectronics.X-CUBE-TOUCHGFX_VS_GraphicsJjApplication_4.23.2 +Mcu.Pin75=VP_STMicroelectronics.X-CUBE-AZRTOS-H7_VS_RTOSJjThreadX_6.1.12_3.0.0 Mcu.Pin8=PF3 Mcu.Pin9=PF4 Mcu.PinsNb=76 @@ -453,7 +453,7 @@ ProjectManager.ToolChainLocation= ProjectManager.UAScriptAfterPath= ProjectManager.UAScriptBeforePath= ProjectManager.UnderRoot=false -ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_FDCAN1_Init-FDCAN1-false-HAL-true,5-MX_LTDC_Init-LTDC-false-HAL-true,6-MX_JPEG_Init-JPEG-false-HAL-true,7-MX_OCTOSPI1_Init-OCTOSPI1-false-HAL-true,8-MX_SPI3_Init-SPI3-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM2_Init-TIM2-false-HAL-true,11-MX_TIM4_Init-TIM4-false-HAL-true,12-MX_CRC_Init-CRC-false-HAL-true,13-MX_TIM17_Init-TIM17-false-HAL-true,14-MX_DMA2D_Init-DMA2D-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true +ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_FDCAN1_Init-FDCAN1-false-HAL-true,5-MX_LTDC_Init-LTDC-false-HAL-true,6-MX_JPEG_Init-JPEG-false-HAL-true,7-MX_OCTOSPI1_Init-OCTOSPI1-false-HAL-true,8-MX_SPI3_Init-SPI3-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM2_Init-TIM2-false-HAL-true,11-MX_TIM4_Init-TIM4-false-HAL-true,12-MX_CRC_Init-CRC-false-HAL-true,13-MX_TIM17_Init-TIM17-false-HAL-true,14-MX_DMA2D_Init-DMA2D-false-HAL-true,16-MX_TouchGFX_Init-STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2-false-HAL-false,17-MX_TouchGFX_Process-STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true RCC.ADCFreq_Value=2000000 RCC.AHB12Freq_Value=160000000 RCC.AHB4Freq_Value=160000000 @@ -577,9 +577,13 @@ 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=ApplicationCcGraphicsJjApplication,tgfx_custom_width,tgfx_custom_height +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.tgfx_address1=0x24040000 +STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2.tgfx_address2=0x24040000 +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_custom_width=320 +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_IsPackSelfContextualization=true STMicroelectronics.X-CUBE-TOUCHGFX.4.23.2_SwParameter=ApplicationCcGraphicsJjApplication\:TouchGFXOoGenerator; TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1