pub struct Pcf8563Async<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 async fn get_datetime(&mut self) -> Result<DateTime, RtcError<I2CBusErr>>
pub async 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 async fn set_datetime(
&mut self,
dt: &DateTime,
) -> Result<(), RtcError<I2CBusErr>>
pub async 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 async fn set_time(&mut self, time: &Time) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_time(&mut self, time: &Time) -> Result<(), RtcError<I2CBusErr>>
Set only the time (hours, minutes, seconds)
Sourcepub async fn is_clock_valid(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub async 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 async fn clear_voltage_low_flag(
&mut self,
) -> Result<(), RtcError<I2CBusErr>>
pub async 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 async fn get_century_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub async 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 async fn set_century_flag(
&mut self,
century: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_century_flag( &mut self, century: bool, ) -> Result<(), RtcError<I2CBusErr>>
Set the century flag
Sourcepub async fn set_clock_running(
&mut self,
running: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_clock_running( &mut self, running: bool, ) -> Result<(), RtcError<I2CBusErr>>
Start or stop the RTC clock
Sourcepub async fn is_clock_running(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub async fn is_clock_running(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if the RTC clock is running
Sourcepub async fn get_alarm(&mut self) -> Result<Alarm, RtcError<I2CBusErr>>
pub async fn get_alarm(&mut self) -> Result<Alarm, RtcError<I2CBusErr>>
Get the current alarm configuration
Sourcepub async fn set_alarm(
&mut self,
alarm: &Alarm,
) -> Result<(), RtcError<I2CBusErr>>
pub async 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 async fn disable_alarm(&mut self) -> Result<(), RtcError<I2CBusErr>>
pub async fn disable_alarm(&mut self) -> Result<(), RtcError<I2CBusErr>>
Disable all alarm components
Sourcepub async fn get_alarm_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub async fn get_alarm_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if alarm flag is set (alarm has triggered)
Sourcepub async fn clear_alarm_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
pub async fn clear_alarm_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
Clear the alarm flag
Sourcepub async fn set_alarm_interrupt(
&mut self,
enable: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_alarm_interrupt( &mut self, enable: bool, ) -> Result<(), RtcError<I2CBusErr>>
Enable or disable alarm interrupt
Sourcepub async fn is_alarm_interrupt_enabled(
&mut self,
) -> Result<bool, RtcError<I2CBusErr>>
pub async fn is_alarm_interrupt_enabled( &mut self, ) -> Result<bool, RtcError<I2CBusErr>>
Check if alarm interrupt is enabled
Sourcepub async fn set_timer_value(
&mut self,
value: u8,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_timer_value( &mut self, value: u8, ) -> Result<(), RtcError<I2CBusErr>>
Set the timer countdown value (0-255)
Sourcepub async fn get_timer_value(&mut self) -> Result<u8, RtcError<I2CBusErr>>
pub async fn get_timer_value(&mut self) -> Result<u8, RtcError<I2CBusErr>>
Get the current timer countdown value
Sourcepub async fn set_timer_frequency(
&mut self,
freq: TimerFrequency,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_timer_frequency( &mut self, freq: TimerFrequency, ) -> Result<(), RtcError<I2CBusErr>>
Set the timer source clock frequency
Sourcepub async fn get_timer_frequency(
&mut self,
) -> Result<TimerFrequency, RtcError<I2CBusErr>>
pub async fn get_timer_frequency( &mut self, ) -> Result<TimerFrequency, RtcError<I2CBusErr>>
Get the timer source clock frequency
Sourcepub async fn set_timer_enabled(
&mut self,
enable: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_timer_enabled( &mut self, enable: bool, ) -> Result<(), RtcError<I2CBusErr>>
Enable or disable the timer
Sourcepub async fn is_timer_enabled(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub async fn is_timer_enabled(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if timer is enabled
Sourcepub async fn get_timer_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub async fn get_timer_flag(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if timer flag is set (timer has triggered)
Sourcepub async fn clear_timer_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
pub async fn clear_timer_flag(&mut self) -> Result<(), RtcError<I2CBusErr>>
Clear the timer flag
Sourcepub async fn set_timer_interrupt(
&mut self,
enable: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_timer_interrupt( &mut self, enable: bool, ) -> Result<(), RtcError<I2CBusErr>>
Enable or disable timer interrupt
Sourcepub async fn is_timer_interrupt_enabled(
&mut self,
) -> Result<bool, RtcError<I2CBusErr>>
pub async fn is_timer_interrupt_enabled( &mut self, ) -> Result<bool, RtcError<I2CBusErr>>
Check if timer interrupt is enabled
Sourcepub async fn set_timer_interrupt_pulse_mode(
&mut self,
pulse: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_timer_interrupt_pulse_mode( &mut self, pulse: bool, ) -> Result<(), RtcError<I2CBusErr>>
Set timer interrupt mode (level or pulse)
Sourcepub async fn set_clkout_enabled(
&mut self,
enable: bool,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_clkout_enabled( &mut self, enable: bool, ) -> Result<(), RtcError<I2CBusErr>>
Enable or disable the CLKOUT output
Sourcepub async fn is_clkout_enabled(&mut self) -> Result<bool, RtcError<I2CBusErr>>
pub async fn is_clkout_enabled(&mut self) -> Result<bool, RtcError<I2CBusErr>>
Check if CLKOUT is enabled
Sourcepub async fn set_clkout_frequency(
&mut self,
freq: ClkoutFrequency,
) -> Result<(), RtcError<I2CBusErr>>
pub async fn set_clkout_frequency( &mut self, freq: ClkoutFrequency, ) -> Result<(), RtcError<I2CBusErr>>
Set the CLKOUT frequency
Sourcepub async fn get_clkout_frequency(
&mut self,
) -> Result<ClkoutFrequency, RtcError<I2CBusErr>>
pub async fn get_clkout_frequency( &mut self, ) -> Result<ClkoutFrequency, RtcError<I2CBusErr>>
Get the CLKOUT frequency setting