mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-13 10:47:44 +00:00
Beep-on-packet support in AIS app (#2064)
* Beep-on-packet support in AIS app
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "proc_ais.hpp"
|
||||
#include "audio_dma.hpp"
|
||||
|
||||
#include "portapack_shared_memory.hpp"
|
||||
|
||||
@@ -64,7 +65,17 @@ void AISProcessor::payload_handler(
|
||||
shared_memory.application_queue.push(message);
|
||||
}
|
||||
|
||||
void AISProcessor::on_message(const Message* const message) {
|
||||
if (message->id == Message::ID::AudioBeep)
|
||||
on_beep_message(*reinterpret_cast<const AudioBeepMessage*>(message));
|
||||
}
|
||||
|
||||
void AISProcessor::on_beep_message(const AudioBeepMessage& message) {
|
||||
audio::dma::beep_start(message.freq, message.sample_rate, message.duration_ms);
|
||||
}
|
||||
|
||||
int main() {
|
||||
audio::dma::init_audio_out();
|
||||
EventDispatcher event_dispatcher{std::make_unique<AISProcessor>()};
|
||||
event_dispatcher.run();
|
||||
return 0;
|
||||
|
@@ -74,13 +74,15 @@ class AISProcessor : public BasebandProcessor {
|
||||
this->payload_handler(packet);
|
||||
}};
|
||||
|
||||
void consume_symbol(const float symbol);
|
||||
void payload_handler(const baseband::Packet& packet);
|
||||
void on_message(const Message* const message);
|
||||
void on_beep_message(const AudioBeepMessage& message);
|
||||
|
||||
/* NB: Threads should be the last members in the class definition. */
|
||||
BasebandThread baseband_thread{
|
||||
baseband_fs, this, baseband::Direction::Receive, /*auto_start*/ false};
|
||||
RSSIThread rssi_thread{};
|
||||
|
||||
void consume_symbol(const float symbol);
|
||||
void payload_handler(const baseband::Packet& packet);
|
||||
};
|
||||
|
||||
#endif /*__PROC_AIS_H__*/
|
||||
|
Reference in New Issue
Block a user