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 21:87a2227c1ad2, committed 2010-12-26
- Comitter:
- Nakor
- Date:
- Sun Dec 26 18:49:00 2010 +0000
- Parent:
- 20:a07d700164c8
- Child:
- 22:66401b612b1b
- 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 14:47:35 2010 +0000 +++ b/uOLED.cpp Sun Dec 26 18:49:00 2010 +0000 @@ -148,25 +148,32 @@ return (_oled.getc() == OLED_ACK); } -bool uOLED::drawRectangle(char x, char y, char width, char height, short color) { +bool uOLED::drawRectangle(char x, char y, char width, char height, short red, short green, short blue) +{ + short colour = getRGB(red, green, blue); + _oled.putc(0x72); _oled.putc(x); _oled.putc(y); _oled.putc(x + width); _oled.putc(y + height); - _oled.putc(color >> 8); - _oled.putc(color & 0xFF); + _oled.putc(colour >> 8); + _oled.putc(colour & 0xFF); return (_oled.getc() == OLED_ACK); } -bool uOLED::drawText(char column, char row, char font, short color, char *text) { +bool uOLED::drawText(char column, char row, char font, short red, short green, short blue, char *text) +{ + + short colour = getRGB(red, green, blue); + _oled.putc(0x73); _oled.putc(column); _oled.putc(row); _oled.putc(font); - _oled.putc(color >> 8); - _oled.putc(color & 0xFF); + _oled.putc(colour >> 8); + _oled.putc(colour & 0xFF); for (int i=0 ; i<strlen(text) ; i++) _oled.putc(text[i]); _oled.putc(0x00); @@ -191,7 +198,11 @@ return (_oled.getc() == OLED_ACK); } -bool uOLED::drawTriangle(char x1, char y1, char x2, char y2, char x3, char y3, short color) { +bool uOLED::drawTriangle(char x1, char y1, char x2, char y2, char x3, char y3, short red, short green, short blue) +{ + + short colour = getRGB(red, green, blue); + _oled.putc(0x47); _oled.putc(x1); _oled.putc(y1); @@ -199,8 +210,8 @@ _oled.putc(y2); _oled.putc(x3); _oled.putc(y3); - _oled.putc(color >> 8); - _oled.putc(color & 0xFF); + _oled.putc(colour >> 8); + _oled.putc(colour & 0xFF); return (_oled.getc() == OLED_ACK); }
--- a/uOLED.h Tue Dec 21 14:47:35 2010 +0000 +++ b/uOLED.h Sun Dec 26 18:49:00 2010 +0000 @@ -129,16 +129,24 @@ */ bool drawLine(char x1, char y1, char x2, char y2, short red, short green, short blue); - /** Dunno11 - * Dunno + /** !!ToDo!! + * * @param returns something. */ bool drawPolygon(char vertices, char *x, char *y, short color); - /** Dunno12 - * Dunno - * @param returns something. + + /** Draw a rectangle. + * + * @param x Top left horizontal start position. + * @param y Top left vertical start position. + * @param width Bottom right horizontal end position. + * @param height Bottom right vertical end position. + * @param red Amount of red. + * @param green Amount of green. + * @param blue Amount of blue. */ - bool drawRectangle(char x, char y, char width, char height, short color); + bool drawRectangle(char x, char y, char width, char height, short red, short green, short blue); + /** Draw text to the screen. * * @param column X coordinate for text placement. @@ -152,7 +160,8 @@ * SGC.drawText(0, 0, 0, FF, "This is text"); * @endcode */ - bool drawText(char column, char row, char font, short color, char *text); + bool drawText(char column, char row, char font, short red, short green, short blue, char *text); + /** Draw unformated text to the screen. * The manual describes this as "graphics format". * @@ -172,26 +181,50 @@ * @endcode */ bool drawTextUF(char x, char y, char font, short red, short green, short blue, char width, char height, char *text); - /** Dunno13 - * Dunno - * @param returns something. + + /** Draw a triangle. + * + * Vertices must be defined counter clockwise. + * + * @param x1 Vertice 1 X coordinate. + * @param y1 Vertice 1 Y coordinate. + * @param x2 Vertice 2 X coordinate. + * @param y2 Vertice 2 Y coordinate. + * @param x3 Vertice 3 X coordinate. + * @param y3 Vertice 3 Y coordinate. + * @param red Amount of red. + * @param blue Amount of blue. + * @param green Amount of green. */ - bool drawTriangle(char x1, char y1, char x2, char y2, char x3, char y3, short color); - /** Dunno15 - * Dunno - * @param returns something. + bool drawTriangle(char x1, char y1, char x2, char y2, char x3, char y3, short red, short green, short blue); + + /** Clear the screen. + * + * Remove everything except the background colour. + * + * @param returns success or failure. */ bool eraseScreen(); + /** Initialize the screen. This must be completed before any other communication with the device. + * * Timing allows for at least 500ms delay for initialization. + * * @param returns bool indicating success or failure of initialization. */ bool init(); - /** Dunno16 - * Dunno - * @param returns something. + + /** Set pen size. + * + * Sets if objects should be drawn solid or wire frame. + * Does not apply to polygon function. + * + * @param size Sets solid or wire frame. + * - 0x00 = Solid + * - 0x01 = Wire frame. */ bool penSize(char size); + /** Dunno17 * Dunno * @param returns something.