eldruin / ads1x1x-rs

Platform-agnostic Rust driver for the ADS1x1x ultra-small, low-power analog-to-digital converters (ADC). Compatible with ADS1013, ADS1014, ADS1015, ADS1113, ADS1114 and ADS1115
https://blog.eldruin.com/ads1x1x-analog-to-digital-converter-driver-in-rust/
Apache License 2.0
31 stars 9 forks source link

ADS1119 support? #12

Closed clintfred closed 6 months ago

clintfred commented 10 months ago

Thanks for the great crate! (and all the other ones as well)

Do you know if this library supports or could support the ADS1119? The numbering scheme makes it seem like it might be compatible, but that may be misleading.

We were trying to use 2 ADS1115, but we ran into I2C address conflict issues and the EE I am working with suggested we use the 1119 instead.

I'm fairly new to the embedded world, so any guidance is appreciated.

eldruin commented 10 months ago

You are welcome. I'm glad they are useful to you. The ADS1119 is not immediately compatible with this driver as it features a command-based interface and the register map also differs. The device seems fairly simple, though, so you may be able to write a driver for it.

Nevertheless, if you are only using 2 ADS1115, you should be able to just change the polarization of the ADDR pin to change its address and avoid the conflict. Actually, you can have up to 4 ADS1115 connected to the same bus simultaneously. See Table 4 in section 9.5.1.1 of the datasheet.

clintfred commented 9 months ago

Thanks for the reply. Would it make sense to try to add the 1119 to this crate, or is it different enough that that wouldn't be appropriate? I may be interested in attempting to add 1119 support if I can't find any alternatives.

(After talking to the EEs, I've learn the ADS1115 were also conflicting with other I2C devices as well. So we're forging ahead with using the 1119.)

eldruin commented 9 months ago

The ADS1119 is actually quite different so I think a separate driver would make more sense. Please note that you can also use a PCA9548A or similar device to switch between devices in your I2C bus and resolve your conflicts. I have a driver for a few of them here.

clintfred commented 6 months ago

I have created a partial driver. You can find it here

Any comments would be welcome. :)

eldruin commented 6 months ago

Great. I do not have time to review it but let me know if you need help with any specific issue. Closing.