FastLED 3.9.15
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

◆ writeBytes() [1/2]

template<uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint32_t SPI_SPEED>
template<class D>
void AVRSoftwareSPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED >::writeBytes ( FASTLED_REGISTER uint8_t * data,
int len )
inline

Write an array of data to the SPI interface.

Template Parameters
DPer-byte modifier class, e.g. DATA_NOP
Parameters
datapointer to data to write
lennumber of bytes to write
Todo
Need to type this better so that explicit casts into the call aren't required.

Definition at line 298 of file fastspi_bitbang.h.

298 {
299 select();
300#ifdef FAST_SPI_INTERRUPTS_WRITE_PINS
301 uint8_t *end = data + len;
302 while(data != end) {
304 }
305#else
308
310 // If data and clock are on different ports, then writing a bit will consist of writing the value foor
311 // the bit (hi or low) to the data pin port, and then two writes to the clock port to strobe the clock line
316 uint8_t *end = data + len;
317
318 while(data != end) {
320 }
321
322 } else {
323 // FastPin<CLOCK_PIN>::hi();
324 // If data and clock are on the same port then we can combine setting the data and clock pins
329
330 uint8_t *end = data + len;
331
332 while(data != end) {
334 }
335 // FastPin<CLOCK_PIN>::lo();
336 }
337#endif
339 release();
340 }
void select()
Select the SPI output (chip select)
static void writeByte(uint8_t b)
Write a single byte over SPI.
void release()
Release the SPI chip select line.
FastPin< CLOCK_PIN >::port_t clock_t
FastPin< DATA_PIN >::port_t data_t
FastPin< DATA_PIN >::port_ptr_t data_ptr_t
FastPin< CLOCK_PIN >::port_ptr_t clock_ptr_t
Software SPI (aka bit-banging) support Includes aggressive optimizations for when the clock and data ...
static port_t hival()
Gets the state of the port with this pin HIGH
Definition fastpin.h:265
static port_t loval()
Gets the state of the port with this pin LOW
Definition fastpin.h:267
static port_t mask()
Get the pin mask.
Definition fastpin.h:271
static port_ptr_t port()
Get the output state of the port.
Definition fastpin.h:269

References FASTLED_REGISTER, FastPin< PIN >::hival(), FastPin< PIN >::loval(), FastPin< PIN >::mask(), FastPin< PIN >::port(), release(), select(), and writeByte().

Referenced by writeBytes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: