pub struct Dac<'d, T: Instance, M: PeriMode> { /* private fields */ }
Expand description
Implementations§
Source§impl<'d, T: Instance> Dac<'d, T, Async>
impl<'d, T: Instance> Dac<'d, T, Async>
Sourcepub fn new(
peri: Peri<'d, T>,
dma_ch1: Peri<'d, impl Dma<T, Ch1>>,
dma_ch2: Peri<'d, impl Dma<T, Ch2>>,
pin_ch1: Peri<'d, impl DacPin<T, Ch1> + Pin>,
pin_ch2: Peri<'d, impl DacPin<T, Ch2> + Pin>,
) -> Self
pub fn new( peri: Peri<'d, T>, dma_ch1: Peri<'d, impl Dma<T, Ch1>>, dma_ch2: Peri<'d, impl Dma<T, Ch2>>, pin_ch1: Peri<'d, impl DacPin<T, Ch1> + Pin>, pin_ch2: Peri<'d, impl DacPin<T, Ch2> + Pin>, ) -> 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_unbuffered(
peri: Peri<'d, T>,
dma_ch1: Peri<'d, impl Dma<T, Ch1>>,
dma_ch2: Peri<'d, impl Dma<T, Ch2>>,
pin_ch1: Peri<'d, impl DacPin<T, Ch1> + Pin>,
pin_ch2: Peri<'d, impl DacPin<T, Ch2> + Pin>,
) -> Self
pub fn new_unbuffered( peri: Peri<'d, T>, dma_ch1: Peri<'d, impl Dma<T, Ch1>>, dma_ch2: Peri<'d, impl Dma<T, Ch2>>, pin_ch1: Peri<'d, impl DacPin<T, Ch1> + Pin>, pin_ch2: Peri<'d, impl DacPin<T, Ch2> + Pin>, ) -> Self
Create a new Dac
instance with external output pins and unbuffered mode.
This function consumes the underlying DAC peripheral and allows access to both channels. The channels are configured for external output with the buffer disabled.
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.
§Arguments
peri
- The DAC peripheral instance.dma_ch1
- The DMA channel for DAC channel 1.dma_ch2
- The DMA channel for DAC channel 2.pin_ch1
- The GPIO pin for DAC channel 1 output.pin_ch2
- The GPIO pin for DAC channel 2 output.
§Returns
A new Dac
instance in unbuffered mode.
Source§impl<'d, T: Instance> Dac<'d, T, Blocking>
impl<'d, T: Instance> Dac<'d, T, Blocking>
Sourcepub fn new_blocking(
peri: Peri<'d, T>,
pin_ch1: Peri<'d, impl DacPin<T, Ch1> + Pin>,
pin_ch2: Peri<'d, impl DacPin<T, Ch2> + Pin>,
) -> Self
pub fn new_blocking( peri: Peri<'d, T>, pin_ch1: Peri<'d, impl DacPin<T, Ch1> + Pin>, pin_ch2: Peri<'d, impl DacPin<T, Ch2> + Pin>, ) -> 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.