Rv3028 RTC on Pico exploring breakout_rtc

I’m using the rv3028 RTC in a Pimoroni pico Explorer. I am new microprocessors and Micropython.
I have used the following code in the Thonny Shell to determine which methods are available for the rv3028 with Pimoroni Micropython.

import breakout_rtc

I can see all the methods available but how do I explore the valid arguments for these methods. I’ve worked out several by trial and error! For example, how do I determine the valid parameters for ‘set_backup_switchover_mode’?


Does this help?
extern mp_obj_t BreakoutRTC_set_backup_switchover_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
if(val < 0 || val > 3) mp_raise_ValueError("tcr out of range. Expected 0 to 3");

Looks like its 1, 2, or 3

pimoroni-pico/breakout_rtc.cpp at main · pimoroni/pimoroni-pico (github.com)

Thanks alphanumeric. I would never have found that. So are there four possible values? 0-3?
It’s still a mystery which setting to use.

I found this in rv3028-python library (not Micropython)…

# Switches RTC to backup battery if VCC goes below 2V
# Other settings: ‘switchover_disabled’, ‘direct_switching_mode’, 'standby_mode’

So there appear to be four options. Just not sure what they mean and which one is “0”, “1”, “2” and “3”. Any further information would be much appreciated.

On a Pi its

And the python examples enable the battery as follows.

# Create RV3028 instance
rtc = rv3028.RV3028()

# Switches RTC to backup battery if VCC goes below 2V
# Other settings: 'switchover_disabled', 'direct_switching_mode', 'standby_mode'

Found this rv3028-python/init.py at master · pimoroni/rv3028-python (github.com)

00 = 0, 01 = 1, 10 = 2, and 11 = 3.
This is for Python though.

‘switchover_disabled’: 0b00,
‘direct_switching_mode’: 0b01,
‘standby_mode’: 0b10,
‘level_switching_mode’: 0b11

Thank you very much, I really appreciate your input.