Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: uOLED-128-G1-CLASS-DEMO
Diff: uOLED.cpp
- 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);
}