pub struct DacChannel<'d, T: Instance, C: Channel, M: PeriMode> { /* private fields */ }
Expand description
Driver for a single DAC channel.
If you want to use both channels, either together or independently,
create a Dac
first and use it to access each channel.
Implementations§
Source§impl<'d, T: Instance, C: Channel> DacChannel<'d, T, C, Async>
impl<'d, T: Instance, C: Channel> DacChannel<'d, T, C, Async>
Sourcepub fn new(
peri: Peri<'d, T>,
dma: Peri<'d, impl Dma<T, C>>,
pin: Peri<'d, impl DacPin<T, C>>,
) -> Self
pub fn new( peri: Peri<'d, T>, dma: Peri<'d, impl Dma<T, C>>, pin: Peri<'d, impl DacPin<T, C>>, ) -> Self
Create a new DacChannel
instance, consuming the underlying DAC peripheral.
The channel is enabled on creation and begin to drive the output pin.
Note that some methods, such as set_trigger()
and set_mode()
, will
disable the channel; you must re-enable it with enable()
.
By default, triggering is disabled, but it can be enabled using
DacChannel::set_trigger()
.
Source§impl<'d, T: Instance, C: Channel> DacChannel<'d, T, C, Blocking>
impl<'d, T: Instance, C: Channel> DacChannel<'d, T, C, Blocking>
Sourcepub fn new_blocking(peri: Peri<'d, T>, pin: Peri<'d, impl DacPin<T, C>>) -> Self
pub fn new_blocking(peri: Peri<'d, T>, pin: Peri<'d, impl DacPin<T, C>>) -> Self
Create a new DacChannel
instance, consuming the underlying DAC peripheral.
The channel is enabled on creation and begin to drive the output pin.
Note that some methods, such as set_trigger()
and set_mode()
, will
disable the channel; you must re-enable it with enable()
.
By default, triggering is disabled, but it can be enabled using
DacChannel::set_trigger()
.
Source§impl<'d, T: Instance, C: Channel, M: PeriMode> DacChannel<'d, T, C, M>
impl<'d, T: Instance, C: Channel, M: PeriMode> DacChannel<'d, T, C, M>
Sourcepub fn set_enable(&mut self, on: bool)
pub fn set_enable(&mut self, on: bool)
Enable or disable this channel.
Sourcepub fn set_trigger(&mut self, source: TriggerSel)
pub fn set_trigger(&mut self, source: TriggerSel)
Set the trigger source for this channel.
This method disables the channel, so you may need to re-enable afterwards.
Sourcepub fn set_triggering(&mut self, on: bool)
pub fn set_triggering(&mut self, on: bool)
Enable or disable triggering for this channel.
Sourcepub fn set_mode(&mut self, mode: Mode)
pub fn set_mode(&mut self, mode: Mode)
Set mode of this channel.
This method disables the channel, so you may need to re-enable afterwards.