Loading...
Searching...
No Matches
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
29extern "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
67#ifndef CONFIG_ZTIMER_LPTIMER_WIDTH
68#define CONFIG_ZTIMER_LPTIMER_WIDTH (32)
69#endif
70
80#ifndef CONFIG_ZTIMER_USEC_MIN
81#define CONFIG_ZTIMER_USEC_MIN (10)
82#endif
83
87#ifndef CONFIG_ZTIMER_USEC_WIDTH
88# if (TIMER_0_MAX_VALUE) == 0xffff
89# define CONFIG_ZTIMER_USEC_WIDTH (16)
90# elif (TIMER_0_MAX_VALUE) == 0xffffffUL
91# define CONFIG_ZTIMER_USEC_WIDTH (24)
92# else
93# define CONFIG_ZTIMER_USEC_WIDTH (32)
94# endif
95#endif
96
100#ifndef CONFIG_ZTIMER_USEC_BASE_FREQ
101#define CONFIG_ZTIMER_USEC_BASE_FREQ (1000000LU)
102#endif
103
107#ifdef MODULE_ZTIMER_PERIPH_RTT
108# define CONFIG_ZTIMER_MSEC_BASE_FREQ (RTT_FREQUENCY)
109# else
110# define CONFIG_ZTIMER_MSEC_BASE_FREQ (CONFIG_ZTIMER_USEC_BASE_FREQ)
111#endif /* MODULE_ZTIMER_PERIPH_RTT */
112
116#ifndef CONFIG_ZTIMER_TIMER_BLOCK_PM_MODE
117# ifdef CONFIG_ZTIMER_USEC_REQUIRED_PM_MODE
118# define CONFIG_ZTIMER_TIMER_BLOCK_PM_MODE CONFIG_ZTIMER_USEC_REQUIRED_PM_MODE
119# else
120# define CONFIG_ZTIMER_TIMER_BLOCK_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
121# endif
122#endif
123
127#ifndef CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE
128# define CONFIG_ZTIMER_LPTIMER_BLOCK_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
129#endif
130
134#ifndef CONFIG_ZTIMER_RTT_BLOCK_PM_MODE
135# ifdef CONFIG_ZTIMER_MSEC_REQUIRED_PM_MODE
136# define CONFIG_ZTIMER_RTT_BLOCK_PM_MODE CONFIG_ZTIMER_MSEC_REQUIRED_PM_MODE
137# else
138# define CONFIG_ZTIMER_RTT_BLOCK_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
139# endif
140#endif
141
145#ifndef CONFIG_ZTIMER_RTC_BLOCK_PM_MODE
146# ifdef CONFIG_ZTIMER_SEC_REQUIRED_PM_MODE
147# define CONFIG_ZTIMER_RTC_BLOCK_PM_MODE CONFIG_ZTIMER_SEC_REQUIRED_PM_MODE
148# else
149# define CONFIG_ZTIMER_RTC_BLOCK_PM_MODE ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
150# endif
151#endif
152
162#ifndef CONFIG_ZTIMER_USEC_ADJUST_CLOCK_START
163#define CONFIG_ZTIMER_USEC_ADJUST_CLOCK_START 0
164#endif
165
173#ifndef CONFIG_ZTIMER_USEC_ADJUST_SET
174#define CONFIG_ZTIMER_USEC_ADJUST_SET 0
175#endif
176
186#ifndef CONFIG_ZTIMER_USEC_ADJUST_SLEEP
187#define CONFIG_ZTIMER_USEC_ADJUST_SLEEP 0
188#endif
189
197#ifndef CONFIG_ZTIMER_AUTO_ADJUST_SETTLE
198#define CONFIG_ZTIMER_AUTO_ADJUST_SETTLE 0
199#endif
200
201#ifdef __cplusplus
202}
203#endif
204
205#endif /* ZTIMER_CONFIG_H */
ztimer API