W35 RGB Solution

Senacharim
For those out there who might be coding their own simple display routine
directly to the /dev/fb0 without the overhead of xorg or
quick*whateveritwas...

I'd been struggling with getting the 2byte RGB color coding for the W35
screen correct.  Recently nailed it, thought I'd share my results.

Nothing speaks more clearly than <b>simple</b> code, so

[code]
/*
Color Notes:
1111100000000000  Red bits
0000011111100000  Green bits
0000000000011111  Blue bits
*/
unsigned short RGB(unsigned char pRed, unsigned char pGreen, unsigned char
pBlue)
{
  return (( pRed / 8) << 11) + ((pGreen / 4) << 5) + (pBlue / 8);
}
[/code]

Happy coding y'all.  Hope this helps out somebody besides myself.

Juergen Beisert
"/dev/fb0" suggests you tried under Linux. Why didn't you use the tool
"fbset" to get information about the physical layout of the video mode? Or
just open "/dev/fb0" and query it by yourself via the  FBIOGET_VSCREENINFO
IOTCL?
BTW: You should use the FBIOGET_VSCREENINFO IOCTL to query the video mode
layout. RGB565 is only *one* supported colour depth the built-in LCD
controller can handle and is completly independent of the used LC display
(means you also can run the W35 with RGB888).