pub struct Symbol(/* private fields */);Expand description
A Symbol constists of two Pulses, where each pulse defines a level of the pin (high or low)
and a duration (PulseTicks).
The Pulses can be the same level (e.g., both high) and must not necessarily be different levels.
This is just a newtype over the IDF’s rmt_item32_t or rmt_symbol_word_t type.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn new_with(
resolution: Hertz,
level0: PinState,
duration0: Duration,
level1: PinState,
duration1: Duration,
) -> Result<Self, EspError>
pub fn new_with( resolution: Hertz, level0: PinState, duration0: Duration, level1: PinState, duration1: Duration, ) -> Result<Self, EspError>
Constructs a symbol from the given levels and durations.
This is a convenience function that combines Pulse::new_with_duration and Symbol::new.
Sourcepub fn new_half_split(
resolution: Hertz,
level0: PinState,
level1: PinState,
duration: Duration,
) -> Result<Self, EspError>
pub fn new_half_split( resolution: Hertz, level0: PinState, level1: PinState, duration: Duration, ) -> Result<Self, EspError>
Constructs a new symbol where the duration is split evenly between the two levels.
It is guaranteed that the combined duration of the two levels adds up to the given duration. If the duration is odd, the first level might be a bit shorter than the second level.
Sourcepub fn repeat_for(
&self,
resolution: Hertz,
duration: Duration,
) -> impl Iterator<Item = Self>
pub fn repeat_for( &self, resolution: Hertz, duration: Duration, ) -> impl Iterator<Item = Self>
Repeats the symbol to have the returned sequence of symbols last for exactly the given duration.
There is an upper limit for how long a single symbol can be (PulseTicks::max).
To create a symbol that lasts longer than that, it is split into multiple symbols.
The returned iterator yields as many symbols as necessary to reach the
desired duration.
If the given duration is not a multiple of the symbol duration, the last symbol will be adjusted to occupy the remaining time.
§Panics
If self has a duration of zero.
Trait Implementations§
Source§impl From<Symbol> for rmt_symbol_word_t
impl From<Symbol> for rmt_symbol_word_t
Source§impl From<rmt_symbol_word_t> for Symbol
impl From<rmt_symbol_word_t> for Symbol
Source§fn from(value: rmt_symbol_word_t) -> Self
fn from(value: rmt_symbol_word_t) -> Self
impl Copy for Symbol
impl Eq for Symbol
Auto Trait Implementations§
impl Freeze for Symbol
impl RefUnwindSafe for Symbol
impl Send for Symbol
impl Sync for Symbol
impl Unpin for Symbol
impl UnsafeUnpin for Symbol
impl UnwindSafe for Symbol
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)