write config register in little endian

This commit is contained in:
John Pauley 2017-05-10 18:20:35 -04:00 committed by deadprogram
parent 8f8a889d04
commit 5f2bb180ee
1 changed files with 2 additions and 2 deletions

View File

@ -193,7 +193,7 @@ func (i *INA3221Driver) readWordFromRegister(reg uint8) (uint16, error) {
return 0, err
}
return uint16((val << 8) | ((val >> 8) & 0xFF)), nil
return uint16((val << 8) | ((val >> 8) & 0x00FF)), nil
}
// initialize initializes the INA3221 device
@ -208,5 +208,5 @@ func (i *INA3221Driver) initialize() error {
ina3221ConfigMode1 |
ina3221ConfigMode0
return i.connection.WriteWordData(ina3221RegConfig, config)
return i.connection.WriteBlockData(ina3221RegConfig, []byte{byte(config >> 8), byte(config & 0x00FF)})
}