#include #include #include "ws2812.h" #include "np_common.c" /* #include AVR_MCU(F_CPU, "attiny85"); const struct avr_mmcu_vcd_trace_t _mytrace[] _MMCU_ = { { AVR_MCU_VCD_SYMBOL("GTCCR"), .what = (void*)>CCR, }, // { AVR_MCU_VCD_SYMBOL("TCCR0B"), .what = (void*)&TCCR0B, }, { AVR_MCU_VCD_SYMBOL("TIMSK"), .what = (void*)&TIMSK, }, { AVR_MCU_VCD_SYMBOL("TIFR"), .what = (void*)&TIFR, }, { AVR_MCU_VCD_SYMBOL("OCR0A"), .what = (void*)&OCR0A, }, { AVR_MCU_VCD_SYMBOL("OCR0B"), .what = (void*)&OCR0B, }, { AVR_MCU_VCD_SYMBOL("current"), .what = (void*)¤t, }, { AVR_MCU_VCD_SYMBOL("idx"), .what = (void*)&idx, }, { AVR_MCU_VCD_SYMBOL("cnt"), .what = (void*)&cnt, }, { AVR_MCU_VCD_SYMBOL("val"), .what = (void*)&val, }, // { AVR_MCU_VCD_SYMBOL("DDRB"), .what = (void*)&DDRB, }, { AVR_MCU_VCD_SYMBOL("PORTB"), .what = (void*)&PORTB, }, // { AVR_MCU_VCD_SYMBOL("TCNT0"), .what = (void*)&TCNT0, }, // { AVR_MCU_VCD_SYMBOL("TCNT1"), .what = (void*)&TCNT1, }, }; */ #define PIXEL_COUNT 7 const uint8_t pixels_1[PIXEL_COUNT * 4] = { 0, 0, 0, 0, 32, 0, 0, 0, 64, 0, 0, 0, 96, 0, 0, 0, 128, 0, 0, 0, 160, 0, 0, 0, 192, 0, 0, 0 }; const uint8_t pixels_2[PIXEL_COUNT * 4] = { 0, 0, 0, 0, 0, 32, 0, 0, 0, 64, 0, 0, 0, 96, 0, 0, 0, 128, 0, 0, 0, 160, 0, 0, 0, 192, 0, 0 }; const uint8_t pixels_3[PIXEL_COUNT * 4] = { 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 64, 0, 0, 0, 96, 0, 0, 0, 128, 0, 0, 0, 160, 0, 0, 0, 192, 0 }; const uint8_t pixels_4[PIXEL_COUNT * 4] = { 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 64, 0, 0, 0, 96, 0, 0, 0, 128, 0, 0, 0, 160, 0, 0, 0, 192 }; void blink(void) { PORTB |= _BV(2); _delay_ms(100); PORTB &= ~(_BV(2)); } int main (void) { _delay_ms(1000); PORTB = 0; DDRB = _BV(0) | _BV(1) | _BV(2); _delay_ms(50); blink(); np_initialize(); sei(); _delay_ms(500); while (1) { blink(); write_pixels(pixels_1, PIXEL_COUNT * 4); _delay_ms(1000); write_pixels(pixels_2, PIXEL_COUNT * 4); _delay_ms(1000); write_pixels(pixels_3, PIXEL_COUNT * 4); _delay_ms(1000); write_pixels(pixels_4, PIXEL_COUNT * 4); } }