pub struct Channel<'a, S, O>where
S: TimerSpeed,
O: OutputPin,{ /* private fields */ }
Expand description
Channel struct
Implementations§
source§impl<'a, S, O> Channel<'a, S, O>where
S: TimerSpeed,
O: OutputPin,
impl<'a, S, O> Channel<'a, S, O>where
S: TimerSpeed,
O: OutputPin,
sourcepub fn new(
number: Number,
output_pin: impl Peripheral<P = O> + 'a
) -> Channel<'a, S, O>
pub fn new( number: Number, output_pin: impl Peripheral<P = O> + 'a ) -> Channel<'a, S, O>
Return a new channel
Trait Implementations§
source§impl<'a, O> ChannelHW<O> for Channel<'a, HighSpeed, O>where
O: OutputPin,
impl<'a, O> ChannelHW<O> for Channel<'a, HighSpeed, O>where
O: OutputPin,
Channel HW interface for HighSpeed channels
source§fn configure_hw(&mut self) -> Result<(), Error>
fn configure_hw(&mut self) -> Result<(), Error>
Configure Channel HW except for the duty which is set via
Self::set_duty_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
fn configure_hw_with_pin_config(&mut self, cfg: PinConfig) -> Result<(), Error>
source§fn is_duty_fade_running_hw(&self) -> bool
fn is_duty_fade_running_hw(&self) -> bool
source§impl<'a, O> ChannelHW<O> for Channel<'a, LowSpeed, O>where
O: OutputPin,
impl<'a, O> ChannelHW<O> for Channel<'a, LowSpeed, O>where
O: OutputPin,
Channel HW interface for LowSpeed channels
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
fn configure_hw_with_pin_config(&mut self, cfg: PinConfig) -> Result<(), Error>
source§fn is_duty_fade_running_hw(&self) -> bool
fn is_duty_fade_running_hw(&self) -> bool
source§impl<'a, S, O> ChannelIFace<'a, S, O> for Channel<'a, S, O>
impl<'a, S, O> ChannelIFace<'a, S, O> for Channel<'a, S, O>
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.