pub struct Dac<'d, T: Instance, DMACh1 = NoDma, DMACh2 = NoDma> { /* private fields */ }
Expand description
Implementations§
Source§impl<'d, T: Instance, DMACh1, DMACh2> Dac<'d, T, DMACh1, DMACh2>
impl<'d, T: Instance, DMACh1, DMACh2> Dac<'d, T, DMACh1, DMACh2>
Sourcepub fn new(
_peri: impl Peripheral<P = T> + 'd,
dma_ch1: impl Peripheral<P = DMACh1> + 'd,
dma_ch2: impl Peripheral<P = DMACh2> + 'd,
pin_ch1: impl Peripheral<P = impl DacPin<T, 1> + Pin> + 'd,
pin_ch2: impl Peripheral<P = impl DacPin<T, 2> + Pin> + 'd,
) -> Self
pub fn new( _peri: impl Peripheral<P = T> + 'd, dma_ch1: impl Peripheral<P = DMACh1> + 'd, dma_ch2: impl Peripheral<P = DMACh2> + 'd, pin_ch1: impl Peripheral<P = impl DacPin<T, 1> + Pin> + 'd, pin_ch2: impl Peripheral<P = impl DacPin<T, 2> + Pin> + 'd, ) -> Self
Create a new Dac
instance, consuming the underlying DAC peripheral.
This struct allows you to access both channels of the DAC, where available. You can either
call split()
to obtain separate DacChannel
s, or use methods on Dac
to use
the two channels together.
The channels are enabled on creation and begin to drive their output pins.
Note that some methods, such as set_trigger()
and set_mode()
, will
disable the channel; you must re-enable them with enable()
.
By default, triggering is disabled, but it can be enabled using the set_trigger()
method on the underlying channels.
Sourcepub fn new_internal(
_peri: impl Peripheral<P = T> + 'd,
dma_ch1: impl Peripheral<P = DMACh1> + 'd,
dma_ch2: impl Peripheral<P = DMACh2> + 'd,
) -> Self
pub fn new_internal( _peri: impl Peripheral<P = T> + 'd, dma_ch1: impl Peripheral<P = DMACh1> + 'd, dma_ch2: impl Peripheral<P = DMACh2> + 'd, ) -> Self
Create a new Dac
instance where the external output pins are not used,
so the DAC can only be used to generate internal signals but the GPIO
pins remain available for other functions.
This struct allows you to access both channels of the DAC, where available. You can either
call split()
to obtain separate DacChannel
s, or use methods on Dac
to use the two
channels together.
The channels are set to Mode::NormalInternalUnbuffered
and enabled on creation.
Note that some methods, such as set_trigger()
and set_mode()
, will disable the
channel; you must re-enable them with enable()
.
By default, triggering is disabled, but it can be enabled using the set_trigger()
method on the underlying channels.