pub struct Pcf8563<I2CImpl: RegisterInterface<AddressType = u8, Error = RtcError<I2CBusErr>>, I2CBusErr: Debug> {
pub ll: Pcf8563LowLevel<I2CImpl>,
/* private fields */
}Fields§
§ll: Pcf8563LowLevel<I2CImpl>Implementations§
Source§impl<I2CBus, E> Pcf8563<Pcf8563Interface<I2CBus>, E>
impl<I2CBus, E> Pcf8563<Pcf8563Interface<I2CBus>, E>
Source§impl<I2CImpl, I2CBusErr> Pcf8563<I2CImpl, I2CBusErr>
impl<I2CImpl, I2CBusErr> Pcf8563<I2CImpl, I2CBusErr>
Sourcepub fn get_datetime(&mut self) -> Result<DateTime, RtcError<I2CBusErr>>
pub fn get_datetime(&mut self) -> Result<DateTime, RtcError<I2CBusErr>>
Get the current date and time
Reads all 7 time/date registers (0x02-0x08) in a single I2C burst read, as recommended by the datasheet to ensure consistency.
Sourcepub fn set_datetime(&mut self, dt: &DateTime) -> Result<(), RtcError<I2CBusErr>>
pub fn set_datetime(&mut self, dt: &DateTime) -> Result<(), RtcError<I2CBusErr>>
Set the date and time
Writes all 7 time/date registers (0x02-0x08) in a single I2C burst write. Also clears the VL (voltage-low) flag.
Sourcepub fn set_time(&mut self, time: &Time) -> Result<(), RtcError<I2CBusErr>>
pub fn set_time(&mut self, time: &Time) -> Result<(), RtcError<I2CBusErr>>
Set only the time (hours, minutes, seconds)
Sourcepub fn is_clock_valid(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub fn is_clock_valid(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if clock integrity is guaranteed
Returns false if the VL (Voltage Low) flag is set, indicating
the clock data may be invalid due to power loss.
Sourcepub fn clear_voltage_low_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
pub fn clear_voltage_low_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
Clear the voltage-low flag
Should be called after setting the time to indicate clock is valid.
Sourcepub fn get_century_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub fn get_century_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Get the century flag
Returns true if century is X+1 (e.g., 2100s), false if century is X (e.g., 2000s)
Sourcepub fn set_century_flag(
&mut self,
century: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub fn set_century_flag( &mut self, century: bool, ) -> Result<(), RtcError<I2CBusErr>>
Set the century flag
Sourcepub fn set_clock_running(
&mut self,
running: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub fn set_clock_running( &mut self, running: bool, ) -> Result<(), RtcError<I2CBusErr>>
Start or stop the RTC clock
Sourcepub fn is_clock_running(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub fn is_clock_running(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if the RTC clock is running
Sourcepub fn get_alarm(&mut self) -> Result<Alarm, RtcError<I2CBusErr>>
pub fn get_alarm(&mut self) -> Result<Alarm, RtcError<I2CBusErr>>
Get the current alarm configuration
Sourcepub fn set_alarm(&mut self, alarm: &Alarm) -> Result<(), RtcError<I2CBusErr>>
pub fn set_alarm(&mut self, alarm: &Alarm) -> Result<(), RtcError<I2CBusErr>>
Set the alarm configuration
Set a field to Some(value) to enable that alarm component,
or None to disable it.
Sourcepub fn disable_alarm(&mut self) -> Result<(), RtcError<I2CBusErr>>
pub fn disable_alarm(&mut self) -> Result<(), RtcError<I2CBusErr>>
Disable all alarm components
Sourcepub fn get_alarm_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub fn get_alarm_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if alarm flag is set (alarm has triggered)
Sourcepub fn clear_alarm_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
pub fn clear_alarm_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
Clear the alarm flag
Sourcepub fn set_alarm_interrupt(
&mut self,
enable: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub fn set_alarm_interrupt( &mut self, enable: bool, ) -> Result<(), RtcError<I2CBusErr>>
Enable or disable alarm interrupt
Sourcepub fn is_alarm_interrupt_enabled(
&mut self,
) -> Result<bool, RtcError<I2CBusErr>>
pub fn is_alarm_interrupt_enabled( &mut self, ) -> Result<bool, RtcError<I2CBusErr>>
Check if alarm interrupt is enabled
Sourcepub fn set_timer_value(&mut self, value: u8) -> Result<(), RtcError<I2CBusErr>>
pub fn set_timer_value(&mut self, value: u8) -> Result<(), RtcError<I2CBusErr>>
Set the timer countdown value (0-255)
Sourcepub fn get_timer_value(&mut self) -> Result<u8, RtcError<I2CBusErr>>
pub fn get_timer_value(&mut self) -> Result<u8, RtcError<I2CBusErr>>
Get the current timer countdown value
Sourcepub fn set_timer_frequency(
&mut self,
freq: TimerFrequency,
) -> Result<(), RtcError<I2CBusErr>>
pub fn set_timer_frequency( &mut self, freq: TimerFrequency, ) -> Result<(), RtcError<I2CBusErr>>
Set the timer source clock frequency
Sourcepub fn get_timer_frequency(
&mut self,
) -> Result<TimerFrequency, RtcError<I2CBusErr>>
pub fn get_timer_frequency( &mut self, ) -> Result<TimerFrequency, RtcError<I2CBusErr>>
Get the timer source clock frequency
Sourcepub fn set_timer_enabled(
&mut self,
enable: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub fn set_timer_enabled( &mut self, enable: bool, ) -> Result<(), RtcError<I2CBusErr>>
Enable or disable the timer
Sourcepub fn is_timer_enabled(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub fn is_timer_enabled(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if timer is enabled
Sourcepub fn get_timer_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub fn get_timer_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if timer flag is set (timer has triggered)
Sourcepub fn clear_timer_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
pub fn clear_timer_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
Clear the timer flag
Sourcepub fn set_timer_interrupt(
&mut self,
enable: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub fn set_timer_interrupt( &mut self, enable: bool, ) -> Result<(), RtcError<I2CBusErr>>
Enable or disable timer interrupt
Sourcepub fn is_timer_interrupt_enabled(
&mut self,
) -> Result<bool, RtcError<I2CBusErr>>
pub fn is_timer_interrupt_enabled( &mut self, ) -> Result<bool, RtcError<I2CBusErr>>
Check if timer interrupt is enabled
Sourcepub fn set_timer_interrupt_pulse_mode(
&mut self,
pulse: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub fn set_timer_interrupt_pulse_mode( &mut self, pulse: bool, ) -> Result<(), RtcError<I2CBusErr>>
Set timer interrupt mode (level or pulse)
Sourcepub fn set_clkout_enabled(
&mut self,
enable: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub fn set_clkout_enabled( &mut self, enable: bool, ) -> Result<(), RtcError<I2CBusErr>>
Enable or disable the CLKOUT output
Sourcepub fn is_clkout_enabled(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub fn is_clkout_enabled(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if CLKOUT is enabled
Sourcepub fn set_clkout_frequency(
&mut self,
freq: ClkoutFrequency,
) -> Result<(), RtcError<I2CBusErr>>
pub fn set_clkout_frequency( &mut self, freq: ClkoutFrequency, ) -> Result<(), RtcError<I2CBusErr>>
Set the CLKOUT frequency
Sourcepub fn get_clkout_frequency(
&mut self,
) -> Result<ClkoutFrequency, RtcError<I2CBusErr>>
pub fn get_clkout_frequency( &mut self, ) -> Result<ClkoutFrequency, RtcError<I2CBusErr>>
Get the CLKOUT frequency setting