Skip to content
Newer
Older
100755 737 lines (612 sloc) 21.4 KB
e880eb1 @ladyada updated all the URLs
ladyada authored Sep 5, 2014
1 /***************************************************
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
2 This is a library for the Adafruit 1.8" SPI display.
e880eb1 @ladyada updated all the URLs
ladyada authored Sep 5, 2014
3
4 This library works with the Adafruit 1.8" TFT Breakout w/SD card
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
5 ----> http://www.adafruit.com/products/358
e880eb1 @ladyada updated all the URLs
ladyada authored Sep 5, 2014
6 The 1.8" TFT shield
7 ----> https://www.adafruit.com/product/802
8 The 1.44" TFT breakout
9 ----> https://www.adafruit.com/product/2088
10 as well as Adafruit raw 1.8" TFT display
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
11 ----> http://www.adafruit.com/products/618
e880eb1 @ladyada updated all the URLs
ladyada authored Sep 5, 2014
12
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
13 Check out the links above for our tutorials and wiring diagrams
14 These displays use SPI to communicate, 4 or 5 pins are required to
15 interface (RST is optional)
16 Adafruit invests time and resources providing this open source code,
17 please support Adafruit and open-source hardware by purchasing
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
18 products from Adafruit!
19
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
20 Written by Limor Fried/Ladyada for Adafruit Industries.
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
21 MIT license, all text above must be included in any redistribution
22 ****************************************************/
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
23
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
24 #include "Adafruit_ST7735.h"
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
25 #include <limits.h>
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
26 #include "pins_arduino.h"
27 #include "wiring_private.h"
28 #include <SPI.h>
29
3d868af @ladyada Added support for black tab (ST7735S?)
ladyada authored Mar 26, 2013
30 inline uint16_t swapcolor(uint16_t x) {
31 return (x << 11) | (x & 0x07E0) | (x >> 11);
32 }
33
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
34 #if defined (SPI_HAS_TRANSACTION)
35 static SPISettings mySPISettings;
36 #elif defined (__AVR__)
37 static uint8_t SPCRbackup;
38 static uint8_t mySPCR;
39 #endif
40
41
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
42
43 // Constructor when using software SPI. All output pins are configurable.
9bc135d @ladyada clean up the graphics test (unify!) and add 1.44" TFT support
ladyada authored Sep 5, 2014
44 Adafruit_ST7735::Adafruit_ST7735(int8_t cs, int8_t rs, int8_t sid, int8_t sclk, int8_t rst)
45 : Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT_18)
5e76c85 @PaintYourDragon Fix for recent Adafruit_GFX change
PaintYourDragon authored Jul 5, 2013
46 {
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
47 _cs = cs;
48 _rs = rs;
49 _sid = sid;
50 _sclk = sclk;
51 _rst = rst;
52 hwSPI = false;
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
53 }
54
21a2e77 @ladyada rotation for pixels, lines and fast lines
ladyada authored Dec 19, 2011
55
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
56 // Constructor when using hardware SPI. Faster, but must use SPI pins
57 // specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.)
9bc135d @ladyada clean up the graphics test (unify!) and add 1.44" TFT support
ladyada authored Sep 5, 2014
58 Adafruit_ST7735::Adafruit_ST7735(int8_t cs, int8_t rs, int8_t rst)
59 : Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT_18) {
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
60 _cs = cs;
61 _rs = rs;
62 _rst = rst;
63 hwSPI = true;
64 _sid = _sclk = 0;
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
65 }
66
8e44c98 @PaulStoffregen Support Teensy 3.0 & 3.1 using AVR code
PaulStoffregen authored Dec 14, 2013
67 #if defined(CORE_TEENSY) && !defined(__AVR__)
68 #define __AVR__
69 #endif
70
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
71 inline void Adafruit_ST7735::spiwrite(uint8_t c) {
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
72
73 //Serial.println(c, HEX);
74
75 if (hwSPI) {
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
76 #if defined (SPI_HAS_TRANSACTION)
77 SPI.transfer(c);
78 #elif defined (__AVR__)
79 SPCRbackup = SPCR;
80 SPCR = mySPCR;
81 SPI.transfer(c);
82 SPCR = SPCRbackup;
83 // SPDR = c;
84 // while(!(SPSR & _BV(SPIF)));
85 #elif defined (__arm__)
86 SPI.setClockDivider(21); //4MHz
87 SPI.setDataMode(SPI_MODE0);
e53687c @driverblock Support SPI Transactions
driverblock authored Aug 25, 2015
88 SPI.transfer(c);
89 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
90 } else {
91 // Fast SPI bitbang swiped from LPD8806 library
92 for(uint8_t bit = 0x80; bit; bit >>= 1) {
93 if(c & bit) *dataport |= datapinmask;
94 else *dataport &= ~datapinmask;
95 *clkport |= clkpinmask;
96 *clkport &= ~clkpinmask;
a5e5ad0 @jersagfast Added triangles, and roundrects.
jersagfast authored Dec 13, 2011
97 }
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
98 }
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
99 }
100
101
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
102 void Adafruit_ST7735::writecommand(uint8_t c) {
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
103 #if defined (SPI_HAS_TRANSACTION)
104 SPI.beginTransaction(mySPISettings);
105 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
106 *rsport &= ~rspinmask;
107 *csport &= ~cspinmask;
108
109 //Serial.print("C ");
110 spiwrite(c);
111
112 *csport |= cspinmask;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
113 #if defined (SPI_HAS_TRANSACTION)
114 SPI.endTransaction();
115 #endif
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
116 }
117
118
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
119 void Adafruit_ST7735::writedata(uint8_t c) {
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
120 #if defined (SPI_HAS_TRANSACTION)
121 SPI.beginTransaction(mySPISettings);
122 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
123 *rsport |= rspinmask;
124 *csport &= ~cspinmask;
a5e5ad0 @jersagfast Added triangles, and roundrects.
jersagfast authored Dec 13, 2011
125
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
126 //Serial.print("D ");
127 spiwrite(c);
128
129 *csport |= cspinmask;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
130 #if defined (SPI_HAS_TRANSACTION)
131 SPI.endTransaction();
132 #endif
968d8a7 @driverblock Add support for Arduino Due
driverblock authored Sep 22, 2013
133 }
134
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
135 // Rather than a bazillion writecommand() and writedata() calls, screen
136 // initialization commands and arguments are organized in these tables
137 // stored in PROGMEM. The table may look bulky, but that's mostly the
138 // formatting -- storage-wise this is hundreds of bytes more compact
139 // than the equivalent code. Companion function follows.
140 #define DELAY 0x80
98c5d9d @PaintYourDragon Modernized PROGMEM syntax
PaintYourDragon authored Nov 8, 2013
141 static const uint8_t PROGMEM
4aea3d1 @ladyada hmm undo last commit
ladyada authored Nov 12, 2012
142 Bcmd[] = { // Initialization commands for 7735B screens
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
143 18, // 18 commands in list:
144 ST7735_SWRESET, DELAY, // 1: Software reset, no args, w/delay
145 50, // 50 ms delay
146 ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, no args, w/delay
147 255, // 255 = 500 ms delay
148 ST7735_COLMOD , 1+DELAY, // 3: Set color mode, 1 arg + delay:
149 0x05, // 16-bit color
150 10, // 10 ms delay
151 ST7735_FRMCTR1, 3+DELAY, // 4: Frame rate control, 3 args + delay:
152 0x00, // fastest refresh
153 0x06, // 6 lines front porch
154 0x03, // 3 lines back porch
155 10, // 10 ms delay
156 ST7735_MADCTL , 1 , // 5: Memory access ctrl (directions), 1 arg:
157 0x08, // Row addr/col addr, bottom to top refresh
158 ST7735_DISSET5, 2 , // 6: Display settings #5, 2 args, no delay:
159 0x15, // 1 clk cycle nonoverlap, 2 cycle gate
160 // rise, 3 cycle osc equalize
161 0x02, // Fix on VTL
162 ST7735_INVCTR , 1 , // 7: Display inversion control, 1 arg:
163 0x0, // Line inversion
164 ST7735_PWCTR1 , 2+DELAY, // 8: Power control, 2 args + delay:
165 0x02, // GVDD = 4.7V
166 0x70, // 1.0uA
167 10, // 10 ms delay
168 ST7735_PWCTR2 , 1 , // 9: Power control, 1 arg, no delay:
169 0x05, // VGH = 14.7V, VGL = -7.35V
170 ST7735_PWCTR3 , 2 , // 10: Power control, 2 args, no delay:
171 0x01, // Opamp current small
172 0x02, // Boost frequency
173 ST7735_VMCTR1 , 2+DELAY, // 11: Power control, 2 args + delay:
174 0x3C, // VCOMH = 4V
175 0x38, // VCOML = -1.1V
176 10, // 10 ms delay
177 ST7735_PWCTR6 , 2 , // 12: Power control, 2 args, no delay:
178 0x11, 0x15,
179 ST7735_GMCTRP1,16 , // 13: Magical unicorn dust, 16 args, no delay:
180 0x09, 0x16, 0x09, 0x20, // (seriously though, not sure what
181 0x21, 0x1B, 0x13, 0x19, // these config values represent)
182 0x17, 0x15, 0x1E, 0x2B,
183 0x04, 0x05, 0x02, 0x0E,
184 ST7735_GMCTRN1,16+DELAY, // 14: Sparkles and rainbows, 16 args + delay:
185 0x0B, 0x14, 0x08, 0x1E, // (ditto)
186 0x22, 0x1D, 0x18, 0x1E,
187 0x1B, 0x1A, 0x24, 0x2B,
188 0x06, 0x06, 0x02, 0x0F,
189 10, // 10 ms delay
190 ST7735_CASET , 4 , // 15: Column addr set, 4 args, no delay:
191 0x00, 0x02, // XSTART = 2
192 0x00, 0x81, // XEND = 129
193 ST7735_RASET , 4 , // 16: Row addr set, 4 args, no delay:
194 0x00, 0x02, // XSTART = 1
195 0x00, 0x81, // XEND = 160
196 ST7735_NORON , DELAY, // 17: Normal display on, no args, w/delay
197 10, // 10 ms delay
198 ST7735_DISPON , DELAY, // 18: Main screen turn on, no args, w/delay
199 255 }, // 255 = 500 ms delay
200
201 Rcmd1[] = { // Init for 7735R, part 1 (red or green tab)
202 15, // 15 commands in list:
203 ST7735_SWRESET, DELAY, // 1: Software reset, 0 args, w/delay
204 150, // 150 ms delay
205 ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, 0 args, w/delay
206 255, // 500 ms delay
207 ST7735_FRMCTR1, 3 , // 3: Frame rate ctrl - normal mode, 3 args:
208 0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
209 ST7735_FRMCTR2, 3 , // 4: Frame rate control - idle mode, 3 args:
210 0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
211 ST7735_FRMCTR3, 6 , // 5: Frame rate ctrl - partial mode, 6 args:
212 0x01, 0x2C, 0x2D, // Dot inversion mode
213 0x01, 0x2C, 0x2D, // Line inversion mode
214 ST7735_INVCTR , 1 , // 6: Display inversion ctrl, 1 arg, no delay:
215 0x07, // No inversion
216 ST7735_PWCTR1 , 3 , // 7: Power control, 3 args, no delay:
217 0xA2,
218 0x02, // -4.6V
219 0x84, // AUTO mode
220 ST7735_PWCTR2 , 1 , // 8: Power control, 1 arg, no delay:
221 0xC5, // VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD
222 ST7735_PWCTR3 , 2 , // 9: Power control, 2 args, no delay:
223 0x0A, // Opamp current small
224 0x00, // Boost frequency
225 ST7735_PWCTR4 , 2 , // 10: Power control, 2 args, no delay:
226 0x8A, // BCLK/2, Opamp current small & Medium low
227 0x2A,
228 ST7735_PWCTR5 , 2 , // 11: Power control, 2 args, no delay:
229 0x8A, 0xEE,
230 ST7735_VMCTR1 , 1 , // 12: Power control, 1 arg, no delay:
231 0x0E,
232 ST7735_INVOFF , 0 , // 13: Don't invert display, no args, no delay
233 ST7735_MADCTL , 1 , // 14: Memory access control (directions), 1 arg:
234 0xC8, // row addr/col addr, bottom to top refresh
235 ST7735_COLMOD , 1 , // 15: set color mode, 1 arg, no delay:
4aea3d1 @ladyada hmm undo last commit
ladyada authored Nov 12, 2012
236 0x05 }, // 16-bit color
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
237
4aea3d1 @ladyada hmm undo last commit
ladyada authored Nov 12, 2012
238 Rcmd2green[] = { // Init for 7735R, part 2 (green tab only)
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
239 2, // 2 commands in list:
240 ST7735_CASET , 4 , // 1: Column addr set, 4 args, no delay:
241 0x00, 0x02, // XSTART = 0
242 0x00, 0x7F+0x02, // XEND = 127
243 ST7735_RASET , 4 , // 2: Row addr set, 4 args, no delay:
244 0x00, 0x01, // XSTART = 0
4aea3d1 @ladyada hmm undo last commit
ladyada authored Nov 12, 2012
245 0x00, 0x9F+0x01 }, // XEND = 159
246 Rcmd2red[] = { // Init for 7735R, part 2 (red tab only)
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
247 2, // 2 commands in list:
248 ST7735_CASET , 4 , // 1: Column addr set, 4 args, no delay:
249 0x00, 0x00, // XSTART = 0
250 0x00, 0x7F, // XEND = 127
251 ST7735_RASET , 4 , // 2: Row addr set, 4 args, no delay:
252 0x00, 0x00, // XSTART = 0
4aea3d1 @ladyada hmm undo last commit
ladyada authored Nov 12, 2012
253 0x00, 0x9F }, // XEND = 159
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
254
9bc135d @ladyada clean up the graphics test (unify!) and add 1.44" TFT support
ladyada authored Sep 5, 2014
255 Rcmd2green144[] = { // Init for 7735R, part 2 (green 1.44 tab)
256 2, // 2 commands in list:
257 ST7735_CASET , 4 , // 1: Column addr set, 4 args, no delay:
258 0x00, 0x00, // XSTART = 0
259 0x00, 0x7F, // XEND = 127
260 ST7735_RASET , 4 , // 2: Row addr set, 4 args, no delay:
261 0x00, 0x00, // XSTART = 0
262 0x00, 0x7F }, // XEND = 127
263
4aea3d1 @ladyada hmm undo last commit
ladyada authored Nov 12, 2012
264 Rcmd3[] = { // Init for 7735R, part 3 (red or green tab)
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
265 4, // 4 commands in list:
266 ST7735_GMCTRP1, 16 , // 1: Magical unicorn dust, 16 args, no delay:
267 0x02, 0x1c, 0x07, 0x12,
268 0x37, 0x32, 0x29, 0x2d,
269 0x29, 0x25, 0x2B, 0x39,
270 0x00, 0x01, 0x03, 0x10,
271 ST7735_GMCTRN1, 16 , // 2: Sparkles and rainbows, 16 args, no delay:
272 0x03, 0x1d, 0x07, 0x06,
273 0x2E, 0x2C, 0x29, 0x2D,
274 0x2E, 0x2E, 0x37, 0x3F,
275 0x00, 0x00, 0x02, 0x10,
276 ST7735_NORON , DELAY, // 3: Normal display on, no args, w/delay
277 10, // 10 ms delay
278 ST7735_DISPON , DELAY, // 4: Main screen turn on, no args w/delay
279 100 }; // 100 ms delay
280
281
282 // Companion code to the above tables. Reads and issues
283 // a series of LCD commands stored in PROGMEM byte array.
98c5d9d @PaintYourDragon Modernized PROGMEM syntax
PaintYourDragon authored Nov 8, 2013
284 void Adafruit_ST7735::commandList(const uint8_t *addr) {
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
285
5005a67 @PaintYourDragon Ties into Adafruit_GFX core graphics library
PaintYourDragon authored Apr 2, 2012
286 uint8_t numCommands, numArgs;
287 uint16_t ms;
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
288
289 numCommands = pgm_read_byte(addr++); // Number of commands to follow
290 while(numCommands--) { // For each command...
291 writecommand(pgm_read_byte(addr++)); // Read, issue command
292 numArgs = pgm_read_byte(addr++); // Number of args to follow
293 ms = numArgs & DELAY; // If hibit set, delay follows args
294 numArgs &= ~DELAY; // Mask out delay bit
295 while(numArgs--) { // For each argument...
296 writedata(pgm_read_byte(addr++)); // Read, issue argument
297 }
298
299 if(ms) {
300 ms = pgm_read_byte(addr++); // Read post-command delay time (ms)
301 if(ms == 255) ms = 500; // If 255, delay for 500 ms
302 delay(ms);
303 }
304 }
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
305 }
306
307
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
308 // Initialization code common to both 'B' and 'R' type displays
98c5d9d @PaintYourDragon Modernized PROGMEM syntax
PaintYourDragon authored Nov 8, 2013
309 void Adafruit_ST7735::commonInit(const uint8_t *cmdList) {
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
310 colstart = rowstart = 0; // May be overridden in init func
311
312 pinMode(_rs, OUTPUT);
313 pinMode(_cs, OUTPUT);
314 csport = portOutputRegister(digitalPinToPort(_cs));
315 rsport = portOutputRegister(digitalPinToPort(_rs));
968d8a7 @driverblock Add support for Arduino Due
driverblock authored Sep 22, 2013
316 cspinmask = digitalPinToBitMask(_cs);
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
317 rspinmask = digitalPinToBitMask(_rs);
318
319 if(hwSPI) { // Using hardware SPI
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
320 #if defined (SPI_HAS_TRANSACTION)
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
321 SPI.begin();
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
322 mySPISettings = SPISettings(8000000, MSBFIRST, SPI_MODE0);
323 #elif defined (__AVR__)
324 SPCRbackup = SPCR;
325 SPI.begin();
326 SPI.setClockDivider(SPI_CLOCK_DIV4);
327 SPI.setDataMode(SPI_MODE0);
328 mySPCR = SPCR; // save our preferred state
329 //Serial.print("mySPCR = 0x"); Serial.println(SPCR, HEX);
330 SPCR = SPCRbackup; // then restore
331 #elif defined (__SAM3X8E__)
332 SPI.begin();
333 SPI.setClockDivider(21); //4MHz
334 SPI.setDataMode(SPI_MODE0);
335 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
336 } else {
337 pinMode(_sclk, OUTPUT);
338 pinMode(_sid , OUTPUT);
339 clkport = portOutputRegister(digitalPinToPort(_sclk));
340 dataport = portOutputRegister(digitalPinToPort(_sid));
968d8a7 @driverblock Add support for Arduino Due
driverblock authored Sep 22, 2013
341 clkpinmask = digitalPinToBitMask(_sclk);
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
342 datapinmask = digitalPinToBitMask(_sid);
343 *clkport &= ~clkpinmask;
344 *dataport &= ~datapinmask;
d1ae2c3 @ladyada Merge branch 'master' of github.com:adafruit/ST7735-Library
ladyada authored Jan 29, 2012
345 }
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
346
347 // toggle RST low to reset; CS low so it'll listen to us
348 *csport &= ~cspinmask;
349 if (_rst) {
350 pinMode(_rst, OUTPUT);
351 digitalWrite(_rst, HIGH);
352 delay(500);
353 digitalWrite(_rst, LOW);
354 delay(500);
355 digitalWrite(_rst, HIGH);
356 delay(500);
d1ae2c3 @ladyada Merge branch 'master' of github.com:adafruit/ST7735-Library
ladyada authored Jan 29, 2012
357 }
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
358
359 if(cmdList) commandList(cmdList);
360 }
361
362
363 // Initialization for ST7735B screens
364 void Adafruit_ST7735::initB(void) {
365 commonInit(Bcmd);
366 }
367
368
369 // Initialization for ST7735R screens (green or red tabs)
370 void Adafruit_ST7735::initR(uint8_t options) {
371 commonInit(Rcmd1);
372 if(options == INITR_GREENTAB) {
373 commandList(Rcmd2green);
374 colstart = 2;
375 rowstart = 1;
9bc135d @ladyada clean up the graphics test (unify!) and add 1.44" TFT support
ladyada authored Sep 5, 2014
376 } else if(options == INITR_144GREENTAB) {
377 _height = ST7735_TFTHEIGHT_144;
378 commandList(Rcmd2green144);
379 colstart = 2;
380 rowstart = 3;
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
381 } else {
382 // colstart, rowstart left at default '0' values
383 commandList(Rcmd2red);
21a2e77 @ladyada rotation for pixels, lines and fast lines
ladyada authored Dec 19, 2011
384 }
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
385 commandList(Rcmd3);
3c00bd1 @ladyada fix for black tab using MADCTL
ladyada authored Apr 29, 2013
386
387 // if black, change MADCTL color filter
388 if (options == INITR_BLACKTAB) {
389 writecommand(ST7735_MADCTL);
390 writedata(0xC0);
391 }
392
3d868af @ladyada Added support for black tab (ST7735S?)
ladyada authored Mar 26, 2013
393 tabcolor = options;
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
394 }
395
396
397 void Adafruit_ST7735::setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1,
398 uint8_t y1) {
399
400 writecommand(ST7735_CASET); // Column addr set
401 writedata(0x00);
402 writedata(x0+colstart); // XSTART
403 writedata(0x00);
404 writedata(x1+colstart); // XEND
405
406 writecommand(ST7735_RASET); // Row addr set
407 writedata(0x00);
408 writedata(y0+rowstart); // YSTART
409 writedata(0x00);
410 writedata(y1+rowstart); // YEND
411
412 writecommand(ST7735_RAMWR); // write to RAM
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
413 }
414
415
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
416 void Adafruit_ST7735::pushColor(uint16_t color) {
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
417 #if defined (SPI_HAS_TRANSACTION)
418 SPI.beginTransaction(mySPISettings);
419 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
420 *rsport |= rspinmask;
421 *csport &= ~cspinmask;
968d8a7 @driverblock Add support for Arduino Due
driverblock authored Sep 22, 2013
422
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
423 spiwrite(color >> 8);
424 spiwrite(color);
425
426 *csport |= cspinmask;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
427 #if defined (SPI_HAS_TRANSACTION)
428 SPI.endTransaction();
429 #endif
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
430 }
431
d742806 @PaintYourDragon Tweaks for Adafruit_GFX
PaintYourDragon authored Apr 9, 2012
432 void Adafruit_ST7735::drawPixel(int16_t x, int16_t y, uint16_t color) {
14d2c0e @ladyada Added support for ST7735R init code and differentiated between R and B
ladyada authored May 11, 2011
433
d742806 @PaintYourDragon Tweaks for Adafruit_GFX
PaintYourDragon authored Apr 10, 2012
434 if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
435
436 setAddrWindow(x,y,x+1,y+1);
437
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
438 #if defined (SPI_HAS_TRANSACTION)
439 SPI.beginTransaction(mySPISettings);
440 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
441 *rsport |= rspinmask;
442 *csport &= ~cspinmask;
968d8a7 @driverblock Add support for Arduino Due
driverblock authored Sep 22, 2013
443
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
444 spiwrite(color >> 8);
445 spiwrite(color);
446
447 *csport |= cspinmask;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
448 #if defined (SPI_HAS_TRANSACTION)
449 SPI.endTransaction();
450 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
451 }
452
453
d742806 @PaintYourDragon Tweaks for Adafruit_GFX
PaintYourDragon authored Apr 10, 2012
454 void Adafruit_ST7735::drawFastVLine(int16_t x, int16_t y, int16_t h,
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
455 uint16_t color) {
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
456
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
457 // Rudimentary clipping
458 if((x >= _width) || (y >= _height)) return;
737712e @PaintYourDragon Corrected Adafruit_GFX library integration
PaintYourDragon authored Apr 3, 2012
459 if((y+h-1) >= _height) h = _height-y;
460 setAddrWindow(x, y, x, y+h-1);
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
461
462 uint8_t hi = color >> 8, lo = color;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
463
464 #if defined (SPI_HAS_TRANSACTION)
465 SPI.beginTransaction(mySPISettings);
466 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
467 *rsport |= rspinmask;
468 *csport &= ~cspinmask;
737712e @PaintYourDragon Corrected Adafruit_GFX library integration
PaintYourDragon authored Apr 3, 2012
469 while (h--) {
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
470 spiwrite(hi);
471 spiwrite(lo);
472 }
473 *csport |= cspinmask;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
474 #if defined (SPI_HAS_TRANSACTION)
475 SPI.endTransaction();
476 #endif
21a2e77 @ladyada rotation for pixels, lines and fast lines
ladyada authored Dec 19, 2011
477 }
478
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
479
d742806 @PaintYourDragon Tweaks for Adafruit_GFX
PaintYourDragon authored Apr 10, 2012
480 void Adafruit_ST7735::drawFastHLine(int16_t x, int16_t y, int16_t w,
737712e @PaintYourDragon Corrected Adafruit_GFX library integration
PaintYourDragon authored Apr 3, 2012
481 uint16_t color) {
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
482
483 // Rudimentary clipping
484 if((x >= _width) || (y >= _height)) return;
737712e @PaintYourDragon Corrected Adafruit_GFX library integration
PaintYourDragon authored Apr 3, 2012
485 if((x+w-1) >= _width) w = _width-x;
486 setAddrWindow(x, y, x+w-1, y);
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
487
488 uint8_t hi = color >> 8, lo = color;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
489
490 #if defined (SPI_HAS_TRANSACTION)
491 SPI.beginTransaction(mySPISettings);
492 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
493 *rsport |= rspinmask;
494 *csport &= ~cspinmask;
737712e @PaintYourDragon Corrected Adafruit_GFX library integration
PaintYourDragon authored Apr 3, 2012
495 while (w--) {
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
496 spiwrite(hi);
497 spiwrite(lo);
498 }
499 *csport |= cspinmask;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
500 #if defined (SPI_HAS_TRANSACTION)
501 SPI.endTransaction();
502 #endif
21a2e77 @ladyada rotation for pixels, lines and fast lines
ladyada authored Dec 19, 2011
503 }
14d2c0e @ladyada Added support for ST7735R init code and differentiated between R and B
ladyada authored May 11, 2011
504
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
505
3d868af @ladyada Added support for black tab (ST7735S?)
ladyada authored Mar 26, 2013
506
507 void Adafruit_ST7735::fillScreen(uint16_t color) {
508 fillRect(0, 0, _width, _height, color);
509 }
510
511
512
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
513 // fill a rectangle
d742806 @PaintYourDragon Tweaks for Adafruit_GFX
PaintYourDragon authored Apr 10, 2012
514 void Adafruit_ST7735::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
737712e @PaintYourDragon Corrected Adafruit_GFX library integration
PaintYourDragon authored Apr 3, 2012
515 uint16_t color) {
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
516
517 // rudimentary clipping (drawChar w/big text requires this)
518 if((x >= _width) || (y >= _height)) return;
519 if((x + w - 1) >= _width) w = _width - x;
520 if((y + h - 1) >= _height) h = _height - y;
521
522 setAddrWindow(x, y, x+w-1, y+h-1);
523
524 uint8_t hi = color >> 8, lo = color;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
525
526 #if defined (SPI_HAS_TRANSACTION)
527 SPI.beginTransaction(mySPISettings);
528 #endif
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
529 *rsport |= rspinmask;
530 *csport &= ~cspinmask;
531 for(y=h; y>0; y--) {
532 for(x=w; x>0; x--) {
533 spiwrite(hi);
534 spiwrite(lo);
535 }
536 }
537
538 *csport |= cspinmask;
a0b3f47 @driverblock Improved SPI transactions, doubled SPI speed
driverblock authored Sep 6, 2015
539 #if defined (SPI_HAS_TRANSACTION)
540 SPI.endTransaction();
541 #endif
a5e5ad0 @jersagfast Added triangles, and roundrects.
jersagfast authored Dec 13, 2011
542 }
543
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
544
545 // Pass 8-bit (each) R,G,B, get back 16-bit packed color
546 uint16_t Adafruit_ST7735::Color565(uint8_t r, uint8_t g, uint8_t b) {
547 return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
548 }
549
21a2e77 @ladyada rotation for pixels, lines and fast lines
ladyada authored Dec 19, 2011
550
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
551 #define MADCTL_MY 0x80
552 #define MADCTL_MX 0x40
553 #define MADCTL_MV 0x20
554 #define MADCTL_ML 0x10
3c00bd1 @ladyada fix for black tab using MADCTL
ladyada authored Apr 30, 2013
555 #define MADCTL_RGB 0x00
556 #define MADCTL_BGR 0x08
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
557 #define MADCTL_MH 0x04
558
559 void Adafruit_ST7735::setRotation(uint8_t m) {
560
561 writecommand(ST7735_MADCTL);
562 rotation = m % 4; // can't be higher than 3
563 switch (rotation) {
564 case 0:
3c00bd1 @ladyada fix for black tab using MADCTL
ladyada authored Apr 30, 2013
565 if (tabcolor == INITR_BLACKTAB) {
566 writedata(MADCTL_MX | MADCTL_MY | MADCTL_RGB);
567 } else {
568 writedata(MADCTL_MX | MADCTL_MY | MADCTL_BGR);
569 }
570 _width = ST7735_TFTWIDTH;
9bc135d @ladyada clean up the graphics test (unify!) and add 1.44" TFT support
ladyada authored Sep 5, 2014
571
572 if (tabcolor == INITR_144GREENTAB)
573 _height = ST7735_TFTHEIGHT_144;
574 else
575 _height = ST7735_TFTHEIGHT_18;
576
3c00bd1 @ladyada fix for black tab using MADCTL
ladyada authored Apr 30, 2013
577 break;
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
578 case 1:
3c00bd1 @ladyada fix for black tab using MADCTL
ladyada authored Apr 30, 2013
579 if (tabcolor == INITR_BLACKTAB) {
580 writedata(MADCTL_MY | MADCTL_MV | MADCTL_RGB);
581 } else {
582 writedata(MADCTL_MY | MADCTL_MV | MADCTL_BGR);
583 }
9bc135d @ladyada clean up the graphics test (unify!) and add 1.44" TFT support
ladyada authored Sep 5, 2014
584
585 if (tabcolor == INITR_144GREENTAB)
586 _width = ST7735_TFTHEIGHT_144;
587 else
588 _width = ST7735_TFTHEIGHT_18;
589
3c00bd1 @ladyada fix for black tab using MADCTL
ladyada authored Apr 30, 2013
590 _height = ST7735_TFTWIDTH;
591 break;
592 case 2:
593 if (tabcolor == INITR_BLACKTAB) {
594 writedata(MADCTL_RGB);
595 } else {
596 writedata(MADCTL_BGR);
597 }
598 _width = ST7735_TFTWIDTH;
9bc135d @ladyada clean up the graphics test (unify!) and add 1.44" TFT support
ladyada authored Sep 5, 2014
599 if (tabcolor == INITR_144GREENTAB)
600 _height = ST7735_TFTHEIGHT_144;
601 else
602 _height = ST7735_TFTHEIGHT_18;
603
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
604 break;
605 case 3:
3c00bd1 @ladyada fix for black tab using MADCTL
ladyada authored Apr 30, 2013
606 if (tabcolor == INITR_BLACKTAB) {
607 writedata(MADCTL_MX | MADCTL_MV | MADCTL_RGB);
608 } else {
609 writedata(MADCTL_MX | MADCTL_MV | MADCTL_BGR);
610 }
9bc135d @ladyada clean up the graphics test (unify!) and add 1.44" TFT support
ladyada authored Sep 5, 2014
611 if (tabcolor == INITR_144GREENTAB)
612 _width = ST7735_TFTHEIGHT_144;
613 else
614 _width = ST7735_TFTHEIGHT_18;
615
3c00bd1 @ladyada fix for black tab using MADCTL
ladyada authored Apr 30, 2013
616 _height = ST7735_TFTWIDTH;
617 break;
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
618 }
da4f019 @ladyada initial commit of working code & example sketch
ladyada authored May 5, 2011
619 }
620
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
621
737712e @PaintYourDragon Corrected Adafruit_GFX library integration
PaintYourDragon authored Apr 3, 2012
622 void Adafruit_ST7735::invertDisplay(boolean i) {
623 writecommand(i ? ST7735_INVON : ST7735_INVOFF);
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
624 }
625
626
627 ////////// stuff not actively being used, but kept for posterity
14d2c0e @ladyada Added support for ST7735R init code and differentiated between R and B
ladyada authored May 11, 2011
628 /*
3b1e2de @PaintYourDragon Many bug fixes, esp. BMP file and triangle rendering
PaintYourDragon authored Mar 6, 2012
629
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
630 uint8_t Adafruit_ST7735::spiread(void) {
a5e5ad0 @jersagfast Added triangles, and roundrects.
jersagfast authored Dec 13, 2011
631 uint8_t r = 0;
632 if (_sid > 0) {
633 r = shiftIn(_sid, _sclk, MSBFIRST);
634 } else {
635 //SID_DDR &= ~_BV(SID);
636 //int8_t i;
637 //for (i=7; i>=0; i--) {
638 // SCLK_PORT &= ~_BV(SCLK);
639 // r <<= 1;
640 // r |= (SID_PIN >> SID) & 0x1;
641 // SCLK_PORT |= _BV(SCLK);
642 //}
643 //SID_DDR |= _BV(SID);
644
645 }
646 return r;
647 }
648
649
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
650 void Adafruit_ST7735::dummyclock(void) {
a5e5ad0 @jersagfast Added triangles, and roundrects.
jersagfast authored Dec 13, 2011
651
652 if (_sid > 0) {
653 digitalWrite(_sclk, LOW);
654 digitalWrite(_sclk, HIGH);
655 } else {
656 // SCLK_PORT &= ~_BV(SCLK);
657 //SCLK_PORT |= _BV(SCLK);
658 }
659 }
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
660 uint8_t Adafruit_ST7735::readdata(void) {
a5e5ad0 @jersagfast Added triangles, and roundrects.
jersagfast authored Dec 13, 2011
661 *portOutputRegister(rsport) |= rspin;
662
663 *portOutputRegister(csport) &= ~ cspin;
664
665 uint8_t r = spiread();
666
667 *portOutputRegister(csport) |= cspin;
668
669 return r;
670
671 }
672
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
673 uint8_t Adafruit_ST7735::readcommand8(uint8_t c) {
a5e5ad0 @jersagfast Added triangles, and roundrects.
jersagfast authored Dec 13, 2011
674 digitalWrite(_rs, LOW);
675
676 *portOutputRegister(csport) &= ~ cspin;
677
678 spiwrite(c);
679
680 digitalWrite(_rs, HIGH);
681 pinMode(_sid, INPUT); // input!
682 digitalWrite(_sid, LOW); // low
683 spiread();
684 uint8_t r = spiread();
685
686
687 *portOutputRegister(csport) |= cspin;
688
689
690 pinMode(_sid, OUTPUT); // back to output
691 return r;
692 }
693
694
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
695 uint16_t Adafruit_ST7735::readcommand16(uint8_t c) {
a5e5ad0 @jersagfast Added triangles, and roundrects.
jersagfast authored Dec 13, 2011
696 digitalWrite(_rs, LOW);
697 if (_cs)
698 digitalWrite(_cs, LOW);
699
700 spiwrite(c);
701 pinMode(_sid, INPUT); // input!
702 uint16_t r = spiread();
703 r <<= 8;
704 r |= spiread();
705 if (_cs)
706 digitalWrite(_cs, HIGH);
707
708 pinMode(_sid, OUTPUT); // back to output
709 return r;
710 }
711
9f680f9 @ladyada Changed naming, graphics test
ladyada authored Jan 29, 2012
712 uint32_t Adafruit_ST7735::readcommand32(uint8_t c) {
a5e5ad0 @jersagfast Added triangles, and roundrects.
jersagfast authored Dec 13, 2011
713 digitalWrite(_rs, LOW);
714 if (_cs)
715 digitalWrite(_cs, LOW);
716 spiwrite(c);
717 pinMode(_sid, INPUT); // input!
718
719 dummyclock();
720 dummyclock();
721
722 uint32_t r = spiread();
723 r <<= 8;
724 r |= spiread();
725 r <<= 8;
726 r |= spiread();
727 r <<= 8;
728 r |= spiread();
729 if (_cs)
730 digitalWrite(_cs, HIGH);
731
732 pinMode(_sid, OUTPUT); // back to output
733 return r;
734 }
735
21a2e77 @ladyada rotation for pixels, lines and fast lines
ladyada authored Dec 19, 2011
736 */
Something went wrong with that request. Please try again.