3434 #include < mbed_rtc_time.h>
3535#endif
3636
37- #ifdef ARDUINO_ARCH_ESP8266
37+ #if defined ( ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W)
3838 #include " RTCMillis.h"
3939#endif
4040
5050RTCZero rtc;
5151#endif
5252
53- #ifdef ARDUINO_ARCH_ESP8266
53+ #if defined ( ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W)
5454RTCMillis rtc;
5555#endif
5656
@@ -90,6 +90,12 @@ void renesas_setRTC(unsigned long time);
9090unsigned long renesas_getRTC ();
9191#endif
9292
93+ #ifdef ARDUINO_RASPBERRY_PI_PICO_W
94+ void pico_w_initRTC ();
95+ void pico_w_setRTC (unsigned long time);
96+ unsigned long pico_w_getRTC ();
97+ #endif
98+
9399/* *************************************************************************************
94100 * DEFINES
95101 **************************************************************************************/
@@ -342,6 +348,7 @@ void TimeServiceClass::initRTC()
342348#elif defined (ARDUINO_ARCH_RENESAS)
343349 renesas_initRTC ();
344350#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
351+ pico_w_initRTC ();
345352#else
346353 #error "RTC not available for this architecture"
347354#endif
@@ -360,6 +367,7 @@ void TimeServiceClass::setRTC(unsigned long time)
360367#elif defined (ARDUINO_ARCH_RENESAS)
361368 renesas_setRTC (time);
362369#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
370+ pico_w_setRTC (time);
363371#else
364372 #error "RTC not available for this architecture"
365373#endif
@@ -378,7 +386,7 @@ unsigned long TimeServiceClass::getRTC()
378386#elif defined (ARDUINO_ARCH_RENESAS)
379387 return renesas_getRTC ();
380388#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
381- return 1 ;
389+ return pico_w_getRTC () ;
382390#else
383391 #error "RTC not available for this architecture"
384392#endif
@@ -513,6 +521,23 @@ unsigned long renesas_getRTC()
513521}
514522#endif
515523
524+ #ifdef ARDUINO_RASPBERRY_PI_PICO_W
525+ void pico_w_initRTC ()
526+ {
527+ rtc.begin ();
528+ }
529+
530+ void pico_w_setRTC (unsigned long time)
531+ {
532+ rtc.set (time);
533+ }
534+
535+ unsigned long pico_w_getRTC ()
536+ {
537+ return rtc.get ();
538+ }
539+ #endif
540+
516541/* *****************************************************************************
517542 * EXTERN DEFINITION
518543 ******************************************************************************/
0 commit comments