Skip to content

Commit

Permalink
Fix temperature reading with clang formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-3bian committed Oct 5, 2024
1 parent 2aa8838 commit d75587e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/all/i2c_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ static void read_temperature_sensor_value(Mmio<OpenTitanI2c> i2c,
i2c->blocking_write(0x48, buf, 1, false);
if (i2c->blocking_read(0x48, buf, 2u))
{
uint16_t temp = (buf[0] << 8) | buf[1];
int16_t regValue = (buf[0] << 8) | buf[1];
int64_t temp = regValue * 1000000LL / 128;
Debug::log("The {} readout is {}", regName, temp);
}
else
Expand Down

0 comments on commit d75587e

Please sign in to comment.