From c04d01652d1e10d2f16d6d140b543dfeb9da1c4f Mon Sep 17 00:00:00 2001 From: pennam <m.pennasilico@arduino.cc> Date: Mon, 13 Nov 2023 10:21:34 +0100 Subject: [PATCH 1/2] TimeService: RTC use generic ARDUINO_ARCH_MBED and rename functions --- src/utility/time/TimeService.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/utility/time/TimeService.cpp b/src/utility/time/TimeService.cpp index ac0a5eb0..777f73d4 100644 --- a/src/utility/time/TimeService.cpp +++ b/src/utility/time/TimeService.cpp @@ -72,10 +72,10 @@ void rp2040_connect_setRTC(unsigned long time); unsigned long rp2040_connect_getRTC(); #endif -#ifdef BOARD_STM32H7 -void stm32h7_initRTC(); -void stm32h7_setRTC(unsigned long time); -unsigned long stm32h7_getRTC(); +#ifdef ARDUINO_ARCH_MBED +void mbed_initRTC(); +void mbed_setRTC(unsigned long time); +unsigned long mbed_getRTC(); #endif #ifdef ARDUINO_ARCH_ESP32 @@ -339,8 +339,8 @@ void TimeServiceClass::initRTC() samd_initRTC(); #elif defined (ARDUINO_NANO_RP2040_CONNECT) rp2040_connect_initRTC(); -#elif defined (BOARD_STM32H7) - stm32h7_initRTC(); +#elif defined (ARDUINO_ARCH_MBED) + mbed_initRTC(); #elif defined (ARDUINO_ARCH_ESP32) esp32_initRTC(); #elif defined (ARDUINO_ARCH_ESP8266) @@ -358,8 +358,8 @@ void TimeServiceClass::setRTC(unsigned long time) samd_setRTC(time); #elif defined (ARDUINO_NANO_RP2040_CONNECT) rp2040_connect_setRTC(time); -#elif defined (BOARD_STM32H7) - stm32h7_setRTC(time); +#elif defined (ARDUINO_ARCH_MBED) + mbed_setRTC(time); #elif defined (ARDUINO_ARCH_ESP32) esp32_setRTC(time); #elif defined (ARDUINO_ARCH_ESP8266) @@ -377,8 +377,8 @@ unsigned long TimeServiceClass::getRTC() return samd_getRTC(); #elif defined (ARDUINO_NANO_RP2040_CONNECT) return rp2040_connect_getRTC(); -#elif defined (BOARD_STM32H7) - return stm32h7_getRTC(); +#elif defined (ARDUINO_ARCH_MBED) + return mbed_getRTC(); #elif defined (ARDUINO_ARCH_ESP32) return esp32_getRTC(); #elif defined (ARDUINO_ARCH_ESP8266) @@ -464,18 +464,18 @@ unsigned long rp2040_connect_getRTC() } #endif -#ifdef BOARD_STM32H7 -void stm32h7_initRTC() +#ifdef ARDUINO_ARCH_MBED +void mbed_initRTC() { /* Nothing to do */ } -void stm32h7_setRTC(unsigned long time) +void mbed_setRTC(unsigned long time) { set_time(time); } -unsigned long stm32h7_getRTC() +unsigned long mbed_getRTC() { return time(NULL); } From 4b0ef290f159da563156fe47212b8d895c9ff553 Mon Sep 17 00:00:00 2001 From: pennam <m.pennasilico@arduino.cc> Date: Mon, 13 Nov 2023 10:24:25 +0100 Subject: [PATCH 2/2] TimeService: remove RP2040 functions --- src/utility/time/TimeService.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/utility/time/TimeService.cpp b/src/utility/time/TimeService.cpp index 777f73d4..cc387215 100644 --- a/src/utility/time/TimeService.cpp +++ b/src/utility/time/TimeService.cpp @@ -66,12 +66,6 @@ void samd_setRTC(unsigned long time); unsigned long samd_getRTC(); #endif -#ifdef ARDUINO_NANO_RP2040_CONNECT -void rp2040_connect_initRTC(); -void rp2040_connect_setRTC(unsigned long time); -unsigned long rp2040_connect_getRTC(); -#endif - #ifdef ARDUINO_ARCH_MBED void mbed_initRTC(); void mbed_setRTC(unsigned long time); @@ -337,8 +331,6 @@ void TimeServiceClass::initRTC() { #if defined (ARDUINO_ARCH_SAMD) samd_initRTC(); -#elif defined (ARDUINO_NANO_RP2040_CONNECT) - rp2040_connect_initRTC(); #elif defined (ARDUINO_ARCH_MBED) mbed_initRTC(); #elif defined (ARDUINO_ARCH_ESP32) @@ -356,8 +348,6 @@ void TimeServiceClass::setRTC(unsigned long time) { #if defined (ARDUINO_ARCH_SAMD) samd_setRTC(time); -#elif defined (ARDUINO_NANO_RP2040_CONNECT) - rp2040_connect_setRTC(time); #elif defined (ARDUINO_ARCH_MBED) mbed_setRTC(time); #elif defined (ARDUINO_ARCH_ESP32) @@ -375,8 +365,6 @@ unsigned long TimeServiceClass::getRTC() { #if defined (ARDUINO_ARCH_SAMD) return samd_getRTC(); -#elif defined (ARDUINO_NANO_RP2040_CONNECT) - return rp2040_connect_getRTC(); #elif defined (ARDUINO_ARCH_MBED) return mbed_getRTC(); #elif defined (ARDUINO_ARCH_ESP32) @@ -447,23 +435,6 @@ unsigned long samd_getRTC() } #endif -#ifdef ARDUINO_NANO_RP2040_CONNECT -void rp2040_connect_initRTC() -{ - /* Nothing to do */ -} - -void rp2040_connect_setRTC(unsigned long time) -{ - set_time(time); -} - -unsigned long rp2040_connect_getRTC() -{ - return time(NULL); -} -#endif - #ifdef ARDUINO_ARCH_MBED void mbed_initRTC() {