mirror of
https://github.com/kidoman/embd
synced 2024-06-08 12:07:48 +02:00
reformat
This commit is contained in:
parent
e87156263c
commit
802db1c399
|
@ -3,6 +3,7 @@
|
|||
// interfcace.
|
||||
|
||||
// TODO - add options to config voltage range, sensitivity and averaging
|
||||
// TODO - Current and Power can overflow within normal ranges
|
||||
// TODO - add documentation
|
||||
|
||||
package ina219
|
||||
|
@ -24,7 +25,7 @@ const (
|
|||
calibReg = 0x05
|
||||
)
|
||||
|
||||
// INA219 represents a Bosch INA219 current sensor.
|
||||
// INA219 represents an INA219 current sensor.
|
||||
type INA219 struct {
|
||||
Bus embd.I2CBus
|
||||
|
||||
|
@ -88,7 +89,7 @@ func (d *INA219) ShuntVoltage() (float64, error) {
|
|||
return math.NaN(), err
|
||||
}
|
||||
|
||||
voltage := float64( int16(v) ) / 100000.0
|
||||
voltage := float64(int16(v)) / 100000.0
|
||||
|
||||
return voltage, nil
|
||||
}
|
||||
|
@ -118,7 +119,7 @@ func (d *INA219) Current() (float64, error) {
|
|||
return math.NaN(), err
|
||||
}
|
||||
|
||||
current := float64( int16(v) ) / 1000.0
|
||||
current := float64(int16(v)) / 1000.0
|
||||
|
||||
return current, nil
|
||||
}
|
||||
|
@ -133,7 +134,7 @@ func (d *INA219) Power() (float64, error) {
|
|||
return math.NaN(), err
|
||||
}
|
||||
|
||||
current := float64( int16(v) ) / 50.0
|
||||
current := float64(int16(v)) / 50.0
|
||||
|
||||
return current, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user