mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-14 12:08:40 +00:00
Further AudioThread cleanup.
This commit is contained in:
parent
feeb5bff6f
commit
14d1b5fd72
@ -72,7 +72,11 @@ public:
|
|||||||
~AudioThread() {
|
~AudioThread() {
|
||||||
chThdTerminate(thread);
|
chThdTerminate(thread);
|
||||||
chEvtSignal(thread, EVT_FIFO_HIGHWATER);
|
chEvtSignal(thread, EVT_FIFO_HIGHWATER);
|
||||||
chThdWait(thread);
|
const auto success = chThdWait(thread);
|
||||||
|
|
||||||
|
if( !success ) {
|
||||||
|
led_tx.on();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_fifo_isr() {
|
static void check_fifo_isr() {
|
||||||
@ -94,12 +98,10 @@ private:
|
|||||||
|
|
||||||
static msg_t static_fn(void* arg) {
|
static msg_t static_fn(void* arg) {
|
||||||
auto obj = static_cast<AudioThread*>(arg);
|
auto obj = static_cast<AudioThread*>(arg);
|
||||||
obj->run();
|
return obj->run();
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void run() {
|
msg_t run() {
|
||||||
bool success = true;
|
bool success = true;
|
||||||
while( success && !chThdShouldTerminate() ) {
|
while( success && !chThdShouldTerminate() ) {
|
||||||
chEvtWaitAny(EVT_FIFO_HIGHWATER);
|
chEvtWaitAny(EVT_FIFO_HIGHWATER);
|
||||||
@ -115,10 +117,8 @@ private:
|
|||||||
success = transfer(stream, write_buffer.get());
|
success = transfer(stream, write_buffer.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success ) {
|
return success;
|
||||||
led_tx.on();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool transfer(StreamOutput& stream, std::array<uint8_t, write_size>* const write_buffer) {
|
bool transfer(StreamOutput& stream, std::array<uint8_t, write_size>* const write_buffer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user