Zephyr Project API
3.1.0
A Scalable Open Source RTOS
ina237.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 Grinn
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_INA237_H_
7
#define ZEPHYR_INCLUDE_DT_BINDINGS_INA237_H_
8
9
#include <
zephyr/dt-bindings/dt-util.h
>
10
11
/* Operating Mode */
12
#define INA237_OPER_MODE_SHUTDOWN 0x00
13
#define INA237_OPER_MODE_TRIG_BUS_VOLTAGE_SINGLE_SHOT 0x01
14
#define INA237_OPER_MODE_TRIG_SHUNT_VOLTAGE_TRIG_SINGLE_SHOT 0x02
15
#define INA237_OPER_MODE_TRIG_SHUNT_BUS_VOLTAGE_SINGLE_SHOT 0x03
16
#define INA237_OPER_MODE_TRIG_TEMP_SINGLE_SHOT 0x05
17
#define INA237_OPER_MODE_TRIG_TEMP_BUS_SINGLE_SHOT 0x06
18
#define INA237_OPER_MODE_TRIG_TEMP_SHUNT_SINGLE_SHOT 0x07
19
#define INA237_OPER_MODE_CONT_BUS_VOLTAGE 0x09
20
#define INA237_OPER_MODE_CONT_SHUNT_VOLTAGE 0x0A
21
#define INA237_OPER_MODE_CONT_SHUNT_BUS_VOLTAGE 0x0B
22
#define INA237_OPER_MODE_CONT_TEMP 0x0C
23
#define INA237_OPER_MODE_CONT_BUS_VOLTAGE_TEMP 0x0D
24
#define INA237_OPER_MODE_CONT_TEMP_SHUNT_VOLTAGE 0x0E
25
#define INA237_OPER_MODE_CONT_BUS_SHUNT_VOLTAGE_TEMP 0x0F
26
27
/* Conversion time for bus, shunt and temp in micro-seconds */
28
#define INA237_CONV_TIME_50 0x00
29
#define INA237_CONV_TIME_84 0x01
30
#define INA237_CONV_TIME_150 0x02
31
#define INA237_CONV_TIME_280 0x03
32
#define INA237_CONV_TIME_540 0x04
33
#define INA237_CONV_TIME_1052 0x05
34
#define INA237_CONV_TIME_2074 0x06
35
#define INA237_CONV_TIME_4120 0x07
36
37
/* Averaging Mode */
38
#define INA237_AVG_MODE_1 0x00
39
#define INA237_AVG_MODE_4 0x01
40
#define INA237_AVG_MODE_16 0x02
41
#define INA237_AVG_MODE_64 0x03
42
#define INA237_AVG_MODE_128 0x04
43
#define INA237_AVG_MODE_256 0x05
44
#define INA237_AVG_MODE_512 0x06
45
#define INA237_AVG_MODE_1024 0x07
46
47
/* Reset Mode */
48
#define INA237_RST_NORMAL_OPERATION 0x00
49
#define INA237_RST_SYSTEM_RESET 0x01
50
51
/* Delay for initial ADC conversion in steps of 2 ms */
52
#define INA237_INIT_ADC_DELAY_0_S 0x00
53
#define INA237_INIT_ADC_DELAY_2_MS 0x01
54
#define INA237_INIT_ADC_DELAY_510_MS 0xFF
55
56
/* Shunt full scale range selection across IN+ and IN–. */
57
#define INA237_ADC_RANGE_163_84 0x00
58
#define INA237_ADC_RANGE_40_96 0x01
59
68
#define INA237_CONFIG(rst_mode, \
69
convdly, \
70
adc_range) \
71
(((rst_mode) << 15) | ((convdly) << 6) | ((adc_range) << 4))
72
82
#define INA237_ADC_CONFIG(mode, \
83
vshct, \
84
vbusct, \
85
vtct, \
86
avg) \
87
(((mode) << 12) | ((vbusct) << 9) | ((vshct) << 6) | ((vtct) << 3) | (avg))
88
89
#endif
/* ZEPHYR_INCLUDE_DT_BINDINGS_INA237_H_ */
dt-util.h
include
zephyr
dt-bindings
sensor
ina237.h
Generated on Fri Oct 14 2022 07:25:58 for Zephyr Project API by
1.9.2