config.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
20 #ifndef ZTIMER_CONFIG_H
21 #define ZTIMER_CONFIG_H
22 
23 #include "board.h"
24 #include "periph_conf.h"
25 
26 #include "ztimer.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*
33  * @brief Use periph_timer as the base timer for ZTIMER_USEC
34  */
35 #define CONFIG_ZTIMER_USEC_TYPE_PERIPH_TIMER (1)
36 
37 /* for ZTIMER_USEC, use xtimer configuration if available and no ztimer
38  * specific configuration is set. */
39 #if CONFIG_ZTIMER_USEC_TYPE_PERIPH_TIMER
40 # ifndef CONFIG_ZTIMER_USEC_DEV
41 # ifdef XTIMER_DEV
42 # define CONFIG_ZTIMER_USEC_DEV XTIMER_DEV
43 # endif
44 # endif
45 # ifndef CONFIG_ZTIMER_USEC_BASE_FREQ
46 # ifdef XTIMER_HZ
47 # define CONFIG_ZTIMER_USEC_BASE_FREQ XTIMER_HZ
48 # endif
49 # endif
50 # ifndef CONFIG_ZTIMER_USEC_WIDTH
51 # ifdef XTIMER_WIDTH
52 # define CONFIG_ZTIMER_USEC_WIDTH XTIMER_WIDTH
53 # endif
54 # endif
55 #endif
56 
60 #ifndef CONFIG_ZTIMER_USEC_DEV
61 #define CONFIG_ZTIMER_USEC_DEV (TIMER_DEV(0))
62 #endif
63 
73 #ifndef CONFIG_ZTIMER_USEC_MIN
74 #define CONFIG_ZTIMER_USEC_MIN (10)
75 #endif
76 
80 #ifndef CONFIG_ZTIMER_USEC_WIDTH
81 # if (TIMER_0_MAX_VALUE) == 0xffff
82 # define CONFIG_ZTIMER_USEC_WIDTH (16)
83 # elif (TIMER_0_MAX_VALUE) == 0xffffffUL
84 # define CONFIG_ZTIMER_USEC_WIDTH (24)
85 # else
86 # define CONFIG_ZTIMER_USEC_WIDTH (32)
87 # endif
88 #endif
89 
93 #ifndef CONFIG_ZTIMER_USEC_BASE_FREQ
94 #define CONFIG_ZTIMER_USEC_BASE_FREQ (1000000LU)
95 #endif
96 
100 #ifdef MODULE_ZTIMER_PERIPH_RTT
101 # define CONFIG_ZTIMER_MSEC_BASE_FREQ (RTT_FREQUENCY)
102 # else
103 # define CONFIG_ZTIMER_MSEC_BASE_FREQ (CONFIG_ZTIMER_USEC_BASE_FREQ)
104 #endif /* MODULE_ZTIMER_PERIPH_RTT */
105 
109 #ifndef CONFIG_ZTIMER_USEC_REQUIRED_PM_MODE
110 #define CONFIG_ZTIMER_USEC_REQUIRED_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
111 #endif
112 
116 #ifndef CONFIG_ZTIMER_MSEC_REQUIRED_PM_MODE
117 #define CONFIG_ZTIMER_MSEC_REQUIRED_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
118 #endif
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif /* ZTIMER_CONFIG_H */
125 
ztimer.h
ztimer API