Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
scan.hpp File Reference

ADC DMA scan interface - continuous multi-channel acquisition. More...

Detailed Description

ADC DMA scan interface - continuous multi-channel acquisition.

Platform-agnostic interface for DMA-based ADC scanning. The driver handles all DMA configuration internally; the HAL just forwards calls.

Usage:

SBL_DMA_BUFFER static uint16_t adc_buf[2];
const sbl::AdcHandle channels[] = { sbl::hw::adc::knob1, sbl::hw::adc::knob2 };
sbl::adc::start_scan<sbl::driver::Adc>(channels, 2, adc_buf);
// Main loop: read each slot through a volatile access, as
// Pot::update_dma() does
knob1.update_dma(adc_buf, 0);
knob2.update_dma(adc_buf, 1);
ADC DMA scan interface - continuous multi-channel acquisition.
ADC channel handle.
Definition handle.hpp:26

start_scan() takes a plain uint16_t*. The DMA writes the buffer behind the compiler's back, so the reader is responsible for volatile access.

Definition in file scan.hpp.

#include "handle.hpp"
#include "types.hpp"

Go to the source code of this file.

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::adc
 Convenience layer: read a channel, start and stop a scan.
 

Functions

template<typename Driver >
void sbl::adc::start_scan (const AdcHandle *channels, uint8_t num_channels, uint16_t *buffer, SampleTime sample_time=SampleTime::Slow)
 Start continuous DMA scan of multiple ADC channels.
 
template<typename Driver >
void sbl::adc::start_scan (const AdcHandle *channels, uint8_t num_channels, uint16_t *buffer, const SampleTime *sample_times)
 Start continuous DMA scan with per-channel sample times.
 
template<typename Driver >
void sbl::adc::stop_scan ()
 Stop DMA scan mode.