retrolefty:
Thanks Jeff, that would be great. I've had the device for over a week now but just not the time to try and cobble something together. I'm a hardware type and software comes slow and gradual to me. The built in A/D pins on a arduino are useful but sadly fall far short of instrumentation quality. I thoough this would be a nice improvement to have avalible.
Lefty, I just pushed a new ADS1115 class up on GitHub for you to try. It compiles okay, and it's as close to the datasheet as I could make it. There should hopefully be enough comments that you can tell how to use it, but check the datasheet or ask me if you aren't sure. I might not have an answer, but I can give it a shot. Let me know how it works.
The ADS1115 is interesting because it uses 16-bit registers, which I haven't run into before. I had to update the main I2Cdev library to support word-size operations conveniently instead of just byte-size ones, though I'm sure that will come in handy for other devices as well, so in no way was it wasted effort or a one-time-use thing.
mem:
one suggestion is to add a timeout property to the library so calls want hang if the I2C device does not respond. ... You would want to inform the caller of a timeout, for example return 0 if the code times out.
Good idea! I've added this as well. The timeout is set to a default of 250ms (defined in I2Cdev.h). Read operations that time out return -1, while 0 indicates instant failure and 1 or more indicates success. A timeout length of zero disables timeout detection. Thanks for the suggestion!
Graynomad:
I suppose you library doesn't think of itself as a slave device, but can you implement that for inter-Arduino talks.
This could be useful, though I'd have to think about how best to build it into the library's basic structure. The I2Cdev main class and all device classes are specifically designed to interface with slave devices, and doing an Arduino-to-Arduino link is unpredictable and arbitrary in terms of protocols. The Arduino MasterReader example uses a very simple Wire implementation to do just that, including the necessary "onRequest" event hook on the "slave" Arduino. I don't know if it would be valuable to write one of these class libraries for generic communication, but if you had a specific functional protocol in mind for the slave device (like these manufactured I2C slave chips), then maybe it would be.
If you just use the basic "I2C::readBytes()" and other core functions of the main library, you might be able to accomplish simple communication without any specific device classes. I haven't tried, but it would be interesting.
terryking228:
Jeff, Very nice professional work! Thanks for the effort. I'll be following...
Thanks, Terry! I'm glad you and others believe it will be helpful. That's my goal!
Jeff