Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Texas Instruments INA237 current and power monitor. More...

Files

file  ina237.h
 Devicetree binding constants for the TI INA237 power monitor.

Macros

#define INA237_CONFIG(rst_mode, convdly, adc_range)
 Build the INA237 configuration register value.
#define INA237_ADC_CONFIG(mode, vshct, vbusct, vtct, avg)
 Build the INA237 ADC configuration register value.

Operating mode

Operating-mode argument for the INA237_ADC_CONFIG() macro.

#define INA237_CFG_HIGH_PRECISION   BIT(4)
 High-precision mode flag.
#define INA237_OPER_MODE_SHUTDOWN   0x00
 Shutdown.
#define INA237_OPER_MODE_BUS_VOLTAGE_TRIG   0x01
 Bus voltage, triggered.
#define INA237_OPER_MODE_SHUNT_VOLTAGE_TRIG   0x02
 Shunt voltage, triggered.
#define INA237_OPER_MODE_SHUNT_BUS_VOLTAGE_TRIG   0x03
 Shunt and bus, triggered.
#define INA237_OPER_MODE_TEMP_TRIG   0x04
 Temperature, triggered.
#define INA237_OPER_MODE_TEMP_BUS_VOLTAGE_TRIG   0x05
 Temp and bus, triggered.
#define INA237_OPER_MODE_TEMP_SHUNT_VOLTAGE_TRIG   0x06
 Temp and shunt, triggered.
#define INA237_OPER_MODE_BUS_SHUNT_VOLTAGE_TEMP_TRIG   0x07
 Bus, shunt and temp, triggered.
#define INA237_OPER_MODE_BUS_VOLTAGE_CONT   0x09
 Bus voltage, continuous.
#define INA237_OPER_MODE_SHUNT_VOLTAGE_CONT   0x0A
 Shunt voltage, continuous.
#define INA237_OPER_MODE_SHUNT_BUS_VOLTAGE_CONT   0x0B
 Shunt and bus, continuous.
#define INA237_OPER_MODE_TEMP_CONT   0x0C
 Temperature, continuous.
#define INA237_OPER_MODE_BUS_VOLTAGE_TEMP_CONT   0x0D
 Bus and temp, continuous.
#define INA237_OPER_MODE_TEMP_SHUNT_VOLTAGE_CONT   0x0E
 Temp and shunt, continuous.
#define INA237_OPER_MODE_BUS_SHUNT_VOLTAGE_TEMP_CONT   0x0F
 Bus, shunt and temp, continuous.

Bus, shunt and temperature conversion time

Conversion-time argument for the INA237_ADC_CONFIG() macro.

#define INA237_CONV_TIME_50   0x00
 50 µs
#define INA237_CONV_TIME_84   0x01
 84 µs
#define INA237_CONV_TIME_150   0x02
 150 µs
#define INA237_CONV_TIME_280   0x03
 280 µs
#define INA237_CONV_TIME_540   0x04
 540 µs
#define INA237_CONV_TIME_1052   0x05
 1052 µs
#define INA237_CONV_TIME_2074   0x06
 2074 µs
#define INA237_CONV_TIME_4120   0x07
 4120 µs

Averaging mode (number of samples)

Averaging-mode argument for the INA237_ADC_CONFIG() macro.

#define INA237_AVG_MODE_1   0x00
 1 sample
#define INA237_AVG_MODE_4   0x01
 4 samples
#define INA237_AVG_MODE_16   0x02
 16 samples
#define INA237_AVG_MODE_64   0x03
 64 samples
#define INA237_AVG_MODE_128   0x04
 128 samples
#define INA237_AVG_MODE_256   0x05
 256 samples
#define INA237_AVG_MODE_512   0x06
 512 samples
#define INA237_AVG_MODE_1024   0x07
 1024 samples

Reset mode

Reset-mode argument for the INA237_CONFIG() macro.

#define INA237_RST_NORMAL_OPERATION   0x00
 Normal operation.
#define INA237_RST_SYSTEM_RESET   0x01
 Trigger a system reset.

Initial ADC conversion delay (steps of 2 ms)

Initial ADC-delay argument for the INA237_CONFIG() macro.

#define INA237_INIT_ADC_DELAY_0_S   0x00
 0 s (no delay)
#define INA237_INIT_ADC_DELAY_2_MS   0x01
 2 ms
#define INA237_INIT_ADC_DELAY_510_MS   0xFF
 510 ms

Shunt full-scale range across IN+ and IN−

Shunt full-scale range argument for the INA237_CONFIG() macro.

#define INA237_ADC_RANGE_163_84   0x00
 ±163.84 mV
#define INA237_ADC_RANGE_40_96   0x01
 ±40.96 mV

Detailed Description

Texas Instruments INA237 current and power monitor.

Macro Definition Documentation

◆ INA237_ADC_CONFIG

#define INA237_ADC_CONFIG ( mode,
vshct,
vbusct,
vtct,
avg )

#include <zephyr/dt-bindings/sensor/ina237.h>

Value:
(((mode) << 12) | ((vbusct) << 9) | ((vshct) << 6) | ((vtct) << 3) | (avg))

Build the INA237 ADC configuration register value.

Parameters
modeOperating mode (see ina237_oper_mode).
vshctShunt voltage conversion time (see ina237_conv_time).
vbusctBus voltage conversion time (see ina237_conv_time).
vtctTemperature conversion time (see ina237_conv_time).
avgAveraging mode (see ina237_avg).

◆ INA237_ADC_RANGE_163_84

#define INA237_ADC_RANGE_163_84   0x00

#include <zephyr/dt-bindings/sensor/ina237.h>

±163.84 mV

◆ INA237_ADC_RANGE_40_96

#define INA237_ADC_RANGE_40_96   0x01

#include <zephyr/dt-bindings/sensor/ina237.h>

±40.96 mV

◆ INA237_AVG_MODE_1

#define INA237_AVG_MODE_1   0x00

◆ INA237_AVG_MODE_1024

#define INA237_AVG_MODE_1024   0x07

#include <zephyr/dt-bindings/sensor/ina237.h>

1024 samples

◆ INA237_AVG_MODE_128

#define INA237_AVG_MODE_128   0x04

#include <zephyr/dt-bindings/sensor/ina237.h>

128 samples

◆ INA237_AVG_MODE_16

#define INA237_AVG_MODE_16   0x02

#include <zephyr/dt-bindings/sensor/ina237.h>

16 samples

◆ INA237_AVG_MODE_256

#define INA237_AVG_MODE_256   0x05

#include <zephyr/dt-bindings/sensor/ina237.h>

256 samples

◆ INA237_AVG_MODE_4

#define INA237_AVG_MODE_4   0x01

#include <zephyr/dt-bindings/sensor/ina237.h>

4 samples

◆ INA237_AVG_MODE_512

#define INA237_AVG_MODE_512   0x06

#include <zephyr/dt-bindings/sensor/ina237.h>

512 samples

◆ INA237_AVG_MODE_64

#define INA237_AVG_MODE_64   0x03

#include <zephyr/dt-bindings/sensor/ina237.h>

64 samples

◆ INA237_CFG_HIGH_PRECISION

#define INA237_CFG_HIGH_PRECISION   BIT(4)

#include <zephyr/dt-bindings/sensor/ina237.h>

High-precision mode flag.

◆ INA237_CONFIG

#define INA237_CONFIG ( rst_mode,
convdly,
adc_range )

#include <zephyr/dt-bindings/sensor/ina237.h>

Value:
(((rst_mode) << 15) | ((convdly) << 6) | ((adc_range) << 4))

Build the INA237 configuration register value.

Parameters
rst_modeReset mode (see ina237_reset).
convdlyInitial ADC conversion delay (see ina237_init_adc_delay).
adc_rangeShunt full-scale range (see ina237_adc_range).

◆ INA237_CONV_TIME_1052

#define INA237_CONV_TIME_1052   0x05

◆ INA237_CONV_TIME_150

#define INA237_CONV_TIME_150   0x02

◆ INA237_CONV_TIME_2074

#define INA237_CONV_TIME_2074   0x06

◆ INA237_CONV_TIME_280

#define INA237_CONV_TIME_280   0x03

◆ INA237_CONV_TIME_4120

#define INA237_CONV_TIME_4120   0x07

◆ INA237_CONV_TIME_50

#define INA237_CONV_TIME_50   0x00

◆ INA237_CONV_TIME_540

#define INA237_CONV_TIME_540   0x04

◆ INA237_CONV_TIME_84

#define INA237_CONV_TIME_84   0x01

◆ INA237_INIT_ADC_DELAY_0_S

#define INA237_INIT_ADC_DELAY_0_S   0x00

#include <zephyr/dt-bindings/sensor/ina237.h>

0 s (no delay)

◆ INA237_INIT_ADC_DELAY_2_MS

#define INA237_INIT_ADC_DELAY_2_MS   0x01

◆ INA237_INIT_ADC_DELAY_510_MS

#define INA237_INIT_ADC_DELAY_510_MS   0xFF

◆ INA237_OPER_MODE_BUS_SHUNT_VOLTAGE_TEMP_CONT

#define INA237_OPER_MODE_BUS_SHUNT_VOLTAGE_TEMP_CONT   0x0F

#include <zephyr/dt-bindings/sensor/ina237.h>

Bus, shunt and temp, continuous.

◆ INA237_OPER_MODE_BUS_SHUNT_VOLTAGE_TEMP_TRIG

#define INA237_OPER_MODE_BUS_SHUNT_VOLTAGE_TEMP_TRIG   0x07

#include <zephyr/dt-bindings/sensor/ina237.h>

Bus, shunt and temp, triggered.

◆ INA237_OPER_MODE_BUS_VOLTAGE_CONT

#define INA237_OPER_MODE_BUS_VOLTAGE_CONT   0x09

#include <zephyr/dt-bindings/sensor/ina237.h>

Bus voltage, continuous.

◆ INA237_OPER_MODE_BUS_VOLTAGE_TEMP_CONT

#define INA237_OPER_MODE_BUS_VOLTAGE_TEMP_CONT   0x0D

#include <zephyr/dt-bindings/sensor/ina237.h>

Bus and temp, continuous.

◆ INA237_OPER_MODE_BUS_VOLTAGE_TRIG

#define INA237_OPER_MODE_BUS_VOLTAGE_TRIG   0x01

#include <zephyr/dt-bindings/sensor/ina237.h>

Bus voltage, triggered.

◆ INA237_OPER_MODE_SHUNT_BUS_VOLTAGE_CONT

#define INA237_OPER_MODE_SHUNT_BUS_VOLTAGE_CONT   0x0B

#include <zephyr/dt-bindings/sensor/ina237.h>

Shunt and bus, continuous.

◆ INA237_OPER_MODE_SHUNT_BUS_VOLTAGE_TRIG

#define INA237_OPER_MODE_SHUNT_BUS_VOLTAGE_TRIG   0x03

#include <zephyr/dt-bindings/sensor/ina237.h>

Shunt and bus, triggered.

◆ INA237_OPER_MODE_SHUNT_VOLTAGE_CONT

#define INA237_OPER_MODE_SHUNT_VOLTAGE_CONT   0x0A

#include <zephyr/dt-bindings/sensor/ina237.h>

Shunt voltage, continuous.

◆ INA237_OPER_MODE_SHUNT_VOLTAGE_TRIG

#define INA237_OPER_MODE_SHUNT_VOLTAGE_TRIG   0x02

#include <zephyr/dt-bindings/sensor/ina237.h>

Shunt voltage, triggered.

◆ INA237_OPER_MODE_SHUTDOWN

#define INA237_OPER_MODE_SHUTDOWN   0x00

#include <zephyr/dt-bindings/sensor/ina237.h>

Shutdown.

◆ INA237_OPER_MODE_TEMP_BUS_VOLTAGE_TRIG

#define INA237_OPER_MODE_TEMP_BUS_VOLTAGE_TRIG   0x05

#include <zephyr/dt-bindings/sensor/ina237.h>

Temp and bus, triggered.

◆ INA237_OPER_MODE_TEMP_CONT

#define INA237_OPER_MODE_TEMP_CONT   0x0C

#include <zephyr/dt-bindings/sensor/ina237.h>

Temperature, continuous.

◆ INA237_OPER_MODE_TEMP_SHUNT_VOLTAGE_CONT

#define INA237_OPER_MODE_TEMP_SHUNT_VOLTAGE_CONT   0x0E

#include <zephyr/dt-bindings/sensor/ina237.h>

Temp and shunt, continuous.

◆ INA237_OPER_MODE_TEMP_SHUNT_VOLTAGE_TRIG

#define INA237_OPER_MODE_TEMP_SHUNT_VOLTAGE_TRIG   0x06

#include <zephyr/dt-bindings/sensor/ina237.h>

Temp and shunt, triggered.

◆ INA237_OPER_MODE_TEMP_TRIG

#define INA237_OPER_MODE_TEMP_TRIG   0x04

#include <zephyr/dt-bindings/sensor/ina237.h>

Temperature, triggered.

◆ INA237_RST_NORMAL_OPERATION

#define INA237_RST_NORMAL_OPERATION   0x00

#include <zephyr/dt-bindings/sensor/ina237.h>

Normal operation.

◆ INA237_RST_SYSTEM_RESET

#define INA237_RST_SYSTEM_RESET   0x01

#include <zephyr/dt-bindings/sensor/ina237.h>

Trigger a system reset.