Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/arduino_sdi_12: bump version, fix patches #18796

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkg/arduino_sdi_12/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
PKG_NAME=arduino_sdi_12
PKG_URL=https://github.com/EnviroDIY/Arduino-SDI-12
PKG_VERSION=fd9699b390edeac3a8681e2a6d4fe2ba8b1f9a51
PKG_VERSION=1fa8edbeb25fbb6cff71495583e664b5e8ae18a5
PKG_LICENSE=BSD-3-Clause

GITAMFLAGS = --3way

include $(RIOTBASE)/pkg/pkg.mk

all:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 275a4d976ea9140076e2625a69e495aec60d2fe4 Mon Sep 17 00:00:00 2001
From 24135451e8161eca75ceafc1a62854ffa4b14ca8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= <jdavid.ibp@gmail.com>
Date: Thu, 7 Oct 2021 19:35:14 +0200
Subject: [PATCH 1/3] Use RIOT's gpio to handle pin change interrupts
Expand All @@ -12,11 +12,11 @@ Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
src/SDI12.h | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git src/SDI12.cpp src/SDI12.cpp
index c71e998..257eb5a 100644
--- src/SDI12.cpp
+++ src/SDI12.cpp
@@ -349,10 +349,11 @@ void SDI12::setPinInterrupts(bool enable) {
diff --git a/src/SDI12.cpp b/src/SDI12.cpp
index f88fc56..477b16d 100644
--- a/src/SDI12.cpp
+++ b/src/SDI12.cpp
@@ -345,10 +345,11 @@ void SDI12::setPinInterrupts(bool enable) {
// We don't detach the function from the interrupt for AVR processors
}
#else
Expand All @@ -30,7 +30,7 @@ index c71e998..257eb5a 100644
}
#endif
}
@@ -557,7 +558,8 @@ void ICACHE_RAM_ATTR SDI12::handleInterrupt() {
@@ -552,7 +553,8 @@ void ICACHE_RAM_ATTR SDI12::handleInterrupt() {
if (_activeObject) _activeObject->receiveISR();
}
#else
Expand All @@ -40,11 +40,11 @@ index c71e998..257eb5a 100644
if (_activeObject) _activeObject->receiveISR();
}
#endif
diff --git src/SDI12.h src/SDI12.h
index ec949e3..6469c7b 100644
--- src/SDI12.h
+++ src/SDI12.h
@@ -971,10 +971,10 @@ class SDI12 : public Stream {
diff --git a/src/SDI12.h b/src/SDI12.h
index 06eb7ab..9ac77f7 100644
--- a/src/SDI12.h
+++ b/src/SDI12.h
@@ -972,10 +972,10 @@ class SDI12 : public Stream {
*
* On espressif boards (ESP8266 and ESP32), the ISR must be stored in IRAM
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From e5a4be53f1bdc4a3c435ad7a35f2d6333277837e Mon Sep 17 00:00:00 2001
From 3bcd51536348265cf44ed326ccb568a06f96f761 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= <jdavid.ibp@gmail.com>
Date: Tue, 3 Aug 2021 12:19:19 +0200
Subject: [PATCH 2/3] Integration with RIOT, to support other boards
Expand All @@ -19,10 +19,10 @@ Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
src/SDI12_boards.h | 33 ++++++++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 3 deletions(-)

diff --git src/SDI12.h src/SDI12.h
index 6469c7b..b57b5bc 100644
--- src/SDI12.h
+++ src/SDI12.h
diff --git a/src/SDI12.h b/src/SDI12.h
index 9ac77f7..6709771 100644
--- a/src/SDI12.h
+++ b/src/SDI12.h
@@ -191,11 +191,19 @@ enum LookaheadMode {
* processor timer directly.
*/
Expand All @@ -44,10 +44,10 @@ index 6469c7b..b57b5bc 100644
#endif // defined(ESP32) || defined(ESP8266)

/**
diff --git src/SDI12_boards.cpp src/SDI12_boards.cpp
diff --git a/src/SDI12_boards.cpp b/src/SDI12_boards.cpp
index beb28e8..2159eee 100644
--- src/SDI12_boards.cpp
+++ src/SDI12_boards.cpp
--- a/src/SDI12_boards.cpp
+++ b/src/SDI12_boards.cpp
@@ -275,5 +275,13 @@ sdi12timer_t SDI12Timer::SDI12TimerRead(void) {
}
// Unknown board
Expand All @@ -63,11 +63,11 @@ index beb28e8..2159eee 100644
+}
+
#endif
diff --git src/SDI12_boards.h src/SDI12_boards.h
index a2a533e..ff0e69e 100644
--- src/SDI12_boards.h
+++ src/SDI12_boards.h
@@ -387,7 +387,38 @@ class SDI12Timer {
diff --git a/src/SDI12_boards.h b/src/SDI12_boards.h
index d91eff4..686444f 100644
--- a/src/SDI12_boards.h
+++ b/src/SDI12_boards.h
@@ -511,7 +511,38 @@ class SDI12Timer {

// Unknown board
#else
Expand Down
90 changes: 69 additions & 21 deletions pkg/arduino_sdi_12/patches/0003-RIOT-Fix-for-SAMD-boards.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From a22d62b524c624ce4ec16f690439d3b737e69bac Mon Sep 17 00:00:00 2001
From ff9eba693d589c8241b02e8c29a176a55c665816 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= <jdavid.ibp@gmail.com>
Date: Tue, 11 Jan 2022 13:09:40 +0100
Subject: [PATCH 3/3] RIOT: Fix for SAMD boards
Expand All @@ -11,32 +11,32 @@ it hangs.

Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
---
src/SDI12.cpp | 4 +--
src/SDI12_boards.cpp | 58 --------------------------------------------
src/SDI12_boards.h | 45 ----------------------------------
3 files changed, 1 insertion(+), 106 deletions(-)
src/SDI12.cpp | 4 +-
src/SDI12_boards.cpp | 58 ---------------------------
src/SDI12_boards.h | 93 --------------------------------------------
3 files changed, 1 insertion(+), 154 deletions(-)

diff --git src/SDI12.cpp src/SDI12.cpp
index 257eb5a..cd8b25c 100644
--- src/SDI12.cpp
+++ src/SDI12.cpp
@@ -244,7 +244,6 @@ SDI12::~SDI12() {
diff --git a/src/SDI12.cpp b/src/SDI12.cpp
index 477b16d..f83c6fe 100644
--- a/src/SDI12.cpp
+++ b/src/SDI12.cpp
@@ -241,7 +241,6 @@ SDI12::~SDI12() {
setState(SDI12_DISABLED);
if (isActive()) { _activeObject = NULL; }
// Set the timer prescalers back to original values
- // NOTE: This does NOT reset SAMD board pre-scalers!
sdi12timer.resetSDI12TimerPrescale();
}

@@ -266,7 +265,6 @@ void SDI12::end() {
@@ -264,7 +263,6 @@ void SDI12::end() {
setState(SDI12_DISABLED);
_activeObject = NULL;
_activeObject = nullptr;
// Set the timer prescalers back to original values
- // NOTE: This does NOT reset SAMD board pre-scalers!
sdi12timer.resetSDI12TimerPrescale();
}

@@ -323,7 +321,7 @@ uint8_t SDI12::parity_even_bit(uint8_t v) {
@@ -319,7 +317,7 @@ uint8_t SDI12::parity_even_bit(uint8_t v) {

// a helper function to switch pin interrupts on or off
void SDI12::setPinInterrupts(bool enable) {
Expand All @@ -45,10 +45,10 @@ index 257eb5a..cd8b25c 100644
// Merely need to attach the interrupt function to the pin
if (enable) attachInterrupt(digitalPinToInterrupt(_dataPin), handleInterrupt, CHANGE);
// Merely need to detach the interrupt function from the pin
diff --git src/SDI12_boards.cpp src/SDI12_boards.cpp
diff --git a/src/SDI12_boards.cpp b/src/SDI12_boards.cpp
index 2159eee..177da96 100644
--- src/SDI12_boards.cpp
+++ src/SDI12_boards.cpp
--- a/src/SDI12_boards.cpp
+++ b/src/SDI12_boards.cpp
@@ -204,64 +204,6 @@ void SDI12Timer::resetSDI12TimerPrescale(void) {
#endif

Expand Down Expand Up @@ -114,10 +114,10 @@ index 2159eee..177da96 100644
// Espressif ESP32/ESP8266 boards
//
#elif defined(ESP32) || defined(ESP8266)
diff --git src/SDI12_boards.h src/SDI12_boards.h
index ff0e69e..a86bc79 100644
--- src/SDI12_boards.h
+++ src/SDI12_boards.h
diff --git a/src/SDI12_boards.h b/src/SDI12_boards.h
index 686444f..45585c6 100644
--- a/src/SDI12_boards.h
+++ b/src/SDI12_boards.h
@@ -50,10 +50,6 @@ class SDI12Timer {
/**
* @brief Reset the processor timer prescaler to whatever it was prior to being
Expand All @@ -129,7 +129,7 @@ index ff0e69e..a86bc79 100644
*/
void resetSDI12TimerPrescale(void);

@@ -303,47 +299,6 @@ class SDI12Timer {
@@ -375,95 +371,6 @@ class SDI12Timer {
#endif


Expand All @@ -140,10 +140,54 @@ index ff0e69e..a86bc79 100644
-
-/**
- * @brief A string description of the timer to use
- *
- * The Generic Clock controller GCLK provides nine Generic Clock Generators that can
- * provide a wide range of clock frequencies.
- *
- * Generators can be set to use different external and internal oscillators as source.
- * The clock of each Generator can be divided. The outputs from the Generators are used
- * as sources for the Generic Clock Multiplexers, which provide the Generic Clock
- * (GCLK_PERIPHERAL) to the peripheral modules, as shown in Generic Clock Controller
- * Block Diagram.
- *
- * Features
- * - Provides Generic Clocks
- * - Wide frequency range
- * - Clock source for the generator can be changed on the fly
- *
- * The TC consists of a counter, a prescaler, compare/capture channels and control
- * logic. The counter can be set to count events, or it can be configured to count clock
- * pulses. The counter, together with the compare/capture channels, can be configured to
- * timestamp input events, allowing capture of frequency and pulse width. It can also
- * perform waveform generation, such as frequency generation and pulse-width modulation
- * (PWM).
- *
- * Features
- * - Selectable configuration
- * – Up to five 16-bit Timer/Counters (TC) including one low-power TC, each
- * configurable as:
- * - 8-bit TC with two compare/capture channels
- * - 16-bit TC with two compare/capture channels
- * - 32-bit TC with two compare/capture channels, by using two TCs
- * - Waveform generation
- * – Frequency generation
- * – Single-slope pulse-width modulation
- * - Input capture
- * – Event capture
- * – Frequency capture
- * – Pulse-width capture
- * - One input event
- * - Interrupts/output events on:
- * – Counter overflow/underflow
- * – Compare match or capture
- * - Internal prescaler
- * - Can be used with DMA and to trigger DMA transactions
- */
-#define TIMER_IN_USE_STR "GCLK4-TC3"
-/**
- * @brief The c macro name for the assembly timer to use
- *
- * This signifies the register of timer/counter 3, the 8-bit count, the count value
- */
-#define TCNTX REG_TC3_COUNT8_COUNT // Using Timer 3 with generic clock 4
-
Expand All @@ -158,6 +202,10 @@ index ff0e69e..a86bc79 100644
- * 48MHz / 3 pre-prescaler = 16MHz
- * 16MHz / 1024 prescaler = 15624 'ticks'/sec = 64 µs / 'tick'
- * (1 sec/1200 bits) * (1 tick/64 µs) = 13.0208 ticks/bit
- *
- * The 8-bit count rolls over after 256 ticks, 19.66 bits, or 16.38505 ms
- * (256 ticks/roll-over) * (1 bit/13.0208 ticks) = 19.66 bits
- * (256 ticks/roll-over) * (1 sec/15624 ticks) = 16.38505 milliseconds
- */
-#define TICKS_PER_BIT 13
-/**
Expand Down