Skip to main content

Crate pcf8563_dd

Crate pcf8563_dd 

Source
Expand description

§PCF8563/BM8563 Real-Time Clock Driver

This crate provides a bisync-based driver for the PCF8563 and BM8563 real-time clock ICs, built upon the device-driver crate for robust, declarative register definitions via a YAML manifest. It supports both asynchronous (async) and blocking operation through a unified API, using the bisync crate for seamless compatibility with both embedded-hal and embedded-hal-async traits.

§Features

  • Declarative Register Map: Full device configuration defined in device.yaml.
  • Unified Async/Blocking Support: Write your code once and use it in both async and blocking contexts via bisync.
  • Type-Safe API: High-level functions for reading/setting date and time and a generated low-level API (ll) for direct register access.
  • Full RTC Functionality: Date/time, alarms, timer, and clock output control.
  • Optional rtcc Traits (blocking): Enable the rtcc feature to implement rtcc::DateTimeAccess and rtcc::Rtcc on the blocking driver.
  • defmt and log Integration: Optional support for logging and debugging.

§Getting Started

To use the driver, instantiate Pcf8563 (blocking) or Pcf8563Async (async) with your I2C bus implementation:

let i2c_bus = todo!();
let mut rtc = Pcf8563::new(i2c_bus);

let datetime = rtc.get_datetime()?;

For async environments, use Pcf8563Async (re-exported from the asynchronous module):

let i2c_bus = todo!();
let mut rtc = Pcf8563Async::new(i2c_bus);

let datetime = rtc.get_datetime().await?;

For a detailed register map, please refer to the device.yaml file in the repository.

§Supported Devices

  • PCF8563 - NXP real-time clock (original)
  • BM8563 - Compatible clone found in M5Stack devices

Modules§

field_sets
Module containing the generated fieldsets of the registers and commands

Structs§

Alarm
Alarm configuration
DateTime
Date and time structure
Pcf8563
Pcf8563Async
Pcf8563Interface
Pcf8563LowLevel
Root block of the Pcf8563LowLevel driver
Time
Time-only structure (for clock applications without calendar)

Enums§

ClkoutFrequency
CLKOUT output frequency selection
RtcError
TimerFrequency
Timer source clock frequency

Constants§

PCF8563_I2C_ADDR
PCF8563/BM8563 I2C address (7-bit)