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 19:cc4f5d01f080, committed 2010-12-21
- Comitter:
- Nakor
- Date:
- Tue Dec 21 14:45:35 2010 +0000
- Parent:
- 18:77ec40174c31
- Child:
- 20:a07d700164c8
- 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 Tue Dec 21 01:15:01 2010 +0000 +++ b/uOLED.cpp Tue Dec 21 14:45:35 2010 +0000 @@ -65,14 +65,6 @@ return (_oled.getc() == OLED_ACK); } -bool uOLED::setContrast(char contrast) { - _oled.putc(0x59); - _oled.putc(0x02); - _oled.putc(contrast); - - return (_oled.getc() == OLED_ACK); -} - bool uOLED::displayUserBitmappedCharacter(char character, char x, char y, short color) { _oled.putc(0x44); _oled.putc(character); @@ -95,7 +87,10 @@ return (_oled.getc() == OLED_ACK); } -bool uOLED::drawCircle(char x, char y, char radius, short color) { +bool uOLED::drawCircle(char x, char y, char radius, short red, short green, short blue) +{ + short color = getRGB(red, green, blue); + _oled.putc(0x43); _oled.putc(x); _oled.putc(y); @@ -125,7 +120,10 @@ return (_oled.getc() == OLED_ACK); } -bool uOLED::drawLine(char x1, char y1, char x2, char y2, short color) { +bool uOLED::drawLine(char x1, char y1, char x2, char y2, short red, short green, short blue) +{ + short color = getRGB(red, green, blue); + _oled.putc(0x4C); _oled.putc(x1); _oled.putc(y1); @@ -177,11 +175,7 @@ bool uOLED::drawTextUF(char x, char y, char font, short red, short green, short blue, char width, char height, char *text) { - int outR = ((red * 31) / 255); - int outG = ((green * 63) / 255); - int outB = ((blue * 31) / 255); - - short colour = (outR << 11) | (outG << 5) | outB; + short colour = getRGB(red, green, blue); _oled.putc(0x53); _oled.putc(x); @@ -263,11 +257,7 @@ bool uOLED::setBackgroundColour(char red, char green, char blue) { - int outR = ((red * 31) / 255); - int outG = ((green * 63) / 255); - int outB = ((blue * 31) / 255); - - short colour = (outR << 11) | (outG << 5) | outB; + short colour = getRGB(red, green, blue); _oled.putc(0x42);
--- a/uOLED.h Tue Dec 21 01:15:01 2010 +0000 +++ b/uOLED.h Tue Dec 21 14:45:35 2010 +0000 @@ -65,15 +65,14 @@ bool addBitmappedCharacter(char character, char data[8]); /** !!ToDO!! - * Dunno + * * @param returns something. */ bool blockCopyPaste(char sourceX, char sourceY, char destinationX, char destinationY, char width, char height); /** Display control. * - * Display ON/OFF and PowerUp/Shutdown. - * Use setContrast(contrast) to set the contrast. + * Display ON/OFF, set contrast, and PowerUp/Shutdown. * * @param mode Sets specified mode. * @param value Value option for mode. @@ -89,36 +88,48 @@ */ bool displayControl(char mode, char value); - /** Dunno5 - * Dunno - * @param returns something. - */ - bool setContrast(char contrast); - /** Dunno6 - * Dunno + /** !!ToDo!! + * * @param returns something. */ bool displayUserBitmappedCharacter(char character, char x, char y, short color); - /** Dunno7 - * Dunno - * @param returns something. + + /** Draw a circle. + * + * @param x X position of circle center. + * @param y Y position of circle center. + * @param radius Radius of the circle. + * @param red Amount of red. + * @param green Amount of green. + * @param blue Amount of blue. */ - bool drawCircle(char x, char y, char radius, short color); - /** Dunno8 - * Dunno + bool drawCircle(char x, char y, char radius, short red, short green, short blue); + + /** !!ToDo!! + * * @param returns something. */ bool drawCharacter(char character, char column, char row, short color); - /** Dunno9 - * Dunno + + /** !!ToDo!! + * * @param returns something. */ bool drawImage(char x, char y, char width, char height, char colorMode, char *pixels); - /** Dunno10 - * Dunno - * @param returns something. + + /** Draw a line. + * + * Draws a line to the screen. + * @param x1 Top left horizontal start position. + * @param y1 Top left vertical start position. + * @param x2 Bottom right horizontal start position. + * @param y2 Bottom right vertical end position. + * @param red Amount of red. + * @param green Amount of green. + * @param blue Amount of blue. */ - bool drawLine(char x1, char y1, char x2, char y2, short color); + bool drawLine(char x1, char y1, char x2, char y2, short red, short green, short blue); + /** Dunno11 * Dunno * @param returns something.