convert_frac.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2018 Kaspar Schleiser <kaspar@schleiser.de>
3  * SPDX-FileCopyrightText: 2018 Eistec AB
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #pragma once
8 
28 #include <stdint.h>
29 #include "ztimer.h"
30 #include "ztimer/convert.h"
31 #include "ztimer/convert_frac.h"
32 #include "frac.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
41 typedef struct {
59  uint32_t round;
61 
71  ztimer_clock_t *lower,
72  uint32_t freq_self, uint32_t freq_lower);
73 
82  uint32_t freq_self, uint32_t freq_lower);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
ztimer frequency conversion base module
ztimer_convert_frac interface definitions
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.
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
frac descriptor for fraction consisting of two 32 bit integers
Definition: frac.h:49
ztimer device structure
Definition: ztimer.h:367
ztimer_convert_frac frequency conversion layer class
Definition: convert_frac.h:41
uint32_t round
Rounding value, will be added to all lower set().
Definition: convert_frac.h:59
ztimer_convert_t super
Superclass instance.
Definition: convert_frac.h:45
frac_t scale_set
Frequency conversion scaling constant from self to lower.
Definition: convert_frac.h:53
frac_t scale_now
Frequency conversion scaling constant from lower to self.
Definition: convert_frac.h:49
base type for ztimer convert modules
Definition: convert.h:41
ztimer API