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

Method writeMulti

Arduino_ST7789_Fast.cpp:147–179  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

145// ----------------------------------------------------------
146// fast method to send multiple 16-bit values via SPI
147inline void Arduino_ST7789::writeMulti(uint16_t color, uint16_t num)
148{
149#ifdef COMPATIBILITY_MODE
150 while(num--) { SPI.transfer(color>>8); SPI.transfer(color); }
151#else
152 asm volatile
153 (
154 "next:\n"
155 "out %[spdr],%[hi]\n"
156 "rjmp .+0\n" // wait 8*2+1 = 17 cycles
157 "rjmp .+0\n"
158 "rjmp .+0\n"
159 "rjmp .+0\n"
160 "rjmp .+0\n"
161 "rjmp .+0\n"
162 "rjmp .+0\n"
163 "rjmp .+0\n"
164 "nop\n"
165 "out %[spdr],%[lo]\n"
166 "rjmp .+0\n" // wait 6*2+1 = 13 cycles + sbiw + brne
167 "rjmp .+0\n"
168 "rjmp .+0\n"
169 "rjmp .+0\n"
170 "rjmp .+0\n"
171 "rjmp .+0\n"
172 "nop\n"
173 "sbiw %[num],1\n"
174 "brne next\n"
175 : [num] "+w" (num)
176 : [spdr] "I" (_SFR_IO_ADDR(SPDR)), [lo] "r" ((uint8_t)color), [hi] "r" ((uint8_t)(color>>8))
177 );
178#endif
179}
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)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected