MCPcopy Create free account
hub / github.com/cbm80amiga/Arduino_ST7789_Fast / copyMulti

Method copyMulti

Arduino_ST7789_Fast.cpp:182–215  ·  view source on GitHub ↗

---------------------------------------------------------- fast method to send multiple 16-bit values from RAM via SPI

Source from the content-addressed store, hash-verified

180// ----------------------------------------------------------
181// fast method to send multiple 16-bit values from RAM via SPI
182inline void Arduino_ST7789::copyMulti(uint8_t *img, uint16_t num)
183{
184#ifdef COMPATIBILITY_MODE
185 while(num--) { SPI.transfer(*(img+1)); SPI.transfer(*(img+0)); img+=2; }
186#else
187 uint8_t lo,hi;
188 asm volatile
189 (
190 "nextCopy:\n"
191 "ld %[hi],%a[img]+\n"
192 "ld %[lo],%a[img]+\n"
193 "out %[spdr],%[lo]\n"
194 "rjmp .+0\n" // wait 8*2+1 = 17 cycles
195 "rjmp .+0\n"
196 "rjmp .+0\n"
197 "rjmp .+0\n"
198 "rjmp .+0\n"
199 "rjmp .+0\n"
200 "rjmp .+0\n"
201 "rjmp .+0\n"
202 "nop\n"
203 "out %[spdr],%[hi]\n"
204 "rjmp .+0\n" // wait 4*2+1 = 9 cycles + sbiw + brne + ld*2
205 "rjmp .+0\n"
206 "rjmp .+0\n"
207 "rjmp .+0\n"
208 "nop\n"
209 "sbiw %[num],1\n"
210 "brne nextCopy\n"
211 : [num] "+w" (num)
212 : [spdr] "I" (_SFR_IO_ADDR(SPDR)), [img] "e" (img), [lo] "r" (lo), [hi] "r" (hi)
213 );
214#endif
215}
216// ----------------------------------------------------------
217Arduino_ST7789::Arduino_ST7789(int8_t dc, int8_t rst, int8_t cs) : Adafruit_GFX(ST7789_TFTWIDTH, ST7789_TFTHEIGHT)
218{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected