Struct esp32c3_hal::ledc::channel::Channel
source · 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, 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
Check whether a duty-cycle fade is running HW
source§impl<'a, S, O> ChannelIFace<'a, S, O> for Channel<'a, S, O>where
S: TimerSpeed,
O: OutputPin,
Channel<'a, S, O>: ChannelHW<O>,
impl<'a, S, O> ChannelIFace<'a, S, O> for Channel<'a, S, O>where S: TimerSpeed, O: OutputPin, Channel<'a, S, O>: ChannelHW<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.
source§fn is_duty_fade_running(&self) -> bool
fn is_duty_fade_running(&self) -> bool
Check whether a duty-cycle fade is running
Auto Trait Implementations§
impl<'a, S, O> !RefUnwindSafe for Channel<'a, S, O>
impl<'a, S, O> !Send for Channel<'a, S, O>
impl<'a, S, O> !Sync for Channel<'a, S, O>
impl<'a, S, O> Unpin for Channel<'a, S, O>where O: Unpin,
impl<'a, S, O> !UnwindSafe for Channel<'a, S, O>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more