Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
ina23x.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 The Chromium OS Authors
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_INA23X_H_
7#define ZEPHYR_INCLUDE_DT_BINDINGS_INA23X_H_
8
10
11/* Mask/Enable bits that asserts the ALERT pin */
12#define INA23X_SHUNT_VOLTAGE_OVER BIT(15)
13#define INA23X_SHUNT_VOLTAGE_UNDER BIT(14)
14#define INA23X_BUS_VOLTAGE_OVER BIT(13)
15#define INA23X_BUS_VOLTAGE_UNDER BIT(12)
16#define INA23X_OVER_LIMIT_POWER BIT(11)
17#define INA23X_CONVERSION_READY BIT(10)
18#define INA23X_ALERT_FUNCTION_FLAG BIT(4)
19#define INA23X_CONVERSION_READY_FLAG BIT(3)
20#define INA23X_MATH_OVERFLOW_FLAG BIT(2)
21#define INA23X_ALERT_POLARITY BIT(1)
22#define INA23X_ALERT_LATCH_ENABLE BIT(0)
23
24/* Operating Mode */
25#define INA23X_OPER_MODE_POWER_DOWN 0x00
26#define INA23X_OPER_MODE_SHUNT_VOLTAGE_TRIG 0x01
27#define INA23X_OPER_MODE_BUS_VOLTAGE_TRIG 0x02
28#define INA23X_OPER_MODE_SHUNT_BUS_VOLTAGE_TRIG 0x03
29#define INA23X_OPER_MODE_SHUNT_VOLTAGE_CONT 0x05
30#define INA23X_OPER_MODE_BUS_VOLTAGE_CONT 0x06
31#define INA23X_OPER_MODE_SHUNT_BUS_VOLTAGE_CONT 0x07
32
33/* Conversion time for bus and shunt in micro-seconds */
34#define INA23X_CONV_TIME_140 0x00
35#define INA23X_CONV_TIME_204 0x01
36#define INA23X_CONV_TIME_332 0x02
37#define INA23X_CONV_TIME_588 0x03
38#define INA23X_CONV_TIME_1100 0x04
39#define INA23X_CONV_TIME_2116 0x05
40#define INA23X_CONV_TIME_4156 0x06
41#define INA23X_CONV_TIME_8244 0x07
42
43/* Averaging Mode */
44#define INA23X_AVG_MODE_1 0x00
45#define INA23X_AVG_MODE_4 0x01
46#define INA23X_AVG_MODE_16 0x02
47#define INA23X_AVG_MODE_64 0x03
48#define INA23X_AVG_MODE_128 0x04
49#define INA23X_AVG_MODE_256 0x05
50#define INA23X_AVG_MODE_512 0x06
51#define INA23X_AVG_MODE_1024 0x07
52
61#define INA23X_CONFIG(mode, \
62 svct, \
63 bvct, \
64 avg) \
65 (((avg) << 9) | ((bvct) << 6) | ((svct) << 3) | (mode))
66
67#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_INA23X_H_ */