Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ina230.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 The Chromium OS Authors
3 * Copyright (c) 2021 Grinn
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_INA230_H_
8#define ZEPHYR_INCLUDE_DT_BINDINGS_INA230_H_
9
11
12/* Mask/Enable bits that asserts the ALERT pin */
13#define INA230_SHUNT_VOLTAGE_OVER BIT(15)
14#define INA230_SHUNT_VOLTAGE_UNDER BIT(14)
15#define INA230_BUS_VOLTAGE_OVER BIT(13)
16#define INA230_BUS_VOLTAGE_UNDER BIT(12)
17#define INA230_OVER_LIMIT_POWER BIT(11)
18#define INA230_CONVERSION_READY BIT(10)
19#define INA230_ALERT_FUNCTION_FLAG BIT(4)
20#define INA230_CONVERSION_READY_FLAG BIT(3)
21#define INA230_MATH_OVERFLOW_FLAG BIT(2)
22#define INA230_ALERT_POLARITY BIT(1)
23#define INA230_ALERT_LATCH_ENABLE BIT(0)
24
25/* Operating Mode */
26#define INA230_OPER_MODE_POWER_DOWN 0x00
27#define INA230_OPER_MODE_SHUNT_VOLTAGE_TRIG 0x01
28#define INA230_OPER_MODE_BUS_VOLTAGE_TRIG 0x02
29#define INA230_OPER_MODE_SHUNT_BUS_VOLTAGE_TRIG 0x03
30#define INA230_OPER_MODE_SHUNT_VOLTAGE_CONT 0x05
31#define INA230_OPER_MODE_BUS_VOLTAGE_CONT 0x06
32#define INA230_OPER_MODE_SHUNT_BUS_VOLTAGE_CONT 0x07
33
34/* Conversion time for bus and shunt in micro-seconds */
35#define INA230_CONV_TIME_140 0x00
36#define INA230_CONV_TIME_204 0x01
37#define INA230_CONV_TIME_332 0x02
38#define INA230_CONV_TIME_588 0x03
39#define INA230_CONV_TIME_1100 0x04
40#define INA230_CONV_TIME_2116 0x05
41#define INA230_CONV_TIME_4156 0x06
42#define INA230_CONV_TIME_8244 0x07
43
44/* Averaging Mode */
45#define INA230_AVG_MODE_1 0x00
46#define INA230_AVG_MODE_4 0x01
47#define INA230_AVG_MODE_16 0x02
48#define INA230_AVG_MODE_64 0x03
49#define INA230_AVG_MODE_128 0x04
50#define INA230_AVG_MODE_256 0x05
51#define INA230_AVG_MODE_512 0x06
52#define INA230_AVG_MODE_1024 0x07
53
62#define INA230_CONFIG(mode, \
63 svct, \
64 bvct, \
65 avg) \
66 (((avg) << 9) | ((bvct) << 6) | ((svct) << 3) | (mode))
67
68#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_INA230_H_ */