Fast! Install BurstSPI library! https://os.mbed.com/users/peekpt/code/BurstSPI/ New display (greentab2 blue module compact).
Adafruit_ST7735.cpp@8:66c5dc727281, 2020-04-24 (annotated)
- Committer:
- peekpt
- Date:
- Fri Apr 24 11:14:56 2020 +0000
- Revision:
- 8:66c5dc727281
- Parent:
- 7:856a3443f68d
ADDED BURST SPI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SomeRandomBloke | 0:99ee879ef5a9 | 1 | /*************************************************** |
SomeRandomBloke | 0:99ee879ef5a9 | 2 | This is a library for the Adafruit 1.8" SPI display. |
SomeRandomBloke | 0:99ee879ef5a9 | 3 | This library works with the Adafruit 1.8" TFT Breakout w/SD card |
SomeRandomBloke | 0:99ee879ef5a9 | 4 | ----> http://www.adafruit.com/products/358 |
SomeRandomBloke | 0:99ee879ef5a9 | 5 | as well as Adafruit raw 1.8" TFT display |
SomeRandomBloke | 0:99ee879ef5a9 | 6 | ----> http://www.adafruit.com/products/618 |
SomeRandomBloke | 0:99ee879ef5a9 | 7 | |
SomeRandomBloke | 0:99ee879ef5a9 | 8 | Check out the links above for our tutorials and wiring diagrams |
SomeRandomBloke | 0:99ee879ef5a9 | 9 | These displays use SPI to communicate, 4 or 5 pins are required to |
SomeRandomBloke | 0:99ee879ef5a9 | 10 | interface (RST is optional) |
SomeRandomBloke | 0:99ee879ef5a9 | 11 | Adafruit invests time and resources providing this open source code, |
SomeRandomBloke | 0:99ee879ef5a9 | 12 | please support Adafruit and open-source hardware by purchasing |
SomeRandomBloke | 0:99ee879ef5a9 | 13 | products from Adafruit! |
SomeRandomBloke | 0:99ee879ef5a9 | 14 | |
SomeRandomBloke | 0:99ee879ef5a9 | 15 | Written by Limor Fried/Ladyada for Adafruit Industries. |
SomeRandomBloke | 0:99ee879ef5a9 | 16 | MIT license, all text above must be included in any redistribution |
SomeRandomBloke | 0:99ee879ef5a9 | 17 | ****************************************************/ |
SomeRandomBloke | 0:99ee879ef5a9 | 18 | |
peekpt | 7:856a3443f68d | 19 | // + GREENTAB2 display |
peekpt | 8:66c5dc727281 | 20 | // BurstSPI |
peekpt | 7:856a3443f68d | 21 | |
SomeRandomBloke | 0:99ee879ef5a9 | 22 | #include "Adafruit_ST7735.h" |
SomeRandomBloke | 0:99ee879ef5a9 | 23 | |
peekpt | 7:856a3443f68d | 24 | #include "mbed.h" |
peekpt | 7:856a3443f68d | 25 | |
peekpt | 7:856a3443f68d | 26 | inline uint16_t swapcolor(uint16_t x) { |
SomeRandomBloke | 4:2123ea52a4d9 | 27 | return (x << 11) | (x & 0x07E0) | (x >> 11); |
SomeRandomBloke | 4:2123ea52a4d9 | 28 | } |
SomeRandomBloke | 4:2123ea52a4d9 | 29 | |
peekpt | 7:856a3443f68d | 30 | // Constructor |
peekpt | 7:856a3443f68d | 31 | Adafruit_ST7735::Adafruit_ST7735(PinName mosi, PinName miso, PinName sck, |
peekpt | 7:856a3443f68d | 32 | PinName cs, PinName rs, PinName rst) |
peekpt | 7:856a3443f68d | 33 | : lcdPort(mosi, miso, sck), _cs(cs), _rs(rs), _rst(rst), |
peekpt | 7:856a3443f68d | 34 | Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT) {} |
SomeRandomBloke | 0:99ee879ef5a9 | 35 | |
peekpt | 7:856a3443f68d | 36 | void Adafruit_ST7735::writecommand(uint8_t c) { |
peekpt | 7:856a3443f68d | 37 | _rs = 0; |
peekpt | 7:856a3443f68d | 38 | _cs = 0; |
peekpt | 7:856a3443f68d | 39 | |
peekpt | 8:66c5dc727281 | 40 | lcdPort.fastWrite(c); |
peekpt | 8:66c5dc727281 | 41 | lcdPort.clearRX(); |
peekpt | 7:856a3443f68d | 42 | _cs = 1; |
SomeRandomBloke | 0:99ee879ef5a9 | 43 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 44 | |
peekpt | 7:856a3443f68d | 45 | void Adafruit_ST7735::writedata(uint8_t c) { |
peekpt | 7:856a3443f68d | 46 | _rs = 1; |
peekpt | 7:856a3443f68d | 47 | _cs = 0; |
peekpt | 8:66c5dc727281 | 48 | lcdPort.fastWrite(c); |
peekpt | 8:66c5dc727281 | 49 | lcdPort.clearRX(); |
SomeRandomBloke | 0:99ee879ef5a9 | 50 | |
peekpt | 7:856a3443f68d | 51 | _cs = 1; |
SomeRandomBloke | 0:99ee879ef5a9 | 52 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 53 | |
SomeRandomBloke | 0:99ee879ef5a9 | 54 | // Rather than a bazillion writecommand() and writedata() calls, screen |
SomeRandomBloke | 0:99ee879ef5a9 | 55 | // initialization commands and arguments are organized in these tables |
SomeRandomBloke | 0:99ee879ef5a9 | 56 | // stored in PROGMEM. The table may look bulky, but that's mostly the |
SomeRandomBloke | 0:99ee879ef5a9 | 57 | // formatting -- storage-wise this is hundreds of bytes more compact |
SomeRandomBloke | 0:99ee879ef5a9 | 58 | // than the equivalent code. Companion function follows. |
SomeRandomBloke | 0:99ee879ef5a9 | 59 | #define DELAY 0x80 |
peekpt | 7:856a3443f68d | 60 | |
peekpt | 7:856a3443f68d | 61 | static unsigned char Bcmd[] = |
peekpt | 7:856a3443f68d | 62 | { // Initialization commands for 7735B screens |
peekpt | 7:856a3443f68d | 63 | 18, // 18 commands in list: |
peekpt | 7:856a3443f68d | 64 | ST7735_SWRESET, DELAY, // 1: Software reset, no args, w/delay |
peekpt | 7:856a3443f68d | 65 | 50, // 50 ms delay |
peekpt | 7:856a3443f68d | 66 | ST7735_SLPOUT, DELAY, // 2: Out of sleep mode, no args, w/delay |
peekpt | 7:856a3443f68d | 67 | 255, // 255 = 500 ms delay |
peekpt | 7:856a3443f68d | 68 | ST7735_COLMOD, 1 + DELAY, // 3: Set color mode, 1 arg + delay: |
peekpt | 7:856a3443f68d | 69 | 0x05, // 16-bit color |
peekpt | 7:856a3443f68d | 70 | 10, // 10 ms delay |
peekpt | 7:856a3443f68d | 71 | ST7735_FRMCTR1, 3 + DELAY, // 4: Frame rate control, 3 args + delay: |
peekpt | 7:856a3443f68d | 72 | 0x00, // fastest refresh |
peekpt | 7:856a3443f68d | 73 | 0x06, // 6 lines front porch |
peekpt | 7:856a3443f68d | 74 | 0x03, // 3 lines back porch |
peekpt | 7:856a3443f68d | 75 | 10, // 10 ms delay |
peekpt | 7:856a3443f68d | 76 | ST7735_MADCTL, 1, // 5: Memory access ctrl (directions), 1 arg: |
peekpt | 7:856a3443f68d | 77 | 0x08, // Row addr/col addr, bottom to top refresh |
peekpt | 7:856a3443f68d | 78 | ST7735_DISSET5, 2, // 6: Display settings #5, 2 args, no delay: |
peekpt | 7:856a3443f68d | 79 | 0x15, // 1 clk cycle nonoverlap, 2 cycle gate |
peekpt | 7:856a3443f68d | 80 | // rise, 3 cycle osc equalize |
peekpt | 7:856a3443f68d | 81 | 0x02, // Fix on VTL |
peekpt | 7:856a3443f68d | 82 | ST7735_INVCTR, 1, // 7: Display inversion control, 1 arg: |
peekpt | 7:856a3443f68d | 83 | 0x0, // Line inversion |
peekpt | 7:856a3443f68d | 84 | ST7735_PWCTR1, 2 + DELAY, // 8: Power control, 2 args + delay: |
peekpt | 7:856a3443f68d | 85 | 0x02, // GVDD = 4.7V |
peekpt | 7:856a3443f68d | 86 | 0x70, // 1.0uA |
peekpt | 7:856a3443f68d | 87 | 10, // 10 ms delay |
peekpt | 7:856a3443f68d | 88 | ST7735_PWCTR2, 1, // 9: Power control, 1 arg, no delay: |
peekpt | 7:856a3443f68d | 89 | 0x05, // VGH = 14.7V, VGL = -7.35V |
peekpt | 7:856a3443f68d | 90 | ST7735_PWCTR3, 2, // 10: Power control, 2 args, no delay: |
peekpt | 7:856a3443f68d | 91 | 0x01, // Opamp current small |
peekpt | 7:856a3443f68d | 92 | 0x02, // Boost frequency |
peekpt | 7:856a3443f68d | 93 | ST7735_VMCTR1, 2 + DELAY, // 11: Power control, 2 args + delay: |
peekpt | 7:856a3443f68d | 94 | 0x3C, // VCOMH = 4V |
peekpt | 7:856a3443f68d | 95 | 0x38, // VCOML = -1.1V |
peekpt | 7:856a3443f68d | 96 | 10, // 10 ms delay |
peekpt | 7:856a3443f68d | 97 | ST7735_PWCTR6, 2, // 12: Power control, 2 args, no delay: |
peekpt | 7:856a3443f68d | 98 | 0x11, 0x15, ST7735_GMCTRP1, |
peekpt | 7:856a3443f68d | 99 | 16, // 13: Magical unicorn dust, 16 args, no delay: |
peekpt | 7:856a3443f68d | 100 | 0x09, 0x16, 0x09, 0x20, // (seriously though, not sure what |
peekpt | 7:856a3443f68d | 101 | 0x21, 0x1B, 0x13, 0x19, // these config values represent) |
peekpt | 7:856a3443f68d | 102 | 0x17, 0x15, 0x1E, 0x2B, 0x04, 0x05, 0x02, 0x0E, ST7735_GMCTRN1, |
peekpt | 7:856a3443f68d | 103 | 16 + DELAY, // 14: Sparkles and rainbows, 16 args + delay: |
peekpt | 7:856a3443f68d | 104 | 0x0B, 0x14, 0x08, 0x1E, // (ditto) |
peekpt | 7:856a3443f68d | 105 | 0x22, 0x1D, 0x18, 0x1E, 0x1B, 0x1A, 0x24, 0x2B, 0x06, 0x06, 0x02, 0x0F, |
peekpt | 7:856a3443f68d | 106 | 10, // 10 ms delay |
peekpt | 7:856a3443f68d | 107 | ST7735_CASET, 4, // 15: Column addr set, 4 args, no delay: |
peekpt | 7:856a3443f68d | 108 | 0x00, 0x02, // XSTART = 2 |
peekpt | 7:856a3443f68d | 109 | 0x00, 0x81, // XEND = 129 |
peekpt | 7:856a3443f68d | 110 | ST7735_RASET, 4, // 16: Row addr set, 4 args, no delay: |
peekpt | 7:856a3443f68d | 111 | 0x00, 0x02, // XSTART = 1 |
peekpt | 7:856a3443f68d | 112 | 0x00, 0x81, // XEND = 160 |
peekpt | 7:856a3443f68d | 113 | ST7735_NORON, DELAY, // 17: Normal display on, no args, w/delay |
peekpt | 7:856a3443f68d | 114 | 10, // 10 ms delay |
peekpt | 7:856a3443f68d | 115 | ST7735_DISPON, DELAY, // 18: Main screen turn on, no args, w/delay |
peekpt | 7:856a3443f68d | 116 | 255}, // 255 = 500 ms delay |
SomeRandomBloke | 3:5cd5edbf5b72 | 117 | |
peekpt | 7:856a3443f68d | 118 | Rcmd1[] = |
peekpt | 7:856a3443f68d | 119 | { // Init for 7735R, part 1 (red or green tab) |
peekpt | 7:856a3443f68d | 120 | 15, // 15 commands in list: |
peekpt | 7:856a3443f68d | 121 | ST7735_SWRESET, |
peekpt | 7:856a3443f68d | 122 | DELAY, // 1: Software reset, 0 args, w/delay |
peekpt | 7:856a3443f68d | 123 | 150, // 150 ms delay |
peekpt | 7:856a3443f68d | 124 | ST7735_SLPOUT, |
peekpt | 7:856a3443f68d | 125 | DELAY, // 2: Out of sleep mode, 0 args, w/delay |
peekpt | 7:856a3443f68d | 126 | 255, // 500 ms delay |
peekpt | 7:856a3443f68d | 127 | ST7735_FRMCTR1, |
peekpt | 7:856a3443f68d | 128 | 3, // 3: Frame rate ctrl - normal mode, 3 args: |
peekpt | 7:856a3443f68d | 129 | 0x01, |
peekpt | 7:856a3443f68d | 130 | 0x2C, |
peekpt | 7:856a3443f68d | 131 | 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D) |
peekpt | 7:856a3443f68d | 132 | ST7735_FRMCTR2, |
peekpt | 7:856a3443f68d | 133 | 3, // 4: Frame rate control - idle mode, 3 args: |
peekpt | 7:856a3443f68d | 134 | 0x01, |
peekpt | 7:856a3443f68d | 135 | 0x2C, |
peekpt | 7:856a3443f68d | 136 | 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D) |
peekpt | 7:856a3443f68d | 137 | ST7735_FRMCTR3, |
peekpt | 7:856a3443f68d | 138 | 6, // 5: Frame rate ctrl - partial mode, 6 args: |
peekpt | 7:856a3443f68d | 139 | 0x01, |
peekpt | 7:856a3443f68d | 140 | 0x2C, |
peekpt | 7:856a3443f68d | 141 | 0x2D, // Dot inversion mode |
peekpt | 7:856a3443f68d | 142 | 0x01, |
peekpt | 7:856a3443f68d | 143 | 0x2C, |
peekpt | 7:856a3443f68d | 144 | 0x2D, // Line inversion mode |
peekpt | 7:856a3443f68d | 145 | ST7735_INVCTR, |
peekpt | 7:856a3443f68d | 146 | 1, // 6: Display inversion ctrl, 1 arg, no delay: |
peekpt | 7:856a3443f68d | 147 | 0x07, // No inversion |
peekpt | 7:856a3443f68d | 148 | ST7735_PWCTR1, |
peekpt | 7:856a3443f68d | 149 | 3, // 7: Power control, 3 args, no delay: |
peekpt | 7:856a3443f68d | 150 | 0xA2, |
peekpt | 7:856a3443f68d | 151 | 0x02, // -4.6V |
peekpt | 7:856a3443f68d | 152 | 0x84, // AUTO mode |
peekpt | 7:856a3443f68d | 153 | ST7735_PWCTR2, |
peekpt | 7:856a3443f68d | 154 | 1, // 8: Power control, 1 arg, no delay: |
peekpt | 7:856a3443f68d | 155 | 0xC5, // VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD |
peekpt | 7:856a3443f68d | 156 | ST7735_PWCTR3, |
peekpt | 7:856a3443f68d | 157 | 2, // 9: Power control, 2 args, no delay: |
peekpt | 7:856a3443f68d | 158 | 0x0A, // Opamp current small |
peekpt | 7:856a3443f68d | 159 | 0x00, // Boost frequency |
peekpt | 7:856a3443f68d | 160 | ST7735_PWCTR4, |
peekpt | 7:856a3443f68d | 161 | 2, // 10: Power control, 2 args, no delay: |
peekpt | 7:856a3443f68d | 162 | 0x8A, // BCLK/2, Opamp current small & Medium low |
peekpt | 7:856a3443f68d | 163 | 0x2A, |
peekpt | 7:856a3443f68d | 164 | ST7735_PWCTR5, |
peekpt | 7:856a3443f68d | 165 | 2, // 11: Power control, 2 args, no delay: |
peekpt | 7:856a3443f68d | 166 | 0x8A, |
peekpt | 7:856a3443f68d | 167 | 0xEE, |
peekpt | 7:856a3443f68d | 168 | ST7735_VMCTR1, |
peekpt | 7:856a3443f68d | 169 | 1, // 12: Power control, 1 arg, no delay: |
peekpt | 7:856a3443f68d | 170 | 0x0E, |
peekpt | 7:856a3443f68d | 171 | ST7735_INVOFF, |
peekpt | 7:856a3443f68d | 172 | 0, // 13: Don't invert display, no args, no delay |
peekpt | 7:856a3443f68d | 173 | ST7735_MADCTL, |
peekpt | 7:856a3443f68d | 174 | 1, // 14: Memory access control (directions), 1 arg: |
peekpt | 7:856a3443f68d | 175 | 0xC8, // row addr/col addr, bottom to top refresh |
peekpt | 7:856a3443f68d | 176 | ST7735_COLMOD, |
peekpt | 7:856a3443f68d | 177 | 1, // 15: set color mode, 1 arg, no delay: |
peekpt | 7:856a3443f68d | 178 | 0x05}, // 16-bit color |
SomeRandomBloke | 3:5cd5edbf5b72 | 179 | |
peekpt | 7:856a3443f68d | 180 | Rcmd2green[] = |
peekpt | 7:856a3443f68d | 181 | { // Init for 7735R, part 2 (green tab only) |
peekpt | 7:856a3443f68d | 182 | 2, // 2 commands in list: |
peekpt | 7:856a3443f68d | 183 | ST7735_CASET, |
peekpt | 7:856a3443f68d | 184 | 4, // 1: Column addr set, 4 args, no delay: |
peekpt | 7:856a3443f68d | 185 | 0x00, |
peekpt | 7:856a3443f68d | 186 | 0x02, // XSTART = 0 |
peekpt | 7:856a3443f68d | 187 | 0x00, |
peekpt | 7:856a3443f68d | 188 | 0x7F + 0x02, // XEND = 127 |
peekpt | 7:856a3443f68d | 189 | ST7735_RASET, |
peekpt | 7:856a3443f68d | 190 | 4, // 2: Row addr set, 4 args, no delay: |
peekpt | 7:856a3443f68d | 191 | 0x00, |
peekpt | 7:856a3443f68d | 192 | 0x01, // XSTART = 0 |
peekpt | 7:856a3443f68d | 193 | 0x00, |
peekpt | 7:856a3443f68d | 194 | 0x9F + 0x01}, // XEND = 159 |
peekpt | 7:856a3443f68d | 195 | Rcmd2red[] = |
peekpt | 7:856a3443f68d | 196 | { // Init for 7735R, part 2 (red tab only) |
peekpt | 7:856a3443f68d | 197 | 2, // 2 commands in list: |
peekpt | 7:856a3443f68d | 198 | ST7735_CASET, |
peekpt | 7:856a3443f68d | 199 | 4, // 1: Column addr set, 4 args, no delay: |
peekpt | 7:856a3443f68d | 200 | 0x00, |
peekpt | 7:856a3443f68d | 201 | 0x00, // XSTART = 0 |
peekpt | 7:856a3443f68d | 202 | 0x00, |
peekpt | 7:856a3443f68d | 203 | 0x7F, // XEND = 127 |
peekpt | 7:856a3443f68d | 204 | ST7735_RASET, |
peekpt | 7:856a3443f68d | 205 | 4, // 2: Row addr set, 4 args, no delay: |
peekpt | 7:856a3443f68d | 206 | 0x00, |
peekpt | 7:856a3443f68d | 207 | 0x00, // XSTART = 0 |
peekpt | 7:856a3443f68d | 208 | 0x00, |
peekpt | 7:856a3443f68d | 209 | 0x9F}, // XEND = 159 |
SomeRandomBloke | 3:5cd5edbf5b72 | 210 | |
peekpt | 7:856a3443f68d | 211 | Rcmd2green144[] = |
peekpt | 7:856a3443f68d | 212 | { // Init for 7735R, part 2 (green 1.44 tab) |
peekpt | 7:856a3443f68d | 213 | 2, // 2 commands in list: |
peekpt | 7:856a3443f68d | 214 | ST7735_CASET, |
peekpt | 7:856a3443f68d | 215 | 4, // 1: Column addr set, 4 args, no delay: |
peekpt | 7:856a3443f68d | 216 | 0x00, |
peekpt | 7:856a3443f68d | 217 | 0x00, // XSTART = 0 |
peekpt | 7:856a3443f68d | 218 | 0x00, |
peekpt | 7:856a3443f68d | 219 | 0x7F, // XEND = 127 |
peekpt | 7:856a3443f68d | 220 | ST7735_RASET, |
peekpt | 7:856a3443f68d | 221 | 4, // 2: Row addr set, 4 args, no delay: |
peekpt | 7:856a3443f68d | 222 | 0x00, |
peekpt | 7:856a3443f68d | 223 | 0x00, // XSTART = 0 |
peekpt | 7:856a3443f68d | 224 | 0x00, |
peekpt | 7:856a3443f68d | 225 | 0x7F}, // XEND = 127 |
SomeRandomBloke | 3:5cd5edbf5b72 | 226 | |
peekpt | 7:856a3443f68d | 227 | Rcmd3[] = { // Init for 7735R, part 3 (red or green tab) |
peekpt | 7:856a3443f68d | 228 | 4, // 4 commands in list: |
peekpt | 7:856a3443f68d | 229 | ST7735_GMCTRP1, |
peekpt | 7:856a3443f68d | 230 | 16, // 1: Magical unicorn dust, 16 args, no delay: |
peekpt | 7:856a3443f68d | 231 | 0x02, |
peekpt | 7:856a3443f68d | 232 | 0x1c, |
peekpt | 7:856a3443f68d | 233 | 0x07, |
peekpt | 7:856a3443f68d | 234 | 0x12, |
peekpt | 7:856a3443f68d | 235 | 0x37, |
peekpt | 7:856a3443f68d | 236 | 0x32, |
peekpt | 7:856a3443f68d | 237 | 0x29, |
peekpt | 7:856a3443f68d | 238 | 0x2d, |
peekpt | 7:856a3443f68d | 239 | 0x29, |
peekpt | 7:856a3443f68d | 240 | 0x25, |
peekpt | 7:856a3443f68d | 241 | 0x2B, |
peekpt | 7:856a3443f68d | 242 | 0x39, |
peekpt | 7:856a3443f68d | 243 | 0x00, |
peekpt | 7:856a3443f68d | 244 | 0x01, |
peekpt | 7:856a3443f68d | 245 | 0x03, |
peekpt | 7:856a3443f68d | 246 | 0x10, |
peekpt | 7:856a3443f68d | 247 | ST7735_GMCTRN1, |
peekpt | 7:856a3443f68d | 248 | 16, // 2: Sparkles and rainbows, 16 args, no delay: |
peekpt | 7:856a3443f68d | 249 | 0x03, |
peekpt | 7:856a3443f68d | 250 | 0x1d, |
peekpt | 7:856a3443f68d | 251 | 0x07, |
peekpt | 7:856a3443f68d | 252 | 0x06, |
peekpt | 7:856a3443f68d | 253 | 0x2E, |
peekpt | 7:856a3443f68d | 254 | 0x2C, |
peekpt | 7:856a3443f68d | 255 | 0x29, |
peekpt | 7:856a3443f68d | 256 | 0x2D, |
peekpt | 7:856a3443f68d | 257 | 0x2E, |
peekpt | 7:856a3443f68d | 258 | 0x2E, |
peekpt | 7:856a3443f68d | 259 | 0x37, |
peekpt | 7:856a3443f68d | 260 | 0x3F, |
peekpt | 7:856a3443f68d | 261 | 0x00, |
peekpt | 7:856a3443f68d | 262 | 0x00, |
peekpt | 7:856a3443f68d | 263 | 0x02, |
peekpt | 7:856a3443f68d | 264 | 0x10, |
peekpt | 7:856a3443f68d | 265 | ST7735_NORON, |
peekpt | 7:856a3443f68d | 266 | DELAY, // 3: Normal display on, no args, w/delay |
peekpt | 7:856a3443f68d | 267 | 10, // 10 ms delay |
peekpt | 7:856a3443f68d | 268 | ST7735_DISPON, |
peekpt | 7:856a3443f68d | 269 | DELAY, // 4: Main screen turn on, no args w/delay |
peekpt | 7:856a3443f68d | 270 | 100}; // 100 ms delay |
SomeRandomBloke | 3:5cd5edbf5b72 | 271 | |
SomeRandomBloke | 0:99ee879ef5a9 | 272 | // Companion code to the above tables. Reads and issues |
SomeRandomBloke | 0:99ee879ef5a9 | 273 | // a series of LCD commands stored in byte array. |
peekpt | 7:856a3443f68d | 274 | void Adafruit_ST7735::commandList(uint8_t *addr) { |
peekpt | 7:856a3443f68d | 275 | uint8_t numCommands, numArgs; |
peekpt | 7:856a3443f68d | 276 | uint16_t ms; |
SomeRandomBloke | 0:99ee879ef5a9 | 277 | |
peekpt | 7:856a3443f68d | 278 | numCommands = *addr++; // Number of commands to follow |
peekpt | 7:856a3443f68d | 279 | while (numCommands--) { // For each command... |
peekpt | 7:856a3443f68d | 280 | writecommand(*addr++); // Read, issue command |
peekpt | 7:856a3443f68d | 281 | numArgs = *addr++; // Number of args to follow |
peekpt | 7:856a3443f68d | 282 | ms = numArgs & DELAY; // If hibit set, delay follows args |
peekpt | 7:856a3443f68d | 283 | numArgs &= ~DELAY; // Mask out delay bit |
peekpt | 7:856a3443f68d | 284 | while (numArgs--) { // For each argument... |
peekpt | 7:856a3443f68d | 285 | writedata(*addr++); // Read, issue argument |
peekpt | 7:856a3443f68d | 286 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 287 | |
peekpt | 7:856a3443f68d | 288 | if (ms) { |
peekpt | 7:856a3443f68d | 289 | ms = *addr++; // Read post-command delay time (ms) |
peekpt | 7:856a3443f68d | 290 | if (ms == 255) |
peekpt | 7:856a3443f68d | 291 | ms = 500; // If 255, delay for 500 ms |
peekpt | 7:856a3443f68d | 292 | ThisThread::sleep_for(ms); |
SomeRandomBloke | 0:99ee879ef5a9 | 293 | } |
peekpt | 7:856a3443f68d | 294 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 295 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 296 | |
SomeRandomBloke | 0:99ee879ef5a9 | 297 | // Initialization code common to both 'B' and 'R' type displays |
peekpt | 7:856a3443f68d | 298 | void Adafruit_ST7735::commonInit(uint8_t *cmdList) { |
peekpt | 7:856a3443f68d | 299 | |
peekpt | 7:856a3443f68d | 300 | colstart = rowstart = 0; // May be overridden in init func |
SomeRandomBloke | 0:99ee879ef5a9 | 301 | |
peekpt | 7:856a3443f68d | 302 | _rs = 1; |
peekpt | 7:856a3443f68d | 303 | _cs = 1; |
SomeRandomBloke | 0:99ee879ef5a9 | 304 | |
peekpt | 7:856a3443f68d | 305 | // use default SPI format |
peekpt | 8:66c5dc727281 | 306 | |
peekpt | 8:66c5dc727281 | 307 | // lcdPort.format(8, 0); |
peekpt | 8:66c5dc727281 | 308 | // lcdPort.frequency(4000000); |
peekpt | 8:66c5dc727281 | 309 | |
peekpt | 8:66c5dc727281 | 310 | lcdPort.setFormat(); |
SomeRandomBloke | 0:99ee879ef5a9 | 311 | |
peekpt | 7:856a3443f68d | 312 | // toggle RST low to reset; CS low so it'll listen to us |
peekpt | 7:856a3443f68d | 313 | _cs = 0; |
peekpt | 7:856a3443f68d | 314 | _rst = 1; |
peekpt | 7:856a3443f68d | 315 | ThisThread::sleep_for(100); |
peekpt | 7:856a3443f68d | 316 | _rst = 0; |
peekpt | 7:856a3443f68d | 317 | ThisThread::sleep_for(100); |
peekpt | 7:856a3443f68d | 318 | _rst = 1; |
peekpt | 7:856a3443f68d | 319 | ThisThread::sleep_for(100); |
SomeRandomBloke | 0:99ee879ef5a9 | 320 | |
peekpt | 7:856a3443f68d | 321 | if (cmdList) |
peekpt | 7:856a3443f68d | 322 | commandList(cmdList); |
SomeRandomBloke | 0:99ee879ef5a9 | 323 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 324 | |
SomeRandomBloke | 0:99ee879ef5a9 | 325 | // Initialization for ST7735B screens |
peekpt | 7:856a3443f68d | 326 | void Adafruit_ST7735::initB(void) { commonInit(Bcmd); } |
SomeRandomBloke | 0:99ee879ef5a9 | 327 | |
SomeRandomBloke | 0:99ee879ef5a9 | 328 | // Initialization for ST7735R screens (green or red tabs) |
SomeRandomBloke | 4:2123ea52a4d9 | 329 | void Adafruit_ST7735::initR(uint8_t options) { |
SomeRandomBloke | 4:2123ea52a4d9 | 330 | commonInit(Rcmd1); |
peekpt | 7:856a3443f68d | 331 | if (options == INITR_GREENTAB) { |
SomeRandomBloke | 4:2123ea52a4d9 | 332 | commandList(Rcmd2green); |
SomeRandomBloke | 4:2123ea52a4d9 | 333 | colstart = 2; |
SomeRandomBloke | 4:2123ea52a4d9 | 334 | rowstart = 1; |
peekpt | 7:856a3443f68d | 335 | } else if (options == INITR_GREENTAB2) { |
peekpt | 7:856a3443f68d | 336 | commandList(Rcmd2green); |
peekpt | 7:856a3443f68d | 337 | colstart = 1; |
peekpt | 7:856a3443f68d | 338 | rowstart = 2; |
peekpt | 7:856a3443f68d | 339 | } else if (options == INITR_144GREENTAB) { |
SomeRandomBloke | 4:2123ea52a4d9 | 340 | _height = ST7735_TFTHEIGHT_144; |
SomeRandomBloke | 4:2123ea52a4d9 | 341 | commandList(Rcmd2green144); |
SomeRandomBloke | 4:2123ea52a4d9 | 342 | colstart = 2; |
SomeRandomBloke | 4:2123ea52a4d9 | 343 | rowstart = 3; |
SomeRandomBloke | 4:2123ea52a4d9 | 344 | } else { |
SomeRandomBloke | 4:2123ea52a4d9 | 345 | // colstart, rowstart left at default '0' values |
SomeRandomBloke | 4:2123ea52a4d9 | 346 | commandList(Rcmd2red); |
SomeRandomBloke | 4:2123ea52a4d9 | 347 | } |
SomeRandomBloke | 4:2123ea52a4d9 | 348 | commandList(Rcmd3); |
SomeRandomBloke | 4:2123ea52a4d9 | 349 | |
SomeRandomBloke | 4:2123ea52a4d9 | 350 | // if black, change MADCTL color filter |
peekpt | 7:856a3443f68d | 351 | if (options == INITR_BLACKTAB || INITR_GREENTAB2) { |
SomeRandomBloke | 4:2123ea52a4d9 | 352 | writecommand(ST7735_MADCTL); |
SomeRandomBloke | 4:2123ea52a4d9 | 353 | writedata(0xC0); |
SomeRandomBloke | 4:2123ea52a4d9 | 354 | } |
SomeRandomBloke | 4:2123ea52a4d9 | 355 | |
SomeRandomBloke | 4:2123ea52a4d9 | 356 | tabcolor = options; |
SomeRandomBloke | 0:99ee879ef5a9 | 357 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 358 | |
SomeRandomBloke | 0:99ee879ef5a9 | 359 | void Adafruit_ST7735::setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, |
peekpt | 7:856a3443f68d | 360 | uint8_t y1) { |
peekpt | 7:856a3443f68d | 361 | writecommand(ST7735_CASET); // Column addr set |
peekpt | 7:856a3443f68d | 362 | writedata(0x00); |
peekpt | 7:856a3443f68d | 363 | writedata(x0 + colstart); // XSTART |
peekpt | 7:856a3443f68d | 364 | writedata(0x00); |
peekpt | 7:856a3443f68d | 365 | writedata(x1 + colstart); // XEND |
SomeRandomBloke | 0:99ee879ef5a9 | 366 | |
peekpt | 7:856a3443f68d | 367 | writecommand(ST7735_RASET); // Row addr set |
peekpt | 7:856a3443f68d | 368 | writedata(0x00); |
peekpt | 7:856a3443f68d | 369 | writedata(y0 + rowstart); // YSTART |
peekpt | 7:856a3443f68d | 370 | writedata(0x00); |
peekpt | 7:856a3443f68d | 371 | writedata(y1 + rowstart); // YEND |
SomeRandomBloke | 0:99ee879ef5a9 | 372 | |
peekpt | 7:856a3443f68d | 373 | writecommand(ST7735_RAMWR); // write to RAM |
SomeRandomBloke | 0:99ee879ef5a9 | 374 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 375 | |
peekpt | 7:856a3443f68d | 376 | void Adafruit_ST7735::pushColor(uint16_t color) { |
peekpt | 7:856a3443f68d | 377 | _rs = 1; |
peekpt | 7:856a3443f68d | 378 | _cs = 0; |
SomeRandomBloke | 0:99ee879ef5a9 | 379 | |
peekpt | 8:66c5dc727281 | 380 | lcdPort.fastWrite(color >> 8); |
peekpt | 8:66c5dc727281 | 381 | lcdPort.clearRX(); |
peekpt | 8:66c5dc727281 | 382 | lcdPort.fastWrite(color); |
peekpt | 8:66c5dc727281 | 383 | lcdPort.clearRX(); |
peekpt | 7:856a3443f68d | 384 | _cs = 1; |
SomeRandomBloke | 0:99ee879ef5a9 | 385 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 386 | |
peekpt | 7:856a3443f68d | 387 | void Adafruit_ST7735::drawPixel(int16_t x, int16_t y, uint16_t color) { |
peekpt | 7:856a3443f68d | 388 | if ((x < 0) || (x >= _width) || (y < 0) || (y >= _height)) |
peekpt | 7:856a3443f68d | 389 | return; |
SomeRandomBloke | 0:99ee879ef5a9 | 390 | |
peekpt | 7:856a3443f68d | 391 | setAddrWindow(x, y, x + 1, y + 1); |
SomeRandomBloke | 0:99ee879ef5a9 | 392 | |
peekpt | 7:856a3443f68d | 393 | _rs = 1; |
peekpt | 7:856a3443f68d | 394 | _cs = 0; |
SomeRandomBloke | 0:99ee879ef5a9 | 395 | |
peekpt | 8:66c5dc727281 | 396 | lcdPort.fastWrite(color >> 8); |
peekpt | 8:66c5dc727281 | 397 | lcdPort.clearRX(); |
peekpt | 8:66c5dc727281 | 398 | lcdPort.fastWrite(color); |
peekpt | 8:66c5dc727281 | 399 | lcdPort.clearRX(); |
SomeRandomBloke | 0:99ee879ef5a9 | 400 | |
peekpt | 7:856a3443f68d | 401 | _cs = 1; |
SomeRandomBloke | 0:99ee879ef5a9 | 402 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 403 | |
SomeRandomBloke | 0:99ee879ef5a9 | 404 | void Adafruit_ST7735::drawFastVLine(int16_t x, int16_t y, int16_t h, |
peekpt | 7:856a3443f68d | 405 | uint16_t color) { |
peekpt | 7:856a3443f68d | 406 | // Rudimentary clipping |
peekpt | 7:856a3443f68d | 407 | if ((x >= _width) || (y >= _height)) |
peekpt | 7:856a3443f68d | 408 | return; |
peekpt | 7:856a3443f68d | 409 | if ((y + h - 1) >= _height) |
peekpt | 7:856a3443f68d | 410 | h = _height - y; |
peekpt | 7:856a3443f68d | 411 | setAddrWindow(x, y, x, y + h - 1); |
SomeRandomBloke | 0:99ee879ef5a9 | 412 | |
peekpt | 7:856a3443f68d | 413 | uint8_t hi = color >> 8, lo = color; |
peekpt | 7:856a3443f68d | 414 | _rs = 1; |
peekpt | 7:856a3443f68d | 415 | _cs = 0; |
peekpt | 7:856a3443f68d | 416 | while (h--) { |
peekpt | 8:66c5dc727281 | 417 | lcdPort.fastWrite(hi); |
peekpt | 8:66c5dc727281 | 418 | lcdPort.clearRX(); |
peekpt | 8:66c5dc727281 | 419 | lcdPort.fastWrite(lo); |
peekpt | 8:66c5dc727281 | 420 | lcdPort.clearRX(); |
peekpt | 7:856a3443f68d | 421 | } |
peekpt | 7:856a3443f68d | 422 | _cs = 1; |
SomeRandomBloke | 0:99ee879ef5a9 | 423 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 424 | |
SomeRandomBloke | 0:99ee879ef5a9 | 425 | void Adafruit_ST7735::drawFastHLine(int16_t x, int16_t y, int16_t w, |
peekpt | 7:856a3443f68d | 426 | uint16_t color) { |
peekpt | 7:856a3443f68d | 427 | // Rudimentary clipping |
peekpt | 7:856a3443f68d | 428 | if ((x >= _width) || (y >= _height)) |
peekpt | 7:856a3443f68d | 429 | return; |
peekpt | 7:856a3443f68d | 430 | if ((x + w - 1) >= _width) |
peekpt | 7:856a3443f68d | 431 | w = _width - x; |
peekpt | 7:856a3443f68d | 432 | setAddrWindow(x, y, x + w - 1, y); |
SomeRandomBloke | 0:99ee879ef5a9 | 433 | |
peekpt | 7:856a3443f68d | 434 | uint8_t hi = color >> 8, lo = color; |
peekpt | 7:856a3443f68d | 435 | _rs = 1; |
peekpt | 7:856a3443f68d | 436 | _cs = 0; |
peekpt | 7:856a3443f68d | 437 | while (w--) { |
peekpt | 8:66c5dc727281 | 438 | lcdPort.fastWrite(hi); |
peekpt | 8:66c5dc727281 | 439 | lcdPort.clearRX(); |
peekpt | 8:66c5dc727281 | 440 | lcdPort.fastWrite(lo); |
peekpt | 8:66c5dc727281 | 441 | lcdPort.clearRX(); |
peekpt | 7:856a3443f68d | 442 | } |
peekpt | 7:856a3443f68d | 443 | _cs = 1; |
SomeRandomBloke | 0:99ee879ef5a9 | 444 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 445 | |
peekpt | 7:856a3443f68d | 446 | void Adafruit_ST7735::fillScreen(uint16_t color) { |
peekpt | 7:856a3443f68d | 447 | fillRect(0, 0, _width, _height, color); |
SomeRandomBloke | 4:2123ea52a4d9 | 448 | } |
SomeRandomBloke | 4:2123ea52a4d9 | 449 | |
SomeRandomBloke | 0:99ee879ef5a9 | 450 | // fill a rectangle |
SomeRandomBloke | 0:99ee879ef5a9 | 451 | void Adafruit_ST7735::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, |
peekpt | 7:856a3443f68d | 452 | uint16_t color) { |
peekpt | 7:856a3443f68d | 453 | // rudimentary clipping (drawChar w/big text requires this) |
peekpt | 7:856a3443f68d | 454 | if ((x >= _width) || (y >= _height)) |
peekpt | 7:856a3443f68d | 455 | return; |
peekpt | 7:856a3443f68d | 456 | if ((x + w - 1) >= _width) |
peekpt | 7:856a3443f68d | 457 | w = _width - x; |
peekpt | 7:856a3443f68d | 458 | if ((y + h - 1) >= _height) |
peekpt | 7:856a3443f68d | 459 | h = _height - y; |
SomeRandomBloke | 0:99ee879ef5a9 | 460 | |
peekpt | 7:856a3443f68d | 461 | setAddrWindow(x, y, x + w - 1, y + h - 1); |
SomeRandomBloke | 0:99ee879ef5a9 | 462 | |
peekpt | 7:856a3443f68d | 463 | uint8_t hi = color >> 8, lo = color; |
peekpt | 7:856a3443f68d | 464 | _rs = 1; |
peekpt | 7:856a3443f68d | 465 | _cs = 0; |
peekpt | 7:856a3443f68d | 466 | for (y = h; y > 0; y--) { |
peekpt | 7:856a3443f68d | 467 | for (x = w; x > 0; x--) { |
peekpt | 8:66c5dc727281 | 468 | lcdPort.fastWrite(hi); |
peekpt | 8:66c5dc727281 | 469 | lcdPort.clearRX(); |
peekpt | 8:66c5dc727281 | 470 | lcdPort.fastWrite(lo); |
peekpt | 8:66c5dc727281 | 471 | lcdPort.clearRX(); |
SomeRandomBloke | 0:99ee879ef5a9 | 472 | } |
peekpt | 7:856a3443f68d | 473 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 474 | |
peekpt | 7:856a3443f68d | 475 | _cs = 1; |
SomeRandomBloke | 0:99ee879ef5a9 | 476 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 477 | |
SomeRandomBloke | 0:99ee879ef5a9 | 478 | // Pass 8-bit (each) R,G,B, get back 16-bit packed color |
peekpt | 7:856a3443f68d | 479 | uint16_t Adafruit_ST7735::Color565(uint8_t r, uint8_t g, uint8_t b) { |
peekpt | 7:856a3443f68d | 480 | return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3); |
SomeRandomBloke | 0:99ee879ef5a9 | 481 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 482 | |
peekpt | 7:856a3443f68d | 483 | #define MADCTL_MY 0x80 |
peekpt | 7:856a3443f68d | 484 | #define MADCTL_MX 0x40 |
peekpt | 7:856a3443f68d | 485 | #define MADCTL_MV 0x20 |
peekpt | 7:856a3443f68d | 486 | #define MADCTL_ML 0x10 |
SomeRandomBloke | 6:c964b41674fc | 487 | #define MADCTL_RGB 0x00 |
SomeRandomBloke | 6:c964b41674fc | 488 | #define MADCTL_BGR 0x08 |
peekpt | 7:856a3443f68d | 489 | #define MADCTL_MH 0x04 |
SomeRandomBloke | 0:99ee879ef5a9 | 490 | |
SomeRandomBloke | 6:c964b41674fc | 491 | void Adafruit_ST7735::setRotation(uint8_t m) { |
SomeRandomBloke | 6:c964b41674fc | 492 | writecommand(ST7735_MADCTL); |
SomeRandomBloke | 6:c964b41674fc | 493 | rotation = m % 4; // can't be higher than 3 |
SomeRandomBloke | 6:c964b41674fc | 494 | switch (rotation) { |
peekpt | 7:856a3443f68d | 495 | case 0: |
peekpt | 7:856a3443f68d | 496 | if (tabcolor == INITR_BLACKTAB || INITR_GREENTAB2) { |
peekpt | 7:856a3443f68d | 497 | writedata(MADCTL_MX | MADCTL_MY | MADCTL_RGB); |
peekpt | 7:856a3443f68d | 498 | } else { |
peekpt | 7:856a3443f68d | 499 | writedata(MADCTL_MX | MADCTL_MY | MADCTL_BGR); |
peekpt | 7:856a3443f68d | 500 | } |
peekpt | 7:856a3443f68d | 501 | _width = ST7735_TFTWIDTH; |
SomeRandomBloke | 6:c964b41674fc | 502 | |
peekpt | 7:856a3443f68d | 503 | if (tabcolor == INITR_144GREENTAB) |
peekpt | 7:856a3443f68d | 504 | _height = ST7735_TFTHEIGHT_144; |
peekpt | 7:856a3443f68d | 505 | else |
peekpt | 7:856a3443f68d | 506 | _height = ST7735_TFTHEIGHT_18; |
SomeRandomBloke | 6:c964b41674fc | 507 | |
SomeRandomBloke | 6:c964b41674fc | 508 | break; |
peekpt | 7:856a3443f68d | 509 | case 1: |
peekpt | 7:856a3443f68d | 510 | if (tabcolor == INITR_BLACKTAB || INITR_GREENTAB2) { |
peekpt | 7:856a3443f68d | 511 | writedata(MADCTL_MY | MADCTL_MV | MADCTL_RGB); |
peekpt | 7:856a3443f68d | 512 | } else { |
peekpt | 7:856a3443f68d | 513 | writedata(MADCTL_MY | MADCTL_MV | MADCTL_BGR); |
peekpt | 7:856a3443f68d | 514 | } |
peekpt | 7:856a3443f68d | 515 | |
peekpt | 7:856a3443f68d | 516 | if (tabcolor == INITR_144GREENTAB) |
peekpt | 7:856a3443f68d | 517 | _width = ST7735_TFTHEIGHT_144; |
peekpt | 7:856a3443f68d | 518 | else |
peekpt | 7:856a3443f68d | 519 | _width = ST7735_TFTHEIGHT_18; |
SomeRandomBloke | 6:c964b41674fc | 520 | |
peekpt | 7:856a3443f68d | 521 | _height = ST7735_TFTWIDTH; |
peekpt | 7:856a3443f68d | 522 | break; |
peekpt | 7:856a3443f68d | 523 | case 2: |
peekpt | 7:856a3443f68d | 524 | if (tabcolor == INITR_BLACKTAB || INITR_GREENTAB2) { |
peekpt | 7:856a3443f68d | 525 | writedata(MADCTL_RGB); |
peekpt | 7:856a3443f68d | 526 | } else { |
peekpt | 7:856a3443f68d | 527 | writedata(MADCTL_BGR); |
peekpt | 7:856a3443f68d | 528 | } |
peekpt | 7:856a3443f68d | 529 | _width = ST7735_TFTWIDTH; |
peekpt | 7:856a3443f68d | 530 | if (tabcolor == INITR_144GREENTAB) |
peekpt | 7:856a3443f68d | 531 | _height = ST7735_TFTHEIGHT_144; |
peekpt | 7:856a3443f68d | 532 | else |
peekpt | 7:856a3443f68d | 533 | _height = ST7735_TFTHEIGHT_18; |
peekpt | 7:856a3443f68d | 534 | |
peekpt | 7:856a3443f68d | 535 | break; |
peekpt | 7:856a3443f68d | 536 | case 3: |
peekpt | 7:856a3443f68d | 537 | if (tabcolor == INITR_BLACKTAB || INITR_GREENTAB2) { |
peekpt | 7:856a3443f68d | 538 | writedata(MADCTL_MX | MADCTL_MV | MADCTL_RGB); |
peekpt | 7:856a3443f68d | 539 | } else { |
peekpt | 7:856a3443f68d | 540 | writedata(MADCTL_MX | MADCTL_MV | MADCTL_BGR); |
peekpt | 7:856a3443f68d | 541 | } |
peekpt | 7:856a3443f68d | 542 | if (tabcolor == INITR_144GREENTAB) |
peekpt | 7:856a3443f68d | 543 | _width = ST7735_TFTHEIGHT_144; |
peekpt | 7:856a3443f68d | 544 | else |
peekpt | 7:856a3443f68d | 545 | _width = ST7735_TFTHEIGHT_18; |
peekpt | 7:856a3443f68d | 546 | |
peekpt | 7:856a3443f68d | 547 | _height = ST7735_TFTWIDTH; |
peekpt | 7:856a3443f68d | 548 | break; |
SomeRandomBloke | 6:c964b41674fc | 549 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 550 | } |
SomeRandomBloke | 0:99ee879ef5a9 | 551 | |
peekpt | 7:856a3443f68d | 552 | void Adafruit_ST7735::invertDisplay(boolean i) { |
peekpt | 7:856a3443f68d | 553 | writecommand(i ? ST7735_INVON : ST7735_INVOFF); |
peekpt | 8:66c5dc727281 | 554 | } |