From bb32ef5321f35b623ed90426b4e6f323d4028fc5 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sat, 25 Jun 2016 10:53:16 -0700 Subject: [PATCH] Bracket BasebandThread loop with enable/disable code. --- firmware/baseband/baseband_thread.cpp | 24 ++++++++---------------- firmware/baseband/baseband_thread.hpp | 3 --- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/firmware/baseband/baseband_thread.cpp b/firmware/baseband/baseband_thread.cpp index 27d4b033..0f575ad6 100644 --- a/firmware/baseband/baseband_thread.cpp +++ b/firmware/baseband/baseband_thread.cpp @@ -101,6 +101,10 @@ void BasebandThread::run() { ); //baseband::dma::allocate(4, 2048); + baseband_sgpio.configure(direction()); + baseband::dma::enable(direction()); + baseband_sgpio.streaming_enable(); + while( !chThdShouldTerminate() ) { // TODO: Place correct sampling rate into buffer returned here: const auto buffer_tmp = baseband::dma::wait_for_rx_buffer(); @@ -114,6 +118,10 @@ void BasebandThread::run() { } } } + + i2s::i2s0::tx_mute(); + baseband::dma::disable(); + baseband_sgpio.streaming_disable(); } BasebandProcessor* BasebandThread::create_processor(const int32_t mode) { @@ -129,19 +137,3 @@ BasebandProcessor* BasebandThread::create_processor(const int32_t mode) { default: return nullptr; } } - -void BasebandThread::disable() { - if( baseband_processor ) { - i2s::i2s0::tx_mute(); - baseband::dma::disable(); - baseband_sgpio.streaming_disable(); - } -} - -void BasebandThread::enable() { - if( baseband_processor ) { - baseband_sgpio.configure(direction()); - baseband::dma::enable(direction()); - baseband_sgpio.streaming_enable(); - } -} diff --git a/firmware/baseband/baseband_thread.hpp b/firmware/baseband/baseband_thread.hpp index 82862049..ce09a51b 100644 --- a/firmware/baseband/baseband_thread.hpp +++ b/firmware/baseband/baseband_thread.hpp @@ -52,9 +52,6 @@ private: BasebandProcessor* create_processor(const int32_t mode); - void disable(); - void enable(); - void set_configuration(const BasebandConfiguration& new_configuration); };