sound volume configurable

This commit is contained in:
2024-05-21 12:31:55 +02:00
parent f9b63c06fe
commit faf75e158a
19 changed files with 129 additions and 27 deletions

View File

@ -4,9 +4,10 @@
#include "scheduler.h"
#include "spi.h"
#include "soundCodes.h"
#include "config.h"
uint8_t cmd;
volatile uint8_t cmd;
void spiInit() {
// SPI slave
@ -25,7 +26,14 @@ void spiInit() {
UC0IE |= UCB0RXIE;
cmd = SOUND_IDLE;
schAdd(spiCmdHandler, NULL, 0, 100);
schAdd(spiCmdHandler, NULL, 0, 5);
}
void spiCommandDispatcher() {
cmd &= ~SOUND_COMMAND;
if (cmd & SOUND_SUBCMD_AMPLITUDE) {
cmd &= ~SOUND_SUBCMD_AMPLITUDE;
configSetAmplitude(cmd);
}
}