From 2c2d69a3968890d09c4648b2523ad47edff3c5b7 Mon Sep 17 00:00:00 2001 From: SirSydom Date: Sun, 13 Feb 2022 21:54:38 +0100 Subject: [PATCH] Rp2040 plattform newcore (#172) * added support for RP2040 (Raspberry Pi Pico) * support DPT9.009 (airflow) and DPT9.029 (absolute humidity) * adapted to work with the latest arduino-pico core V1.11.0 - setPollingMode for knxSerial --- src/rp2040_arduino_platform.cpp | 22 ++++++++++++++++++---- src/rp2040_arduino_platform.h | 2 ++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/rp2040_arduino_platform.cpp b/src/rp2040_arduino_platform.cpp index 72341f5..6ab9909 100644 --- a/src/rp2040_arduino_platform.cpp +++ b/src/rp2040_arduino_platform.cpp @@ -3,10 +3,11 @@ Plattform for Raspberry Pi Pico and other RP2040 boards made to work with arduino-pico - "Raspberry Pi Pico Arduino core, for all RP2040 boards" -by Earl E. Philhower III https://github.com/earlephilhower/arduino-pico -tested with V1.9.1 +by Earl E. Philhower III https://github.com/earlephilhower/arduino-pico V1.11.0 -by SirSydom 2021 +by SirSydom 2021-2022 + +RTTI must be set to enabled in the board options A maximum of 4kB emulated EEPROM is supported. For more, use or own emulation (maybe with littlefs) @@ -16,7 +17,7 @@ For more, use or own emulation (maybe with littlefs) #include "rp2040_arduino_platform.h" #ifdef ARDUINO_ARCH_RP2040 -#include +#include "knx/bits.h" #include @@ -37,6 +38,19 @@ RP2040ArduinoPlatform::RP2040ArduinoPlatform( HardwareSerial* s) : ArduinoPlatfo { } +void RP2040ArduinoPlatform::setupUart() +{ + SerialUART* serial = dynamic_cast(_knxSerial); + if(serial) + { + serial->setPollingMode(); + } + + _knxSerial->begin(19200, SERIAL_8E1); + while (!_knxSerial) + ; +} + uint32_t RP2040ArduinoPlatform::uniqueSerialNumber() { pico_unique_board_id_t id; // 64Bit unique serial number from the QSPI flash diff --git a/src/rp2040_arduino_platform.h b/src/rp2040_arduino_platform.h index 3077b21..75cc7ff 100644 --- a/src/rp2040_arduino_platform.h +++ b/src/rp2040_arduino_platform.h @@ -10,6 +10,8 @@ public: RP2040ArduinoPlatform(); RP2040ArduinoPlatform( HardwareSerial* s); + void setupUart(); + // unique serial number uint32_t uniqueSerialNumber() override;