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

ADC driver requirements validator. More...

Detailed Description

ADC driver requirements validator.

Validates that ADC drivers provide required functionality using the method detection system. This is the core ADC contract enforcement for Sound Byte Libs drivers.

ADC Driver Contract

Every Sound Byte Libs ADC driver MUST implement these methods:

  • init() -> bool - Initialize ADC peripheral
  • configure_channel(const AdcHandle&, SampleTime) - Configure channel
  • start_conversion(const AdcHandle&) - Start single conversion
  • is_conversion_complete() -> bool - Check if conversion done
  • read_raw() -> uint16_t - Read conversion result
  • resolution_bits() -> uint8_t - Get ADC resolution (constexpr)

Optional methods (validated if present):

  • start_dma_scan(const AdcHandle*, uint8_t, uint16_t*, SampleTime) - DMA scan
  • stop_dma_scan() - Stop DMA scan

Validation Usage

Add validation at the bottom of driver adc.hpp:

static_assert(sbl::validation::adc_driver_valid<sbl::driver::Adc>,
"ADC driver missing required methods");
ADC driver requirements validator.
See also
method_detection.hpp

Definition in file adc_requirements.hpp.

Go to the source code of this file.

Classes

class  sbl::validation::AdcDriverRequirements< AdcDriver >
 ADC driver requirements validator. More...
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::validation
 Compile-time driver contracts.
 

Variables

template<typename AdcDriver >
constexpr bool sbl::validation::adc_driver_valid = AdcDriverRequirements<AdcDriver>::validate()
 Helper to validate an ADC driver implementation.