SSD1308 128x64 OLED Driver with I2C interface

Dependents:   sense xadow_m0_ada_gps xadow_m0_SD_Hello sense-DHT11 ... more

See http://mbed.org/users/wim/notebook/oled-display-with-ssd1308-driver/#c6729

Committer:
wim
Date:
Sat Jul 21 12:49:33 2012 +0000
Revision:
1:b7e8f5139026
Parent:
0:300d08d9b058
Child:
2:16c84a134393
Added comments, Added progressbar

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wim 1:b7e8f5139026 1 /** @file SSD1308 I2C device class header file
wim 1:b7e8f5139026 2 * Based on Solomon Systech SSD1308 datasheet, rev. 1, 10/2008
wim 1:b7e8f5139026 3 * The SSD1308 is used for example in the Seeed 128x64 OLED Display
wim 1:b7e8f5139026 4 * http://www.seeedstudio.com/depot/grove-oled-display-12864-p-781.html?cPath=163_167
wim 1:b7e8f5139026 5 */
wim 0:300d08d9b058 6 // The original code by Andrew Schamp is using (and has been submitted as a part of) Jeff Rowberg's I2Cdevlib library,
wim 0:300d08d9b058 7 // which should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
wim 0:300d08d9b058 8 // Some parts also mashed up from Graphic Library for driving monochrome displays based on the PCD8544,
wim 0:300d08d9b058 9 // Copyright (c) 2011, Wim De Roeve, who in turn did partial port of code found on
wim 0:300d08d9b058 10 // http://serdisplib.sourceforge.net/ser/pcd8544.html#links and by Petras Saduikis <petras@petras.co.uk>
wim 0:300d08d9b058 11 //
wim 0:300d08d9b058 12 // Changelog:
wim 0:300d08d9b058 13 // 2011-08-25 - Initial release by Andrew Schamp <schamp@gmail.com>
wim 0:300d08d9b058 14 // 2012-06-19 - Ported to mbed and optimised (WH)
wim 0:300d08d9b058 15 //
wim 0:300d08d9b058 16 /* ============================================
wim 0:300d08d9b058 17 I2Cdev device library code is placed under the MIT license
wim 0:300d08d9b058 18 Copyright (c) 2011 Andrew Schamp
wim 0:300d08d9b058 19 Copyright (c) 2012 WH (mbed port)
wim 0:300d08d9b058 20
wim 0:300d08d9b058 21 Permission is hereby granted, free of charge, to any person obtaining a copy
wim 0:300d08d9b058 22 of this software and associated documentation files (the "Software"), to deal
wim 0:300d08d9b058 23 in the Software without restriction, including without limitation the rights
wim 0:300d08d9b058 24 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
wim 0:300d08d9b058 25 copies of the Software, and to permit persons to whom the Software is
wim 0:300d08d9b058 26 furnished to do so, subject to the following conditions:
wim 0:300d08d9b058 27
wim 0:300d08d9b058 28 The above copyright notice and this permission notice shall be included in
wim 0:300d08d9b058 29 all copies or substantial portions of the Software.
wim 0:300d08d9b058 30
wim 0:300d08d9b058 31 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
wim 0:300d08d9b058 32 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
wim 0:300d08d9b058 33 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
wim 0:300d08d9b058 34 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
wim 0:300d08d9b058 35 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
wim 0:300d08d9b058 36 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
wim 0:300d08d9b058 37 THE SOFTWARE.
wim 0:300d08d9b058 38 ===============================================
wim 0:300d08d9b058 39 */
wim 0:300d08d9b058 40
wim 0:300d08d9b058 41 #ifndef SSD1308_H
wim 0:300d08d9b058 42 #define SSD1308_H
wim 0:300d08d9b058 43
wim 0:300d08d9b058 44 // This is the I2C address (8 bit)
wim 0:300d08d9b058 45 // There are two possible addresses: with D/C# (pin 13) grounded, the address is 0x78,
wim 0:300d08d9b058 46 // with D/C# tied high it is 0x7A. Assume grounded by default.
wim 0:300d08d9b058 47 #define SSD1308_SA0 0x78
wim 0:300d08d9b058 48 #define SSD1308_SA1 0x7A
wim 0:300d08d9b058 49 #define SSD1308_DEF_SA SSD1308_SA0
wim 0:300d08d9b058 50
wim 0:300d08d9b058 51 // Display dimensions
wim 0:300d08d9b058 52 #define ROWS 64
wim 0:300d08d9b058 53 #define COLUMNS 128
wim 0:300d08d9b058 54 #define PAGES (ROWS / 8)
wim 0:300d08d9b058 55 #define MAX_PAGE (PAGES - 1)
wim 0:300d08d9b058 56 #define MAX_COL (COLUMNS - 1)
wim 0:300d08d9b058 57
wim 0:300d08d9b058 58 // Character dimensions 8x8 font
wim 0:300d08d9b058 59 #define CHARS (COLUMNS / FONT8x8_WIDTH)
wim 0:300d08d9b058 60
wim 0:300d08d9b058 61 // Command and Datamode
wim 0:300d08d9b058 62 #define COMMAND_MODE 0x80 // continuation bit is set!
wim 0:300d08d9b058 63 #define DATA_MODE 0x40
wim 0:300d08d9b058 64
wim 0:300d08d9b058 65 // Commands and Parameter defines
wim 0:300d08d9b058 66 #define HORIZONTAL_ADDRESSING_MODE 0x00
wim 0:300d08d9b058 67 #define VERTICAL_ADDRESSING_MODE 0x01
wim 0:300d08d9b058 68 #define PAGE_ADDRESSING_MODE 0x02
wim 0:300d08d9b058 69 #define SET_MEMORY_ADDRESSING_MODE 0x20 // takes one byte as given above
wim 0:300d08d9b058 70
wim 0:300d08d9b058 71 #define SET_COLUMN_ADDRESS 0x21 // takes two bytes, start address and end address of display data RAM
wim 0:300d08d9b058 72 #define SET_PAGE_ADDRESS 0x22 // takes two bytes, start address and end address of display data RAM
wim 0:300d08d9b058 73
wim 0:300d08d9b058 74 // Command maybe unsupported by SSD1308
wim 0:300d08d9b058 75 #define FADE_INTERVAL_8_FRAMES 0x00
wim 0:300d08d9b058 76 #define FADE_INTERVAL_16_FRAMES 0x01
wim 0:300d08d9b058 77 #define FADE_INTERVAL_24_FRAMES 0x02
wim 0:300d08d9b058 78 #define FADE_INTERVAL_32_FRAMES 0x03
wim 0:300d08d9b058 79 #define FADE_INTERVAL_64_FRAMES 0x07
wim 0:300d08d9b058 80 #define FADE_INTERVAL_128_FRAMES 0x0F
wim 0:300d08d9b058 81 #define FADE_BLINK_DISABLE 0x00
wim 0:300d08d9b058 82 #define FADE_OUT_ENABLE 0x20
wim 0:300d08d9b058 83 #define BLINK_ENABLE 0x30
wim 0:300d08d9b058 84 #define SET_FADE_BLINK 0x23 // takes one byte
wim 0:300d08d9b058 85 // bit5-4 = 0, fade/blink mode
wim 0:300d08d9b058 86 // bit3-0 = Time interval in frames
wim 0:300d08d9b058 87
wim 0:300d08d9b058 88 #define SET_DISPLAY_START_LINE 0x40 // | with a row number 0-63 to set start row. Reset = 0
wim 0:300d08d9b058 89
wim 0:300d08d9b058 90 #define SET_CONTRAST 0x81 // takes one byte, 0x00 - 0xFF
wim 0:300d08d9b058 91
wim 0:300d08d9b058 92 #define SET_SEGMENT_REMAP_0 0xA0 // column address 0 is mapped to SEG0 (Reset)
wim 0:300d08d9b058 93 #define SET_SEGMENT_REMAP_127 0xA1 // column address 127 is mapped to SEG0
wim 0:300d08d9b058 94
wim 0:300d08d9b058 95 #define SET_DISPLAY_GDDRAM 0xA4 // restores display to contents of RAM
wim 0:300d08d9b058 96 #define SET_ENTIRE_DISPLAY_ON 0xA5 // turns all pixels on, does not affect RAM
wim 0:300d08d9b058 97
wim 0:300d08d9b058 98 #define SET_NORMAL_DISPLAY 0xA6 // a databit of 1 indicates pixel 'ON'
wim 0:300d08d9b058 99 #define SET_INVERSE_DISPLAY 0xA7 // a databit of 1 indicates pixel 'OFF'
wim 0:300d08d9b058 100
wim 0:300d08d9b058 101 #define SET_MULTIPLEX_RATIO 0xA8 // takes one byte, from 16xMUX to 64xMUX (MUX Ratio = byte+1; Default 64)
wim 0:300d08d9b058 102
wim 0:300d08d9b058 103 #define EXTERNAL_IREF 0x10
wim 0:300d08d9b058 104 #define INTERNAL_IREF 0x00
wim 0:300d08d9b058 105 #define SET_IREF_SELECTION 0xAD // sets internal or external Iref
wim 0:300d08d9b058 106
wim 0:300d08d9b058 107 #define SET_DISPLAY_POWER_OFF 0xAE
wim 0:300d08d9b058 108 #define SET_DISPLAY_POWER_ON 0xAF
wim 0:300d08d9b058 109
wim 0:300d08d9b058 110 #define PAGE0 0x00
wim 0:300d08d9b058 111 #define PAGE1 0x01
wim 0:300d08d9b058 112 #define PAGE2 0x02
wim 0:300d08d9b058 113 #define PAGE3 0x03
wim 0:300d08d9b058 114 #define PAGE4 0x04
wim 0:300d08d9b058 115 #define PAGE5 0x05
wim 0:300d08d9b058 116 #define PAGE6 0x06
wim 0:300d08d9b058 117 #define PAGE7 0x07
wim 0:300d08d9b058 118 #define SET_PAGE_START_ADDRESS 0xB0 // | with a page number to get start address
wim 0:300d08d9b058 119
wim 0:300d08d9b058 120 #define SET_COMMON_REMAP_0 0xC0 // row address 0 is mapped to COM0 (Reset)
wim 0:300d08d9b058 121 #define SET_COMMON_REMAP_63 0xC8 // row address 63 is mapped to COM0
wim 0:300d08d9b058 122
wim 0:300d08d9b058 123 #define SET_DISPLAY_OFFSET 0xD3 // takes one byte from 0-63 for vertical shift, Reset = 0
wim 0:300d08d9b058 124
wim 0:300d08d9b058 125 #define SET_DISPLAY_CLOCK 0xD5 // takes one byte
wim 0:300d08d9b058 126 // bit7-4 = Osc Freq DCLK (Reset = 1000b)
wim 0:300d08d9b058 127 // bit3-0 = Divide ration (Reset = oooob, Ratio = 1)
wim 0:300d08d9b058 128
wim 0:300d08d9b058 129 #define SET_PRECHARGE_TIME 0xD9 // takes one byte
wim 0:300d08d9b058 130 // bit7-4 = Phase2, upto 15 DCLKs (Reset = 0010b)
wim 0:300d08d9b058 131 // bit3-0 = Phase1, upto 15 DCLKs (Reset = 0010b)
wim 0:300d08d9b058 132
wim 0:300d08d9b058 133
wim 0:300d08d9b058 134 #define COMMON_BASE 0x02 //
wim 0:300d08d9b058 135 #define COMMON_SEQUENTIAL 0x00 // Sequential common pins config
wim 0:300d08d9b058 136 #define COMMON_ALTERNATIVE 0x10 // Odd/Even common pins config (Reset)
wim 0:300d08d9b058 137 #define COMMON_LEFTRIGHT_NORMAL 0x00 // LeftRight Normal (Reset)
wim 0:300d08d9b058 138 #define COMMON_LEFTRIGHT_FLIP 0x20 // LeftRight Flip
wim 0:300d08d9b058 139 #define SET_COMMON_CONF 0xDA // takes one byte as given above
wim 0:300d08d9b058 140
wim 0:300d08d9b058 141
wim 0:300d08d9b058 142 #define VCOMH_DESELECT_0_65_CODE 0x00
wim 0:300d08d9b058 143 #define VCOMH_DESELECT_0_77_CODE 0x20
wim 0:300d08d9b058 144 #define VCOMH_DESELECT_0_83_CODE 0x30
wim 0:300d08d9b058 145 #define SET_VCOMH_DESELECT_LEVEL 0xDB // takes one byte as given above
wim 0:300d08d9b058 146
wim 0:300d08d9b058 147 #define NOP 0xE3
wim 0:300d08d9b058 148
wim 0:300d08d9b058 149 #define SCROLL_INTERVAL_5_FRAMES 0x00
wim 0:300d08d9b058 150 #define SCROLL_INTERVAL_64_FRAMES 0x01
wim 0:300d08d9b058 151 #define SCROLL_INTERVAL_128_FRAMES 0x02
wim 0:300d08d9b058 152 #define SCROLL_INTERVAL_256_FRAMES 0x03
wim 0:300d08d9b058 153 #define SCROLL_INTERVAL_3_FRAMES 0x04
wim 0:300d08d9b058 154 #define SCROLL_INTERVAL_4_FRAMES 0x05
wim 0:300d08d9b058 155 #define SCROLL_INTERVAL_25_FRAMES 0x06
wim 0:300d08d9b058 156 #define SCROLL_INTERVAL_2_FRAMES 0x07
wim 0:300d08d9b058 157
wim 0:300d08d9b058 158 #define SET_RIGHT_HOR_SCROLL 0x26 // takes 6 bytes: 0x00, PageStart, Scroll_Interval, PageEnd, 0x00, 0xFF
wim 0:300d08d9b058 159 #define SET_LEFT_HOR_SCROLL 0x27 // takes 6 bytes: 0x00, PageStart, Scroll_Interval, PageEnd, 0x00, 0xFF
wim 0:300d08d9b058 160
wim 0:300d08d9b058 161 #define SET_VERT_RIGHT_HOR_SCROLL 0x29 // takes 5 bytes: 0x00, PageStart, Scroll_Interval, PageEnd, VertOffset
wim 0:300d08d9b058 162 #define SET_VERT_LEFT_HOR_SCROLL 0x2A // takes 5 bytes: 0x00, PageStart, Scroll_Interval, PageEnd, VertOffset
wim 0:300d08d9b058 163
wim 0:300d08d9b058 164 #define SET_DEACTIVATE_SCROLL 0x2E
wim 0:300d08d9b058 165 #define SET_ACTIVATE_SCROLL 0x2F
wim 0:300d08d9b058 166
wim 0:300d08d9b058 167 #define SET_VERTICAL_SCROLL_AREA 0xA3 // takes 2 bytes: Rows in Top Area (Reset=0), Rows in Scroll Area (Reset=64)
wim 0:300d08d9b058 168
wim 0:300d08d9b058 169 class SSD1308 : public Stream {
wim 0:300d08d9b058 170 public:
wim 0:300d08d9b058 171
wim 0:300d08d9b058 172 // Constructor
wim 0:300d08d9b058 173 // takes 8bit I2C address to use for the controller (0x78 by default, assumes D/C# (pin 13) grounded)
wim 0:300d08d9b058 174 SSD1308(I2C &i2c, uint8_t address = SSD1308_DEF_SA);
wim 0:300d08d9b058 175
wim 0:300d08d9b058 176 // High Level methods
wim 0:300d08d9b058 177 void initialize();
wim 0:300d08d9b058 178
wim 0:300d08d9b058 179 void clearDisplay();
wim 0:300d08d9b058 180 // void fillDisplay(uint8_t pattern); // pattern
wim 0:300d08d9b058 181 void fillDisplay(uint8_t pattern = 0x00,
wim 0:300d08d9b058 182 uint8_t start_page=0, uint8_t end_page=MAX_PAGE,
wim 0:300d08d9b058 183 uint8_t start_col=0, uint8_t end_col=MAX_COL);
wim 0:300d08d9b058 184
wim 0:300d08d9b058 185 void writeBitmap(uint8_t* data,
wim 0:300d08d9b058 186 uint8_t start_page=0, uint8_t end_page=MAX_PAGE,
wim 0:300d08d9b058 187 uint8_t start_col=0, uint8_t end_col=MAX_COL);
wim 0:300d08d9b058 188
wim 1:b7e8f5139026 189
wim 1:b7e8f5139026 190 void writeProgressBar(uint8_t page, uint8_t col, int percentage);
wim 1:b7e8f5139026 191
wim 0:300d08d9b058 192 //void setXY(uint8_t, uint8_t y);
wim 0:300d08d9b058 193
wim 0:300d08d9b058 194 // Select inverted or normal text
wim 0:300d08d9b058 195 void setInverted(bool inverted) { _inverted = inverted; };
wim 0:300d08d9b058 196
wim 0:300d08d9b058 197 // write char at current cursor location
wim 0:300d08d9b058 198 void writeChar(char chr);
wim 0:300d08d9b058 199
wim 0:300d08d9b058 200 // write large char at cursor location
wim 0:300d08d9b058 201 void writeBigChar(uint8_t row, uint8_t col, char chr);
wim 0:300d08d9b058 202
wim 0:300d08d9b058 203 // x, y is position (x is row (i.e., page), y is character (0-15), starting at top-left)
wim 0:300d08d9b058 204 // text will wrap around until it is done.
wim 0:300d08d9b058 205 void writeString(uint8_t row, uint8_t col, uint16_t len, const char* txt);
wim 0:300d08d9b058 206
wim 0:300d08d9b058 207 // Stream implementation - provides printf() interface
wim 0:300d08d9b058 208 // You would otherwise be forced to use writeChar() or writeString()
wim 0:300d08d9b058 209 virtual int _putc(int value) { writeChar(value); return 1; };
wim 0:300d08d9b058 210 virtual int _getc() { return -1; };
wim 0:300d08d9b058 211
wim 0:300d08d9b058 212 // Future extension with graphics features
wim 0:300d08d9b058 213 // this must be defined by the subclass
wim 0:300d08d9b058 214 // virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
wim 0:300d08d9b058 215
wim 0:300d08d9b058 216 // Medium Level methods
wim 0:300d08d9b058 217 void setHorizontalAddressingMode();
wim 0:300d08d9b058 218 void setVerticalAddressingMode();
wim 0:300d08d9b058 219 void setPageAddressingMode();
wim 0:300d08d9b058 220
wim 0:300d08d9b058 221 void setMemoryAddressingMode(uint8_t mode);
wim 0:300d08d9b058 222
wim 0:300d08d9b058 223 // takes one byte, 0x00-0x0F
wim 0:300d08d9b058 224 void setLowerColumnStartAddressForPageAddressingMode(uint8_t address);
wim 0:300d08d9b058 225
wim 0:300d08d9b058 226 // takes one byte, 0x10-0x1F
wim 0:300d08d9b058 227 void setHigherColumnStartAddressForPageAddressingMode(uint8_t address);
wim 0:300d08d9b058 228
wim 0:300d08d9b058 229 // takes two bytes, start address and end address of display data RAM
wim 0:300d08d9b058 230 void setColumnAddress(uint8_t start, uint8_t end);
wim 0:300d08d9b058 231
wim 0:300d08d9b058 232 // takes two bytes, start address and end address of display data RAM
wim 0:300d08d9b058 233 void setPageAddress(uint8_t start, uint8_t end);
wim 0:300d08d9b058 234
wim 0:300d08d9b058 235 // takes one byte, PAGE0 - PAGE7
wim 0:300d08d9b058 236 void setPageStartForPageAddressingMode(uint8_t page);
wim 0:300d08d9b058 237
wim 0:300d08d9b058 238 // takes one byte, 0x40-0x7F
wim 0:300d08d9b058 239 void setDisplayStartLine(uint8_t line);
wim 0:300d08d9b058 240
wim 0:300d08d9b058 241 // takes one byte, 0x00 (lowest) - 0xFF (highest)
wim 0:300d08d9b058 242 void setContrastControl(uint8_t contrast);
wim 0:300d08d9b058 243
wim 0:300d08d9b058 244 void setEntireDisplayOn();
wim 0:300d08d9b058 245 void setEntireDisplayRAM();
wim 0:300d08d9b058 246 void setEntireDisplay(bool on);
wim 0:300d08d9b058 247
wim 1:b7e8f5139026 248 // void setMultiplexRatio();
wim 0:300d08d9b058 249
wim 0:300d08d9b058 250 void setInternalIref();
wim 0:300d08d9b058 251 void setExternalIref();
wim 0:300d08d9b058 252
wim 0:300d08d9b058 253 void setDisplayOn();
wim 0:300d08d9b058 254 void setDisplayOff();
wim 0:300d08d9b058 255 void setDisplayPower(bool on);
wim 0:300d08d9b058 256
wim 0:300d08d9b058 257 void setDisplayNormal();
wim 0:300d08d9b058 258 void setDisplayInverse();
wim 0:300d08d9b058 259
wim 0:300d08d9b058 260 void setDisplayBlink(bool on);
wim 0:300d08d9b058 261 void setDisplayFade(bool on);
wim 0:300d08d9b058 262
wim 0:300d08d9b058 263 // Display Flip (Up/Down, Left/Right)
wim 0:300d08d9b058 264 //
wim 0:300d08d9b058 265 void setDisplayFlip(bool left, bool down);
wim 0:300d08d9b058 266
wim 0:300d08d9b058 267 // Set vertical shift by COM from 0 - 63 (0x00 - 0x3F)
wim 0:300d08d9b058 268 // set to 0x00 after RESET
wim 0:300d08d9b058 269 void setDisplayOffset(uint8_t offset);
wim 0:300d08d9b058 270
wim 0:300d08d9b058 271 // Divide ratio 0x00-0x0F, value +1 (reset 0x00)
wim 0:300d08d9b058 272 // Oscillator freq 0x00-0x0F (reset 0x08)
wim 0:300d08d9b058 273 void setDisplayClock(uint8_t divideRatio, uint8_t oscFreq);
wim 0:300d08d9b058 274
wim 0:300d08d9b058 275 // Phase1 0x01-0x0F period of up to 15 DCLK clocks (reset 0x02, 0 is invalid)
wim 0:300d08d9b058 276 // Phase2 0x01-0x0F period of up to 15 DCLK clocks (reset 0x02, 0 is invalid)
wim 0:300d08d9b058 277 void setPrechargePeriod(uint8_t phase1, uint8_t phase2);
wim 0:300d08d9b058 278
wim 0:300d08d9b058 279 void setVcomhDeselectLevel(uint8_t level);
wim 0:300d08d9b058 280
wim 0:300d08d9b058 281 // Command for no-operation
wim 0:300d08d9b058 282 void nop();
wim 0:300d08d9b058 283
wim 0:300d08d9b058 284 // End_page must not be less than start_page
wim 0:300d08d9b058 285 void setContinuousHorizontalScroll(bool left, uint8_t start_page, uint8_t interval, uint8_t end_page);
wim 0:300d08d9b058 286 // Horizontal scroll by one column per interval
wim 0:300d08d9b058 287 // Offset = 1 (0x01) to 63 (0x3F)
wim 0:300d08d9b058 288 void setContinuousVerticalAndHorizontalScroll(bool left, uint8_t start_page, uint8_t interval, uint8_t end_page, uint8_t offset);
wim 0:300d08d9b058 289
wim 0:300d08d9b058 290 // Note, after deactivating scrolling, the RAM data needs to be rewritten
wim 0:300d08d9b058 291 void deactivateScroll();
wim 0:300d08d9b058 292 void activateScroll();
wim 0:300d08d9b058 293
wim 0:300d08d9b058 294 void setVerticalScrollArea(uint8_t topRowsFixed, uint8_t scrollRows);
wim 0:300d08d9b058 295
wim 0:300d08d9b058 296 private:
wim 0:300d08d9b058 297
wim 0:300d08d9b058 298 // Low Level methods
wim 0:300d08d9b058 299 // Sends a command and optional params to device
wim 0:300d08d9b058 300 void _sendCommand(uint8_t command);
wim 0:300d08d9b058 301 void _sendCommand(uint8_t command, uint8_t param1);
wim 0:300d08d9b058 302 void _sendCommand(uint8_t command, uint8_t param1, uint8_t param2);
wim 0:300d08d9b058 303 // void sendCommands(uint8_t len, uint8_t* buf);
wim 0:300d08d9b058 304
wim 0:300d08d9b058 305 // Sends data to device
wim 0:300d08d9b058 306 void _sendData(uint8_t data);
wim 0:300d08d9b058 307 void _sendData(uint8_t len, uint8_t* data);
wim 0:300d08d9b058 308
wim 0:300d08d9b058 309 // Init the configuration registers in accordance with the datasheet
wim 0:300d08d9b058 310 void _init();
wim 0:300d08d9b058 311
wim 1:b7e8f5139026 312 I2C _i2c; // I2C bus reference
wim 1:b7e8f5139026 313 uint8_t _readOpcode; // contains the I2C address of the device
wim 1:b7e8f5139026 314 uint8_t _writeOpcode; // contains the I2C address of the device
wim 0:300d08d9b058 315
wim 0:300d08d9b058 316 bool _inverted; // inverted or normal text
wim 0:300d08d9b058 317 };
wim 0:300d08d9b058 318
wim 0:300d08d9b058 319 #endif