modm API documentation
modm::platform::Dac Class Reference

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

Public Types

enum  Channel : uint8_t { Channel1 = 0, Channel2 = 1 }
 

Static Public Member Functions

template<class... Signals>
static void connect ()
 
static void initialize ()
 
static void enableChannel (Channel chan)
 
static void disableChannel (Channel chan)
 
static void enableOutputBuffer (Channel chan, bool enable)
 
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 (DAC)

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

Author
Jeff McBride

Member Enumeration Documentation

enum modm::platform::Dac::Channel : uint8_t
strong

The DAC has two output channels, Channel1 and Channel2

Member Function Documentation

void modm::platform::Dac::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::Dac::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()
void modm::platform::Dac::enableOutputBuffer ( Channel  chan,
bool  enable 
)
static

Control the output buffer setting

Parameters
chanThe channel to enable/disable the output buffer on
enabletrue to turn on the output buffer, false to turn it off
Precondition
The DAC clock must be enabled with initialize()
void modm::platform::Dac::initialize ( )
static

Initialize the D/A converter.

Enables the RCC clock output for the DAC

void modm::platform::Dac::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::Dac::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::Dac::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: