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
uOLED.h@31:7ad5bf258a1e, 2011-01-09 (annotated)
- Committer:
- Nakor
- Date:
- Sun Jan 09 20:24:37 2011 +0000
- Revision:
- 31:7ad5bf258a1e
- Parent:
- 30:41a872ad6155
Added screen copy function (save screen to uSD).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nakor | 0:4f009971ac11 | 1 | /* mbed 4D uOLED Library |
Nakor | 0:4f009971ac11 | 2 | * Originally designed for use with uOLED-96-G1 (SGC) |
Nakor | 0:4f009971ac11 | 3 | * serially controlled .96" screen. |
Nakor | 0:4f009971ac11 | 4 | * |
Nakor | 0:4f009971ac11 | 5 | * This is a modified library originally obtained from |
Nakor | 0:4f009971ac11 | 6 | * Erik van Wijk's library code at: |
Nakor | 0:4f009971ac11 | 7 | * http://mbed.org/users/evwijk/libraries/microOLED/li4nzn |
Nakor | 5:93ea03e2a688 | 8 | * |
Nakor | 5:93ea03e2a688 | 9 | * This library (uOLED) by Aaron Goselin. |
Nakor | 5:93ea03e2a688 | 10 | * 2010 |
Nakor | 27:da58cb3c815b | 11 | * |
Nakor | 27:da58cb3c815b | 12 | * If you use and/or modify this library please keep credit lines intact. |
Nakor | 0:4f009971ac11 | 13 | */ |
Nakor | 0:4f009971ac11 | 14 | |
Nakor | 0:4f009971ac11 | 15 | #ifndef _MBED_UOLED_ |
Nakor | 0:4f009971ac11 | 16 | #define _MBED_UOLED_ |
Nakor | 0:4f009971ac11 | 17 | |
Nakor | 0:4f009971ac11 | 18 | #include "mbed.h" |
Nakor | 0:4f009971ac11 | 19 | |
Nakor | 0:4f009971ac11 | 20 | #define OLED_FONT5X7 0x01 |
Nakor | 0:4f009971ac11 | 21 | #define OLED_FONT8X8 0x02 |
Nakor | 0:4f009971ac11 | 22 | #define OLED_FONT8X12 0x03 |
Nakor | 0:4f009971ac11 | 23 | |
Nakor | 0:4f009971ac11 | 24 | #define OLED_DISPLAYCONTROL_DISPLAY 0x01 |
Nakor | 0:4f009971ac11 | 25 | #define OLED_DISPLAYCONTROL_CONTRAST 0x02 |
Nakor | 0:4f009971ac11 | 26 | #define OLED_DISPLAYCONTROL_POWER 0x03 |
Nakor | 0:4f009971ac11 | 27 | |
Nakor | 30:41a872ad6155 | 28 | |
Nakor | 0:4f009971ac11 | 29 | /** uOLED control class using Serial |
Nakor | 27:da58cb3c815b | 30 | * |
Nakor | 27:da58cb3c815b | 31 | * The serially controlled uOLEDs by 4D Systems are controlled |
Nakor | 27:da58cb3c815b | 32 | * with only 3 pins: |
Nakor | 27:da58cb3c815b | 33 | * - serialTX |
Nakor | 27:da58cb3c815b | 34 | * - serialRX |
Nakor | 27:da58cb3c815b | 35 | * - reset |
Nakor | 27:da58cb3c815b | 36 | * |
Nakor | 28:81a38ad6e79a | 37 | * While the device includes many serial functions, it is faster to do things from a uSD card. |
Nakor | 27:da58cb3c815b | 38 | * Consider learning the 4DSL scripting language. You can then write your functions in 4DSL |
Nakor | 27:da58cb3c815b | 39 | * storing them on the uSD to later be triggered serially. |
Nakor | 27:da58cb3c815b | 40 | * |
Nakor | 27:da58cb3c815b | 41 | * Examples use SGC as the uOLED instance name. SGC just happens to be the type of device that I have. |
Nakor | 27:da58cb3c815b | 42 | * Of course, it doesn't matter what you call your instance(s). |
Nakor | 27:da58cb3c815b | 43 | * |
Nakor | 27:da58cb3c815b | 44 | * Examples use both decimal and hexadecimal numbers. It does not matter which you use for most functions. |
Nakor | 27:da58cb3c815b | 45 | * |
Nakor | 27:da58cb3c815b | 46 | * Please post a comment on the library page if you spot an error. I will try to fix it quickly. |
Nakor | 0:4f009971ac11 | 47 | * |
Nakor | 0:4f009971ac11 | 48 | * Example: |
Nakor | 0:4f009971ac11 | 49 | * @code |
Nakor | 0:4f009971ac11 | 50 | * // Draw text on the screen. |
Nakor | 0:4f009971ac11 | 51 | * #include "mbed.h" |
Nakor | 0:4f009971ac11 | 52 | * #include "uOLED.h" |
Nakor | 0:4f009971ac11 | 53 | * |
Nakor | 0:4f009971ac11 | 54 | * uOLED SGC(p9, p10, p11); |
Nakor | 0:4f009971ac11 | 55 | * |
Nakor | 5:93ea03e2a688 | 56 | * int main() |
Nakor | 0:4f009971ac11 | 57 | * { |
Nakor | 29:757036aa73cd | 58 | * SGC.drawText(0, 0, 0, FF, FF, FF, "This is text"); |
Nakor | 0:4f009971ac11 | 59 | * } |
Nakor | 3:949c5ac54e9c | 60 | * @endcode |
Nakor | 0:4f009971ac11 | 61 | */ |
Nakor | 0:4f009971ac11 | 62 | class uOLED { |
Nakor | 0:4f009971ac11 | 63 | public: |
Nakor | 0:4f009971ac11 | 64 | |
Nakor | 4:51f274633e70 | 65 | /** Create an instance of the uOLED class. |
Nakor | 4:51f274633e70 | 66 | * |
Nakor | 2:559b81f2bb1e | 67 | * @param serialTX - mbed TX pin to be used |
Nakor | 2:559b81f2bb1e | 68 | * @param serialRX - mbed RX pin to be used |
Nakor | 2:559b81f2bb1e | 69 | * @param reset - mbed pin to control reset of the uOLED |
Nakor | 25:caf134ebfc34 | 70 | * |
Nakor | 25:caf134ebfc34 | 71 | * Example: |
Nakor | 25:caf134ebfc34 | 72 | * @code |
Nakor | 25:caf134ebfc34 | 73 | * // (serialTX, serialRX, reset) |
Nakor | 25:caf134ebfc34 | 74 | * uOLED SGC(p9, p10, p11); |
Nakor | 25:caf134ebfc34 | 75 | * @endcode |
Nakor | 1:476dcc382de3 | 76 | */ |
Nakor | 0:4f009971ac11 | 77 | uOLED(PinName serialTX, PinName serialRX, PinName reset); |
Nakor | 1:476dcc382de3 | 78 | |
Nakor | 17:cee1c66b3133 | 79 | /** Convert RGB value into the type of value that the uOLED wants. |
Nakor | 17:cee1c66b3133 | 80 | * |
Nakor | 17:cee1c66b3133 | 81 | * @param red Red value. |
Nakor | 17:cee1c66b3133 | 82 | * @param green Green value. |
Nakor | 17:cee1c66b3133 | 83 | * @param blue Blue value. |
Nakor | 25:caf134ebfc34 | 84 | * |
Nakor | 25:caf134ebfc34 | 85 | * Example: |
Nakor | 25:caf134ebfc34 | 86 | * @code |
Nakor | 25:caf134ebfc34 | 87 | * // (red, green, blue) |
Nakor | 25:caf134ebfc34 | 88 | * SGC.getRGB(120, 255, 50); |
Nakor | 25:caf134ebfc34 | 89 | * @endcode |
Nakor | 1:476dcc382de3 | 90 | */ |
Nakor | 0:4f009971ac11 | 91 | short getRGB(char red, char green, char blue); |
Nakor | 0:4f009971ac11 | 92 | |
Nakor | 25:caf134ebfc34 | 93 | /** Add user defined bitmap character into internal memory. |
Nakor | 17:cee1c66b3133 | 94 | * |
Nakor | 25:caf134ebfc34 | 95 | * @param character Character index to add to memory. Range is 0-31 (0x00 to 0x1F). 32 8x8 characters. |
Nakor | 25:caf134ebfc34 | 96 | * @param data[8] 8 data bytes that make up the composition of the bitmap character. 8x8 composition is 1 byte wide (8 bits) by 8 bytes deep. |
Nakor | 25:caf134ebfc34 | 97 | * |
Nakor | 25:caf134ebfc34 | 98 | * Example: |
Nakor | 25:caf134ebfc34 | 99 | * @code |
Nakor | 25:caf134ebfc34 | 100 | * // Array containing data for 8x8 "O" character. |
Nakor | 25:caf134ebfc34 | 101 | * char data[8] = {0x18, 0x24, 0x42, 0x81, 0x81, 0x42, 0x24, 0x18}; |
Nakor | 25:caf134ebfc34 | 102 | * // (characterIndex, characterData) |
Nakor | 25:caf134ebfc34 | 103 | * SGC.addBitmappedCharacter(0x01, data); |
Nakor | 25:caf134ebfc34 | 104 | * @endcode |
Nakor | 1:476dcc382de3 | 105 | */ |
Nakor | 0:4f009971ac11 | 106 | bool addBitmappedCharacter(char character, char data[8]); |
Nakor | 17:cee1c66b3133 | 107 | |
Nakor | 25:caf134ebfc34 | 108 | /** Copy and paste a specified block of the screen. |
Nakor | 19:cc4f5d01f080 | 109 | * |
Nakor | 25:caf134ebfc34 | 110 | * @param sourceX Top left horizontal start position of screen area to be copied. |
Nakor | 25:caf134ebfc34 | 111 | * @param sourceY Top left vertical start position of screen area to be copied. |
Nakor | 25:caf134ebfc34 | 112 | * @param destinationX Top left horizontal start position of where copied area is to be pasted. |
Nakor | 25:caf134ebfc34 | 113 | * @param destinationY Top left vertical start position of where copied area is to be pasted. |
Nakor | 25:caf134ebfc34 | 114 | * @param width Width of screen area to be copied. |
Nakor | 25:caf134ebfc34 | 115 | * @param height Height of screen area to be copied. |
Nakor | 25:caf134ebfc34 | 116 | * |
Nakor | 25:caf134ebfc34 | 117 | * Example: |
Nakor | 25:caf134ebfc34 | 118 | * @code |
Nakor | 25:caf134ebfc34 | 119 | * // (sourceX, sourceY, destinationX, destinationY, width, height) |
Nakor | 25:caf134ebfc34 | 120 | * SGC.blockCopyPaste(0, 0, 25, 5, 10, 10); |
Nakor | 25:caf134ebfc34 | 121 | * @endcode |
Nakor | 1:476dcc382de3 | 122 | */ |
Nakor | 0:4f009971ac11 | 123 | bool blockCopyPaste(char sourceX, char sourceY, char destinationX, char destinationY, char width, char height); |
Nakor | 17:cee1c66b3133 | 124 | |
Nakor | 31:7ad5bf258a1e | 125 | /** Save a specified block of the screen to the uSD. |
Nakor | 31:7ad5bf258a1e | 126 | * |
Nakor | 31:7ad5bf258a1e | 127 | * @param x Top left horizontal start position of screen area to be copied. |
Nakor | 31:7ad5bf258a1e | 128 | * @param y Top left vertical start position of screen area to be copied. |
Nakor | 31:7ad5bf258a1e | 129 | * @param width Width of screen area to be copied. |
Nakor | 31:7ad5bf258a1e | 130 | * @param height Height of screen area to be copied. |
Nakor | 31:7ad5bf258a1e | 131 | * @param sectorHi High sector address. |
Nakor | 31:7ad5bf258a1e | 132 | * @param sectorMid Mid sector address. |
Nakor | 31:7ad5bf258a1e | 133 | * @param sectorLow Low sector address. |
Nakor | 31:7ad5bf258a1e | 134 | * |
Nakor | 31:7ad5bf258a1e | 135 | * Example: |
Nakor | 31:7ad5bf258a1e | 136 | * @code |
Nakor | 31:7ad5bf258a1e | 137 | * // Save a block of the screen from (0x, 0y) to (20x, 20y) and save it on the uSD |
Nakor | 31:7ad5bf258a1e | 138 | * // at (0x00, 0x10, 0x66) |
Nakor | 31:7ad5bf258a1e | 139 | * // (x, y, width, height, sectorHi, sectorMid, sectorLow) |
Nakor | 31:7ad5bf258a1e | 140 | * SGC.screenCopy(0, 0, 20, 20, 0x00, 0x10, 0x66); |
Nakor | 31:7ad5bf258a1e | 141 | * @endcode |
Nakor | 31:7ad5bf258a1e | 142 | */ |
Nakor | 31:7ad5bf258a1e | 143 | bool screenCopy(char x, char y, char width, char height, char sectorHi, char sectorMid, char sectorLow); |
Nakor | 31:7ad5bf258a1e | 144 | |
Nakor | 31:7ad5bf258a1e | 145 | |
Nakor | 17:cee1c66b3133 | 146 | /** Display control. |
Nakor | 17:cee1c66b3133 | 147 | * |
Nakor | 19:cc4f5d01f080 | 148 | * Display ON/OFF, set contrast, and PowerUp/Shutdown. |
Nakor | 17:cee1c66b3133 | 149 | * |
Nakor | 17:cee1c66b3133 | 150 | * @param mode Sets specified mode. |
Nakor | 17:cee1c66b3133 | 151 | * @param value Value option for mode. |
Nakor | 17:cee1c66b3133 | 152 | * |
Nakor | 18:77ec40174c31 | 153 | * - Mode: 01 Display ON/OFF |
Nakor | 18:77ec40174c31 | 154 | * - Value: 00 OFF |
Nakor | 18:77ec40174c31 | 155 | * - Value: 01 ON |
Nakor | 18:77ec40174c31 | 156 | * - Mode: 02 Contrast Adjust |
Nakor | 18:77ec40174c31 | 157 | * - Value range: 0x00 to 0x0F |
Nakor | 18:77ec40174c31 | 158 | * - Mode: 03 Display PowerUp/Shutdown (low power mode) |
Nakor | 18:77ec40174c31 | 159 | * - Value 00 Shutdown |
Nakor | 18:77ec40174c31 | 160 | * - Value 01 Powerup |
Nakor | 25:caf134ebfc34 | 161 | * |
Nakor | 25:caf134ebfc34 | 162 | * Example: |
Nakor | 25:caf134ebfc34 | 163 | * @code |
Nakor | 25:caf134ebfc34 | 164 | * // Turn display ON. |
Nakor | 25:caf134ebfc34 | 165 | * SGC.displayControl(0x01, 0x01) |
Nakor | 25:caf134ebfc34 | 166 | * // Set contrast to medium. |
Nakor | 25:caf134ebfc34 | 167 | * SGC.displayControl(0x02, 0x08); |
Nakor | 25:caf134ebfc34 | 168 | * // Shutdown display. |
Nakor | 25:caf134ebfc34 | 169 | * SGC.displayControl(0x03, 0x00); |
Nakor | 25:caf134ebfc34 | 170 | * @endcode |
Nakor | 1:476dcc382de3 | 171 | */ |
Nakor | 17:cee1c66b3133 | 172 | bool displayControl(char mode, char value); |
Nakor | 17:cee1c66b3133 | 173 | |
Nakor | 25:caf134ebfc34 | 174 | /** Draw previously defined user bitmap character at specified location (and colour). |
Nakor | 19:cc4f5d01f080 | 175 | * |
Nakor | 25:caf134ebfc34 | 176 | * @param character Character index of previously defined bitmap character. Range is 0 to 31 (0x00 to 0x1F). 32 8x8 characters. |
Nakor | 25:caf134ebfc34 | 177 | * @param x Horizontal display position of character. |
Nakor | 25:caf134ebfc34 | 178 | * @param y Vertical display position of character. |
Nakor | 25:caf134ebfc34 | 179 | * @param red Amount of red. |
Nakor | 25:caf134ebfc34 | 180 | * @param green Amount of green. |
Nakor | 25:caf134ebfc34 | 181 | * @param blue Amount of blue. |
Nakor | 26:5a2128799f60 | 182 | * |
Nakor | 26:5a2128799f60 | 183 | * Example: |
Nakor | 26:5a2128799f60 | 184 | * @code |
Nakor | 26:5a2128799f60 | 185 | * // Display bitmapped character stored in index 01, at location (0x,0y), and colour it red. |
Nakor | 26:5a2128799f60 | 186 | * // (characterIndex, x, y, red, green, blue) |
Nakor | 26:5a2128799f60 | 187 | * SGC.displayUserBitmappedCharacter(0x01, 0x00, 0x00, 0xFF, 0x00, 0x00); |
Nakor | 26:5a2128799f60 | 188 | * @endcode |
Nakor | 1:476dcc382de3 | 189 | */ |
Nakor | 25:caf134ebfc34 | 190 | bool displayUserBitmappedCharacter(char character, char x, char y, short red, short green, short blue); |
Nakor | 19:cc4f5d01f080 | 191 | |
Nakor | 19:cc4f5d01f080 | 192 | /** Draw a circle. |
Nakor | 19:cc4f5d01f080 | 193 | * |
Nakor | 19:cc4f5d01f080 | 194 | * @param x X position of circle center. |
Nakor | 19:cc4f5d01f080 | 195 | * @param y Y position of circle center. |
Nakor | 19:cc4f5d01f080 | 196 | * @param radius Radius of the circle. |
Nakor | 19:cc4f5d01f080 | 197 | * @param red Amount of red. |
Nakor | 19:cc4f5d01f080 | 198 | * @param green Amount of green. |
Nakor | 19:cc4f5d01f080 | 199 | * @param blue Amount of blue. |
Nakor | 26:5a2128799f60 | 200 | * |
Nakor | 26:5a2128799f60 | 201 | * Example: |
Nakor | 26:5a2128799f60 | 202 | * @code |
Nakor | 26:5a2128799f60 | 203 | * // Draw a circle centered at (63x, 63y) with a radius of 34 and colour it green. |
Nakor | 26:5a2128799f60 | 204 | * // (x, y, radius, red, green, blue) |
Nakor | 26:5a2128799f60 | 205 | * SGC.drawCircle(0x3F, 0x3F, 0x22, 0x00, 0xFF, 0x00); |
Nakor | 26:5a2128799f60 | 206 | * @endcode |
Nakor | 1:476dcc382de3 | 207 | */ |
Nakor | 19:cc4f5d01f080 | 208 | bool drawCircle(char x, char y, char radius, short red, short green, short blue); |
Nakor | 19:cc4f5d01f080 | 209 | |
Nakor | 25:caf134ebfc34 | 210 | /** Draw ASCII character (text format) |
Nakor | 19:cc4f5d01f080 | 211 | * |
Nakor | 25:caf134ebfc34 | 212 | * @param character Inbuilt standard ASCII character. Range 32 to 127 (0x20 to 0x7F). |
Nakor | 25:caf134ebfc34 | 213 | * @param column Horizontal position of character. |
Nakor | 25:caf134ebfc34 | 214 | * - range: 0-20 for 5x7 font. |
Nakor | 25:caf134ebfc34 | 215 | * - range: 0-15 for 8x8 and 8x12 fonts. |
Nakor | 25:caf134ebfc34 | 216 | * @param row Vertical position of character. |
Nakor | 25:caf134ebfc34 | 217 | * @param red Amount of red. |
Nakor | 25:caf134ebfc34 | 218 | * @param green Amount of green. |
Nakor | 25:caf134ebfc34 | 219 | * @param blue Amount of blue. |
Nakor | 26:5a2128799f60 | 220 | * |
Nakor | 26:5a2128799f60 | 221 | * Example: |
Nakor | 26:5a2128799f60 | 222 | * @code |
Nakor | 26:5a2128799f60 | 223 | * // Draw character 'A' at column 0, row 0. Colour it white. |
Nakor | 26:5a2128799f60 | 224 | * // (character, column, row, red, green, blue) |
Nakor | 26:5a2128799f60 | 225 | * SGC.drawCharacter(0x41, 0x00, 0x00, 0xFF, 0xFF, 0xFF); |
Nakor | 26:5a2128799f60 | 226 | * @endcode |
Nakor | 1:476dcc382de3 | 227 | */ |
Nakor | 25:caf134ebfc34 | 228 | bool drawCharacter(char character, char column, char row, short red, short green, short blue); |
Nakor | 19:cc4f5d01f080 | 229 | |
Nakor | 25:caf134ebfc34 | 230 | /** Display a bitmap image on the screen at specified location and size. |
Nakor | 19:cc4f5d01f080 | 231 | * |
Nakor | 25:caf134ebfc34 | 232 | * @param x Image horizontal start position (top left). |
Nakor | 25:caf134ebfc34 | 233 | * @param y Image vertical start position (top left). |
Nakor | 25:caf134ebfc34 | 234 | * @param width Horizontal size of the image. |
Nakor | 25:caf134ebfc34 | 235 | * @param height Vertical size of the image. |
Nakor | 25:caf134ebfc34 | 236 | * @param colorMode Colour mode to use for the image. |
Nakor | 25:caf134ebfc34 | 237 | * - 0x08 = 256 colour mode (8bits/1byte per pixel) |
Nakor | 25:caf134ebfc34 | 238 | * - 0x10 = 65K colour mode (16bits/2bytes per pixel) |
Nakor | 25:caf134ebfc34 | 239 | * @param *pixels Image pixel data. |
Nakor | 25:caf134ebfc34 | 240 | * - Colour Mode 0x08 (256 colour mode): Number of pixels = width x height |
Nakor | 25:caf134ebfc34 | 241 | * - Colour Mode 0x10 (65K colour mode): Number of pixels = 2 x width x height |
Nakor | 1:476dcc382de3 | 242 | */ |
Nakor | 0:4f009971ac11 | 243 | bool drawImage(char x, char y, char width, char height, char colorMode, char *pixels); |
Nakor | 19:cc4f5d01f080 | 244 | |
Nakor | 30:41a872ad6155 | 245 | /** Load an image from the uSD and display on the screen at specified location and size. |
Nakor | 30:41a872ad6155 | 246 | * |
Nakor | 30:41a872ad6155 | 247 | * @param x Image horizontal start position (top left). |
Nakor | 30:41a872ad6155 | 248 | * @param y Image vertical start position (top left). |
Nakor | 30:41a872ad6155 | 249 | * @param width Horizontal size of the image. |
Nakor | 30:41a872ad6155 | 250 | * @param height Vertical size of the image. |
Nakor | 30:41a872ad6155 | 251 | * @param colorMode Colour mode to use for the image. |
Nakor | 30:41a872ad6155 | 252 | * - 0x08 = 256 colour mode (8bits/1byte per pixel) |
Nakor | 30:41a872ad6155 | 253 | * - 0x10 = 65K colour mode (16bits/2bytes per pixel) |
Nakor | 30:41a872ad6155 | 254 | * @param sectorHi High sector address. |
Nakor | 30:41a872ad6155 | 255 | * @param sectorMid Mid sector address. |
Nakor | 30:41a872ad6155 | 256 | * @param sectorLow Low sector address. |
Nakor | 30:41a872ad6155 | 257 | */ |
Nakor | 30:41a872ad6155 | 258 | bool drawImageSD_16bit(char x, char y, char width, char height, char colourMode, char sectorHi, char sectorMid, char sectorLow); |
Nakor | 30:41a872ad6155 | 259 | |
Nakor | 30:41a872ad6155 | 260 | |
Nakor | 19:cc4f5d01f080 | 261 | /** Draw a line. |
Nakor | 19:cc4f5d01f080 | 262 | * |
Nakor | 19:cc4f5d01f080 | 263 | * @param x1 Top left horizontal start position. |
Nakor | 19:cc4f5d01f080 | 264 | * @param y1 Top left vertical start position. |
Nakor | 19:cc4f5d01f080 | 265 | * @param x2 Bottom right horizontal start position. |
Nakor | 19:cc4f5d01f080 | 266 | * @param y2 Bottom right vertical end position. |
Nakor | 19:cc4f5d01f080 | 267 | * @param red Amount of red. |
Nakor | 19:cc4f5d01f080 | 268 | * @param green Amount of green. |
Nakor | 19:cc4f5d01f080 | 269 | * @param blue Amount of blue. |
Nakor | 26:5a2128799f60 | 270 | * |
Nakor | 26:5a2128799f60 | 271 | * Example: |
Nakor | 26:5a2128799f60 | 272 | * @code |
Nakor | 26:5a2128799f60 | 273 | * // Draw a line starting at (0x, 0y) and ending at (43x, 43y). Colour it blue. |
Nakor | 26:5a2128799f60 | 274 | * // (x1, y1, x2, y2, red, green, blue) |
Nakor | 26:5a2128799f60 | 275 | * SGC.drawLine(0x00, 0x00, 0x2B, 0x2B, 0x00, 0x00, 0xFF); |
Nakor | 26:5a2128799f60 | 276 | * @endcode |
Nakor | 1:476dcc382de3 | 277 | */ |
Nakor | 19:cc4f5d01f080 | 278 | bool drawLine(char x1, char y1, char x2, char y2, short red, short green, short blue); |
Nakor | 19:cc4f5d01f080 | 279 | |
Nakor | 25:caf134ebfc34 | 280 | /** Draw a polygon (user defined shape) to the screen. |
Nakor | 21:87a2227c1ad2 | 281 | * |
Nakor | 25:caf134ebfc34 | 282 | * @param vertices Number of vertices from 3 to 7. |
Nakor | 25:caf134ebfc34 | 283 | * @param *x Array of vertices' X coordinates. |
Nakor | 25:caf134ebfc34 | 284 | * @param *y Array of vertices' Y coordinates. |
Nakor | 25:caf134ebfc34 | 285 | * @param red Amount of red. |
Nakor | 25:caf134ebfc34 | 286 | * @param green Amount of green. |
Nakor | 25:caf134ebfc34 | 287 | * @param blue Amount of blue. |
Nakor | 26:5a2128799f60 | 288 | * |
Nakor | 26:5a2128799f60 | 289 | * Example: |
Nakor | 26:5a2128799f60 | 290 | * @code |
Nakor | 29:757036aa73cd | 291 | * char x[5] = {0, 18, 26, 44, 54}; |
Nakor | 29:757036aa73cd | 292 | * char y[5] = {10, 25, 33, 22, 36}; |
Nakor | 29:757036aa73cd | 293 | * // Draw a white polygon with 5 vertices located at: |
Nakor | 29:757036aa73cd | 294 | * // (0x, 10y), (18x, 25y), (26x, 33y), (44x, 22y), (54x, 36y) |
Nakor | 26:5a2128799f60 | 295 | * // (vertices, *x, *y, red, green, blue) |
Nakor | 29:757036aa73cd | 296 | * SGC.drawPolygon(5, x, y, 255, 255, 255); |
Nakor | 26:5a2128799f60 | 297 | * @endcode |
Nakor | 1:476dcc382de3 | 298 | */ |
Nakor | 25:caf134ebfc34 | 299 | bool drawPolygon(char vertices, char *x, char *y, short red, short green, short blue); |
Nakor | 21:87a2227c1ad2 | 300 | |
Nakor | 21:87a2227c1ad2 | 301 | /** Draw a rectangle. |
Nakor | 21:87a2227c1ad2 | 302 | * |
Nakor | 21:87a2227c1ad2 | 303 | * @param x Top left horizontal start position. |
Nakor | 21:87a2227c1ad2 | 304 | * @param y Top left vertical start position. |
Nakor | 21:87a2227c1ad2 | 305 | * @param width Bottom right horizontal end position. |
Nakor | 21:87a2227c1ad2 | 306 | * @param height Bottom right vertical end position. |
Nakor | 21:87a2227c1ad2 | 307 | * @param red Amount of red. |
Nakor | 21:87a2227c1ad2 | 308 | * @param green Amount of green. |
Nakor | 21:87a2227c1ad2 | 309 | * @param blue Amount of blue. |
Nakor | 26:5a2128799f60 | 310 | * |
Nakor | 26:5a2128799f60 | 311 | * Example: |
Nakor | 26:5a2128799f60 | 312 | * @code |
Nakor | 26:5a2128799f60 | 313 | * // Draw rectangle starting at (0x, 0y) and ending at (40x, 40y). Colour red. |
Nakor | 26:5a2128799f60 | 314 | * // (x, y, width, height, red, green, blue) |
Nakor | 26:5a2128799f60 | 315 | * SGC.drawRectangle(0, 0, 40, 40, 255, 0, 0); |
Nakor | 26:5a2128799f60 | 316 | * @endcode |
Nakor | 1:476dcc382de3 | 317 | */ |
Nakor | 21:87a2227c1ad2 | 318 | bool drawRectangle(char x, char y, char width, char height, short red, short green, short blue); |
Nakor | 21:87a2227c1ad2 | 319 | |
Nakor | 5:93ea03e2a688 | 320 | /** Draw text to the screen. |
Nakor | 5:93ea03e2a688 | 321 | * |
Nakor | 5:93ea03e2a688 | 322 | * @param column X coordinate for text placement. |
Nakor | 5:93ea03e2a688 | 323 | * @param row Y coordinate for text placement. |
Nakor | 5:93ea03e2a688 | 324 | * @param font Which font to use (Uses 0, 1, or 2). More fonts can be added. |
Nakor | 5:93ea03e2a688 | 325 | * @param color Font colour to use. |
Nakor | 5:93ea03e2a688 | 326 | * @param *text Character array (string) to be displayed. |
Nakor | 5:93ea03e2a688 | 327 | * |
Nakor | 5:93ea03e2a688 | 328 | * Example: |
Nakor | 5:93ea03e2a688 | 329 | * @code |
Nakor | 26:5a2128799f60 | 330 | * // Draw string "This is text" at (0, 0) with font set 0, coloured white. |
Nakor | 26:5a2128799f60 | 331 | * // (column, row, font, red, green, blue, "text") |
Nakor | 29:757036aa73cd | 332 | * SGC.drawText(0, 0, 0, 0xFF, 0xFF, 0xFF, "This is text"); |
Nakor | 5:93ea03e2a688 | 333 | * @endcode |
Nakor | 1:476dcc382de3 | 334 | */ |
Nakor | 21:87a2227c1ad2 | 335 | bool drawText(char column, char row, char font, short red, short green, short blue, char *text); |
Nakor | 21:87a2227c1ad2 | 336 | |
Nakor | 14:3d90211095d4 | 337 | /** Draw unformated text to the screen. |
Nakor | 14:3d90211095d4 | 338 | * The manual describes this as "graphics format". |
Nakor | 14:3d90211095d4 | 339 | * |
Nakor | 14:3d90211095d4 | 340 | * @param x X coordinate for text placement. |
Nakor | 14:3d90211095d4 | 341 | * @param y Y coordinate for text placement. |
Nakor | 14:3d90211095d4 | 342 | * @param font Which font to use (Uses 0, 1, or 2). More fonts can be added. |
Nakor | 14:3d90211095d4 | 343 | * @param red Amount of red in text colour RGB value. |
Nakor | 14:3d90211095d4 | 344 | * @param green Amount of green in text colour RGB value. |
Nakor | 14:3d90211095d4 | 345 | * @param blue Amount of blue in text colour RGB value. |
Nakor | 14:3d90211095d4 | 346 | * @param width Text width. |
Nakor | 14:3d90211095d4 | 347 | * @param height Text height. |
Nakor | 14:3d90211095d4 | 348 | * @param *text Character array (string) to be displayed. |
Nakor | 14:3d90211095d4 | 349 | * |
Nakor | 14:3d90211095d4 | 350 | * Example: |
Nakor | 14:3d90211095d4 | 351 | * @code |
Nakor | 26:5a2128799f60 | 352 | * // Draw unformatted text string "This is text" at (0, 0) with font set 0, coloured white with zero (1x) magnification. |
Nakor | 26:5a2128799f60 | 353 | * SGC.drawTextUF(0, 0, 0, 255, 255, 255, 1, 1, "This is text"); |
Nakor | 14:3d90211095d4 | 354 | * @endcode |
Nakor | 14:3d90211095d4 | 355 | */ |
Nakor | 15:06ef508fef4b | 356 | bool drawTextUF(char x, char y, char font, short red, short green, short blue, char width, char height, char *text); |
Nakor | 21:87a2227c1ad2 | 357 | |
Nakor | 21:87a2227c1ad2 | 358 | /** Draw a triangle. |
Nakor | 21:87a2227c1ad2 | 359 | * |
Nakor | 21:87a2227c1ad2 | 360 | * Vertices must be defined counter clockwise. |
Nakor | 21:87a2227c1ad2 | 361 | * |
Nakor | 21:87a2227c1ad2 | 362 | * @param x1 Vertice 1 X coordinate. |
Nakor | 21:87a2227c1ad2 | 363 | * @param y1 Vertice 1 Y coordinate. |
Nakor | 21:87a2227c1ad2 | 364 | * @param x2 Vertice 2 X coordinate. |
Nakor | 21:87a2227c1ad2 | 365 | * @param y2 Vertice 2 Y coordinate. |
Nakor | 21:87a2227c1ad2 | 366 | * @param x3 Vertice 3 X coordinate. |
Nakor | 21:87a2227c1ad2 | 367 | * @param y3 Vertice 3 Y coordinate. |
Nakor | 21:87a2227c1ad2 | 368 | * @param red Amount of red. |
Nakor | 21:87a2227c1ad2 | 369 | * @param blue Amount of blue. |
Nakor | 21:87a2227c1ad2 | 370 | * @param green Amount of green. |
Nakor | 26:5a2128799f60 | 371 | * |
Nakor | 26:5a2128799f60 | 372 | * Example: |
Nakor | 26:5a2128799f60 | 373 | * @code |
Nakor | 26:5a2128799f60 | 374 | * // Draw a red triangle with vertices: |
Nakor | 29:757036aa73cd | 375 | * // (0x, 0y), (0x, 40y), (40x, 0y) |
Nakor | 26:5a2128799f60 | 376 | * // (x1, y1, x2, y2, x3, y3, red, green, blue) |
Nakor | 29:757036aa73cd | 377 | * SGC.drawTriangle(0, 0, 0, 40, 40, 0, 255, 0, 0); |
Nakor | 26:5a2128799f60 | 378 | * @endcode |
Nakor | 6:080d52539972 | 379 | */ |
Nakor | 21:87a2227c1ad2 | 380 | bool drawTriangle(char x1, char y1, char x2, char y2, char x3, char y3, short red, short green, short blue); |
Nakor | 21:87a2227c1ad2 | 381 | |
Nakor | 21:87a2227c1ad2 | 382 | /** Clear the screen. |
Nakor | 21:87a2227c1ad2 | 383 | * |
Nakor | 21:87a2227c1ad2 | 384 | * Remove everything except the background colour. |
Nakor | 21:87a2227c1ad2 | 385 | * |
Nakor | 21:87a2227c1ad2 | 386 | * @param returns success or failure. |
Nakor | 26:5a2128799f60 | 387 | * |
Nakor | 26:5a2128799f60 | 388 | * Example: |
Nakor | 26:5a2128799f60 | 389 | * @code |
Nakor | 26:5a2128799f60 | 390 | * // Do you really need an example? :) |
Nakor | 26:5a2128799f60 | 391 | * SGC.eraseScreen(); |
Nakor | 26:5a2128799f60 | 392 | * @endcode |
Nakor | 1:476dcc382de3 | 393 | */ |
Nakor | 0:4f009971ac11 | 394 | bool eraseScreen(); |
Nakor | 21:87a2227c1ad2 | 395 | |
Nakor | 0:4f009971ac11 | 396 | /** Initialize the screen. This must be completed before any other communication with the device. |
Nakor | 21:87a2227c1ad2 | 397 | * |
Nakor | 0:4f009971ac11 | 398 | * Timing allows for at least 500ms delay for initialization. |
Nakor | 21:87a2227c1ad2 | 399 | * |
Nakor | 2:559b81f2bb1e | 400 | * @param returns bool indicating success or failure of initialization. |
Nakor | 26:5a2128799f60 | 401 | * |
Nakor | 26:5a2128799f60 | 402 | * Example: |
Nakor | 26:5a2128799f60 | 403 | * @code |
Nakor | 26:5a2128799f60 | 404 | * // Must be done before anything else |
Nakor | 26:5a2128799f60 | 405 | * SGC.init(); |
Nakor | 26:5a2128799f60 | 406 | * @endcode |
Nakor | 0:4f009971ac11 | 407 | */ |
Nakor | 0:4f009971ac11 | 408 | bool init(); |
Nakor | 21:87a2227c1ad2 | 409 | |
Nakor | 21:87a2227c1ad2 | 410 | /** Set pen size. |
Nakor | 21:87a2227c1ad2 | 411 | * |
Nakor | 21:87a2227c1ad2 | 412 | * Sets if objects should be drawn solid or wire frame. |
Nakor | 21:87a2227c1ad2 | 413 | * Does not apply to polygon function. |
Nakor | 21:87a2227c1ad2 | 414 | * |
Nakor | 21:87a2227c1ad2 | 415 | * @param size Sets solid or wire frame. |
Nakor | 21:87a2227c1ad2 | 416 | * - 0x00 = Solid |
Nakor | 21:87a2227c1ad2 | 417 | * - 0x01 = Wire frame. |
Nakor | 26:5a2128799f60 | 418 | * |
Nakor | 26:5a2128799f60 | 419 | * Example: |
Nakor | 26:5a2128799f60 | 420 | * @code |
Nakor | 26:5a2128799f60 | 421 | * // Draw objects solid |
Nakor | 26:5a2128799f60 | 422 | * SGC.penSize(0); |
Nakor | 26:5a2128799f60 | 423 | * // Draw objects wire frame |
Nakor | 26:5a2128799f60 | 424 | * SGC.penSize(1); |
Nakor | 26:5a2128799f60 | 425 | * @endcode |
Nakor | 1:476dcc382de3 | 426 | */ |
Nakor | 0:4f009971ac11 | 427 | bool penSize(char size); |
Nakor | 21:87a2227c1ad2 | 428 | |
Nakor | 22:66401b612b1b | 429 | /** Draw a coloured pixel at designated position. |
Nakor | 22:66401b612b1b | 430 | * |
Nakor | 22:66401b612b1b | 431 | * @param x Horizontal position of pixel. |
Nakor | 22:66401b612b1b | 432 | * @param y Vertical position of pixel. |
Nakor | 22:66401b612b1b | 433 | * @param red Amount of red. |
Nakor | 22:66401b612b1b | 434 | * @param green Amount of green. |
Nakor | 22:66401b612b1b | 435 | * @param blue Amount of blue. |
Nakor | 26:5a2128799f60 | 436 | * |
Nakor | 26:5a2128799f60 | 437 | * Example: |
Nakor | 26:5a2128799f60 | 438 | * @code |
Nakor | 29:757036aa73cd | 439 | * // Draw a blue pixel at (10x, 10y). |
Nakor | 26:5a2128799f60 | 440 | * // (x, y, red, green, blue) |
Nakor | 26:5a2128799f60 | 441 | * SGC.putPixel(10, 10, 0, 0, 255); |
Nakor | 26:5a2128799f60 | 442 | * @endcode |
Nakor | 1:476dcc382de3 | 443 | */ |
Nakor | 22:66401b612b1b | 444 | bool putPixel(char x, char y, short red, short green, short blue); |
Nakor | 22:66401b612b1b | 445 | |
Nakor | 22:66401b612b1b | 446 | /** Read the colour of a specified pixel. |
Nakor | 22:66401b612b1b | 447 | * |
Nakor | 22:66401b612b1b | 448 | * @param x X coordinate. |
Nakor | 22:66401b612b1b | 449 | * @param y Y coordinate. |
Nakor | 22:66401b612b1b | 450 | * @param returns 2 byte pixel colour in RGB format. |
Nakor | 22:66401b612b1b | 451 | * - MSB: R4R3R2R1R0G5G4G3 |
Nakor | 22:66401b612b1b | 452 | * - LSB: G2G1G0B4B3B2B1B0 |
Nakor | 26:5a2128799f60 | 453 | * |
Nakor | 26:5a2128799f60 | 454 | * Example: |
Nakor | 26:5a2128799f60 | 455 | * @code |
Nakor | 26:5a2128799f60 | 456 | * // Read pixel colour at location (20x, 20y). |
Nakor | 26:5a2128799f60 | 457 | * short pixelColour = SGC.readPixel(20, 20); |
Nakor | 26:5a2128799f60 | 458 | * @endcode |
Nakor | 1:476dcc382de3 | 459 | */ |
Nakor | 0:4f009971ac11 | 460 | short readPixel(char x, char y); |
Nakor | 22:66401b612b1b | 461 | |
Nakor | 7:c2fa784eb477 | 462 | /** Replaces the background colour with a new colour. |
Nakor | 7:c2fa784eb477 | 463 | * |
Nakor | 26:5a2128799f60 | 464 | * Most functions call this internally. |
Nakor | 26:5a2128799f60 | 465 | * |
Nakor | 13:f2b9f249bcff | 466 | * @param red Red value (0 to 255). |
Nakor | 13:f2b9f249bcff | 467 | * @param green Green value (0 to 255). |
Nakor | 13:f2b9f249bcff | 468 | * @param blue Blue value (0 to 255). |
Nakor | 26:5a2128799f60 | 469 | * |
Nakor | 26:5a2128799f60 | 470 | * Example: |
Nakor | 26:5a2128799f60 | 471 | * @code |
Nakor | 26:5a2128799f60 | 472 | * // Set background colour to red. |
Nakor | 26:5a2128799f60 | 473 | * // (red, green, blue) |
Nakor | 26:5a2128799f60 | 474 | * SGC.setBackgroundColour(255, 0, 0); |
Nakor | 26:5a2128799f60 | 475 | * @endcode |
Nakor | 7:c2fa784eb477 | 476 | */ |
Nakor | 13:f2b9f249bcff | 477 | bool setBackgroundColour(char red, char green, char blue); |
Nakor | 22:66401b612b1b | 478 | |
Nakor | 22:66401b612b1b | 479 | /** Set font (for future text). |
Nakor | 22:66401b612b1b | 480 | * |
Nakor | 22:66401b612b1b | 481 | * 3 default fonts are supplied. Further font sets can be added. |
Nakor | 22:66401b612b1b | 482 | * |
Nakor | 22:66401b612b1b | 483 | * @param font Font selection. Either a default or otherwise. |
Nakor | 22:66401b612b1b | 484 | * - DEFAULT: 0x00 = 5x7 small size font set |
Nakor | 22:66401b612b1b | 485 | * - DEFAULT: 0x01 = 8x8 medium size font set |
Nakor | 22:66401b612b1b | 486 | * - DEFAULT: 0x02 = 8x12 large size font set |
Nakor | 26:5a2128799f60 | 487 | * |
Nakor | 26:5a2128799f60 | 488 | * Example: |
Nakor | 26:5a2128799f60 | 489 | * @code |
Nakor | 26:5a2128799f60 | 490 | * // Use default 5x7 font set |
Nakor | 26:5a2128799f60 | 491 | * SGC.setFont(0); |
Nakor | 26:5a2128799f60 | 492 | * // Use default 8x12 font set |
Nakor | 26:5a2128799f60 | 493 | * SGC.setFont(2); |
Nakor | 26:5a2128799f60 | 494 | * @endcode |
Nakor | 7:c2fa784eb477 | 495 | */ |
Nakor | 22:66401b612b1b | 496 | bool setFont(char font); |
Nakor | 22:66401b612b1b | 497 | |
Nakor | 22:66401b612b1b | 498 | /** Draw a text button to the screen. |
Nakor | 22:66401b612b1b | 499 | * |
Nakor | 22:66401b612b1b | 500 | * @param state Button down (0x00) or button up (0x01). |
Nakor | 22:66401b612b1b | 501 | * @param x Top left horizontal start position. |
Nakor | 22:66401b612b1b | 502 | * @param y Top left vertical start position. |
Nakor | 22:66401b612b1b | 503 | * @param red Amount of red (for button not text). |
Nakor | 22:66401b612b1b | 504 | * @param green Amount of green (for button not text). |
Nakor | 22:66401b612b1b | 505 | * @param blue Amount of blue (for button not text). |
Nakor | 22:66401b612b1b | 506 | * @param font Set which font set to use for the button. 3 default font sets are supplied and more can be added. |
Nakor | 22:66401b612b1b | 507 | * - DEFAULT: 0x00 = 5x7 small size font set |
Nakor | 22:66401b612b1b | 508 | * - DEFAULT: 0x01 = 8x8 medium size font set |
Nakor | 22:66401b612b1b | 509 | * - DEFAULT: 0x02 = 8x12 large size font set |
Nakor | 22:66401b612b1b | 510 | * @param textRed Amount of red for text. |
Nakor | 22:66401b612b1b | 511 | * @param textGreen Amount of green for text. |
Nakor | 22:66401b612b1b | 512 | * @param textBlue Amount of blue for text. |
Nakor | 22:66401b612b1b | 513 | * @param textWidth Width of characters (text). Affect total width of string and button. |
Nakor | 22:66401b612b1b | 514 | * @param textHeight Height of characters (text). Affects total height of string and button. |
Nakor | 22:66401b612b1b | 515 | * @param *text Character array (string) to display in the button. |
Nakor | 26:5a2128799f60 | 516 | * |
Nakor | 26:5a2128799f60 | 517 | * Example: |
Nakor | 26:5a2128799f60 | 518 | * @code |
Nakor | 26:5a2128799f60 | 519 | * // Draw a text button in the unpressed state starting at (0x, 0y). |
Nakor | 26:5a2128799f60 | 520 | * // Button colour is red, text colour is white. Text magnification is zero (1x). |
Nakor | 26:5a2128799f60 | 521 | * // (state, x, y, red, green, blue, font, textRed, textGreen, textBlue, textWidth, textHeight, "Text"); |
Nakor | 26:5a2128799f60 | 522 | * SGC.textButton(1, 0, 0, 255, 0, 0, 0, 255, 255, 255, 1, 1, "Button text"); |
Nakor | 26:5a2128799f60 | 523 | * @endcode |
Nakor | 1:476dcc382de3 | 524 | */ |
Nakor | 22:66401b612b1b | 525 | 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); |
Nakor | 22:66401b612b1b | 526 | |
Nakor | 23:dd9a280c8be5 | 527 | /** Set text mode (transparent or opaque). |
Nakor | 23:dd9a280c8be5 | 528 | * |
Nakor | 23:dd9a280c8be5 | 529 | * Opaque text has a rectangle drawn behind it (blocking out what is under it) and transparent text does not. |
Nakor | 23:dd9a280c8be5 | 530 | * |
Nakor | 23:dd9a280c8be5 | 531 | * @param mode Set text to transparent (0x00) or opaque (0x01). |
Nakor | 26:5a2128799f60 | 532 | * |
Nakor | 26:5a2128799f60 | 533 | * Example: |
Nakor | 26:5a2128799f60 | 534 | * @code |
Nakor | 26:5a2128799f60 | 535 | * // Set text mode to transparent. |
Nakor | 26:5a2128799f60 | 536 | * SGC.textMode(0); |
Nakor | 26:5a2128799f60 | 537 | * @endcode |
Nakor | 1:476dcc382de3 | 538 | */ |
Nakor | 0:4f009971ac11 | 539 | bool textMode(char mode); |
Nakor | 23:dd9a280c8be5 | 540 | |
Nakor | 23:dd9a280c8be5 | 541 | /** Retrieve current version info of the device. |
Nakor | 23:dd9a280c8be5 | 542 | * |
Nakor | 23:dd9a280c8be5 | 543 | * Response: |
Nakor | 23:dd9a280c8be5 | 544 | * |
Nakor | 23:dd9a280c8be5 | 545 | * device_type Indicates device type. |
Nakor | 23:dd9a280c8be5 | 546 | * - 0x00 = micro-OLED |
Nakor | 23:dd9a280c8be5 | 547 | * - 0x01 = micro-LCD |
Nakor | 23:dd9a280c8be5 | 548 | * - 0x02 = micro-VGA |
Nakor | 24:22c2d08f111d | 549 | * |
Nakor | 23:dd9a280c8be5 | 550 | * hardware_rev Indicates device hardware version. |
Nakor | 24:22c2d08f111d | 551 | * |
Nakor | 23:dd9a280c8be5 | 552 | * firmware_rev Indicates device firmware version. |
Nakor | 24:22c2d08f111d | 553 | * |
Nakor | 23:dd9a280c8be5 | 554 | * horizontal_res Indicates the horizontal resolution of the display. |
Nakor | 23:dd9a280c8be5 | 555 | * - 0x22 = 220 pixels |
Nakor | 23:dd9a280c8be5 | 556 | * - 0x28 = 128 pixels |
Nakor | 23:dd9a280c8be5 | 557 | * - 0x32 = 320 pixels |
Nakor | 23:dd9a280c8be5 | 558 | * - 0x60 = 160 pixels |
Nakor | 23:dd9a280c8be5 | 559 | * - 0x64 = 64 pixels |
Nakor | 23:dd9a280c8be5 | 560 | * - 0x76 = 176 pixels |
Nakor | 23:dd9a280c8be5 | 561 | * - 0x96 = 96 pixels |
Nakor | 24:22c2d08f111d | 562 | * |
Nakor | 23:dd9a280c8be5 | 563 | * vertical_res Indicates the vertical resolution of the display. |
Nakor | 23:dd9a280c8be5 | 564 | * - See horizontal_res (identical). |
Nakor | 23:dd9a280c8be5 | 565 | * |
Nakor | 23:dd9a280c8be5 | 566 | * @param onScreen Set output option. |
Nakor | 23:dd9a280c8be5 | 567 | * - 0x00 = Output to serial port only. |
Nakor | 23:dd9a280c8be5 | 568 | * - 0x01 = Output to serial port and screen. |
Nakor | 23:dd9a280c8be5 | 569 | * @param *info Character array to store results. |
Nakor | 26:5a2128799f60 | 570 | * |
Nakor | 26:5a2128799f60 | 571 | * Example: |
Nakor | 26:5a2128799f60 | 572 | * @code |
Nakor | 26:5a2128799f60 | 573 | * // Request version info, pass in character array to store results. |
Nakor | 29:757036aa73cd | 574 | * char info[5]; |
Nakor | 26:5a2128799f60 | 575 | * SGC.versionInfo(1, info); |
Nakor | 29:757036aa73cd | 576 | * printf("\n\nVersion info:\n\n"); |
Nakor | 29:757036aa73cd | 577 | * for(int i = 0; i < 5; i++) |
Nakor | 29:757036aa73cd | 578 | * { |
Nakor | 29:757036aa73cd | 579 | * printf("0x%X\n", info[i]); |
Nakor | 29:757036aa73cd | 580 | * } |
Nakor | 26:5a2128799f60 | 581 | * @endcode |
Nakor | 1:476dcc382de3 | 582 | */ |
Nakor | 29:757036aa73cd | 583 | bool versionInfo(bool onScreen, char info[5]); |
Nakor | 0:4f009971ac11 | 584 | |
Nakor | 0:4f009971ac11 | 585 | |
Nakor | 0:4f009971ac11 | 586 | protected: |
Nakor | 0:4f009971ac11 | 587 | Serial _oled; |
Nakor | 0:4f009971ac11 | 588 | DigitalOut _reset; |
Nakor | 0:4f009971ac11 | 589 | |
Nakor | 0:4f009971ac11 | 590 | void resetDisplay(); |
Nakor | 8:0a92ceb34cd0 | 591 | }; |
Nakor | 8:0a92ceb34cd0 | 592 | |
Nakor | 8:0a92ceb34cd0 | 593 | #endif |