pub struct PeriodicResyncConfig {
pub period: u32,
pub max_drift_ulps: i32,
}Expand description
Configuration for periodic fixed-point accumulator resynchronisation.
§Usage
At every observation step, call should_resync(obs_count % period).
When true, call apply_periodic_resync() on each Q16.16 accumulator
that carries a running sum over an extended session.
§Default
period = 65536 (one full Q16.16 fractional cycle, ≈ 1 s at 64 kSPS).
max_drift_ulps = 32 (½ LSB of a 16-bit ADC ≈ 7.6 × 10⁻⁶).
§Examples
use dsfb_rf::fixedpoint::{PeriodicResyncConfig, apply_periodic_resync,
quantize_f32};
let cfg = PeriodicResyncConfig { period: 1000, max_drift_ulps: 50 };
let rho_q = quantize_f32(0.10);
let drifted = rho_q + 80;
if cfg.should_resync(999) {
let (v, _) = apply_periodic_resync(drifted, rho_q, cfg.max_drift_ulps);
let _ = v; // re-zeroed value
}Fields§
§period: u32Number of observations between resync opportunities.
max_drift_ulps: i32Maximum allowed accumulator drift in Q16.16 ULPs before correction. 1 ULP = 1/65536 ≈ 1.53 × 10⁻⁵ in f32 terms.
Implementations§
Trait Implementations§
Source§impl Clone for PeriodicResyncConfig
impl Clone for PeriodicResyncConfig
Source§fn clone(&self) -> PeriodicResyncConfig
fn clone(&self) -> PeriodicResyncConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PeriodicResyncConfig
impl Debug for PeriodicResyncConfig
impl Copy for PeriodicResyncConfig
Auto Trait Implementations§
impl Freeze for PeriodicResyncConfig
impl RefUnwindSafe for PeriodicResyncConfig
impl Send for PeriodicResyncConfig
impl Sync for PeriodicResyncConfig
impl Unpin for PeriodicResyncConfig
impl UnsafeUnpin for PeriodicResyncConfig
impl UnwindSafe for PeriodicResyncConfig
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