template<uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint32_t SPI_SPEED>
class AVRSoftwareSPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED >
Software SPI (aka bit-banging) support Includes aggressive optimizations for when the clock and data pin are on the same port.
- Template Parameters
-
DATA_PIN | pin number of the SPI data pin. |
CLOCK_PIN | pin number of the SPI clock pin. |
SPI_SPEED | speed of the bus. Determines the delay times between pin writes. |
- Note
- Although this is named with the "AVR" prefix, this will work on any platform. Theoretically.
- Todo
- Replace the select pin definition with a set of pins, to allow using mux hardware for routing in the future.
Definition at line 24 of file fastspi_bitbang.h.
|
| AVRSoftwareSPIOutput () |
| Default constructor.
|
|
| AVRSoftwareSPIOutput (Selectable *pSelect) |
| Constructor with selectable for SPI chip select.
|
|
void | setSelect (Selectable *pSelect) |
| Set the pointer for the SPI chip select.
|
|
void | init () |
| Set the clock/data pins to output and make sure the chip select is released.
|
|
void | select () |
| Select the SPI output (chip select)
|
|
void | release () |
| Release the SPI chip select line.
|
|
void | writeBytesValue (uint8_t value, int len) |
| Write multiple bytes of the given value over SPI.
|
|
template<class D > |
void | writeBytes (FASTLED_REGISTER uint8_t *data, int len) |
| Write an array of data to the SPI interface.
|
|
void | writeBytes (FASTLED_REGISTER uint8_t *data, int len) |
| Write an array of data to the SPI interface.
|
|
template<uint8_t FLAGS, class D , EOrder RGB_ORDER> |
void | writePixels (PixelController< RGB_ORDER > pixels, void *context=NULL) |
| Write LED pixel data to the SPI interface.
|
|
|
static void | stop () |
| Stop the SPI output.
|
|
static void | wait () |
| Wait until the SPI subsystem is ready for more data to write.
|
|
static void | waitFully () |
| Wait until the SPI subsystem is ready for more data to write.
|
|
static void | writeByteNoWait (uint8_t b) |
| Write a single byte over SPI without waiting.
|
|
static void | writeBytePostWait (uint8_t b) |
| Write a single byte over SPI and wait afterwards.
|
|
static void | writeWord (uint16_t w) |
| Write a word (two bytes) over SPI.
|
|
static void | writeByte (uint8_t b) |
| Write a single byte over SPI.
|
|
template<uint8_t BIT> |
static void | writeBit (uint8_t b) |
| Write the BIT'th bit out via SPI, setting the data pin then strobing the clock.
|
|
static void | writeBytesValueRaw (uint8_t value, int len) |
| Write multiple bytes of the given value over SPI, without selecting the interface.
|
|
template<uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint32_t SPI_SPEED>
void AVRSoftwareSPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED >::writeBytesValue |
( |
uint8_t | value, |
|
|
int | len ) |
|
inline |
Write multiple bytes of the given value over SPI.
Useful for quickly flushing, say, a line of 0's down the line.
- Parameters
-
value | the value to write to the bus |
len | how many copies of the value to write |
Definition at line 246 of file fastspi_bitbang.h.
template<uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint32_t SPI_SPEED>
static void AVRSoftwareSPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED >::writeBytesValueRaw |
( |
uint8_t | value, |
|
|
int | len ) |
|
inlinestatic |
Write multiple bytes of the given value over SPI, without selecting the interface.
Useful for quickly flushing, say, a line of 0's down the line.
- Parameters
-
value | the value to write to the bus |
len | how many copies of the value to write |
Definition at line 254 of file fastspi_bitbang.h.
template<uint8_t DATA_PIN, uint8_t CLOCK_PIN, uint32_t SPI_SPEED>
template<uint8_t FLAGS, class D , EOrder RGB_ORDER>
Write LED pixel data to the SPI interface.
Data is written in groups of three, re-ordered per the RGB_ORDER.
- Template Parameters
-
FLAGS | Option flags, such as FLAG_START_BIT |
D | Per-byte modifier class, e.g. DATA_NOP |
RGB_ORDER | the rgb ordering for the LED data (e.g. what order red, green, and blue data is written out in) |
- Parameters
-
Definition at line 352 of file fastspi_bitbang.h.