timestamping: docs and naming

This commit is contained in:
Robert Jördens 2021-02-02 14:34:48 +01:00
parent e1c87c149f
commit ddbfa9d988
2 changed files with 5 additions and 6 deletions

View File

@ -117,14 +117,14 @@ const APP: () = {
let iir_state = c.resources.iir_state;
let lockin = c.resources.lockin;
let t = c
let timestamp = c
.resources
.timestamper
.latest_timestamp()
.unwrap_or_else(|t| t) // Ignore timer capture overflows.
.map(|t| t as i32);
let (pll_phase, pll_frequency) = c.resources.pll.update(
t,
timestamp,
22, // frequency settling time (log2 counter cycles), TODO: expose
22, // phase settling time, TODO: expose
);

View File

@ -211,12 +211,11 @@ pub fn setup(
// Configure the timer to count at the designed tick rate. We will manually set the
// period below.
timer5.pause();
timer5.reset_counter();
timer5.set_tick_freq(design_parameters::TIMER_FREQUENCY);
// The timestamp timer must run at exactly a multiple of the sample timer based on the
// batch size. To accomodate this, we manually set the prescaler identical to the sample
// timer, but use a period that is longer.
// The timestamp timer runs at the counter cycle period as the sampling timers.
// To accomodate this, we manually set the prescaler identical to the sample
// timer, but use maximum overflow period.
let mut timer = timers::TimestampTimer::new(timer5);
timer.set_period_ticks(u32::MAX);