pub struct PotConditioner { /* private fields */ }Expand description
Processor struct containing variables and states.
Implementations§
Source§impl PotConditioner
impl PotConditioner
Sourcepub fn new(
sampling_rate: i32,
input_range: (i32, i32),
output_range: (i32, i32),
) -> Self
pub fn new( sampling_rate: i32, input_range: (i32, i32), output_range: (i32, i32), ) -> Self
Create a new instance.
sampling_rate: sampling rate in Hz.input_range: tuple of (lowest/highest) input value.input_range: tuple of (lowest/highest) output value.
Sourcepub fn set_movement_threshold(&mut self, threshold: i32)
pub fn set_movement_threshold(&mut self, threshold: i32)
Sets a new movement threshold. Recommended range is 10-255.
Sourcepub fn update(&mut self, value: i32, tick: u64) -> i32
pub fn update(&mut self, value: i32, tick: u64) -> i32
Update value with new input and return processed value.
Sourcepub fn last_movement(&self) -> Option<u64>
pub fn last_movement(&self) -> Option<u64>
Return tick number of last detected movement.
Sourcepub fn set_output_range(&mut self, out_min: i32, out_max: i32)
pub fn set_output_range(&mut self, out_min: i32, out_max: i32)
Sets a new output range.
Sourcepub fn output_range(&self) -> (i32, i32)
pub fn output_range(&self) -> (i32, i32)
Returns the current output range.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PotConditioner
impl RefUnwindSafe for PotConditioner
impl Send for PotConditioner
impl Sync for PotConditioner
impl Unpin for PotConditioner
impl UnwindSafe for PotConditioner
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