Actions
Bug #2195
closedBug #1450: Illumos should be buildable with GCC4
lm75 ignores the half degree bit in writes
Start date:
2012-02-27
Due date:
% Done:
100%
Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
Description
lm75(7D) allows setting of various temperatures, in a somewhat annoying format:
See http://www.datasheetcatalog.org/datasheet/nationalsemiconductor/DS012658.PDF section 1.4.
Basically, we have 16bits: bit 15 is sign, bits 14-6 are temperature, bits 5-0 are ignored.
The temperature encoding doesn't actually matter, but the one bit of temperature in the 2nd byte is half a degree.
When we come to do this we do:
i2c_tran_pointer->i2c_wbuf[1] = (temp16 >> 1); i2c_tran_pointer->i2c_wbuf[2] = ((temp16 & 0xFE) << 7);
The mask on the second line removes the only bit we actually care about, losing us half a degree of temperature.
Updated by Rich Lowe about 10 years ago
- Status changed from In Progress to Resolved
- % Done changed from 80 to 100
Resolved in r13632 commit:ab0e9bcbdf3e
Actions