M5Unified
m5::INA3221_Class Class Reference

#include <INA3221_Class.hpp>

Inheritance diagram for m5::INA3221_Class:
Collaboration diagram for m5::INA3221_Class:

Public Member Functions

 INA3221_Class (std::uint8_t i2c_addr=DEFAULT_ADDRESS, std::uint32_t freq=400000, I2C_Class *i2c=&In_I2C)
 
bool begin (void)
 
float getBusVoltage (uint8_t channel)
 
float getShuntVoltage (uint8_t channel)
 
float getCurrent (uint8_t channel)
 
int_fast16_t getBusMilliVoltage (uint8_t channel)
 
int32_t getShuntMilliVoltage (uint8_t channel)
 
void setShuntRes (uint8_t channel, uint32_t res)
 
- Public Member Functions inherited from m5::I2C_Device
 I2C_Device (std::uint8_t i2c_addr, std::uint32_t freq, I2C_Class *i2c=&In_I2C)
 
void setPort (I2C_Class *i2c)
 
bool writeRegister8 (std::uint8_t reg, std::uint8_t data) const
 
std::uint8_t readRegister8 (std::uint8_t reg) const
 
bool writeRegister8Array (const std::uint8_t *reg_data_array, std::size_t length) const
 
bool writeRegister (std::uint8_t reg, const std::uint8_t *data, std::size_t length) const
 
bool readRegister (std::uint8_t reg, std::uint8_t *result, std::size_t length) const
 
bool bitOn (std::uint8_t reg, std::uint8_t bit) const
 
bool bitOff (std::uint8_t reg, std::uint8_t bit) const
 
bool isEnabled (void) const
 

Static Public Attributes

static constexpr uint8_t INA3221_CH1_SHUNT_V = 0x01
 
static constexpr uint8_t INA3221_CH1_BUS_V = 0x02
 
static constexpr uint8_t INA3221_CH2_SHUNT_V = 0x03
 
static constexpr uint8_t INA3221_CH2_BUS_V = 0x04
 
static constexpr uint8_t INA3221_CH3_SHUNT_V = 0x05
 
static constexpr uint8_t INA3221_CH3_BUS_V = 0x06
 
static constexpr std::uint8_t INA3221_CH_NUM_MAX = 3
 
static constexpr std::uint8_t DEFAULT_ADDRESS = 0x40
 

Additional Inherited Members

- Protected Attributes inherited from m5::I2C_Device
I2C_Class_i2c
 
std::uint32_t _freq
 
std::uint8_t _addr
 
bool _init
 

Detailed Description

Definition at line 11 of file INA3221_Class.hpp.

Constructor & Destructor Documentation

◆ INA3221_Class()

m5::INA3221_Class::INA3221_Class ( std::uint8_t  i2c_addr = DEFAULT_ADDRESS,
std::uint32_t  freq = 400000,
I2C_Class i2c = &In_I2C 
)
inline

Definition at line 24 of file INA3221_Class.hpp.

Member Function Documentation

◆ begin()

bool m5::INA3221_Class::begin ( void  )

Definition at line 14 of file INA3221_Class.cpp.

Here is the caller graph for this function:

◆ getBusMilliVoltage()

int_fast16_t m5::INA3221_Class::getBusMilliVoltage ( uint8_t  channel)

Definition at line 31 of file INA3221_Class.cpp.

Here is the caller graph for this function:

◆ getBusVoltage()

float m5::INA3221_Class::getBusVoltage ( uint8_t  channel)

Get the voltage of the specified channel.

Parameters
channel0=1ch / 1=2ch / 2=3ch / other=invalid
Returns
voltage [mV]

Definition at line 50 of file INA3221_Class.cpp.

Here is the call graph for this function:

◆ getCurrent()

float m5::INA3221_Class::getCurrent ( uint8_t  channel)

Definition at line 60 of file INA3221_Class.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getShuntMilliVoltage()

int32_t m5::INA3221_Class::getShuntMilliVoltage ( uint8_t  channel)

Definition at line 40 of file INA3221_Class.cpp.

Here is the caller graph for this function:

◆ getShuntVoltage()

float m5::INA3221_Class::getShuntVoltage ( uint8_t  channel)

Definition at line 55 of file INA3221_Class.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setShuntRes()

void m5::INA3221_Class::setShuntRes ( uint8_t  channel,
uint32_t  res 
)

Definition at line 24 of file INA3221_Class.cpp.

Member Data Documentation

◆ DEFAULT_ADDRESS

constexpr std::uint8_t m5::INA3221_Class::DEFAULT_ADDRESS = 0x40
staticconstexpr

Definition at line 22 of file INA3221_Class.hpp.

◆ INA3221_CH1_BUS_V

constexpr uint8_t m5::INA3221_Class::INA3221_CH1_BUS_V = 0x02
staticconstexpr

Definition at line 15 of file INA3221_Class.hpp.

◆ INA3221_CH1_SHUNT_V

constexpr uint8_t m5::INA3221_Class::INA3221_CH1_SHUNT_V = 0x01
staticconstexpr

Definition at line 14 of file INA3221_Class.hpp.

◆ INA3221_CH2_BUS_V

constexpr uint8_t m5::INA3221_Class::INA3221_CH2_BUS_V = 0x04
staticconstexpr

Definition at line 17 of file INA3221_Class.hpp.

◆ INA3221_CH2_SHUNT_V

constexpr uint8_t m5::INA3221_Class::INA3221_CH2_SHUNT_V = 0x03
staticconstexpr

Definition at line 16 of file INA3221_Class.hpp.

◆ INA3221_CH3_BUS_V

constexpr uint8_t m5::INA3221_Class::INA3221_CH3_BUS_V = 0x06
staticconstexpr

Definition at line 19 of file INA3221_Class.hpp.

◆ INA3221_CH3_SHUNT_V

constexpr uint8_t m5::INA3221_Class::INA3221_CH3_SHUNT_V = 0x05
staticconstexpr

Definition at line 18 of file INA3221_Class.hpp.

◆ INA3221_CH_NUM_MAX

constexpr std::uint8_t m5::INA3221_Class::INA3221_CH_NUM_MAX = 3
staticconstexpr

Definition at line 20 of file INA3221_Class.hpp.


The documentation for this class was generated from the following files: