pentabug/firmware/apps/blinker.c

43 lines
563 B
C
Raw Normal View History

2013-08-26 01:08:00 +02:00
#include <stdlib.h>
#include <pentabug/app.h>
#include <pentabug/hal.h>
2013-09-21 02:16:31 +02:00
#include <pentabug/matrix.h>
2013-08-26 01:08:00 +02:00
2013-09-07 12:08:57 +02:00
#ifdef MATRIX
uint8_t inv = 0;
#endif
2013-08-26 01:08:00 +02:00
static void init(void) {
led_on(RIGHT);
2013-09-07 12:08:57 +02:00
matrix_start();
2013-08-26 01:08:00 +02:00
}
static void blinker(void) {
led_inv(RIGHT);
led_inv(LEFT);
2013-09-03 22:49:52 +02:00
2013-09-07 12:08:57 +02:00
#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
2013-09-05 22:15:28 +02:00
wait_ms(500);
2013-09-03 22:49:52 +02:00
2013-09-05 22:15:28 +02:00
if(button_clicked(RIGHT)) {
motor_on();
}
2013-09-03 22:49:52 +02:00
2013-09-05 22:15:28 +02:00
if(button_clicked(LEFT)) {
motor_off();
2013-09-03 22:49:52 +02:00
}
2013-09-05 22:15:28 +02:00
2013-08-26 01:08:00 +02:00
}
REGISTER(blinker, init, NULL);