2013-08-30 18:54:23 +02:00
|
|
|
#include <pentabug/app.h>
|
|
|
|
#include <pentabug/pentatonic.h>
|
2013-08-30 19:25:42 +02:00
|
|
|
#include <pentabug/hal.h>
|
2013-09-04 01:27:50 +02:00
|
|
|
#include <pentabug/music.h>
|
2013-08-30 18:54:23 +02:00
|
|
|
|
|
|
|
static void init(void) {
|
2013-08-30 19:25:42 +02:00
|
|
|
pentatonic_direction(ALL_IN);
|
2013-08-30 18:54:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void run(void) {
|
2013-08-30 19:25:42 +02:00
|
|
|
pentatonic_direction(ALL_IN);
|
2013-08-30 18:54:23 +02:00
|
|
|
|
2013-09-04 01:27:50 +02:00
|
|
|
uint8_t prev_buttons = 0;
|
2013-08-30 19:25:42 +02:00
|
|
|
for(;;) {
|
|
|
|
uint8_t buttons = pentatonic_buttons();
|
2013-09-04 01:27:50 +02:00
|
|
|
if (prev_buttons != buttons) {
|
|
|
|
if (buttons & 16) set_note(NOTE_Db, 4);
|
|
|
|
else if (buttons & 8) set_note(NOTE_Eb, 4);
|
|
|
|
else if (buttons & 4) set_note(NOTE_Gb, 4);
|
|
|
|
else if (buttons & 2) set_note(NOTE_Ab, 4);
|
|
|
|
else if (buttons & 1) set_note(NOTE_Bb, 4);
|
|
|
|
else stop_note();
|
|
|
|
prev_buttons = buttons;
|
2013-08-30 19:25:42 +02:00
|
|
|
}
|
|
|
|
wait_ms(1);
|
2013-08-30 18:54:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
REGISTER(run, init, NULL);
|