Formatted code (#1007)

* Updated style

* Updated files

* fixed new line

* Updated spacing

* File fix WIP

* Updated to clang 13

* updated comment style

* Removed old comment code
This commit is contained in:
jLynx 2023-05-19 08:16:05 +12:00 committed by GitHub
parent 7aca7ce74d
commit 033c4e9a5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
599 changed files with 70746 additions and 66896 deletions

View file

@ -44,60 +44,56 @@ WORKING_AREA(baseband_thread_wa, 4096);
Thread* BasebandThread::thread = nullptr;
BasebandThread::BasebandThread(
uint32_t sampling_rate,
BasebandProcessor* const baseband_processor,
const tprio_t priority,
baseband::Direction direction
) : baseband_processor { baseband_processor },
_direction { direction },
sampling_rate { sampling_rate }
{
thread = chThdCreateStatic(baseband_thread_wa, sizeof(baseband_thread_wa),
priority, ThreadBase::fn,
this
);
uint32_t sampling_rate,
BasebandProcessor* const baseband_processor,
const tprio_t priority,
baseband::Direction direction)
: baseband_processor{baseband_processor},
_direction{direction},
sampling_rate{sampling_rate} {
thread = chThdCreateStatic(baseband_thread_wa, sizeof(baseband_thread_wa),
priority, ThreadBase::fn,
this);
}
BasebandThread::~BasebandThread() {
chThdTerminate(thread);
chThdWait(thread);
thread = nullptr;
chThdTerminate(thread);
chThdWait(thread);
thread = nullptr;
}
void BasebandThread::set_sampling_rate(uint32_t new_sampling_rate) {
sampling_rate = new_sampling_rate;
sampling_rate = new_sampling_rate;
}
void BasebandThread::run() {
baseband_sgpio.init();
baseband::dma::init();
baseband_sgpio.init();
baseband::dma::init();
const auto baseband_buffer = std::make_unique<std::array<baseband::sample_t, 8192>>();
baseband::dma::configure(
baseband_buffer->data(),
direction()
);
//baseband::dma::allocate(4, 2048);
const auto baseband_buffer = std::make_unique<std::array<baseband::sample_t, 8192>>();
baseband::dma::configure(
baseband_buffer->data(),
direction());
// baseband::dma::allocate(4, 2048);
baseband_sgpio.configure(direction());
baseband::dma::enable(direction());
baseband_sgpio.streaming_enable();
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_buffer();
if( buffer_tmp ) {
buffer_c8_t buffer {
buffer_tmp.p, buffer_tmp.count, sampling_rate
};
while (!chThdShouldTerminate()) {
// TODO: Place correct sampling rate into buffer returned here:
const auto buffer_tmp = baseband::dma::wait_for_buffer();
if (buffer_tmp) {
buffer_c8_t buffer{
buffer_tmp.p, buffer_tmp.count, sampling_rate};
if( baseband_processor ) {
baseband_processor->execute(buffer);
}
}
}
if (baseband_processor) {
baseband_processor->execute(buffer);
}
}
}
i2s::i2s0::tx_mute();
baseband::dma::disable();
baseband_sgpio.streaming_disable();
i2s::i2s0::tx_mute();
baseband::dma::disable();
baseband_sgpio.streaming_disable();
}