This commit is contained in:
2025-03-20 21:08:37 +01:00
parent 76e182935b
commit f16659c25c
3 changed files with 42 additions and 11 deletions

View File

@@ -23,6 +23,33 @@ uint16_t get_word(uint8_t address, uint8_t reg) {
return (data[1] << 8) | data[0];
}
char* INA233::print_device_number() {
char data[6];
int16_t rawVoltage;
// Request data from the PMBus device
Wire.beginTransmission(INA233::_address);
Wire.write(0x9A);
Wire.endTransmission();
Wire.requestFrom(INA233::_address, 6);
if (Wire.available() == 6) {
data[0] = Wire.read();
data[1] = Wire.read();
data[2] = Wire.read();
data[3] = Wire.read();
data[4] = Wire.read();
data[5] = Wire.read();
} else {
// return 0 on error
data[0] = '\0';
return data;
}
// Combine the two bytes into a single 16-bit value
return data;
}
void sendWord(uint8_t deviceAddress, uint8_t registerAddress, uint16_t value) {
Wire.beginTransmission(deviceAddress);