pub struct AnalogChannelCalibration {
pub scale_factor: f32,
pub offset: f32,
}Expand description
Scale and offset for one analog battery-monitor channel.
This follows ROSflight C’s conversion order exactly:
(pin_voltage - offset) * scale_factor.
Fields§
§scale_factor: f32§offset: f32Implementations§
Source§impl AnalogChannelCalibration
impl AnalogChannelCalibration
pub const fn new(scale_factor: f32, offset: f32) -> Self
Sourcepub fn apply_multiplier(&mut self, multiplier: f32)
pub fn apply_multiplier(&mut self, multiplier: f32)
Apply ROSflight’s multiplier semantics. Zero means “leave the current board scale unchanged”; every nonzero value replaces it.
pub fn convert_16_bit_sample(self, adc_count: u16, vdda: f32) -> f32
Trait Implementations§
Source§impl Clone for AnalogChannelCalibration
impl Clone for AnalogChannelCalibration
Source§fn clone(&self) -> AnalogChannelCalibration
fn clone(&self) -> AnalogChannelCalibration
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for AnalogChannelCalibration
Source§impl Debug for AnalogChannelCalibration
impl Debug for AnalogChannelCalibration
Source§impl PartialEq for AnalogChannelCalibration
impl PartialEq for AnalogChannelCalibration
impl StructuralPartialEq for AnalogChannelCalibration
Auto Trait Implementations§
impl Freeze for AnalogChannelCalibration
impl RefUnwindSafe for AnalogChannelCalibration
impl Send for AnalogChannelCalibration
impl Sync for AnalogChannelCalibration
impl Unpin for AnalogChannelCalibration
impl UnsafeUnpin for AnalogChannelCalibration
impl UnwindSafe for AnalogChannelCalibration
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.