nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32
https://nodemcu.readthedocs.io
MIT License
7.64k stars 3.12k forks source link

support for ads1015 #2223

Closed paweljasinski closed 6 years ago

paweljasinski commented 6 years ago

Missing feature

When using ads1015 chip, the existing ads1115 module can be used. However, not everything maps 1:1.

Justification

ads1015 breakout boards are is available from adafruiit and ali

Workarounds

marcelstoer commented 6 years ago

2188 is similar in that it adds support to a variant of a chip that we already have a module for. Not sure if it helps to look for inspiration there.

paweljasinski commented 6 years ago

Thanks for the tip. I am new here, so for me it is not obvious how far is the memory consumption an issue. We could make the type of the chip a parameter of the initialization. This will increase size of the module. Mostly parameter validation and different timer values. Alternatively, a chip type could be a build time parameter - the module is compiled either 1015 or 1115. Another, perhaps exotic requirements, is use of mixed setup. 1015 and 1115 in the same project. But before this, the module should support more than one chip - I don't believe the module in current state supports conveniently more than than one device.

Looking at the chip specs, I see no way to automate the initialization - from i2c side both chips appear identical. Actually when I think more about it, I could configure "conversion ready mode" and measure how long did it take. Unfortunately, this is only if "conversion pin ready" is wired.

paweljasinski commented 6 years ago

I manage to add support for multiple devices as well as different device type ads1015. I also believe it will work unchanged with ads1x13 and ads1x14. The changes can be seen under https://github.com/paweljasinski/nodemcu-firmware/tree/new-ads1115. I would appreciate feedback before updating documentation and doing a PR.

devsaurus commented 6 years ago

PR merged. Thanks a lot for your contribution Pawel, very much appreciated!