theCore C++ embedded framework
ecl::adc_cfg< dev > Struct Template Reference

ADC configuration prototype. More...

#include </home/travis/build/forGGe/theCore/platform/stm32/export/aux/adc.hpp>

Detailed Description

template<adc_dev dev>
struct ecl::adc_cfg< dev >

ADC configuration prototype.

Specific ADC device is pre-configured by providing template specialization of the adc_cfg class. Contents of the adc_cfg specialization depends on ADC management mode used. Two options possible:

  • DMA management mode.
  • IRQ management mode.
DMA mode
Following fields must be present:
  • Management mode constexpr field mgtm_mode, set to adc_mgmt_mode::dma
  • DMA descriptor dma for particular ADC. Refer to RM to find appropriate DMA configuration for given ADC.
namespace ecl
{
// Provides configuration of the adc_dev::dev1 (ADC1).
template<>
struct adc_cfg<adc_dev::dev1>
{
// Signifies DMA management mode.
static constexpr adc_mgmt_mode mgtm_mode = adc_mgmt_mode::dma;
// DMA2, Stream 0, Channel 0 is dedicated for ADC1
using dma = dma_wrap<dma_stream::dma2_0, dma_channel::ch0>;
};
} // namespace ecl
IRQ mode
Following fields must be present:

// Provides configuration of the adc_dev::dev1 (ADC1). template<> struct adc_cfg<adc_dev::dev1> { // Signifies IRQ management mode. static constexpr adc_mgmt_mode mgtm_mode = adc_mgmt_mode::irq; };

Warning
To avoid potential problems with multiple configurations for single ADC, make sure that full specialization is placed in the header included (directly or indirectly) by all dependent modules.. Thus, redefinition of the config class for given ADC will result in compilation errors. Good practice is to place all ADC configuration class in the single target-related header.

The documentation for this struct was generated from the following file: