Kaleidoscope
Macros | Functions
light_ws2812.cpp File Reference
#include "light_ws2812.h"
#include <avr/interrupt.h>
#include <avr/io.h>
#include <util/delay.h>
Include dependency graph for light_ws2812.cpp:

Macros

#define w_zeropulse   350
 
#define w_onepulse   900
 
#define w_totalperiod   1250
 
#define w_fixedlow   2
 
#define w_fixedhigh   4
 
#define w_fixedtotal   8
 
#define w_zerocycles   (((F_CPU/1000)*w_zeropulse )/1000000)
 
#define w_onecycles   (((F_CPU/1000)*w_onepulse +500000)/1000000)
 
#define w_totalcycles   (((F_CPU/1000)*w_totalperiod +500000)/1000000)
 
#define w1   (w_zerocycles-w_fixedlow)
 
#define w2   (w_onecycles-w_fixedhigh-w1)
 
#define w3   (w_totalcycles-w_fixedtotal-w1-w2)
 
#define w1_nops   0
 
#define w_lowtime   ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000)
 
#define w2_nops   0
 
#define w3_nops   0
 
#define w_nop1   "nop \n\t"
 
#define w_nop2   "rjmp .+0 \n\t"
 
#define w_nop4   w_nop2 w_nop2
 
#define w_nop8   w_nop4 w_nop4
 
#define w_nop16   w_nop8 w_nop8
 

Functions

void ws2812_setleds (cRGB *ledarray, uint16_t leds)
 
void ws2812_setleds_pin (cRGB *ledarray, uint16_t leds, uint8_t pinmask)
 
void ws2812_sendarray (uint8_t *data, uint16_t datlen)
 
void ws2812_sendarray_mask (uint8_t *data, uint16_t datlen, uint8_t maskhi)
 

Macro Definition Documentation

◆ w1

#define w1   (w_zerocycles-w_fixedlow)

◆ w1_nops

#define w1_nops   0

◆ w2

#define w2   (w_onecycles-w_fixedhigh-w1)

◆ w2_nops

#define w2_nops   0

◆ w3

#define w3   (w_totalcycles-w_fixedtotal-w1-w2)

◆ w3_nops

#define w3_nops   0

◆ w_fixedhigh

#define w_fixedhigh   4

◆ w_fixedlow

#define w_fixedlow   2

◆ w_fixedtotal

#define w_fixedtotal   8

◆ w_lowtime

#define w_lowtime   ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000)

◆ w_nop1

#define w_nop1   "nop \n\t"

◆ w_nop16

#define w_nop16   w_nop8 w_nop8

◆ w_nop2

#define w_nop2   "rjmp .+0 \n\t"

◆ w_nop4

#define w_nop4   w_nop2 w_nop2

◆ w_nop8

#define w_nop8   w_nop4 w_nop4

◆ w_onecycles

#define w_onecycles   (((F_CPU/1000)*w_onepulse +500000)/1000000)

◆ w_onepulse

#define w_onepulse   900

◆ w_totalcycles

#define w_totalcycles   (((F_CPU/1000)*w_totalperiod +500000)/1000000)

◆ w_totalperiod

#define w_totalperiod   1250

◆ w_zerocycles

#define w_zerocycles   (((F_CPU/1000)*w_zeropulse )/1000000)

◆ w_zeropulse

#define w_zeropulse   350

Function Documentation

◆ ws2812_sendarray()

void ws2812_sendarray ( uint8_t *  data,
uint16_t  datlen 
)

◆ ws2812_sendarray_mask()

void ws2812_sendarray_mask ( uint8_t *  data,
uint16_t  datlen,
uint8_t  maskhi 
)
inline

◆ ws2812_setleds()

void ws2812_setleds ( cRGB ledarray,
uint16_t  leds 
)
inline

◆ ws2812_setleds_pin()

void ws2812_setleds_pin ( cRGB ledarray,
uint16_t  leds,
uint8_t  pinmask 
)
inline