wollewald / ADS1220_WE

Arduino library for the 24-bit, 4 channel ADS1220 ADC
https://wolles-elektronikkiste.de/en/
MIT License
20 stars 2 forks source link

Passing SPIClass in the constructor #4

Closed opseb closed 2 months ago

opseb commented 9 months ago

Thank you very much for this library.

ESP32 has got two SPI interfaces namely VSPI (default) and HSPI. When passing a custom SPIClass to use the HSPI interface the setup gets stuck after reading a single value. After several attempts to assign different pins and avoiding restricted pins, I found that there is a method ( void ADS1220_WE::command(uint8_t cmd) ) in the file ADS1220_WE.cpp where there the global SPI is used instead of custom member_spi assigned in the constructor .

Changing the line SPI.transfer(cmd) to _spi->transfer(cmd) solves the problem when assigning a different SPI interface in ESP32.

Kindly advice if this change is correct and if it could be a possible bug fix

wollewald commented 9 months ago

@opseb , thank you! I I have absolutely no idea why I left this single SPI instruction as SPI.transfer() and not like all others to _spi->transfer(). Will change this immediately.

wollewald commented 2 months ago

Since I changed the code and haven't heard anything I consider this issue to be completed.

opseb commented 2 months ago

Sorry for late reply. There has been no problem since the code was updated.