5#include "platforms/shared/spi_pixel_writer.h"
40template <
int DATA_PIN, fl::u8 CLOCK_PIN, EOrder RGB_ORDER = GRB, fl::u32 SPI_SPEED = DATA_RATE_MHZ(25)>
42 typedef fl::SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED>
SPI;
57 for (
int i = 0; i < 8; i++)
mSPI.writeByte(0x00);
59 while (pixels.
has(1)) {
76 constexpr fl::u8 r_gain = 31, g_gain = 31, b_gain = 31;
77 constexpr fl::u8 f0 =
fl::u8(0x80 | ((r_gain & 0x1F) << 2) | ((g_gain >> 3) & 0x03));
78 constexpr fl::u8 f1 =
fl::u8(((g_gain & 0x07) << 5) | (b_gain & 0x1F));
94 const int latch = pixels.
size() / 2 + 4;
95 for (
int i = 0; i < latch; i++)
mSPI.writeByte(0xFF);
96 mSPI.endTransaction();
CPixelLEDController(RegistrationMode mode)
void showPixels(PixelController< RGB_ORDER > &pixels) override
HD108Controller() FL_NOEXCEPT
void init() override
Initialize the LED controller.
fl::SPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED > SPI
defines the templated version of the CLEDController class
Serial peripheral interface (SPI) definitions per platform.
FASTLED_FORCE_INLINE int size() const
Get the length of the LED strip.
FASTLED_FORCE_INLINE void loadAndScaleRGB(fl::u8 *b0_out, fl::u8 *b1_out, fl::u8 *b2_out)
FASTLED_FORCE_INLINE void advanceData()
Advance the data pointer forward, adjust position counter.
FASTLED_FORCE_INLINE bool has(int n)
Do we have n pixels left to process?
FASTLED_FORCE_INLINE void stepDithering()
Step the dithering forward - creates triangular wave that toggles between pixels.