modm API documentation

#include <modm/platform/dac/dac_4.hpp>

Public Types

enum  Channel : uint8_t { Channel1 = 0, Channel2 = 1 }
 
enum  Mode { ExternalWithBuffer = 0, ExternalInternalWithBuffer = DAC_MCR_MODE1_0, ExternalWithoutBuffer = DAC_MCR_MODE1_1, Internal = DAC_MCR_MODE1_0 | DAC_MCR_MODE1_1 }
 

Static Public Member Functions

template<class... Signals>
static void connect ()
 
template<typename SystemClock >
static void initialize ()
 
static void enableChannel (Channel chan)
 
static void disableChannel (Channel chan)
 
static void setMode (Channel chan, Mode mode)
 
static void setOutput (Channel chan, uint16_t value)
 
static void setOutput1 (uint16_t value)
 
static void setOutput2 (uint16_t value)
 
template<class Gpio >
static constexpr Channel getPinChannel ()
 Get the channel for a Pin.
 

Detailed Description

Digital-to-Analog Converter (DAC4)

Supports simple synchronous access to the 2-channel DAC found on most STM32 microcontrollers.

Author
Jeff McBride

Member Enumeration Documentation

enum modm::platform::Dac4::Channel : uint8_t
strong

The DAC has two output channels, Channel1 and Channel2

Member Function Documentation

void modm::platform::Dac4::disableChannel ( Channel  chan)
static

Disable DAC output for the given channel

Parameters
chanThe channel to be disabled
Precondition
The DAC clock must be enabled with initialize()
void modm::platform::Dac4::enableChannel ( Channel  chan)
static

Enable DAC output for the given channel

Parameters
chanThe channel to be enabled
Precondition
The DAC clock must be enabled with initialize()
template<typename SystemClock >
void modm::platform::Dac4::initialize ( )
inlinestatic

Initialize the D/A converter.

Enables the RCC clock output for the DAC

Template Parameters
SystemClockSystem clock struct
void modm::platform::Dac4::setMode ( Channel  channel,
Mode  mode 
)
static

Control the output mode

Parameters
chanThe channel to configure the mode for
modeThe channel output mode
Warning
The DAC channel will be disabled when setting the mode
void modm::platform::Dac4::setOutput ( Channel  chan,
uint16_t  value 
)
inlinestatic

Set the output voltage for a DAC channel

Parameters
chanThe channel to set
valueThe 12-bit DAC output value, range 0-4095.
Precondition
The DAC clock must be enabled with initialize()
void modm::platform::Dac4::setOutput1 ( uint16_t  value)
inlinestatic

Set output value for Channel1

Equivalent to setOutput(modm::platform::Dac::Channel1, value)

Parameters
valueThe 12-bit DAC output value, range 0-4095
Precondition
The DAC clock must be enabled with initialize()
void modm::platform::Dac4::setOutput2 ( uint16_t  value)
inlinestatic

Set output value for Channel2

Equivalent to setOutput(modm::platform::Dac::Channel2, value)

Parameters
valueThe 12-bit DAC output value, range 0-4095
Precondition
The DAC clock must be enabled with initialize()

The documentation for this class was generated from the following files: