I just started to use the LCD controller and created a small test program based on the lcdc_tft example (in boards/lpcxpresso54608/driver_examples/lcdc/lcdc_tft in the SDK) and while playing around with that example I had some problems figuring out what the values for the palette in LCD_SetPalette() mean.
In the example, the palette is defined as uint32_t palette[] and the lpc54608.h also defines the palette registers in the chip as uint32_t PAL[128].
That got me confused. How do 8 bits per pixel result in a palette of 128 entries?
After checking with the user manual, I found that there are actually 256 palette entries, each 16 bits wide organized as 128 32 bits wide registers.
All access to registers is only 32 bits wide, so I do understand the fact that in lpc54608.h this is defined as such, but from a programmer point of view it would make sense to define the palette table as uint16_t array
Rob
The thing is that the prototype for LCDC_SetPallette is:
void LCDC_SetPalette(LCD_Type *base, const uint32_t *palette, uint8_t count_words);
with each entry in *palette containing 2 palette entries and words being the amount of palette entries divided by 2.
Would it not be much easier to have:
void LCDC_SetPalette(LCD_Type *base, const uint16_t *palette, uint8_t count_words);
and have the function itself perform a type cast to uint32_t * with words/2 as the amount of registers to fill.
In my view, the whole idea of having a component to program the LCD Controller is to abstract the hardware view (32 bits register access) from the software view (16 bits palette entries).