2014-11-16 07:37 AM
- In a comment in stm32f4xx_hal_ltdc.c HAL_LTDC_ProgramLineInterrupt() is mentioned...but couldn't find such a function. It's not even declared in ''...ltdc.h''.
- In the source of HAL_LTDC_ConfigCLUT function you find HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx) { ....for(counter = 0; (counter < CLUTSize); counter++) {
tmp = ((counter << 24) | ((uint32_t)(*pCLUT) & 0xFF) | ((uint32_t)(*pCLUT) & 0xFF00) | ((uint32_t)(*pCLUT) & 0xFF0000)); pcounter = (uint32_t)pCLUT + sizeof(*pCLUT); pCLUT = (uint32_t *)pcounter; /* Specifies the C-LUT address and RGB value */ __HAL_LTDC_LAYER(hltdc, LayerIdx)->CLUTWR = tmp; } If I use AL44 color schema, only 16 items are used in CLUT. In this situation these 16 items are 0x00, 0x11, 0x22'th etc. of 256 elements of the table. It was easier to initialize the color table with a smaller and any order arraystatic uint_32t LCUT= {0x00000000, 0x11ff0000, 0x2200ff00, 0x330000ff, 0x44ffffff}; //black, colors, white
if code was simplyfor(counter = 0; (counter < CLUTSize); counter++) {
__HAL_LTDC_LAYER(hltdc, LayerIdx)->CLUTWR =
*pCLUT
; pCLUT +=sizeof(*pCLUT);
} #stm32cubef4-ltdc2014-11-17 05:29 AM
Hi,
for(counter = 0; (counter <
CLUTSize
); counter++)
{
if(hltdc->LayerCfg[LayerIdx].PixelFormat == LTDC_PIXEL_FORMAT_AL44)
{
tmp = (((counter + 16*counter) <<
24
) | ((uint32_t)(*pCLUT) & 0xFF) | ((uint32_t)(*pCLUT) & 0xFF00) | ((uint32_t)(*pCLUT) & 0xFF0000));
}
else
{
tmp = ((counter << 24) | ((uint32_t)(*pCLUT) & 0xFF) | ((uint32_t)(*pCLUT) & 0xFF00) | ((uint32_t)(*pCLUT) & 0xFF0000));
}
pcounter = (uint32_t)pCLUT + sizeof(*pCLUT);
pCLUT = (uint32_t *)pcounter;
/* Specifies the C-LUT address and RGB value */
__HAL_LTDC_LAYER(hltdc, LayerIdx)->CLUTWR = tmp;
}
Thanks for the valuablefeedbacks.
PS:Please Format Code Block - Paintbrush [<>] icon, upper left of Word-in-a-box(tm) interface. Regards, Heisenberg.2014-11-17 10:13 AM
Sorry for dispute:)), but LTDC_LxCLUTWR upper 8 bits is the index itself, so I can address any single one of the 256 CLUT items.
<
br
><
br
>Bits 31:24 CLUTADD[7:0]: CLUT Address<
br
>These bits configure the CLUT address (color position within the CLUT) of each RGB<
br
>value<
br
>Bits 23:16 RED[7:0]: Red value<
br
>These bits configure the red value<
br
>Bits 15:8 GREEN[7:0]: Green value<
br
>These bits configure the green value<
br
>Bits 7:0 BLUE[7:0]: Blue value<
br
>These bits configure the blue value<
br
><
br
>Original solution generates the index, so allows us to
load the table only from the the beginning, my solution allows the user
to load the table in any order by direct addressing. The most flexible way to initialize is supplying a given number [1..256] of 32bit values, where upmost 8bit is the index, the other 8-8-8 are the color components.<
br
>For example I'm able to change only the color nr 20 (and leave all the rest untouched), I call<
br
><
br
>uint32_t NewCLUTItem= 0x16000000; //black to color nr 20<
br
>
HAL_LTDC_ConfigCLUT(&hltdc, &NewCLUTItem, 1, 0);<
br
><
br
><
br
>Thank you,<
br
>Tamas
2014-11-17 10:22 AM
Sorry..I wouldn't have tried formatting:))
2014-11-20 07:22 AM
Hi Tamas,
In fact the implementation we have already suggested is generic and allows us to load the CLUT table from the begenning with the 256 items, which is the most used case. Loading the table in any order by direct addressing, can be a specific use case.Regards,Heisenberg.2014-11-22 10:32 AM
Thank you, Heisenberg.
My last super-minor realization is maybe a misspell: the callback funtion for line interrupt is HAL_LTDC_LineEvenC
allback...shouldn't it be LineEventC
allback? best regards, Tamas