ina219

package
v0.0.0-...-613ce78 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REG_CONFIG byte = iota
	REG_SHUNT_VOLTAGE
	REG_BUS_VOLTAGE
	REG_POWER
	REG_CURRENT
	REG_CALIBRATION
)

Register names and addresses.

View Source
const Address = 0x40

The I2C address which this device listens to by default.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calibration

type Calibration int
const (
	V32A2 Calibration = iota
	V32A1
	V16mA400
)

type Config

type Config struct {
	CalibrationValue   uint16
	ConfigValue        uint16
	CurrentDivider_mA  uint16
	PowerMultiplier_uW uint16
}

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device wraps an I2C connection to a INA219 device.

func New

func New(bus drivers.I2C) Device

New creates a new INA219 connection. The I2C bus must already be configured.

This function only creates the Device object. It does not touch the device.

func (*Device) Configure

func (d *Device) Configure(config *Config) bool

Configure sets up the device for communication.

func (*Device) GetCurrent_uA

func (d *Device) GetCurrent_uA() int32

func (*Device) GetPower_uW

func (d *Device) GetPower_uW() int32

func (*Device) GetVoltage_mV

func (d *Device) GetVoltage_mV() int16

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL