pub struct BaroComputer<A: Altimeter> { /* private fields */ }Expand description
Used to detect the current flight phase
Implementations§
Source§impl<A: Altimeter> BaroComputer<A>
impl<A: Altimeter> BaroComputer<A>
Sourcepub fn new(altimeter: A, current_phase: FlightPhase, fill_buf: BaroData) -> Self
pub fn new(altimeter: A, current_phase: FlightPhase, fill_buf: BaroData) -> Self
Create a new BaroComputer
Sourcepub fn current_phase(&self) -> FlightPhase
pub fn current_phase(&self) -> FlightPhase
Return the current flight phase
Sourcepub fn ground_ref(&self) -> BaroData
pub fn ground_ref(&self) -> BaroData
Return the computer’s ground reference.
Sourcepub fn measure<D: DelayMs<u8>>(
&mut self,
delay: &mut D,
timestamp: MillisDuration<u64>,
)
pub fn measure<D: DelayMs<u8>>( &mut self, delay: &mut D, timestamp: MillisDuration<u64>, )
Execute a barometric measurement. Will store in
self.latest_measurement
Sourcepub fn buf(&self) -> &WheelBuffer<BaroData, BUFFER_LENGTH>
pub fn buf(&self) -> &WheelBuffer<BaroData, BUFFER_LENGTH>
Return a shared reference to the computer’s internal WheelBuffer
Sourcepub fn last_measurement(&self) -> BaroData
pub fn last_measurement(&self) -> BaroData
Return the latest barometric measurement
Sourcepub fn acquire_signal<D: UbloxDriver, const L: usize>(
&mut self,
gps: &mut Device<D, L>,
)
pub fn acquire_signal<D: UbloxDriver, const L: usize>( &mut self, gps: &mut Device<D, L>, )
Notify that the GPS signal has been acquired, and that we can switch
from FlightPhase::Startup to FlightPhase::Ground
Sourcepub fn check_phase_switch<F: FnMut(FlightPhase, BaroData, &mut A)>(
&mut self,
on_switch_phase: F,
)
pub fn check_phase_switch<F: FnMut(FlightPhase, BaroData, &mut A)>( &mut self, on_switch_phase: F, )
Switch flight phases
Compute whether the computer should switch to a new flight phase. Run a closure only if the phase has switched.
Auto Trait Implementations§
impl<A> Freeze for BaroComputer<A>where
A: Freeze,
impl<A> RefUnwindSafe for BaroComputer<A>where
A: RefUnwindSafe,
impl<A> Send for BaroComputer<A>where
A: Send,
impl<A> Sync for BaroComputer<A>where
A: Sync,
impl<A> Unpin for BaroComputer<A>where
A: Unpin,
impl<A> UnwindSafe for BaroComputer<A>where
A: UnwindSafe,
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