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
Diff: uOLED.h
- Revision:
- 26:5a2128799f60
- Parent:
- 25:caf134ebfc34
- Child:
- 27:da58cb3c815b
--- a/uOLED.h Mon Dec 27 03:21:23 2010 +0000 +++ b/uOLED.h Mon Dec 27 04:20:58 2010 +0000 @@ -138,6 +138,13 @@ * @param red Amount of red. * @param green Amount of green. * @param blue Amount of blue. + * + * Example: + * @code + * // Display bitmapped character stored in index 01, at location (0x,0y), and colour it red. + * // (characterIndex, x, y, red, green, blue) + * SGC.displayUserBitmappedCharacter(0x01, 0x00, 0x00, 0xFF, 0x00, 0x00); + * @endcode */ bool displayUserBitmappedCharacter(char character, char x, char y, short red, short green, short blue); @@ -149,6 +156,13 @@ * @param red Amount of red. * @param green Amount of green. * @param blue Amount of blue. + * + * Example: + * @code + * // Draw a circle centered at (63x, 63y) with a radius of 34 and colour it green. + * // (x, y, radius, red, green, blue) + * SGC.drawCircle(0x3F, 0x3F, 0x22, 0x00, 0xFF, 0x00); + * @endcode */ bool drawCircle(char x, char y, char radius, short red, short green, short blue); @@ -162,6 +176,13 @@ * @param red Amount of red. * @param green Amount of green. * @param blue Amount of blue. + * + * Example: + * @code + * // Draw character 'A' at column 0, row 0. Colour it white. + * // (character, column, row, red, green, blue) + * SGC.drawCharacter(0x41, 0x00, 0x00, 0xFF, 0xFF, 0xFF); + * @endcode */ bool drawCharacter(char character, char column, char row, short red, short green, short blue); @@ -189,6 +210,13 @@ * @param red Amount of red. * @param green Amount of green. * @param blue Amount of blue. + * + * Example: + * @code + * // Draw a line starting at (0x, 0y) and ending at (43x, 43y). Colour it blue. + * // (x1, y1, x2, y2, red, green, blue) + * SGC.drawLine(0x00, 0x00, 0x2B, 0x2B, 0x00, 0x00, 0xFF); + * @endcode */ bool drawLine(char x1, char y1, char x2, char y2, short red, short green, short blue); @@ -200,6 +228,16 @@ * @param red Amount of red. * @param green Amount of green. * @param blue Amount of blue. + * + * Example: + * @code + * char x[4] = {0, 10, 20, 30}; + * char y[4] = {0, 10, 20, 30}; + * // Draw a white polygon with 4 vertices located at: + * // (0x, 0y), (10x, 10y), (20x, 20y), (30x, 30y) + * // (vertices, *x, *y, red, green, blue) + * SGC.drawPolygon(4, x, y, 255, 255, 255); + * @endcode */ bool drawPolygon(char vertices, char *x, char *y, short red, short green, short blue); @@ -212,6 +250,13 @@ * @param red Amount of red. * @param green Amount of green. * @param blue Amount of blue. + * + * Example: + * @code + * // Draw rectangle starting at (0x, 0y) and ending at (40x, 40y). Colour red. + * // (x, y, width, height, red, green, blue) + * SGC.drawRectangle(0, 0, 40, 40, 255, 0, 0); + * @endcode */ bool drawRectangle(char x, char y, char width, char height, short red, short green, short blue); @@ -225,7 +270,9 @@ * * Example: * @code - * SGC.drawText(0, 0, 0, FF, "This is text"); + * // Draw string "This is text" at (0, 0) with font set 0, coloured white. + * // (column, row, font, red, green, blue, "text") + * SGC.drawText(0, 0, 0, FF, FF, FF, "This is text"); * @endcode */ bool drawText(char column, char row, char font, short red, short green, short blue, char *text); @@ -245,7 +292,8 @@ * * Example: * @code - * SGC.drawTextUF(0, 0, 0, 20, 20, 255, 1, 1, "This is text"); + * // Draw unformatted text string "This is text" at (0, 0) with font set 0, coloured white with zero (1x) magnification. + * SGC.drawTextUF(0, 0, 0, 255, 255, 255, 1, 1, "This is text"); * @endcode */ bool drawTextUF(char x, char y, char font, short red, short green, short blue, char width, char height, char *text); @@ -263,6 +311,14 @@ * @param red Amount of red. * @param blue Amount of blue. * @param green Amount of green. + * + * Example: + * @code + * // Draw a red triangle with vertices: + * // (0x, 0y), (10x, 10y), (20x, 20y) + * // (x1, y1, x2, y2, x3, y3, red, green, blue) + * SGC.drawTriangle(0, 0, 10, 10, 20, 20, 255, 0, 0); + * @endcode */ bool drawTriangle(char x1, char y1, char x2, char y2, char x3, char y3, short red, short green, short blue); @@ -271,6 +327,12 @@ * Remove everything except the background colour. * * @param returns success or failure. + * + * Example: + * @code + * // Do you really need an example? :) + * SGC.eraseScreen(); + * @endcode */ bool eraseScreen(); @@ -279,6 +341,12 @@ * Timing allows for at least 500ms delay for initialization. * * @param returns bool indicating success or failure of initialization. + * + * Example: + * @code + * // Must be done before anything else + * SGC.init(); + * @endcode */ bool init(); @@ -290,6 +358,14 @@ * @param size Sets solid or wire frame. * - 0x00 = Solid * - 0x01 = Wire frame. + * + * Example: + * @code + * // Draw objects solid + * SGC.penSize(0); + * // Draw objects wire frame + * SGC.penSize(1); + * @endcode */ bool penSize(char size); @@ -300,6 +376,13 @@ * @param red Amount of red. * @param green Amount of green. * @param blue Amount of blue. + * + * Example: + * @code + * Draw a blue pixel at (10x, 10y). + * // (x, y, red, green, blue) + * SGC.putPixel(10, 10, 0, 0, 255); + * @endcode */ bool putPixel(char x, char y, short red, short green, short blue); @@ -310,14 +393,29 @@ * @param returns 2 byte pixel colour in RGB format. * - MSB: R4R3R2R1R0G5G4G3 * - LSB: G2G1G0B4B3B2B1B0 + * + * Example: + * @code + * // Read pixel colour at location (20x, 20y). + * short pixelColour = SGC.readPixel(20, 20); + * @endcode */ short readPixel(char x, char y); /** Replaces the background colour with a new colour. * + * Most functions call this internally. + * * @param red Red value (0 to 255). * @param green Green value (0 to 255). * @param blue Blue value (0 to 255). + * + * Example: + * @code + * // Set background colour to red. + * // (red, green, blue) + * SGC.setBackgroundColour(255, 0, 0); + * @endcode */ bool setBackgroundColour(char red, char green, char blue); @@ -329,6 +427,14 @@ * - DEFAULT: 0x00 = 5x7 small size font set * - DEFAULT: 0x01 = 8x8 medium size font set * - DEFAULT: 0x02 = 8x12 large size font set + * + * Example: + * @code + * // Use default 5x7 font set + * SGC.setFont(0); + * // Use default 8x12 font set + * SGC.setFont(2); + * @endcode */ bool setFont(char font); @@ -350,6 +456,14 @@ * @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. + * + * Example: + * @code + * // Draw a text button in the unpressed state starting at (0x, 0y). + * // Button colour is red, text colour is white. Text magnification is zero (1x). + * // (state, x, y, red, green, blue, font, textRed, textGreen, textBlue, textWidth, textHeight, "Text"); + * SGC.textButton(1, 0, 0, 255, 0, 0, 0, 255, 255, 255, 1, 1, "Button text"); + * @endcode */ 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); @@ -358,6 +472,12 @@ * Opaque text has a rectangle drawn behind it (blocking out what is under it) and transparent text does not. * * @param mode Set text to transparent (0x00) or opaque (0x01). + * + * Example: + * @code + * // Set text mode to transparent. + * SGC.textMode(0); + * @endcode */ bool textMode(char mode); @@ -390,6 +510,13 @@ * - 0x00 = Output to serial port only. * - 0x01 = Output to serial port and screen. * @param *info Character array to store results. + * + * Example: + * @code + * // Request version info, pass in character array to store results. + * char info[5] = 0; + * SGC.versionInfo(1, info); + * @endcode */ bool versionInfo(bool onScreen, char *info);