I am not on the right machine to provide the whole answer to this but if you download the 4DShield Library, The old one, not the one at the beginning of this forum, there is a bit of code to translate RGB numbers to 16bit hex to send to the display.
One of the things that threw me in this routine was the shift. Since your reds and blues are reversed, it sounds like you need to shift to the left as you build your number. I don't remember exactly how it was done but it works. What I ended up doing to save code space was to use this routine to calculate my numbers that I needed for the various colors and print them to serial. Then I put these numbers in as constants.
16bit color uses a 565 format where there are 5 bits of red, 6 bits of green and 5 bits of blue. An interesting side note is that the human eye is able to differentiate shades of green better than the other two so it gets 6 bits.
In 12 bit you get 4 bits for each color. With only 4 bits of color available, you have to convert your 0 -255 to 0 - 15 since 15 is the highest possible 4 bit number.
These three numbers are all then combined together to make your 12bit number.
I found the C file. This is how the 16bit number is built:
int outR = ((red * 31) / 255);
int outG = ((green * 63) / 255);
int outB = ((blue * 31) / 255);
return (outR << 11) | (outG << 5) | outB;
So if you have to convert to 12bit, I am thinking that this should work:
// The red, green and blue numbers are passed and the color is returned.
//in your loop it would be:
unsigned int color = getcolor(255,51,51); // Whatever RGB values you want to pass.
unsigned int getcolor(unsigned int red, unsigned int green, unsigned int blue)
{
int outR = ((red * 15) / 255);
int outG = ((green * 15) / 255);
int outB = ((blue * 15) / 255);
return (outR << 8) | (outG << 4) | outB; //I think my shifts are right here
}
For the 4D displays, when you send color to the display, you have to do it one byte at a time and it is done like so:
Serial.write(color >> 8); // MSB
Serial.write(color & 0xFF); // LSB
I have no idea how to translate this to the Nokia. I am very surprised this function isn't included in the library for those knockoffs.