pub struct TimedSignal { /* private fields */ }
Expand description
Signal state and scheduled tick action.
Implementations§
Source§impl TimedSignal
impl TimedSignal
Sourcepub fn update(&mut self, tick: u64) -> bool
pub fn update(&mut self, tick: u64) -> bool
Update internals and return state. When an action is scheduled and tick reaches the specific value for that action, the state is updated accordingly.
Sourcepub fn set_inverted(&mut self, inverted: bool)
pub fn set_inverted(&mut self, inverted: bool)
Set inverted state on/off.
Sourcepub fn is_inverted(&self) -> bool
pub fn is_inverted(&self) -> bool
Return if state is inverted.
Sourcepub fn blink(&mut self, period: u32)
pub fn blink(&mut self, period: u32)
Toggle state at a predefined rate with a 50% ratio.
period
is the number of ticks for one period. E.g. if set to 4, the state will be
on for 2 ticks and off for another 2 ticks.
Sourcepub fn set_until(&mut self, trigger_tick: u64, state: bool)
pub fn set_until(&mut self, trigger_tick: u64, state: bool)
Set a state until a tick is reached, then return to previous state.
Sourcepub fn set_for(&mut self, duration_ticks: u64, state: bool)
pub fn set_for(&mut self, duration_ticks: u64, state: bool)
Set a state for a number of ticks, then invert it. Single trigger.
Sourcepub fn set_for_retrigger(&mut self, duration_ticks: u64, state: bool)
pub fn set_for_retrigger(&mut self, duration_ticks: u64, state: bool)
Set a state for a number of ticks, then invert it. Retrigger.
Sourcepub fn on_until(&mut self, trigger_tick: u64)
pub fn on_until(&mut self, trigger_tick: u64)
Set on state until a tick is reached, then set it off.
Sourcepub fn on_for(&mut self, duration_ticks: u64)
pub fn on_for(&mut self, duration_ticks: u64)
Set on state for a number of ticks, then set it off.
Sourcepub fn off_until(&mut self, trigger_tick: u64)
pub fn off_until(&mut self, trigger_tick: u64)
Set off state until a tick is reached, then set it on.
Sourcepub fn off_for(&mut self, duration_ticks: u64)
pub fn off_for(&mut self, duration_ticks: u64)
Set off state for a number of ticks, then set it on.
Sourcepub fn toggle_until(&mut self, trigger_tick: u64)
pub fn toggle_until(&mut self, trigger_tick: u64)
Toggle state until a tick is reached, then return to previous state.
Sourcepub fn toggle_for(&mut self, duration_ticks: u64)
pub fn toggle_for(&mut self, duration_ticks: u64)
Toggle state for a number of ticks, then return to previous state. Single trigger.
Sourcepub fn toggle_for_retrigger(&mut self, duration_ticks: u64)
pub fn toggle_for_retrigger(&mut self, duration_ticks: u64)
Toggle state for a number of ticks, then return to previous state. Retrigger.
Trait Implementations§
Source§impl Clone for TimedSignal
impl Clone for TimedSignal
Source§fn clone(&self) -> TimedSignal
fn clone(&self) -> TimedSignal
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more