Driver for the Digole Serial universal LCD display adapter
DigoleSerialDisp.h@5:a78901fe6a7b, 2013-05-27 (annotated)
- Committer:
- shimniok
- Date:
- Mon May 27 13:25:12 2013 +0000
- Revision:
- 5:a78901fe6a7b
- Parent:
- 4:c4b2a8f0d056
Minor tweaks
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:3cf7c2683c3a | 1 | /** Digole Serial Display library, I2C |
shimniok | 0:3cf7c2683c3a | 2 | * |
shimniok | 4:c4b2a8f0d056 | 3 | * @Author: Digole Digital Solutions : www.digole.com ported from Arduino to mbed by Michael Shimniok www.bot-thoughts.com |
shimniok | 0:3cf7c2683c3a | 4 | */ |
shimniok | 0:3cf7c2683c3a | 5 | #ifndef DigoleSerialDisp_h |
shimniok | 0:3cf7c2683c3a | 6 | #define DigoleSerialDisp_h |
shimniok | 0:3cf7c2683c3a | 7 | |
shimniok | 0:3cf7c2683c3a | 8 | #include "mbed.h" |
shimniok | 0:3cf7c2683c3a | 9 | #include <inttypes.h> |
shimniok | 0:3cf7c2683c3a | 10 | |
shimniok | 0:3cf7c2683c3a | 11 | #define DEC 10 |
shimniok | 0:3cf7c2683c3a | 12 | #define HEX 16 |
shimniok | 0:3cf7c2683c3a | 13 | #define OCT 8 |
shimniok | 0:3cf7c2683c3a | 14 | #define BIN 2 |
shimniok | 0:3cf7c2683c3a | 15 | |
shimniok | 0:3cf7c2683c3a | 16 | #define delay(x) wait_ms(x) |
shimniok | 0:3cf7c2683c3a | 17 | |
shimniok | 0:3cf7c2683c3a | 18 | // Communication set up command |
shimniok | 0:3cf7c2683c3a | 19 | // Text function command |
shimniok | 0:3cf7c2683c3a | 20 | // Graph function command |
shimniok | 0:3cf7c2683c3a | 21 | |
shimniok | 0:3cf7c2683c3a | 22 | #define Serial_UART 0; |
shimniok | 0:3cf7c2683c3a | 23 | #define Serial_I2C 1; |
shimniok | 0:3cf7c2683c3a | 24 | #define Serial_SPI 2; |
shimniok | 0:3cf7c2683c3a | 25 | #define _TEXT_ 0 |
shimniok | 0:3cf7c2683c3a | 26 | #define _GRAPH_ 1 |
shimniok | 0:3cf7c2683c3a | 27 | |
shimniok | 0:3cf7c2683c3a | 28 | /** Digole Serial LCD/OLED Library |
shimniok | 4:c4b2a8f0d056 | 29 | * www.digole.com/index.php?productID=535 |
shimniok | 0:3cf7c2683c3a | 30 | * |
shimniok | 1:959715b1d042 | 31 | * Includes Arduino Print class member functions |
shimniok | 0:3cf7c2683c3a | 32 | */ |
shimniok | 0:3cf7c2683c3a | 33 | class DigoleSerialDisp { |
shimniok | 0:3cf7c2683c3a | 34 | public: |
shimniok | 0:3cf7c2683c3a | 35 | |
shimniok | 0:3cf7c2683c3a | 36 | /** Create a new Digole Serial Display interface |
shimniok | 0:3cf7c2683c3a | 37 | * |
shimniok | 1:959715b1d042 | 38 | * @param sda is the pin for I2C SDA |
shimniok | 1:959715b1d042 | 39 | * @param scl is the pin for I2C SCL |
shimniok | 1:959715b1d042 | 40 | * @param address is the 7-bit address (default is 0x27 for the device) |
shimniok | 0:3cf7c2683c3a | 41 | */ |
shimniok | 0:3cf7c2683c3a | 42 | DigoleSerialDisp(PinName sda, PinName scl, uint8_t address=0x27); |
shimniok | 0:3cf7c2683c3a | 43 | |
shimniok | 0:3cf7c2683c3a | 44 | |
shimniok | 0:3cf7c2683c3a | 45 | /** Carryover from Arduino library, not needed |
shimniok | 0:3cf7c2683c3a | 46 | */ |
shimniok | 0:3cf7c2683c3a | 47 | void begin(void) { } // nothing to do here |
shimniok | 0:3cf7c2683c3a | 48 | |
shimniok | 0:3cf7c2683c3a | 49 | |
shimniok | 0:3cf7c2683c3a | 50 | /** Write out a raw character |
shimniok | 1:959715b1d042 | 51 | * @param x is the character to write |
shimniok | 1:959715b1d042 | 52 | * @returns 1 |
shimniok | 0:3cf7c2683c3a | 53 | */ |
shimniok | 0:3cf7c2683c3a | 54 | size_t write(const char x); |
shimniok | 0:3cf7c2683c3a | 55 | |
shimniok | 0:3cf7c2683c3a | 56 | |
shimniok | 0:3cf7c2683c3a | 57 | /** Write out raw data from a buffer |
shimniok | 1:959715b1d042 | 58 | * @param buffer is the char array to write |
shimniok | 1:959715b1d042 | 59 | * @param size is the the number of bytes to write |
shimniok | 0:3cf7c2683c3a | 60 | * @returns size |
shimniok | 0:3cf7c2683c3a | 61 | */ |
shimniok | 0:3cf7c2683c3a | 62 | size_t write(const char *buffer, size_t size); |
shimniok | 0:3cf7c2683c3a | 63 | |
shimniok | 0:3cf7c2683c3a | 64 | |
shimniok | 0:3cf7c2683c3a | 65 | /** Write out raw string |
shimniok | 1:959715b1d042 | 66 | * @param str is the string to write |
shimniok | 0:3cf7c2683c3a | 67 | * @returns number of bytes written |
shimniok | 0:3cf7c2683c3a | 68 | */ |
shimniok | 0:3cf7c2683c3a | 69 | size_t write(const char *str); |
shimniok | 0:3cf7c2683c3a | 70 | |
shimniok | 0:3cf7c2683c3a | 71 | |
shimniok | 0:3cf7c2683c3a | 72 | /** Prints a char to the display in a single I2C transmission using "TTb\0" |
shimniok | 0:3cf7c2683c3a | 73 | * |
shimniok | 1:959715b1d042 | 74 | * @param c is the character to print |
shimniok | 0:3cf7c2683c3a | 75 | * @returns 1 |
shimniok | 0:3cf7c2683c3a | 76 | */ |
shimniok | 0:3cf7c2683c3a | 77 | size_t print(const char c); |
shimniok | 0:3cf7c2683c3a | 78 | |
shimniok | 0:3cf7c2683c3a | 79 | |
shimniok | 0:3cf7c2683c3a | 80 | /** Prints a string of data to the display in a single I2C transmission using "TTbbb...\0" |
shimniok | 0:3cf7c2683c3a | 81 | * |
shimniok | 1:959715b1d042 | 82 | * @param s is the null-terminated char array to print |
shimniok | 0:3cf7c2683c3a | 83 | * @returns length of s |
shimniok | 0:3cf7c2683c3a | 84 | */ |
shimniok | 0:3cf7c2683c3a | 85 | size_t print(const char s[]); |
shimniok | 0:3cf7c2683c3a | 86 | |
shimniok | 0:3cf7c2683c3a | 87 | |
shimniok | 0:3cf7c2683c3a | 88 | /** Print out an unsigned char as a number |
shimniok | 1:959715b1d042 | 89 | * @param u is the integer to print |
shimniok | 1:959715b1d042 | 90 | * @param base is the base to print, either DEC (default), HEX, BIN |
shimniok | 1:959715b1d042 | 91 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 92 | */ |
shimniok | 0:3cf7c2683c3a | 93 | size_t print(unsigned char u, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 94 | |
shimniok | 0:3cf7c2683c3a | 95 | |
shimniok | 0:3cf7c2683c3a | 96 | /** Print out an integer |
shimniok | 1:959715b1d042 | 97 | * @param i is the integer to print |
shimniok | 1:959715b1d042 | 98 | * @param base is the base to print, either DEC (default), HEX, BIN |
shimniok | 1:959715b1d042 | 99 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 100 | */ |
shimniok | 0:3cf7c2683c3a | 101 | size_t print(int i, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 102 | |
shimniok | 0:3cf7c2683c3a | 103 | |
shimniok | 0:3cf7c2683c3a | 104 | /** Print out an unsigned integer |
shimniok | 1:959715b1d042 | 105 | * @param u is the integer to print |
shimniok | 1:959715b1d042 | 106 | * @param base is the base to print, either DEC (default), HEX, BIN |
shimniok | 1:959715b1d042 | 107 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 108 | */ |
shimniok | 0:3cf7c2683c3a | 109 | size_t print(unsigned int u, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 110 | |
shimniok | 0:3cf7c2683c3a | 111 | |
shimniok | 0:3cf7c2683c3a | 112 | /** Print out a long as a number |
shimniok | 1:959715b1d042 | 113 | * @param l is the integer to print |
shimniok | 1:959715b1d042 | 114 | * @param base is the base to print, either DEC (default), HEX, BIN |
shimniok | 1:959715b1d042 | 115 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 116 | */ |
shimniok | 0:3cf7c2683c3a | 117 | size_t print(long l, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 118 | |
shimniok | 0:3cf7c2683c3a | 119 | |
shimniok | 0:3cf7c2683c3a | 120 | /** Print out an unsigned long |
shimniok | 1:959715b1d042 | 121 | * @param l is the integer to print |
shimniok | 1:959715b1d042 | 122 | * @param base is the base to print, either DEC (default), HEX, BIN |
shimniok | 1:959715b1d042 | 123 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 124 | */ |
shimniok | 0:3cf7c2683c3a | 125 | size_t print(unsigned long l, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 126 | |
shimniok | 0:3cf7c2683c3a | 127 | |
shimniok | 0:3cf7c2683c3a | 128 | /** Print out a double |
shimniok | 1:959715b1d042 | 129 | * @param f is the integer to print |
shimniok | 1:959715b1d042 | 130 | * @param digits is the number of digits after the decimal |
shimniok | 0:3cf7c2683c3a | 131 | */ |
shimniok | 0:3cf7c2683c3a | 132 | size_t print(double f, int digits = 2); |
shimniok | 0:3cf7c2683c3a | 133 | |
shimniok | 0:3cf7c2683c3a | 134 | |
shimniok | 0:3cf7c2683c3a | 135 | /** Prints a string of data to the display in a single I2C transmission using "TTbbb...\0" |
shimniok | 0:3cf7c2683c3a | 136 | * |
shimniok | 1:959715b1d042 | 137 | * @param s is the null-terminated char array to print |
shimniok | 0:3cf7c2683c3a | 138 | * @returns length of s |
shimniok | 0:3cf7c2683c3a | 139 | */ |
shimniok | 0:3cf7c2683c3a | 140 | size_t println(const char s[]); |
shimniok | 0:3cf7c2683c3a | 141 | |
shimniok | 0:3cf7c2683c3a | 142 | |
shimniok | 0:3cf7c2683c3a | 143 | /** Prints a char the display in a single I2C transmission using "TTb\0" |
shimniok | 0:3cf7c2683c3a | 144 | * |
shimniok | 1:959715b1d042 | 145 | * @param c is the character to print |
shimniok | 0:3cf7c2683c3a | 146 | * @returns 1 |
shimniok | 0:3cf7c2683c3a | 147 | */ |
shimniok | 0:3cf7c2683c3a | 148 | size_t println(char c); |
shimniok | 0:3cf7c2683c3a | 149 | |
shimniok | 0:3cf7c2683c3a | 150 | |
shimniok | 0:3cf7c2683c3a | 151 | /** Prints an unsigned char as a number |
shimniok | 0:3cf7c2683c3a | 152 | * |
shimniok | 1:959715b1d042 | 153 | * @param u is the unsigned char number |
shimniok | 0:3cf7c2683c3a | 154 | * @returns 1 |
shimniok | 0:3cf7c2683c3a | 155 | */ |
shimniok | 0:3cf7c2683c3a | 156 | size_t println(unsigned char u, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 157 | |
shimniok | 0:3cf7c2683c3a | 158 | |
shimniok | 0:3cf7c2683c3a | 159 | /** Print out an integer |
shimniok | 1:959715b1d042 | 160 | * @param i is the integer to print |
shimniok | 1:959715b1d042 | 161 | * @param base is the base to print, either DEC (default), HEX, BIN |
shimniok | 1:959715b1d042 | 162 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 163 | */ |
shimniok | 0:3cf7c2683c3a | 164 | size_t println(int i, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 165 | |
shimniok | 0:3cf7c2683c3a | 166 | |
shimniok | 0:3cf7c2683c3a | 167 | /** Print out an unsigned char as a number |
shimniok | 1:959715b1d042 | 168 | * @param u is the integer to print |
shimniok | 1:959715b1d042 | 169 | * @param base is the base to print, either DEC (default), HEX, BIN |
shimniok | 1:959715b1d042 | 170 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 171 | */ |
shimniok | 0:3cf7c2683c3a | 172 | size_t println(unsigned int u, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 173 | |
shimniok | 0:3cf7c2683c3a | 174 | |
shimniok | 0:3cf7c2683c3a | 175 | /** Print out a long as a number |
shimniok | 1:959715b1d042 | 176 | * @param l is the integer to print |
shimniok | 1:959715b1d042 | 177 | * @param base is the base to print, either DEC (default), HEX, BIN |
shimniok | 1:959715b1d042 | 178 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 179 | */ |
shimniok | 0:3cf7c2683c3a | 180 | size_t println(long l, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 181 | |
shimniok | 0:3cf7c2683c3a | 182 | |
shimniok | 0:3cf7c2683c3a | 183 | /** Print out an unsigned long |
shimniok | 1:959715b1d042 | 184 | * @param l is the integer to print |
shimniok | 1:959715b1d042 | 185 | * @param base is the base to print, either DEC (default), HEX, BIN |
shimniok | 1:959715b1d042 | 186 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 187 | */ |
shimniok | 0:3cf7c2683c3a | 188 | size_t println(unsigned long l, int base = DEC); |
shimniok | 0:3cf7c2683c3a | 189 | |
shimniok | 0:3cf7c2683c3a | 190 | |
shimniok | 0:3cf7c2683c3a | 191 | /** Print out a double |
shimniok | 1:959715b1d042 | 192 | * @param f is the integer to print |
shimniok | 1:959715b1d042 | 193 | * @param digits is the number of digits after the decimal |
shimniok | 1:959715b1d042 | 194 | * @returns number of chars written |
shimniok | 0:3cf7c2683c3a | 195 | */ |
shimniok | 0:3cf7c2683c3a | 196 | size_t println(double f, int digits = 2); |
shimniok | 0:3cf7c2683c3a | 197 | |
shimniok | 0:3cf7c2683c3a | 198 | |
shimniok | 3:e5615f0cb6ee | 199 | /** prints, well, nothing in this case, but pretend we printed a newline |
shimniok | 0:3cf7c2683c3a | 200 | * @returns 1 |
shimniok | 0:3cf7c2683c3a | 201 | */ |
shimniok | 0:3cf7c2683c3a | 202 | size_t println(void); |
shimniok | 0:3cf7c2683c3a | 203 | |
shimniok | 0:3cf7c2683c3a | 204 | |
shimniok | 0:3cf7c2683c3a | 205 | /*---------functions for Text and Graphic LCD adapters---------*/ |
shimniok | 0:3cf7c2683c3a | 206 | |
shimniok | 0:3cf7c2683c3a | 207 | /** Turns off the cursor */ |
shimniok | 0:3cf7c2683c3a | 208 | void disableCursor(void); |
shimniok | 0:3cf7c2683c3a | 209 | |
shimniok | 0:3cf7c2683c3a | 210 | /** Turns on the cursor */ |
shimniok | 0:3cf7c2683c3a | 211 | void enableCursor(void); |
shimniok | 0:3cf7c2683c3a | 212 | |
shimniok | 0:3cf7c2683c3a | 213 | /** Displays a string at specified coordinates |
shimniok | 1:959715b1d042 | 214 | * @param x is the x coordinate to display the string |
shimniok | 1:959715b1d042 | 215 | * @param y is the y coordinate to display the string |
shimniok | 1:959715b1d042 | 216 | * @param s is the string to display |
shimniok | 0:3cf7c2683c3a | 217 | */ |
shimniok | 0:3cf7c2683c3a | 218 | void drawStr(uint8_t x, uint8_t y, const char *s); |
shimniok | 0:3cf7c2683c3a | 219 | |
shimniok | 0:3cf7c2683c3a | 220 | /** Sets the print position for graphics or text |
shimniok | 1:959715b1d042 | 221 | * @param x is the x coordinate to display the string |
shimniok | 1:959715b1d042 | 222 | * @param y is the y coordinate to display the string |
shimniok | 1:959715b1d042 | 223 | * @param graph if set to _TEXT_ affects subsequent text position, otherwise, affects graphics position |
shimniok | 0:3cf7c2683c3a | 224 | */ |
shimniok | 0:3cf7c2683c3a | 225 | void setPrintPos(uint8_t x, uint8_t y, uint8_t graph = _TEXT_); |
shimniok | 0:3cf7c2683c3a | 226 | |
shimniok | 0:3cf7c2683c3a | 227 | /** Clears the display screen */ |
shimniok | 0:3cf7c2683c3a | 228 | void clearScreen(void); |
shimniok | 0:3cf7c2683c3a | 229 | |
shimniok | 0:3cf7c2683c3a | 230 | /** Configure your LCD if other than 1602 and the chip is other than KS0066U/F / HD44780 |
shimniok | 1:959715b1d042 | 231 | * @param col is the number of columns |
shimniok | 1:959715b1d042 | 232 | * @param row is the number of rows |
shimniok | 0:3cf7c2683c3a | 233 | */ |
shimniok | 0:3cf7c2683c3a | 234 | void setLCDColRow(uint8_t col, uint8_t row); |
shimniok | 0:3cf7c2683c3a | 235 | |
shimniok | 0:3cf7c2683c3a | 236 | /** Sets a new I2C address for the display (default is 0x27), the adapter will store the new address in memory |
shimniok | 1:959715b1d042 | 237 | * @param address is the the new address |
shimniok | 0:3cf7c2683c3a | 238 | */ |
shimniok | 0:3cf7c2683c3a | 239 | void setI2CAddress(uint8_t add); |
shimniok | 0:3cf7c2683c3a | 240 | |
shimniok | 0:3cf7c2683c3a | 241 | /** Display Config on/off, the factory default set is on, |
shimniok | 0:3cf7c2683c3a | 242 | * so, when the module is powered up, it will display |
shimniok | 0:3cf7c2683c3a | 243 | * current communication mode on LCD, after you |
shimniok | 0:3cf7c2683c3a | 244 | * design finished, you can turn it off |
shimniok | 1:959715b1d042 | 245 | * @param v is the 1 is on, 0 is off |
shimniok | 0:3cf7c2683c3a | 246 | */ |
shimniok | 0:3cf7c2683c3a | 247 | void displayConfig(uint8_t v); |
shimniok | 0:3cf7c2683c3a | 248 | |
shimniok | 0:3cf7c2683c3a | 249 | /** Holdover from Arduino library; not needed */ |
shimniok | 0:3cf7c2683c3a | 250 | void preprint(void); |
shimniok | 0:3cf7c2683c3a | 251 | |
shimniok | 0:3cf7c2683c3a | 252 | /*----------Functions for Graphic LCD/OLED adapters only---------*/ |
shimniok | 0:3cf7c2683c3a | 253 | //the functions in this section compatible with u8glib |
shimniok | 0:3cf7c2683c3a | 254 | void drawBitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *bitmap); |
shimniok | 0:3cf7c2683c3a | 255 | void setRot90(void); |
shimniok | 0:3cf7c2683c3a | 256 | void setRot180(void); |
shimniok | 0:3cf7c2683c3a | 257 | void setRot270(void); |
shimniok | 0:3cf7c2683c3a | 258 | void undoRotation(void); |
shimniok | 0:3cf7c2683c3a | 259 | void setRotation(uint8_t); |
shimniok | 0:3cf7c2683c3a | 260 | void setContrast(uint8_t); |
shimniok | 0:3cf7c2683c3a | 261 | void drawBox(uint8_t x, uint8_t y, uint8_t w, uint8_t h); |
shimniok | 0:3cf7c2683c3a | 262 | void drawCircle(uint8_t x, uint8_t y, uint8_t r, uint8_t = 0); |
shimniok | 0:3cf7c2683c3a | 263 | void drawDisc(uint8_t x, uint8_t y, uint8_t r); |
shimniok | 0:3cf7c2683c3a | 264 | void drawFrame(uint8_t x, uint8_t y, uint8_t w, uint8_t h); |
shimniok | 0:3cf7c2683c3a | 265 | void drawPixel(uint8_t x, uint8_t y, uint8_t = 1); |
shimniok | 0:3cf7c2683c3a | 266 | void drawLine(uint8_t x, uint8_t y, uint8_t x1, uint8_t y1); |
shimniok | 0:3cf7c2683c3a | 267 | void drawLineTo(uint8_t x, uint8_t y); |
shimniok | 0:3cf7c2683c3a | 268 | void drawHLine(uint8_t x, uint8_t y, uint8_t w); |
shimniok | 0:3cf7c2683c3a | 269 | void drawVLine(uint8_t x, uint8_t y, uint8_t h); |
shimniok | 0:3cf7c2683c3a | 270 | //------------------------------- |
shimniok | 0:3cf7c2683c3a | 271 | //special functions for our adapters |
shimniok | 0:3cf7c2683c3a | 272 | |
shimniok | 0:3cf7c2683c3a | 273 | /** Sets the font |
shimniok | 0:3cf7c2683c3a | 274 | * |
shimniok | 0:3cf7c2683c3a | 275 | * @parameter font - available fonts: 6,10,18,51,120,123, user font 200-203 |
shimniok | 0:3cf7c2683c3a | 276 | */ |
shimniok | 0:3cf7c2683c3a | 277 | void setFont(uint8_t font); |
shimniok | 0:3cf7c2683c3a | 278 | |
shimniok | 0:3cf7c2683c3a | 279 | /** go to next text line, depending on the font size */ |
shimniok | 0:3cf7c2683c3a | 280 | void nextTextLine(void); |
shimniok | 0:3cf7c2683c3a | 281 | |
shimniok | 0:3cf7c2683c3a | 282 | /** set color for graphic function */ |
shimniok | 0:3cf7c2683c3a | 283 | void setColor(uint8_t); |
shimniok | 0:3cf7c2683c3a | 284 | |
shimniok | 0:3cf7c2683c3a | 285 | /** Turn on back light */ |
shimniok | 0:3cf7c2683c3a | 286 | void backLightOn(void); |
shimniok | 0:3cf7c2683c3a | 287 | |
shimniok | 0:3cf7c2683c3a | 288 | /** Turn off back light */ |
shimniok | 0:3cf7c2683c3a | 289 | void backLightOff(void); |
shimniok | 0:3cf7c2683c3a | 290 | |
shimniok | 0:3cf7c2683c3a | 291 | /** send command to LCD drectly |
shimniok | 0:3cf7c2683c3a | 292 | * @param d - command |
shimniok | 0:3cf7c2683c3a | 293 | */ |
shimniok | 0:3cf7c2683c3a | 294 | void directCommand(uint8_t d); |
shimniok | 0:3cf7c2683c3a | 295 | |
shimniok | 0:3cf7c2683c3a | 296 | /** send data to LCD drectly |
shimniok | 1:959715b1d042 | 297 | * @param d is the data |
shimniok | 0:3cf7c2683c3a | 298 | */ |
shimniok | 0:3cf7c2683c3a | 299 | void directData(uint8_t d); |
shimniok | 0:3cf7c2683c3a | 300 | |
shimniok | 0:3cf7c2683c3a | 301 | /** Move rectangle area on screen to another place |
shimniok | 1:959715b1d042 | 302 | * @param x0, y1 is the top left of the area to move |
shimniok | 1:959715b1d042 | 303 | * @param x1, y1 is the bottom right of the area to move |
shimniok | 1:959715b1d042 | 304 | * @param xoffset, yoffset is the the distance to move |
shimniok | 0:3cf7c2683c3a | 305 | */ |
shimniok | 0:3cf7c2683c3a | 306 | void moveArea(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, char xoffset, char yoffset); |
shimniok | 0:3cf7c2683c3a | 307 | |
shimniok | 0:3cf7c2683c3a | 308 | /** Display startup screen */ |
shimniok | 0:3cf7c2683c3a | 309 | void displayStartScreen(uint8_t m); |
shimniok | 0:3cf7c2683c3a | 310 | |
shimniok | 0:3cf7c2683c3a | 311 | /** Set display mode */ |
shimniok | 0:3cf7c2683c3a | 312 | void setMode(uint8_t m); |
shimniok | 0:3cf7c2683c3a | 313 | |
shimniok | 0:3cf7c2683c3a | 314 | /** set text position back to previous, only one back allowed */ |
shimniok | 0:3cf7c2683c3a | 315 | void setTextPosBack(void); |
shimniok | 0:3cf7c2683c3a | 316 | |
shimniok | 0:3cf7c2683c3a | 317 | void setTextPosOffset(char xoffset, char yoffset); |
shimniok | 0:3cf7c2683c3a | 318 | void setTextPosAbs(uint8_t x, uint8_t y); |
shimniok | 0:3cf7c2683c3a | 319 | void setLinePattern(uint8_t pattern); |
shimniok | 0:3cf7c2683c3a | 320 | /** Only for universal serial adapter */ |
shimniok | 0:3cf7c2683c3a | 321 | void setLCDChip(uint8_t chip); |
shimniok | 0:3cf7c2683c3a | 322 | |
shimniok | 0:3cf7c2683c3a | 323 | |
shimniok | 0:3cf7c2683c3a | 324 | /** Set Start Screen, 1st B is the lower byte of data length. |
shimniok | 0:3cf7c2683c3a | 325 | * Convert images to C array here: <a href="http://www.digole.com/tools/PicturetoC_Hex_converter.php">http://www.digole.com/tools/PicturetoC_Hex_converter.php</a> |
shimniok | 1:959715b1d042 | 326 | * @param lon is the length of data |
shimniok | 1:959715b1d042 | 327 | * @param data is the binary data |
shimniok | 0:3cf7c2683c3a | 328 | */ |
shimniok | 0:3cf7c2683c3a | 329 | void uploadStartScreen(int lon, const unsigned char *data); //upload start screen |
shimniok | 0:3cf7c2683c3a | 330 | |
shimniok | 0:3cf7c2683c3a | 331 | /** Upload a user font |
shimniok | 1:959715b1d042 | 332 | * @param lon is the length of data |
shimniok | 1:959715b1d042 | 333 | * @param data is the user font data |
shimniok | 1:959715b1d042 | 334 | * @param sect is the section of memory you want to upload to |
shimniok | 0:3cf7c2683c3a | 335 | */ |
shimniok | 0:3cf7c2683c3a | 336 | void uploadUserFont(int lon, const unsigned char *data, uint8_t sect); //upload user font |
shimniok | 0:3cf7c2683c3a | 337 | |
shimniok | 0:3cf7c2683c3a | 338 | /** Send a Byte to output head on board |
shimniok | 1:959715b1d042 | 339 | * @param x is the byte to output |
shimniok | 0:3cf7c2683c3a | 340 | */ |
shimniok | 0:3cf7c2683c3a | 341 | void digitalOutput(uint8_t x); |
shimniok | 0:3cf7c2683c3a | 342 | |
shimniok | 0:3cf7c2683c3a | 343 | private: |
shimniok | 0:3cf7c2683c3a | 344 | I2C _device; |
shimniok | 0:3cf7c2683c3a | 345 | uint8_t _address; |
shimniok | 0:3cf7c2683c3a | 346 | uint8_t _Comdelay; |
shimniok | 5:a78901fe6a7b | 347 | char buf[128]; |
shimniok | 0:3cf7c2683c3a | 348 | |
shimniok | 0:3cf7c2683c3a | 349 | size_t printNumber(unsigned long n, uint8_t base); |
shimniok | 0:3cf7c2683c3a | 350 | size_t printFloat(double number, uint8_t digits); |
shimniok | 0:3cf7c2683c3a | 351 | }; |
shimniok | 0:3cf7c2683c3a | 352 | |
shimniok | 0:3cf7c2683c3a | 353 | #endif |