On this page
article
peary::component::INA226
peary::component::INA226
INA226 Power Monitor Component.
#include <peary/hardware/components/INA226.hpp>
Inherits from peary::hal::Component
Public Types
| Name | |
|---|---|
| enum class | Register { CONFIGURATION = 0x00, SHUNT_VOLTAGE = 0x01, BUS_VOLTAGE = 0x02, POWER = 0x03, CURRENT = 0x04, CALIBRATION = 0x05, ENABLE = 0x06, ALERT_LIMIT = 0x07} |
Public Functions
| Name | |
|---|---|
| INA226(const std::string & i2c_bus, uint8_t device_address, double r_shunt)Constructor for INA226 class. | |
| void | setCurrentLimit(double current)Set the current limit for the INA226. |
| double | getVoltage()Get the bus voltage from the INA226. |
| double | getCurrent()Get the current from the INA226. |
| double | getPower()Get the power from the INA226. |
Additional inherited members
Public Functions inherited from peary::hal::Component
| Name | |
|---|---|
| Component() =defaultDefault constructor. | |
| virtual | ~Component() =defaultDefault destructor. |
Public Types Documentation
enum Register
| Enumerator | Value | Description |
|---|---|---|
| CONFIGURATION | 0x00 | |
| SHUNT_VOLTAGE | 0x01 | |
| BUS_VOLTAGE | 0x02 | |
| POWER | 0x03 | |
| CURRENT | 0x04 | |
| CALIBRATION | 0x05 | |
| ENABLE | 0x06 | |
| ALERT_LIMIT | 0x07 |
Public Functions Documentation
function INA226
INA226(
const std::string & i2c_bus,
uint8_t device_address,
double r_shunt
)
Constructor for INA226 class.
Parameters:
- i2c_bus The I2C bus to which the INA226 is connected
- device_address The I2C address of the INA226 device
- r_shunt The value of the shunt resistor in ohms
function setCurrentLimit
void setCurrentLimit(
double current
)
Set the current limit for the INA226.
Parameters:
- current The maximum expected current in amperes
function getVoltage
double getVoltage()
Get the bus voltage from the INA226.
Return: The bus voltage in volts
function getCurrent
double getCurrent()
Get the current from the INA226.
Return: The current in amperes
function getPower
double getPower()
Get the power from the INA226.
Return: The power in watts
Updated on 2025-11-14 at 11:31:23 +0100