44 * SPDX-License-Identifier: Apache-2.0
55 */
66
7+ /**
8+ * @file
9+ * @brief Header file for extended API of Voltage Divider
10+ * @ingroup adc_voltage_divider_interface
11+ */
12+
713#ifndef ZEPHYR_INCLUDE_DRIVERS_ADC_VOLTAGE_DIVIDER_H_
814#define ZEPHYR_INCLUDE_DRIVERS_ADC_VOLTAGE_DIVIDER_H_
915
1016#include <zephyr/drivers/adc.h>
1117
18+ /**
19+ * @brief Voltage Divider
20+ * @defgroup adc_voltage_divider_interface Voltage Divider
21+ * @ingroup adc_interface_ext
22+ * @{
23+ */
24+
25+ /**
26+ * @brief Voltage divider DT struct.
27+ *
28+ * This stores information about a voltage divider obtained from Devicetree.
29+ *
30+ * @see VOLTAGE_DIVIDER_DT_SPEC_GET
31+ */
1232struct voltage_divider_dt_spec {
33+ /** ADC channel info */
1334 const struct adc_dt_spec port ;
35+ /** Full resistance in ohms */
1436 uint32_t full_ohms ;
37+ /** Output resistance in ohms */
1538 uint32_t output_ohms ;
1639};
1740
@@ -33,7 +56,7 @@ struct voltage_divider_dt_spec {
3356 }
3457
3558/**
36- * @brief Calculates the actual voltage from the measured voltage
59+ * @brief Calculates the actual voltage from a measured voltage
3760 *
3861 * @param[in] spec voltage divider specification from Devicetree.
3962 * @param[in,out] v_to_v Pointer to the measured voltage on input, and the
@@ -56,4 +79,6 @@ static inline int voltage_divider_scale_dt(const struct voltage_divider_dt_spec
5679 return 0 ;
5780}
5881
82+ /** @} */
83+
5984#endif /* ZEPHYR_INCLUDE_DRIVERS_ADC_VOLTAGE_DIVIDER_H_ */
0 commit comments