diff --git a/firmware/apps/blinker.c b/firmware/apps/blinker.c index fc45329..f2b9012 100644 --- a/firmware/apps/blinker.c +++ b/firmware/apps/blinker.c @@ -3,14 +3,29 @@ #include #include +#ifdef MATRIX +uint8_t inv = 0; +#endif + static void init(void) { led_on(RIGHT); + matrix_start(); } static void blinker(void) { led_inv(RIGHT); led_inv(LEFT); +#ifdef MATRIX + for(uint8_t x = 0; x < 3; ++x) { + for(uint8_t y = 0; y < 3; ++y) { + matrix_set(x, y, ((x + y) & 1) ^ inv); + } + } + + inv = !inv; +#endif + wait_ms(500); if(button_clicked(RIGHT)) { diff --git a/firmware/lib/matrix.c b/firmware/lib/matrix.c index 35826c8..8cea181 100644 --- a/firmware/lib/matrix.c +++ b/firmware/lib/matrix.c @@ -13,24 +13,24 @@ void matrix_init(void) { } static void move_line(uint8_t line) { - PORTD &= ~0xe0; - PORTD |= 1 << (line + 5); + PORTD |= 0xe0; + PORTD &= ~(1 << (line + 5)); } static void write_line(uint8_t data[]) { - PORTC |= (1 << 5) | (1 << 4); - PORTB |= 1 << 2; + PORTC &= ~((1 << 5) | (1 << 4)); + PORTB &= ~(1 << 2); if(data[0]) { - PORTC &= ~(1 << 5); + PORTC |= 1 << 5; } if(data[1]) { - PORTC &= ~(1 << 4); + PORTC |= 1 << 4; } if(data[2]) { - PORTB &= ~(1 << 2); + PORTB |= 1 << 2; } }