I'm trying to create a screen positioning screen.
I'm trying to create a screen positioning screen, to adjust the location of the screen using the LTDC registers. I've used the BPRC registers, and the HAL_LTDC_SetWindowPosition() function methods.
My screen has 4 buttons for adjusting all directions in X, and Y.
When a limit is reached, I setInvisible() the button.
==============================
I've created a routine to adjust the BPCR registers, and this moves the display around.
But is is limited to a small range of values in Y, only 0..23. Greater than that generates and LTDC_ER_EXCEPTION. (X-Range is 0..100+)
I've also found if NOT called from the VSync interrupt (OSWrappers::signalVSync() routine), I get random LTDC_ER_EXCEPTION.
I've created a callback mechanism, so this routine is called from the VSync interrupt.
callback()
{
// Need to change LTDC_BPCR register only.
hltdc.Init.AccumulatedHBP = x; // 46, 0..100 allowed
hltdc.Init.AccumulatedVBP = y; // 23, 0..23 allowed (24 locks up the GUI.)
hltdc.Init.AccumulatedActiveW = x + DISPLAY_SIZE_X;
hltdc.Init.AccumulatedActiveH = y + DISPLAY_SIZE_Y;
// Changes the Horizontal, and Vertical Back Porch values.
hltdc.Instance->BPCR &= ~(LTDC_BPCR_AVBP | LTDC_BPCR_AHBP);
int tmp = (hltdc.Init.AccumulatedHBP << 16U);
hltdc.Instance->BPCR |= (tmp | hltdc.Init.AccumulatedVBP);
}
This works rather well, but as I said, is very limited in Y movement.
outside the interrupt, it generates the LTDC_ER_EXCEPTION sometimes.
==============================
So I tried using the HAL_LTDC_SetWindowPosition() routine which also moves the display around.
I also call this from the VSync Interrupt. I get better range on this routine X values of -50..45, and Y values of -87..0.
BUT, I'm noticing that some of the Buttons, when setInvisible(), will come and go, as the screen is moved. They are still there, but just NOT redrawn. And sometimes other strange artifacts.
I also note with the HAL_LTDC_SetWindowPosition, that sometimes I get the LTDC_ER_EXCEPTION.
=========================
I also tried to implement the HAL_LTDC_SetWindowPosition_NO_RELOAD, then doing a HAL_LTDC_Reload, setup for the next blanking inverval. This can be called directly from the GUI when a button is pressed.
This version can run outside of the VSync Interrupt, but still has the problems with buttons coming, and going, and once in a while LTDC_ER_EXCEPTION, and similar strange artifacts.
Any ideas.
Paul Sucro.