dsp: small refactor
This commit is contained in:
parent
ef81ec3b12
commit
a4005ade77
16
dsp/main.c
16
dsp/main.c
@ -27,34 +27,34 @@ int main() {
|
||||
|
||||
while(1) {
|
||||
uint8_t c = uart_read(uart0);
|
||||
uint16_t period;
|
||||
uint16_t period = 0;
|
||||
if (c == 'c') {
|
||||
led0->output = 1;
|
||||
period = 1493; // C4, 262.63 Hz, maybe
|
||||
uart_writen(uart0, "C4\r\n", 4);
|
||||
log("C4\r\n");
|
||||
} else if (c == 'd') {
|
||||
period = 1330; // D4, 293.66 Hz, maybe
|
||||
uart_writen(uart0, "D4\r\n", 4);
|
||||
log("D4\r\n");
|
||||
led0->output = 2;
|
||||
} else if (c == 'e') {
|
||||
period = 1185; // E4, 329.63 Hz, maybe
|
||||
uart_writen(uart0, "E4\r\n", 4);
|
||||
log("E4\r\n");
|
||||
led0->output = 4;
|
||||
} else if (c == 'f') {
|
||||
period = 1119; // F4, 249.23 Hz, maybe
|
||||
uart_writen(uart0, "F4\r\n", 4);
|
||||
log("F4\r\n");
|
||||
led0->output = 8;
|
||||
} else if (c == 'g') {
|
||||
period = 996; // G4, 392.00 Hz, maybe
|
||||
uart_writen(uart0, "G4\r\n", 4);
|
||||
log("G4\r\n");
|
||||
led0->output = 16;
|
||||
} else if (c == 'a') {
|
||||
period = 887; // A4, 440.00 Hz, maybe
|
||||
uart_writen(uart0, "A4\r\n", 4);
|
||||
log("A4\r\n");
|
||||
led0->output = 32;
|
||||
} else if (c == 'b') {
|
||||
period = 791; // B4, 493.88 Hz, maybe
|
||||
uart_writen(uart0, "B4\r\n", 4);
|
||||
log("B4\r\n");
|
||||
led0->output = 64;
|
||||
} else {
|
||||
led0->output = 37;
|
||||
|
Loading…
Reference in New Issue
Block a user