|
|
| UnitPCF8563 (const uint8_t addr=DEFAULT_ADDRESS) |
| |
|
virtual bool | begin () override |
| |
|
virtual void | update (const bool force=false) override |
| |
|
|
config_t | config () const |
| | Gets the configuration.
|
| |
|
void | config (const config_t &cfg) |
| | Set the configuration.
|
| |
|
| bool | readTime (pcf8563::rtc_time_t &time) |
| | Read time from RTC.
|
| |
| bool | writeTime (const pcf8563::rtc_time_t &time) |
| | Write time to RTC.
|
| |
| bool | readDate (pcf8563::rtc_date_t &date) |
| | Read date from RTC.
|
| |
| bool | writeDate (const pcf8563::rtc_date_t &date) |
| | Write date to RTC.
|
| |
| bool | readDateTime (pcf8563::rtc_datetime_t &dt) |
| | Read date and time from RTC.
|
| |
| bool | writeDateTime (const pcf8563::rtc_datetime_t &dt) |
| | Write date and time to RTC.
|
| |
| bool | readDateTime (struct tm &t) |
| | Read date and time from RTC into struct tm.
|
| |
| bool | writeDateTime (const struct tm &t) |
| | Write date and time to RTC from struct tm.
|
| |
|
- Note
- About IRQ/Alarm/Timer: These functions configure the PCF8563 chip's internal alarm/timer registers and interrupt flags via I2C. When triggered, the chip drives its INT pin (open-drain, active LOW).
-
The INT pin is not wired on standard GROVE/Port A/B/C connectors (4-pin: GND, VCC, SDA, SCL only).
-
Two modes are supported via config_t:
- Polling mode (default,
polling=true): update() periodically reads the IRQ status register via I2C (every 500ms) and invokes the callback. Works without the INT pin (GROVE compatible).
- Hardware interrupt mode (
polling=false, int_pin set): begin() calls attachInterrupt() on the specified GPIO. The ISR sets an internal flag; update() detects it and invokes the callback. Requires a direct connection from the PCF8563 INT pin to a host GPIO.
-
In both modes, callbacks (on_alarm / on_timer) are called from update(), never from an ISR context. Set them in config_t before calling begin().
|
| bool | writeAlarm (const pcf8563::rtc_time_t &time, const pcf8563::rtc_date_t &date) |
| | Set alarm and enable interrupt.
|
| |
| bool | readAlarm (pcf8563::rtc_time_t &time, pcf8563::rtc_date_t &date) |
| | Read alarm settings.
|
| |
| bool | readAlarmInterrupt (bool &enabled) |
| | Read alarm interrupt enable state.
|
| |
| bool | writeAlarmInterrupt (const bool enabled) |
| | Write alarm interrupt enable state.
|
| |
| bool | readAlarmFlag (bool &fired) |
| | Read alarm flag.
|
| |
| bool | clearAlarmFlag () |
| | Clear alarm flag (AF bit)
|
| |
| uint32_t | writeTimer (const uint32_t msec, const bool repeat=false) |
| | Set countdown timer with millisecond duration.
|
| |
| bool | readTimerControl (bool &enabled, pcf8563::TimerClock &clock) |
| | Read timer control settings.
|
| |
| bool | writeTimerControl (const bool enabled, const pcf8563::TimerClock clock) |
| | Write timer control settings.
|
| |
| bool | readTimerValue (uint8_t &count) |
| | Read timer countdown value.
|
| |
| bool | writeTimerValue (const uint8_t count) |
| | Write timer countdown value.
|
| |
| bool | readTimerInterrupt (bool &enabled) |
| | Read timer interrupt enable state.
|
| |
| bool | writeTimerInterrupt (const bool enabled) |
| | Write timer interrupt enable state.
|
| |
| bool | readTimerFlag (bool &fired) |
| | Read timer flag.
|
| |
| bool | clearTimerFlag () |
| | Clear timer flag (TF bit)
|
| |
| bool | readTimerPeriodic (bool &periodic) |
| | Read timer periodic mode (TI_TP bit)
|
| |
| bool | writeTimerPeriodic (const bool periodic) |
| | Write timer periodic mode (TI_TP bit)
|
| |
|
| bool | readStop (bool &stopped) |
| | Read RTC clock stop state.
|
| |
| bool | writeStop (const bool stop) |
| | Write RTC clock stop state.
|
| |
|
| bool | readVoltLow (bool &low) |
| | Read voltage-low flag (battery backup status)
|
| |
|
|
bool | read_datetime (pcf8563::rtc_date_t *date, pcf8563::rtc_time_t *time) |
| | Read time and/or date registers (nullable pointer support)
|
| |
|
bool | write_datetime (const pcf8563::rtc_date_t *date, const pcf8563::rtc_time_t *time) |
| | Write time and/or date registers (nullable pointer support)
|
| |
|
bool | read_control2 (uint8_t &val) |
| | Read CONTROL2 register.
|
| |
|
bool | write_control2_bits (const uint8_t mask, const uint8_t bits) |
| | Write CONTROL2 register with bit mask (read-modify-write)
|
| |
|
|
bool | read_register (const uint8_t reg, uint8_t *buf, const size_t len) |
| |
|
bool | read_register8 (const uint8_t reg, uint8_t &val) |
| |
|
bool | write_register (const uint8_t reg, const uint8_t *buf, const size_t len) |
| |
|
bool | write_register8 (const uint8_t reg, const uint8_t val) |
| |
Real-time clock unit using PCF8563 compatible chip (BM8563/HYM8563)