Loading...
Searching...
No Matches

Translates between clock tick rates. More...

Detailed Description

Translates between clock tick rates.

Translates the ticks of an underlying clock into virtual ticks at a different frequency. This module makes use of frac for calculating fractions using multiplicative inversions, avoiding integer divisions. frac trades accuracy for speed. Please see the documentation of frac for more details.

Files

file  convert_frac.h
 ztimer_convert_frac interface definitions
 

Data Structures

struct  ztimer_convert_frac_t
 ztimer_convert_frac frequency conversion layer class More...
 

Functions

void ztimer_convert_frac_init (ztimer_convert_frac_t *self, ztimer_clock_t *lower, uint32_t freq_self, uint32_t freq_lower)
 ztimer_convert_frac_t constructor
 
void ztimer_convert_frac_change_rate (ztimer_convert_frac_t *self, uint32_t freq_self, uint32_t freq_lower)
 Change the scaling without affecting the current count.
 

Function Documentation

◆ ztimer_convert_frac_change_rate()

void ztimer_convert_frac_change_rate ( ztimer_convert_frac_t self,
uint32_t  freq_self,
uint32_t  freq_lower 
)

Change the scaling without affecting the current count.

Parameters
[in]selfpointer to instance being initialized
[in]freq_selfdesired frequency of this clock
[in]freq_lowerfrequency of the underlying clock

◆ ztimer_convert_frac_init()

void ztimer_convert_frac_init ( ztimer_convert_frac_t self,
ztimer_clock_t lower,
uint32_t  freq_self,
uint32_t  freq_lower 
)

ztimer_convert_frac_t constructor

Parameters
[in]selfpointer to instance being initialized
[in]lowerpointer to underlying clock
[in]freq_selfdesired frequency of this clock
[in]freq_lowerfrequency of the underlying clock