rp2/machine_rtc: Add initial support for RTC.

Initial support for machine.RTC on rp2 port. It only supports datetime()
method and nothing else. The method gets/returns a tuple of 8 items, just
like esp32 port, for example, but the usec parameter is ignored as the RP2
RTC only works up to seconds precision.

The Pico RTC isn't very useful as the time is lost during reset and there
seems to be no way to easily power up just the RTC clock with a low current
voltage, but still there seems to be use-cases for that, see issues #6831,
and a Thonny issue #1592. It was also requested for inclusion on v1.15
roadmap on #6832.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
This commit is contained in:
Krzysztof Adamski
2021-02-18 19:45:23 +01:00
committed by Damien George
parent c0499bc2b9
commit 37d01d4be3
4 changed files with 125 additions and 0 deletions

View File

@@ -86,6 +86,7 @@ set(MICROPY_SOURCE_PORT
machine_i2c.c
machine_pin.c
machine_pwm.c
machine_rtc.c
machine_spi.c
machine_timer.c
machine_uart.c
@@ -113,6 +114,7 @@ set(MICROPY_SOURCE_QSTR
${PROJECT_SOURCE_DIR}/machine_i2c.c
${PROJECT_SOURCE_DIR}/machine_pin.c
${PROJECT_SOURCE_DIR}/machine_pwm.c
${PROJECT_SOURCE_DIR}/machine_rtc.c
${PROJECT_SOURCE_DIR}/machine_spi.c
${PROJECT_SOURCE_DIR}/machine_timer.c
${PROJECT_SOURCE_DIR}/machine_uart.c
@@ -154,6 +156,7 @@ set(PICO_SDK_COMPONENTS
pico_sync
pico_time
pico_unique_id
pico_util
tinyusb_common
tinyusb_device
)