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 #include <zephyr/dt-bindings/dt-util.h>
10 
11 /** Acquisition time is expressed in microseconds. */
12 #define ADC_ACQ_TIME_MICROSECONDS  (1)
13 /** Acquisition time is expressed in nanoseconds. */
14 #define ADC_ACQ_TIME_NANOSECONDS   (2)
15 /** Acquisition time is expressed in ADC ticks. */
16 #define ADC_ACQ_TIME_TICKS         (3)
17 /** Macro for composing the acquisition time value in given units. */
18 #define ADC_ACQ_TIME(unit, value)  (((unit) << 14) | ((value) & BIT_MASK(14)))
19 /** Value indicating that the default acquisition time should be used. */
20 #define ADC_ACQ_TIME_DEFAULT       0
21 #define ADC_ACQ_TIME_MAX           BIT_MASK(14)
22 
23 #define ADC_ACQ_TIME_UNIT(time)    (((time) >> 14) & BIT_MASK(2))
24 #define ADC_ACQ_TIME_VALUE(time)   ((time) & BIT_MASK(14))
25 
26 #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADC_H_ */
27