|
Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Typedefs | |
| using | SampleTime = sbl::hal::adc::SampleTime |
| using | Resolution = sbl::hal::adc::Resolution |
Functions | |
| template<typename Driver > | |
| uint16_t | read (const AdcHandle &handle, SampleTime sample_time=SampleTime::Medium) |
| Blocking single-channel ADC read. | |
| template<typename Driver > | |
| uint32_t | to_millivolts (uint16_t raw_value, uint32_t vref_mv=3300) |
| Convert raw ADC value to voltage (millivolts) | |
| template<typename Driver > | |
| void | 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 | stop_scan () |
| Stop DMA scan mode. | |
| using sbl::adc::Resolution = typedef sbl::hal::adc::Resolution |
Definition at line 56 of file driver.hpp.
Definition at line 55 of file driver.hpp.
|
inline |
Blocking single-channel ADC read.
Convenience function that composes low-level driver primitives. Configures the channel, starts conversion, waits for completion, and returns the raw value.
| Driver | ADC driver type (e.g., sbl::driver::Adc) |
| handle | ADC channel handle from hardware config |
| sample_time | Sampling duration (default: Medium) |
Example: auto value = sbl::adc::read<sbl::driver::Adc>(sbl::hw::adc::knob1);
Definition at line 76 of file driver.hpp.
|
inline |
Start continuous DMA scan of multiple ADC channels.
The ADC scans all channels in sequence with circular DMA, depositing results into buffer[0..num_channels-1]. The CPU reads the buffer at any time for the latest value — no synchronization needed (16-bit aligned reads are atomic on Cortex-M).
| Driver | ADC driver type (e.g., sbl::driver::Adc) |
| channels | Array of AdcHandle defining the scan sequence |
| num_channels | Number of channels to scan (1–16) |
| buffer | DMA-accessible buffer with num_channels elements |
| sample_time | Sampling duration for all channels (default: Slow) |
|
inline |
Stop DMA scan mode.
Stops continuous conversion and disables DMA. After this call, polling functions (read<Driver>()) can be used again.
| Driver | ADC driver type |
|
inline |
Convert raw ADC value to voltage (millivolts)
| Driver | ADC driver type for resolution info |
| raw_value | Raw ADC reading |
| vref_mv | Reference voltage in millivolts (default: 3300mV) |
Definition at line 97 of file driver.hpp.