Bracket BasebandThread loop with enable/disable code.

This commit is contained in:
Jared Boone 2016-06-25 10:53:16 -07:00
parent 9188bb9ee9
commit bb32ef5321
2 changed files with 8 additions and 19 deletions

View File

@ -101,6 +101,10 @@ void BasebandThread::run() {
); );
//baseband::dma::allocate(4, 2048); //baseband::dma::allocate(4, 2048);
baseband_sgpio.configure(direction());
baseband::dma::enable(direction());
baseband_sgpio.streaming_enable();
while( !chThdShouldTerminate() ) { while( !chThdShouldTerminate() ) {
// TODO: Place correct sampling rate into buffer returned here: // TODO: Place correct sampling rate into buffer returned here:
const auto buffer_tmp = baseband::dma::wait_for_rx_buffer(); 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) { BasebandProcessor* BasebandThread::create_processor(const int32_t mode) {
@ -129,19 +137,3 @@ BasebandProcessor* BasebandThread::create_processor(const int32_t mode) {
default: return nullptr; 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();
}
}

View File

@ -52,9 +52,6 @@ private:
BasebandProcessor* create_processor(const int32_t mode); BasebandProcessor* create_processor(const int32_t mode);
void disable();
void enable();
void set_configuration(const BasebandConfiguration& new_configuration); void set_configuration(const BasebandConfiguration& new_configuration);
}; };