Content originally posted in LPCWare by wellsk on Wed Jan 11 17:39:33 MST 2012
The RAM palette is just an array of memory in the LCD controller than translates a color index value to a color bit pattern on the LCD bus.
The RAM palette allows up to 256 entries to be defined at 16 bits/color per entry.
You can use the palette RAM to define your own color patterns for color index values used in your frame buffer.
For example, you might want to use the following indices for the palette RAM...
Index 0 = 0x0000 = BLACK
Index 1 = 0x001F = Blue
Index 2 = 0x07E0 = Green
Index 3 = 0xF100 = Red
Index 4 = 0xFFFF = White
So instead of using the direct color values (0x0000, 0xFFFF, etc.), you can use the index (0, 4) into the palette RAM lookup table to select the color for a element on the display. The drawback is that you can only get a maximum of 256 colors out of a selection of 65536 colors. The advantage is that your frame buffer only uses 8-bits per pixel instead of 16-bits per pixel, cutting your frame buffer memory and display refresh bandwidth in half.