implement five key piano
This commit is contained in:
parent
0d10ffb67e
commit
329a153a2c
|
@ -1,6 +1,7 @@
|
|||
#include <pentabug/app.h>
|
||||
#include <pentabug/pentatonic.h>
|
||||
#include <pentabug/hal.h>
|
||||
#include <pentabug/music.h>
|
||||
|
||||
static void init(void) {
|
||||
pentatonic_direction(ALL_IN);
|
||||
|
@ -9,21 +10,18 @@ static void init(void) {
|
|||
static void run(void) {
|
||||
pentatonic_direction(ALL_IN);
|
||||
|
||||
uint8_t prev_buttons = 0;
|
||||
for(;;) {
|
||||
uint8_t buttons = pentatonic_buttons();
|
||||
|
||||
if(buttons) {
|
||||
pentatonic_direction(ALL_OUT);
|
||||
|
||||
pentatonic_all_led_set(buttons);
|
||||
|
||||
led_inv(RIGHT);
|
||||
|
||||
wait_ms(1000);
|
||||
|
||||
break;
|
||||
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;
|
||||
}
|
||||
|
||||
wait_ms(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user