Build-a-Driver #8: Delay after integration time changes

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

The driver needs to delay after changing integration times so that it does not report a temperature in the previous resolution.  This fixes a problem found during testing and noted in this post.

I referenced the kernel documentation timers-howto.txt where I found the  RightWay (TM) for adding delays to drivers.  It says that if you are sleeping for larger MSECS which it defines as  10ms+,  msleep() is the appropriate choice.

We are operating in continuous mode, so we'll use the conversion times as the delay.

Those conversion times range from 30-250 MSECS, so msleep() is the way to go.

From the MCP9808 Data Sheet:

Changes required:

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

Labels: ,