EnviroDIY / Arduino-SDI-12

An Arduino library for SDI-12 communication with a wide variety of environmental sensors. This library provides a general software solution, without requiring any additional hardware.
https://github.com/EnviroDIY/Arduino-SDI-12/wiki
BSD 3-Clause "New" or "Revised" License
164 stars 100 forks source link

Support for Arduino R4 Renesas chip? #128

Closed electromechpro closed 1 month ago

electromechpro commented 1 year ago

<Sorry, I hit enter after the title and it went straight to post.> I do not intend to ask something like, "Can you spend hundreds of hours of development time to make my $3 ebay board work with your library?", but we have an existing UNO R3 setup monitoring SDI12 devices, some thermocouples, and driving a small OLED. Adding a second thermocouple shield was too much for the R3 to handle (memory errors and glitches on the display), so we ordered some R4s. Little did we know the SDI-12 library documentation stated it only supported AVR and ESP type chips. As it is an official Arduino Brand board, can someone point me in the right direction to modify the following files for the Renesas chipset on the R4s? (It may already be in the works) Looking at the 4 files in the src directory, starting with SDI12_boards.cpp, I can see where the board is not defined, thus the "Please define your board timer and pins" message. What can I add to the cpp file to include R4 info? Then, I can see the definitions for the ESP32/8266 boards timers and prescales. Then in the SDI12_boards.h file, I was wondering if the Renesas chip could be added in to the Or statement with the ESP chips for the uint32_t sdi12timer_t, along with the #elif defined (ESP32 or 8266)? In the SDI12.cpp, could the Renesas be added where the SAMD or ESP32/8266 code is (around line 326 and 555)? Similarly, in the SDI12.h, line 164 for ESPs, could one add Renesas?

SRGDamia1 commented 1 month ago

I've modified the library to use the micros() function instead of timers for anything faster than 48MHz (which the R4 is). I haven't tested it, but it should work.