pub struct Channel<'d> { /* private fields */ }Expand description
A connected sigma-delta channel.
Dropping a channel disconnects its output pin and releases the SDM clock guard.
Implementations§
Source§impl<'d> Channel<'d>
impl<'d> Channel<'d>
Sourcepub fn new(
channel: impl Instance + 'd,
pin: impl PeripheralOutput<'d>,
config: ChannelConfig,
) -> Self
pub fn new( channel: impl Instance + 'd, pin: impl PeripheralOutput<'d>, config: ChannelConfig, ) -> Self
Creates a connected sigma-delta channel.
Sourcepub fn apply_config(&mut self, config: &ChannelConfig)
pub fn apply_config(&mut self, config: &ChannelConfig)
Applies a new channel configuration.
Sourcepub fn set_pulse_density(&mut self, density: i8)
pub fn set_pulse_density(&mut self, density: i8)
Sets raw pulse density.
The value ranges from -128 to 127.
Sourcepub fn set_duty(&mut self, duty: u8)
pub fn set_duty(&mut self, duty: u8)
Sets duty cycle. 0 maps to the minimum density and 255 maps to the
maximum density.
Sourcepub fn prescaler(&self) -> u16
pub fn prescaler(&self) -> u16
Reads the hardware prescaler.
The returned value is in the hardware divider range 1..=256.
Sourcepub fn pulse_density(&self) -> i8
pub fn pulse_density(&self) -> i8
Reads the raw pulse density.
The returned value is in the hardware range -128..=127.