34
34
#include < mbed_rtc_time.h>
35
35
#endif
36
36
37
- #ifdef ARDUINO_ARCH_ESP8266
37
+ #if defined ( ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W)
38
38
#include " RTCMillis.h"
39
39
#endif
40
40
50
50
RTCZero rtc;
51
51
#endif
52
52
53
- #ifdef ARDUINO_ARCH_ESP8266
53
+ #if defined ( ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W)
54
54
RTCMillis rtc;
55
55
#endif
56
56
@@ -90,6 +90,12 @@ void renesas_setRTC(unsigned long time);
90
90
unsigned long renesas_getRTC ();
91
91
#endif
92
92
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
+
93
99
/* *************************************************************************************
94
100
* DEFINES
95
101
**************************************************************************************/
@@ -342,6 +348,7 @@ void TimeServiceClass::initRTC()
342
348
#elif defined (ARDUINO_ARCH_RENESAS)
343
349
renesas_initRTC ();
344
350
#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
351
+ pico_w_initRTC ();
345
352
#else
346
353
#error "RTC not available for this architecture"
347
354
#endif
@@ -360,6 +367,7 @@ void TimeServiceClass::setRTC(unsigned long time)
360
367
#elif defined (ARDUINO_ARCH_RENESAS)
361
368
renesas_setRTC (time );
362
369
#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
370
+ pico_w_setRTC (time );
363
371
#else
364
372
#error "RTC not available for this architecture"
365
373
#endif
@@ -378,7 +386,7 @@ unsigned long TimeServiceClass::getRTC()
378
386
#elif defined (ARDUINO_ARCH_RENESAS)
379
387
return renesas_getRTC ();
380
388
#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
381
- return 1 ;
389
+ return pico_w_getRTC () ;
382
390
#else
383
391
#error "RTC not available for this architecture"
384
392
#endif
@@ -513,6 +521,23 @@ unsigned long renesas_getRTC()
513
521
}
514
522
#endif
515
523
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
+
516
541
/* *****************************************************************************
517
542
* EXTERN DEFINITION
518
543
******************************************************************************/
0 commit comments