![]() |
SparkFun INA2XX Arduino Library
v1.0.0-3-gc9007d6
Arduino Library for the SparkFun Qwiic Power Monitor (INA228 / INA237)
|
Header file for the SparkFun INA2XX family base driver. More...
#include <stdint.h>#include <sfTk/sfToolkit.h>#include <sfTk/sfTkII2C.h>Go to the source code of this file.
Classes | |
| union | sfe_ina2xx_config_reg_t |
| Bitfield union for the 16-bit CONFIG register (0x00). More... | |
| union | sfe_ina2xx_adc_config_reg_t |
| Bitfield union for the 16-bit ADC_CONFIG register (0x01). More... | |
| union | sfe_ina2xx_diag_alrt_reg_t |
| Bitfield union for the 16-bit DIAG_ALRT diagnostic flags and alert register (0x0B). More... | |
| class | sfDevINA2XX |
| Platform-independent base driver for the INA228/INA237 power monitor ICs. More... | |
Typedefs | |
| typedef enum sfe_ina2xx_mode_t | sfe_ina2xx_mode_t |
| ADC operating mode settings for the MODE field in ADC_CONFIG (bits [15:12]). More... | |
| typedef enum sfe_ina2xx_conv_time_t | sfe_ina2xx_conv_time_t |
| Conversion time settings shared by the VBUSCT, VSHCT, and VTCT fields. More... | |
| typedef enum sfe_ina2xx_avg_count_t | sfe_ina2xx_avg_count_t |
| ADC averaging count settings for the AVG field in ADC_CONFIG (bits [2:0]). More... | |
Header file for the SparkFun INA2XX family base driver.
sfDevINA2XX is the platform-independent base class for the Texas Instruments INA228 and INA237 digital power/energy monitor ICs. It provides register access for all configuration and diagnostic registers that are shared between both devices:
Device-specific measurement registers (VSHUNT, VBUS, CURRENT, POWER, ENERGY, CHARGE) are implemented in the derived sfDevINA228 and sfDevINA237 classes because they differ in register width and LSB scaling between the two ICs.
Both devices use 8-bit register addresses and big-endian byte order over I2C.
Most methods return a SparkFun Toolkit error code (::ksfTkErrOk on success, a negative value on error); values read from the device are returned through reference (output) parameters. Callers that do not care about error handling can simply ignore the returned code.
SPDX-License-Identifier: MIT
| typedef enum sfe_ina2xx_avg_count_t sfe_ina2xx_avg_count_t |
ADC averaging count settings for the AVG field in ADC_CONFIG (bits [2:0]).
| typedef enum sfe_ina2xx_conv_time_t sfe_ina2xx_conv_time_t |
Conversion time settings shared by the VBUSCT, VSHCT, and VTCT fields.
| typedef enum sfe_ina2xx_mode_t sfe_ina2xx_mode_t |
ADC operating mode settings for the MODE field in ADC_CONFIG (bits [15:12]).
Modes 0x0 and 0x8 are both shutdown. Modes 0x1-0x7 are triggered (single-shot). Modes 0x9-0xF are continuous. A typedef is provided so the type can be used without the enum keyword in environments where that matters.
| enum sfe_ina2xx_avg_count_t : uint8_t |
ADC averaging count settings for the AVG field in ADC_CONFIG (bits [2:0]).
| enum sfe_ina2xx_conv_time_t : uint8_t |
| enum sfe_ina2xx_mode_t : uint8_t |
ADC operating mode settings for the MODE field in ADC_CONFIG (bits [15:12]).
Modes 0x0 and 0x8 are both shutdown. Modes 0x1-0x7 are triggered (single-shot). Modes 0x9-0xF are continuous. A typedef is provided so the type can be used without the enum keyword in environments where that matters.