41 #include <util/delay.h>
47 #define DATA_PINS_PORT PORTB
48 #define DATA_PINS_DDR DDRB
49 #define DATA_PINS {PB0, PB1}
51 #define COLOR_ORDER grb
81 for (
unsigned int i = 0; i <
N_LEDS; i++) {
95 for (
unsigned int i = 0; i <
N_LEDS; i++) {
ws2812_cpp * ws2812_dev
Device object.
ws2812_rgb leds[N_LEDS]
RGB array which represents the LEDs.
#define DATA_PINS_PORT
Port register used to communicate with the WS2812 device(s)
#define DATA_PINS_DDR
Data direction register of the pin(s) used to communicate with the WS2812 device(s)
#define DATA_PINS
Pin(s) used to communicate with the WS2812 device(s)
#define RESET_TIME
Reset time in microseconds (50us recommended by datasheet)
#define N_LEDS
Number of LEDs on your WS2812 device(s)
ALL PLATFORMS: Data structure to configure a WS2812 device struct.
volatile uint8_t * ddr
Data Direction Register (ex. DDRB, DDRC, DDRD...)
uint8_t n_dev
Number of WS2812 device to drive.
volatile uint8_t * port
PORT Register (ex. PORTB, PORTC, PORTD...)
uint8_t rst_time_us
Time required for the WS2812 device(s) to reset in us.
ws2812_order order
CoColor order of the WS2812 device(s) (ex. rgb, grb, bgr...)
uint8_t * pins
Array of pins used to program WS2812 devices (Must share the same PORT! (ex. PB0, PB1,...
Data structure to hold RGB color values.
C++ Wrapper for the Tiny-WS2812 interface.