pub struct Channel<'a, S: TimerSpeed> { /* private fields */ }
Available on crate feature
unstable
only.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 Peripheral<P = impl PeripheralOutput> + 'a,
) -> Self
pub fn new( number: Number, output_pin: impl Peripheral<P = impl PeripheralOutput> + 'a, ) -> Self
Return a new channel
Trait Implementations§
Source§impl<S> ChannelHW for Channel<'_, S>where
S: TimerSpeed,
impl<S> ChannelHW for Channel<'_, S>where
S: TimerSpeed,
Source§fn configure_hw(&mut self) -> Result<(), Error>
fn configure_hw(&mut self) -> Result<(), Error>
Configure Channel HW
Source§fn set_duty_hw(&self, duty: u32)
fn set_duty_hw(&self, duty: u32)
Set 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, )
Start a duty-cycle fade HW
Source§fn configure_hw_with_pin_config(&mut self, cfg: PinConfig) -> Result<(), Error>
fn configure_hw_with_pin_config(&mut self, cfg: PinConfig) -> Result<(), Error>
Configure 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
Check whether a duty-cycle fade is running HW
Source§impl<'a, S: TimerSpeed> ChannelIFace<'a, S> for Channel<'a, S>
impl<'a, S: TimerSpeed> ChannelIFace<'a, S> for Channel<'a, S>
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>
Start a duty fade from one % to another.
There’s 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, this function will return an error Result.
Source§fn is_duty_fade_running(&self) -> bool
fn is_duty_fade_running(&self) -> bool
Check whether a duty-cycle fade is running
Source§impl<'a, S: TimerSpeed> SetDutyCycle for Channel<'a, S>
impl<'a, S: TimerSpeed> SetDutyCycle for Channel<'a, S>
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