pub struct Channel<'a, S: TimerSpeed> { /* private fields */ }Expand description
Channel struct
Implementations§
Source§impl<'a, S: TimerSpeed> Channel<'a, S>
impl<'a, S: TimerSpeed> Channel<'a, S>
Sourcepub fn new(number: Number, output_pin: impl PeripheralOutput<'a>) -> Self
pub fn new(number: Number, output_pin: impl PeripheralOutput<'a>) -> Self
Returns a new channel.
Trait Implementations§
Source§impl<S> ChannelHW for Channel<'_, S>where
S: TimerSpeed,
Available on crate feature unstable only.
impl<S> ChannelHW for Channel<'_, S>where
S: TimerSpeed,
Available on crate feature
unstable only.Source§fn configure_hw(&mut self) -> Result<(), Error>
fn configure_hw(&mut self) -> Result<(), Error>
Configures Channel HW.
Source§fn set_duty_hw(&self, duty: u32)
fn set_duty_hw(&self, duty: u32)
Sets duty in channel HW.
Source§fn start_duty_fade_hw(
&self,
start_duty: u32,
duty_inc: bool,
duty_steps: u16,
cycles_per_step: u16,
duty_per_cycle: u16,
)
fn start_duty_fade_hw( &self, start_duty: u32, duty_inc: bool, duty_steps: u16, cycles_per_step: u16, duty_per_cycle: u16, )
Starts a duty-cycle fade HW.
Source§fn configure_hw_with_drive_mode(&mut self, cfg: DriveMode) -> Result<(), Error>
fn configure_hw_with_drive_mode(&mut self, cfg: DriveMode) -> Result<(), Error>
Configures the hardware for the channel with a specific pin
configuration.
Source§fn is_duty_fade_running_hw(&self) -> bool
fn is_duty_fade_running_hw(&self) -> bool
Returns whether a duty-cycle fade is running HW.
Source§impl<'a, S: TimerSpeed> ChannelIFace<'a, S> for Channel<'a, S>
Available on crate feature unstable only.
impl<'a, S: TimerSpeed> ChannelIFace<'a, S> for Channel<'a, S>
Available on crate feature
unstable only.Source§fn start_duty_fade(
&self,
start_duty_pct: u8,
end_duty_pct: u8,
duration_ms: u16,
) -> Result<(), Error>
fn start_duty_fade( &self, start_duty_pct: u8, end_duty_pct: u8, duration_ms: u16, ) -> Result<(), Error>
Starts a duty fade from one % to another.
There is a constraint on the combination of timer frequency, timer PWM duty resolution (the bit count), the fade “range” (abs(start-end)), and the duration:
frequency * duration / ((1<<bit_count) * abs(start-end)) < 1024
Small percentage changes, long durations, coarse PWM resolutions (that is, low bit counts), and high timer frequencies will all be more likely to fail this requirement. If it does fail, returns an error.
Source§fn is_duty_fade_running(&self) -> bool
fn is_duty_fade_running(&self) -> bool
Returns whether a duty-cycle fade is running.
Source§impl<S: TimerSpeed> ErrorType for Channel<'_, S>
Available on crate feature unstable only.
impl<S: TimerSpeed> ErrorType for Channel<'_, S>
Available on crate feature
unstable only.Source§impl<'a, S: TimerSpeed> SetDutyCycle for Channel<'a, S>
Available on crate feature unstable only.
impl<'a, S: TimerSpeed> SetDutyCycle for Channel<'a, S>
Available on crate feature
unstable only.Source§fn max_duty_cycle(&self) -> u16
fn max_duty_cycle(&self) -> u16
Get the maximum duty cycle value. Read more
Source§fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
Set the duty cycle to
duty / max_duty. Read moreSource§fn set_duty_cycle_fully_off(&mut self) -> Result<(), Self::Error>
fn set_duty_cycle_fully_off(&mut self) -> Result<(), Self::Error>
Set the duty cycle to 0%, or always inactive.
Source§fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error>
fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error>
Set the duty cycle to 100%, or always active.
Source§fn set_duty_cycle_fraction(
&mut self,
num: u16,
denom: u16,
) -> Result<(), Self::Error>
fn set_duty_cycle_fraction( &mut self, num: u16, denom: u16, ) -> Result<(), Self::Error>
Set the duty cycle to
num / denom. Read moreSource§fn set_duty_cycle_percent(&mut self, percent: u8) -> Result<(), Self::Error>
fn set_duty_cycle_percent(&mut self, percent: u8) -> Result<(), Self::Error>
Set the duty cycle to
percent / 100 Read more