Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
OkiStuff authored Oct 25, 2022
2 parents d58cb24 + 1cf6d79 commit fefe473
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 79 deletions.
14 changes: 9 additions & 5 deletions makefiles/tools/gdb.inc.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# new versions of gdb will support all architectures in one binary
ifeq ($(shell gdb-multiarch -v > /dev/null 2>&1; echo $$?),0)
export GDB ?= gdb-multiarch
export GDBPREFIX ?= $(PREFIX)

# If the user installed a magic single target GDB rather than just using
# gdb-multiarch, there typically is a reason for it - e.g. missing support for
# that particular target in gdb-multiarch.
ifeq ($(shell $(GDBPREFIX)gdb -v > /dev/null 2>&1; echo $$?),0)
export GDB ?= $(GDBPREFIX)gdb
else
export GDBPREFIX ?= $(PREFIX)
export GDB ?= $(GDBPREFIX)gdb
# gdb-multiarch is normally
export GDB ?= gdb-multiarch
endif
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?= <[email protected]>
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 <[email protected]>
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?= <[email protected]>
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 <[email protected]>
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?= <[email protected]>
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 <[email protected]>
---
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
4 changes: 2 additions & 2 deletions pkg/lvgl/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PKG_NAME=lvgl
PKG_URL=https://github.com/lvgl/lvgl
# v8.3.1
PKG_VERSION=9024b72b4853e1e7ac29a42e54b7a10d3c4f3b20
# v8.3.3
PKG_VERSION=5545ffc9257808ee26eac833ec5326706cdf2007
PKG_LICENSE=MIT

include $(RIOTBASE)/pkg/pkg.mk
Expand Down
1 change: 1 addition & 0 deletions sys/shell/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ endif
ifneq (,$(filter shell_cmd_gnrc_udp,$(USEMODULE)))
USEMODULE += gnrc_udp
USEMODULE += gnrc_pktdump
USEMODULE += netutils
endif
ifneq (,$(filter shell_cmd_i2c_scan,$(USEMODULE)))
FEATURES_REQUIRED += periph_i2c
Expand Down
3 changes: 0 additions & 3 deletions sys/stdio_uart/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
ifeq (gnu, $(TOOLCHAIN))
CFLAGS += -Wno-cast-function-type
endif
include $(RIOTBASE)/Makefile.base
37 changes: 17 additions & 20 deletions sys/stdio_uart/stdio_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
#include <errno.h>
#include <string.h>

#include "stdio_uart.h"

#include "board.h"
#include "periph/uart.h"
#include "isrpipe.h"
#include "kernel_defines.h"
#include "periph/uart.h"
#include "stdio_uart.h"

#if MODULE_VFS
#include "vfs.h"
Expand All @@ -43,23 +43,23 @@
#define ENABLE_DEBUG 0
#include "debug.h"

#ifdef MODULE_STDIO_UART_RX
static uint8_t _rx_buf_mem[STDIO_UART_RX_BUFSIZE];
isrpipe_t stdio_uart_isrpipe = ISRPIPE_INIT(_rx_buf_mem);
#endif

static void _isrpipe_write_one_wrapper(void *arg, uint8_t value)
{
isrpipe_write_one(arg, value);
}

void stdio_init(void)
{
uart_rx_cb_t cb;
void *arg;
uart_rx_cb_t cb = NULL;
void *arg = NULL;

#ifdef MODULE_STDIO_UART_RX
cb = (uart_rx_cb_t) isrpipe_write_one;
arg = &stdio_uart_isrpipe;
#else
cb = NULL;
arg = NULL;
#endif
if (IS_USED(MODULE_STDIO_UART_RX)) {
cb = _isrpipe_write_one_wrapper;
arg = &stdio_uart_isrpipe;
}

uart_init(STDIO_UART_DEV, STDIO_UART_BAUDRATE, cb, arg);

Expand All @@ -77,13 +77,10 @@ int stdio_available(void)

ssize_t stdio_read(void* buffer, size_t count)
{
#ifdef MODULE_STDIO_UART_RX
return (ssize_t)isrpipe_read(&stdio_uart_isrpipe, buffer, count);
#else
(void)buffer;
(void)count;
if (IS_USED(MODULE_STDIO_UART_RX)) {
return (ssize_t)isrpipe_read(&stdio_uart_isrpipe, buffer, count);
}
return -ENOTSUP;
#endif
}

ssize_t stdio_write(const void *buffer, size_t len)
Expand Down

0 comments on commit fefe473

Please sign in to comment.