Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
adc.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google LLC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADC_H_
7#define ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADC_H_
8
9/*
10 * Provide the BIT_MASK() macro for when this file is included from
11 * devicetrees.
12 */
13#ifndef BIT_MASK
14#define BIT_MASK(n) ((1 << (n)) - 1)
15#endif
16
18#define ADC_ACQ_TIME_MICROSECONDS (1)
20#define ADC_ACQ_TIME_NANOSECONDS (2)
22#define ADC_ACQ_TIME_TICKS (3)
24#define ADC_ACQ_TIME(unit, value) (((unit) << 14) | ((value) & BIT_MASK(14)))
26#define ADC_ACQ_TIME_DEFAULT 0
27#define ADC_ACQ_TIME_MAX BIT_MASK(14)
28
29#define ADC_ACQ_TIME_UNIT(time) (((time) >> 14) & BIT_MASK(2))
30#define ADC_ACQ_TIME_VALUE(time) ((time) & BIT_MASK(14))
31
32#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADC_H_ */