lpc54608 LCD palette issue?

cancel
Showing results for 
Search instead for 
Did you mean: 

lpc54608 LCD palette issue?

290 Views
Contributor III

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

Tags (2)
0 Kudos
2 Replies

41 Views
NXP Employee
NXP Employee

A Union may work but adding some redundant...

There are also discussion in the team about the compromise between IP point of view and programmer point of view.

0 Kudos

41 Views
Contributor III

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).

0 Kudos