Build-a-Driver #5: Measurement Resolution

Here's the fifth patch in the Build-a-Driver series for MCP9808.
(If this post seems out of context, please refer to "Build-a-Driver Introduction" post.)

mcp9808: this version adds support for changing measurement resolution also known as the integration time.

MCP9808 supports 4 resolutions: .5 .25 .125 .0625.
Power-on default resolution is .0625.

This requires the following changes:
Much of this was verified with debug code that has since been removed.  For example, for the writing of the resolution bits, I had dumped the array at probe, dumped the bits before I sent them, and read back the resolution register after I wrote it to be sure those bits were set correctly.  

The testing at this point was a simple bash script, some icepacks, hotpack, icewater and some ziploc bags.  My sensor has survived, but I have not reached zero. So, more to do on the coldest side.  I looped while reading temps and changing integration times checking that they were as expected.  
(I'll post test info separately.)

This version mcp9808-resolution.c
To view complete revision history go here.

Labels: ,