Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions LM75.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ LM75::LM75 (byte addr) {
address = addr;
}

word LM75::float2regdata (float temp)
uint16_t LM75::float2regdata (float temp)
{
// First multiply by 8 and coerce to integer to get +/- whole numbers
// Then coerce to word and bitshift 5 to fill out MSB
return (word)((int)(temp * 8) << 5);
return (uint16_t)((int16_t)(temp * 8) << 5);
}

float LM75::regdata2float (word regdata)
{
return ((float)(int)regdata / 32) / 8;
return ((float)(int16_t)regdata / 32) / 8;
}

word LM75::_register16 (byte reg) {
Expand Down