1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2023 Carl Zeiss Meditec AG
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #ifndef ZEPHYR_DRIVERS_SENSOR_ADLTC2990_H
7 #define ZEPHYR_DRIVERS_SENSOR_ADLTC2990_H
8 
9 #include <zephyr/types.h>
10 #include <zephyr/device.h>
11 #include <zephyr/drivers/gpio.h>
12 #include <zephyr/drivers/i2c.h>
13 #include <zephyr/drivers/sensor.h>
14 
15 enum adltc2990_monitor_pins {
16 	V1,
17 	V2,
18 	V3,
19 	V4,
20 	INTERNAL_TEMPERATURE,
21 	SUPPLY_VOLTAGE
22 };
23 
24 enum adltc2990_monitoring_type {
25 	NOTHING,
26 	VOLTAGE_DIFFERENTIAL,
27 	VOLTAGE_SINGLEENDED,
28 	TEMPERATURE
29 };
30 
31 union voltage_divider_resistors {
32 	struct {
33 		uint32_t v1_r1_r2[2];
34 		uint32_t v2_r1_r2[2];
35 	};
36 	struct {
37 		uint32_t v3_r1_r2[2];
38 		uint32_t v4_r1_r2[2];
39 	};
40 };
41 
42 struct pins_configuration {
43 	uint32_t pins_current_resistor;
44 	union voltage_divider_resistors voltage_divider_resistors;
45 };
46 
47 struct adltc2990_data {
48 	int32_t internal_temperature;
49 	int32_t supply_voltage;
50 	int32_t pins_v1_v2_values[2];
51 	int32_t pins_v3_v4_values[2];
52 };
53 
54 struct adltc2990_config {
55 	struct i2c_dt_spec bus;
56 	uint8_t temp_format;
57 	uint8_t acq_format;
58 	uint8_t measurement_mode[2];
59 	struct pins_configuration pins_v1_v2;
60 	struct pins_configuration pins_v3_v4;
61 };
62 
63 #endif /* ZEPHYR_DRIVERS_SENSOR_ADLTC2990_H */
64