jrowberg/i2cdevlib — pull request #21 by aerdos (2012-12-03 18:56:16+00:00)
Title: Driver additions and fixes

I've been working on an Arduino shield that has an ADS1115 and an LM73 on it and made some additions to your drivers while working on the board.

ADS1115:
Single shot conversions of channels weren't working properly, namely, in single-shot mode 'getDiff' and 'getDifferential0' don't wait for a conversion to be finished before returning a value. This results in an incorrect value being returned. I added auxiliary functions to start a conversion on a certain channel with a certain gain, to wait for a conversion to be finished (with an approximate timeout), and to do a single-shot conversion using these functions.

LM73:
I needed to use an LM73 so I wrote a driver for it using your I2Cdev library. This driver is somewhat basic since I only implemented what I needed at the moment, that is, temperature measurements at 11-14 bit resolutions. The alarm functionality and single-shot conversions are not implemented but could be easily added. I tried to follow the style you had set, but this should be checked.

I2Cdev.cpp Comment:
The calls to 'Wire.endTransmission' don't seem necessary in the 'readByte' and 'readWord' functions. They write the I2C device ID onto the bus but don't actually write any data. It seems unnecessary given the I2C transmission examples I found in the ADS1115 and the LM73 datasheets. I tried with and without the calls to this function and both ways worked for me when talking to the ADS1115 and the LM73. I'm not familiar with the reasons behind the calls, I just wanted to ask if this was intentional.