Christian Dupaty / uOLED

Dependents:   uOLED-128-G1-CLASS-DEMO

Revision:
13:f2b9f249bcff
Parent:
12:59da6ae5cfb7
Child:
14:3d90211095d4
diff -r 59da6ae5cfb7 -r f2b9f249bcff uOLED.cpp
--- a/uOLED.cpp	Mon Dec 20 20:33:36 2010 +0000
+++ b/uOLED.cpp	Mon Dec 20 20:49:25 2010 +0000
@@ -238,16 +238,18 @@
     return returnValue;
 }
 
-bool uOLED::setBackgroundColor(short color) {
-    _oled.putc(0x42);
-
+bool uOLED::setBackgroundColour(char red, char green, char blue)
+{
+    int outR = ((red * 31) / 255);
+    int outG = ((green * 63) / 255);
+    int outB = ((blue * 31) / 255);
     
-    _oled.putc(color >> 8);
-    _oled.putc(color & 0xFF);
+    short colour = (outR << 11) | (outG << 5) | outB;
+
+    _oled.putc(0x42);
     
-    
-    //_oled.putc(colorA);
-    //_oled.putc(colorB);
+    _oled.putc(colour >> 8);
+    _oled.putc(colour & 0xFF);
 
     return (_oled.getc() == OLED_ACK);
 }