1 /*
2  * Copyright (c) 2023 STMicrelectronics
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_STM32H7_ADC_H_
7 #define ZEPHYR_INCLUDE_DT_BINDINGS_STM32H7_ADC_H_
8 
9 #include <zephyr/dt-bindings/adc/stm32_adc.h>
10 
11 /* STM32 ADC resolution register for H7 and similar */
12 #define STM32_ADC_RES_REG	0x0C
13 #define STM32_ADC_RES_SHIFT	2
14 #define STM32_ADC_RES_MASK	BIT_MASK(3)
15 
16 /*
17  * For STM32H72x & H73x, ADC3 is different and has a 12 to 6-bit resolution.
18  * The offset and the width of the resolution field need to be redefined.
19  */
20 #define STM32H72X_ADC3_RES_SHIFT	3
21 #define STM32H72X_ADC3_RES_MASK		0x03
22 
23 #define STM32H72X_ADC3_RES(resolution, reg_val)	\
24 	STM32_ADC(resolution, reg_val, STM32H72X_ADC3_RES_MASK, \
25 		  STM32H72X_ADC3_RES_SHIFT, STM32_ADC_RES_REG)
26 
27 #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_STM32H7_ADC_H_ */
28