Struct esp_idf_hal::rmt::Pulse
source · pub struct Pulse {
pub ticks: PulseTicks,
pub pin_state: PinState,
}
Expand description
A Pulse
contains a pin state and a tick count, used in creating a Signal
.
The real time duration of a tick depends on the [Config::clock_divider
] setting.
You can create a Pulse
with a [Duration
] by using Pulse::new_with_duration
.
§Example
let pulse = Pulse::new(PinState::High, PulseTicks::new(32));
Fields§
§ticks: PulseTicks
§pin_state: PinState
Implementations§
source§impl Pulse
impl Pulse
pub const fn zero() -> Self
pub const fn new(pin_state: PinState, ticks: PulseTicks) -> Self
sourcepub fn new_with_duration(
ticks_hz: Hertz,
pin_state: PinState,
duration: &Duration,
) -> Result<Self, EspError>
pub fn new_with_duration( ticks_hz: Hertz, pin_state: PinState, duration: &Duration, ) -> Result<Self, EspError>
Create a Pulse
using a [Duration
].
The ticks frequency, which depends on the clock divider set on the channel within a
[Transmit
]. To get the frequency for the ticks_hz
argument, use [Transmit::counter_clock()
].
§Example
let tx = Transmit::new(led, channel, &config)?;
let ticks_hz = tx.counter_clock()?;
let pulse = Pulse::new_with_duration(ticks_hz, PinState::High, Duration::from_nanos(500))?;
Trait Implementations§
impl Copy for Pulse
impl Eq for Pulse
impl StructuralPartialEq for Pulse
Auto Trait Implementations§
impl Freeze for Pulse
impl RefUnwindSafe for Pulse
impl Send for Pulse
impl Sync for Pulse
impl Unpin for Pulse
impl UnwindSafe for Pulse
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
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)