2025-06-12 8:44 PM
hello,
When configuring the STM2H7 LTDC display controller in CLUT mode, the CLUTWR register needs to be write. In the official example provided by STM32, the register is cycled 256 times to configure the CLUT table. This method of writing 256 times to a register in a loop is different from common sense. How should we understand this configuration method? or who can give me some other example as this config method, thanks!
for (counter = 0U; (counter < CLUTSize); counter++)
{
if (hltdc->LayerCfg[LayerIdx].PixelFormat == LTDC_PIXEL_FORMAT_AL44)
{
tmp = (((counter + (16U * counter)) << 24U) | ((uint32_t)(*pcolorlut) & 0xFFU) | \
((uint32_t)(*pcolorlut) & 0xFF00U) | ((uint32_t)(*pcolorlut) & 0xFF0000U));
}
else
{
tmp = ((counter << 24U) | ((uint32_t)(*pcolorlut) & 0xFFU) | \
((uint32_t)(*pcolorlut) & 0xFF00U) | ((uint32_t)(*pcolorlut) & 0xFF0000U));
}
pcolorlut++;
/* Specifies the C-LUT address and RGB value */
LTDC_LAYER(hltdc, LayerIdx)->CLUTWR = tmp;
}