peary/hardware/components/INA226.hpp

INA226 Component Class. More…

Namespaces

Name
peary
peary::component

Classes

Name
class peary::component::INA226 INA226 Power Monitor Component.

Detailed Description

INA226 Component Class.

Copyright: Copyright (c) 2016-2025 CERN and the Peary Caribou authors. This software is distributed under the terms of the LGPL-3.0-only License, copied verbatim in the file “LICENSE.md”. SPDX-License-Identifier: LGPL-3.0-only

Source code

  
#pragma once

#include <cstdint>
#include <string>

#include "peary/hal/Components.hpp"
#include "peary/interfaces/I2C/i2c.hpp"

namespace peary::component {

    class INA226 : public hal::Component {
    public:
        // Register addresses
        enum class Register {
            CONFIGURATION = 0x00,
            SHUNT_VOLTAGE = 0x01,
            BUS_VOLTAGE = 0x02,
            POWER = 0x03,
            CURRENT = 0x04,
            CALIBRATION = 0x05,
            ENABLE = 0x06,
            ALERT_LIMIT = 0x07
        };

        INA226(const std::string& i2c_bus, uint8_t device_address, double r_shunt);

        void setCurrentLimit(double current);

        double getVoltage();

        double getCurrent();

        double getPower();

    private:
        std::string _bus;
        uint8_t _address;
        double _r_shunt;
    };

} // namespace peary::component
  

Updated on 2025-11-14 at 11:31:23 +0100