pub struct Blink {
pub en: bool,
pub q: bool,
/* private fields */
}Expand description
Blink Oscillator
A simple oscillator that toggles its output q on and off at a fixed
frequency (0.5 seconds on, 0.5 seconds off) while the enable input en is true.
When en is false, the output q is false and the internal timer resets.
§Behavior
- When
enbecomestrue,qimmediately becomestrue. - Every 500ms thereafter,
qtoggles its state. - When
enbecomesfalse,qimmediately becomesfalse.
§Example
use autocore_std::fb::Blink;
use std::time::Duration;
let mut blink = Blink::new();
// Disabled - output is false
assert_eq!(blink.call(false), false);
// Enabled - output is immediately true
assert_eq!(blink.call(true), true);
// ... after 500ms ...
// assert_eq!(blink.call(true), false);Fields§
§en: boolInput: Enable the oscillator
q: boolOutput: Toggles every 500ms while enabled
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Blink
impl RefUnwindSafe for Blink
impl Send for Blink
impl Sync for Blink
impl Unpin for Blink
impl UnsafeUnpin for Blink
impl UnwindSafe for Blink
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