convert_frac.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Kaspar Schleiser <kaspar@schleiser.de>
3  * Copyright (C) 2018 Eistec AB
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser General
6  * Public License v2.1. See the file LICENSE in the top level directory for more
7  * details.
8  */
9 
28 #ifndef ZTIMER_CONVERT_FRAC_H
29 #define ZTIMER_CONVERT_FRAC_H
30 
31 #include <stdint.h>
32 #include "ztimer.h"
33 #include "ztimer/convert.h"
34 #include "ztimer/convert_frac.h"
35 #include "frac.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
44 typedef struct {
62  uint32_t round;
64 
74  ztimer_clock_t *lower,
75  uint32_t freq_self, uint32_t freq_lower);
76 
85  uint32_t freq_self, uint32_t freq_lower);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif /* ZTIMER_CONVERT_FRAC_H */
92 
frac_t
frac descriptor for fraction consisting of two 32 bit integers
Definition: frac.h:53
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.
ztimer.h
ztimer API
frac.h
convert_frac.h
ztimer_convert_frac interface definitions
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
ztimer_convert_frac_t::super
ztimer_convert_t super
Superclass instance.
Definition: convert_frac.h:48
ztimer_clock
ztimer device structure
Definition: ztimer.h:312
ztimer_convert_t
base type for ztimer convert modules
Definition: convert.h:45
convert.h
ztimer frequency conversion base module
ztimer_convert_frac_t
ztimer_convert_frac frequency conversion layer class
Definition: convert_frac.h:44
ztimer_convert_frac_t::round
uint32_t round
Rounding value, will be added to all lower set().
Definition: convert_frac.h:62
ztimer_convert_frac_t::scale_set
frac_t scale_set
Frequency conversion scaling constant from self to lower.
Definition: convert_frac.h:56
ztimer_convert_frac_t::scale_now
frac_t scale_now
Frequency conversion scaling constant from lower to self.
Definition: convert_frac.h:52