cancel
Showing results for 
Search instead for 
Did you mean: 

Touch GFX Two Layers frame buffer update issue

MSale.1
Senior

Hi,

In TouchGFXGeneratedHAL.CPP u are using the HAL_LTDC_LineEventCallback. the issue is i use the two layers.

Layer_1 for live video from camera and layer_2 for GUI. every time i generate code i must add this code below. the added code in bold,italic. is there any way to make it more automatic or u know other way around?

uint16_t* TouchGFXGeneratedHAL::getTFTFrameBuffer() const
{
return (uint16_t*)LTDC_Layer2->CFBAR;
}

void TouchGFXGeneratedHAL::setTFTFrameBuffer(uint16_t* adr)
{
LTDC_Layer2->CFBAR = (uint32_t)adr;
LTDC_Layer1->CFBAR = (uint32_t)activeBuffer;
/* Reload immediate */
LTDC->SRCR = (uint32_t)LTDC_SRCR_IMR;
}

1 REPLY 1
Osman SOYKURT
ST Employee

Hello @MSale.1 ,

I think you should use the TouchGFXHAL.cpp file instead of TouchGFXGeneratedHAL.cpp file. This one overwrites the generated implementation and whatever you'll put in this file won't be erased when you generate code again.

/**
 * Gets the frame buffer address used by the TFT controller.
 *
 * @return The address of the frame buffer currently being displayed on the TFT.
 */
uint16_t* TouchGFXHAL::getTFTFrameBuffer() const
{
    // Calling parent implementation of getTFTFrameBuffer().
    //
    // To overwrite the generated implementation, omit call to parent function
    // and implemented needed functionality here.

    return TouchGFXGeneratedHAL::getTFTFrameBuffer();
}

/**
 * Sets the frame buffer address used by the TFT controller.
 *
 * @param [in] address New frame buffer address.
 */
void TouchGFXHAL::setTFTFrameBuffer(uint16_t* address)
{
    // Calling parent implementation of setTFTFrameBuffer(uint16_t* address).
    //
    // To overwrite the generated implementation, omit call to parent function
    // and implemented needed functionality here.

    TouchGFXGeneratedHAL::setTFTFrameBuffer(address);
}
Osman SOYKURT
ST Software Developer | TouchGFX