Heavily documented control library for the uOLED-96-G1 (SGC) by 4D Systems. Will likely work with any of the 4D Systems serial controlled screens. <<info>> All examples in the documentation have been tested to the best of my current abilities, but there are a few functions that I simply do not use. I have created a Lighthouse page for this library. You may submit bug reports or feature requests to [[http://mbed-uoled.lighthouseapp.com|this page]]. If you really do not wish to sign up for a Lighthouse account you may also post any bugs or requests [[/users/Nakor/notebook/uoled-bug-reports/|here]]. <</info>>
Dependents: DS18B20 DS18B20GSM Astromed Astromed_build20121123
Revision 22:66401b612b1b, committed 2010-12-26
- Comitter:
- Nakor
- Date:
- Sun Dec 26 19:25:23 2010 +0000
- Parent:
- 21:87a2227c1ad2
- Child:
- 23:dd9a280c8be5
- Commit message:
Changed in this revision
uOLED.cpp | Show annotated file Show diff for this revision Revisions of this file |
uOLED.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/uOLED.cpp Sun Dec 26 18:49:00 2010 +0000 +++ b/uOLED.cpp Sun Dec 26 19:25:23 2010 +0000 @@ -243,13 +243,16 @@ return (_oled.getc() == OLED_ACK); } -bool uOLED::putPixel(char x, char y, short color) { +bool uOLED::putPixel(char x, char y, short red, short green, short blue) +{ + short colour = getRGB(red, green, blue); + _oled.putc(0x50); _oled.putc(x); _oled.putc(y); - _oled.putc(color >> 8); - _oled.putc(color & 0xFF); + _oled.putc(colour >> 8); + _oled.putc(colour & 0xFF); return (_oled.getc() == OLED_ACK); } @@ -278,23 +281,27 @@ return (_oled.getc() == OLED_ACK); } -bool uOLED::setFontSize(char fontType) { +bool uOLED::setFont(char font) { _oled.putc(0x46); - _oled.putc(fontType); + _oled.putc(font); return (_oled.getc() == OLED_ACK); } -bool uOLED::textButton(char state, char x, char y, short buttonColor, char font, short textColor, char textWidth, char textHeight, char *text) { +bool uOLED::textButton(char state, char x, char y, short red, short green, short blue, char font, short textRed, short textGreen, short textBlue, char textWidth, char textHeight, char *text) +{ + short buttonColour = getRGB(red, green, blue); + short textColour = getRGB(textRed, textGreen, textBlue); + _oled.putc(0x62); _oled.putc(state); _oled.putc(x); _oled.putc(y); - _oled.putc(buttonColor >> 8); - _oled.putc(buttonColor & 0xFF); + _oled.putc(buttonColour >> 8); + _oled.putc(buttonColour & 0xFF); _oled.putc(font); - _oled.putc(textColor >> 8); - _oled.putc(textColor & 0xFF); + _oled.putc(textColour >> 8); + _oled.putc(textColour & 0xFF); _oled.putc(textWidth); _oled.putc(textHeight); for (int i=0 ; i<strlen(text) ; i++) _oled.putc(text[i]);
--- a/uOLED.h Sun Dec 26 18:49:00 2010 +0000 +++ b/uOLED.h Sun Dec 26 19:25:23 2010 +0000 @@ -225,16 +225,26 @@ */ bool penSize(char size); - /** Dunno17 - * Dunno - * @param returns something. + /** Draw a coloured pixel at designated position. + * + * @param x Horizontal position of pixel. + * @param y Vertical position of pixel. + * @param red Amount of red. + * @param green Amount of green. + * @param blue Amount of blue. */ - bool putPixel(char x, char y, short color); - /** Dunno18 - * Dunno - * @param returns something. + bool putPixel(char x, char y, short red, short green, short blue); + + /** Read the colour of a specified pixel. + * + * @param x X coordinate. + * @param y Y coordinate. + * @param returns 2 byte pixel colour in RGB format. + * - MSB: R4R3R2R1R0G5G4G3 + * - LSB: G2G1G0B4B3B2B1B0 */ short readPixel(char x, char y); + /** Replaces the background colour with a new colour. * * @param red Red value (0 to 255). @@ -242,16 +252,39 @@ * @param blue Blue value (0 to 255). */ bool setBackgroundColour(char red, char green, char blue); - /** Dunno19 - * Dunno - * @param returns something. + + /** Set font (for future text). + * + * 3 default fonts are supplied. Further font sets can be added. + * + * @param font Font selection. Either a default or otherwise. + * - DEFAULT: 0x00 = 5x7 small size font set + * - DEFAULT: 0x01 = 8x8 medium size font set + * - DEFAULT: 0x02 = 8x12 large size font set */ - bool setFontSize(char fontType); - /** Dunno21 - * Dunno - * @param returns something. + bool setFont(char font); + + /** Draw a text button to the screen. + * + * @param state Button down (0x00) or button up (0x01). + * @param x Top left horizontal start position. + * @param y Top left vertical start position. + * @param red Amount of red (for button not text). + * @param green Amount of green (for button not text). + * @param blue Amount of blue (for button not text). + * @param font Set which font set to use for the button. 3 default font sets are supplied and more can be added. + * - DEFAULT: 0x00 = 5x7 small size font set + * - DEFAULT: 0x01 = 8x8 medium size font set + * - DEFAULT: 0x02 = 8x12 large size font set + * @param textRed Amount of red for text. + * @param textGreen Amount of green for text. + * @param textBlue Amount of blue for text. + * @param textWidth Width of characters (text). Affect total width of string and button. + * @param textHeight Height of characters (text). Affects total height of string and button. + * @param *text Character array (string) to display in the button. */ - bool textButton(char state, char x, char y, short buttonColor, char font, short textColor, char textWidth, char textHeight, char *text); + bool textButton(char state, char x, char y, short red, short green, short blue, char font, short textRed, short textGreen, short textBlue, char textWidth, char textHeight, char *text); + /** Dunno22 * Dunno * @param returns something.