#define F_CPU 16000000UL #include #include #include #include #include "light_ws2812.h" #include "light_ws2812.c" #include "ws2812_config.h" typedef char s8; typedef int16_t s16; typedef int s32; typedef int64_t s64; typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; #define MAGIC 2500 #define LEDS 18 struct cRGB leds[LEDS]={{0}}; void gpioSetup(void) { DDRB=(1<cy)=cx-(h->lx); (h->cy)+=(h->ly); (h->cy)*=64; (h->cy)/=128; (h->ly)=(h->cy); (h->lx)=cx; return(h->cy); } s16 lowPass(s16 cx, struct lp *l) { cx*=1; (l->cy)=cx-(l->ly); (l->cy)*=1; (l->cy)/=8; (l->cy)+=(l->ly); (l->ly)=(l->cy); return(l->cy); } u8 scale(s16 cx) { cx=(cx>0)?cx:-cx; cx/=1; cx=cx>255?255:cx; return(cx); } s32 main(void) { u8 i; struct hp fh[3]={{0}}; struct lp fl[3]={{0}}; gpioSetup(); timerSetup(); adcSetup(); ledSetup(); while(1) { if(TCNT1