pub fn date_time(&self) -> Option<NaiveDateTime> {
        loop {
            self.calendar_initialized()?;
            let ss = self.reg.ssr.read().ss().bits();
            let dr = self.reg.dr.read();
            let tr = self.reg.tr.read();

            // If an RTCCLK edge occurs during read we may see inconsistent values
            // so read ssr again and see if it has changed. (see RM0433 Rev 7 46.3.9)
            let ss_after = self.reg.ssr.read().ss().bits();
            if ss == ss_after {
                let year =
                    2000 + i32(dr.yt().bits()) * 10 + i32(dr.yu().bits());
                let month = dr.mt().bits() as u8 * 10 + dr.mu().bits();
                let day = dr.dt().bits() * 10 + dr.du().bits();

                let date = NaiveDate::from_ymd_opt(year, u32(month), u32(day))?;

                let mut hour = tr.ht().bits() * 10 + tr.hu().bits();
                if tr.pm().bit_is_set() {
                    hour += 12;
                }
                let minute = tr.mnt().bits() * 10 + tr.mnu().bits();
                let second = tr.st().bits() * 10 + tr.su().bits();
                let micro = self.ss_to_us(ss);

                let time = NaiveTime::from_hms_micro_opt(
                    u32(hour),
                    u32(minute),
                    u32(second),
                    micro,
                )?;

                return Some(date.and_time(time));
            }
        }
    }
/// Calendar Date and Time
///
/// Returns `None` if the calendar has not been initialized
Calendar Date and Time
Returns `None` if the calendar has not been initialized
Calendar Date and Time Returns ` None ` if the calendar has not been initialized
pub fn date_time(&self) -> Option<NaiveDateTime> {
        loop {
            self.calendar_initialized()?;
            let ss = self.reg.ssr.read().ss().bits();
            let dr = self.reg.dr.read();
            let tr = self.reg.tr.read();
            // If an RTCCLK edge occurs during read we may see inconsistent values
            // so read ssr again and see if it has changed. (see RM0433 Rev 7 46.3.9)
            let ss_after = self.reg.ssr.read().ss().bits();
            if ss == ss_after {
                let year =
                    2000 + i32(dr.yt().bits()) * 10 + i32(dr.yu().bits());
                let month = dr.mt().bits() as u8 * 10 + dr.mu().bits();
                let day = dr.dt().bits() * 10 + dr.du().bits();
                let date = NaiveDate::from_ymd_opt(year, u32(month), u32(day))?;
                let mut hour = tr.ht().bits() * 10 + tr.hu().bits();
                if tr.pm().bit_is_set() {
                    hour += 12;
                }
                let minute = tr.mnt().bits() * 10 + tr.mnu().bits();
                let second = tr.st().bits() * 10 + tr.su().bits();
                let micro = self.ss_to_us(ss);
                let time = NaiveTime::from_hms_micro_opt(
                    u32(hour),
                    u32(minute),
                    u32(second),
                    micro,
                )?;
                return Some(date.and_time(time));
            }
        }
    }
pub fn date_time ( & self ) -> Option < NaiveDateTime > { loop { self . calendar_initialized ( ) ? ; let ss = self . reg . ssr . read ( ) . ss ( ) . bits ( ) ; let dr = self . reg . dr . read ( ) ; let tr = self . reg . tr . read ( ) ; // If an RTCCLK edge occurs during read we may see inconsistent values // so read ssr again and see if it has changed. (see RM0433 Rev 7 46.3.9) let ss_after = self . reg . ssr . read ( ) . ss ( ) . bits ( ) ; if ss == ss_after { let year = 2000 + i32 ( dr . yt ( ) . bits ( ) ) * 10 + i32 ( dr . yu ( ) . bits ( ) ) ; let month = dr . mt ( ) . bits ( ) as u8 * 10 + dr . mu ( ) . bits ( ) ; let day = dr . dt ( ) . bits ( ) * 10 + dr . du ( ) . bits ( ) ; let date = NaiveDate :: from_ymd_opt ( year , u32 ( month ) , u32 ( day ) ) ? ; let mut hour = tr . ht ( ) . bits ( ) * 10 + tr . hu ( ) . bits ( ) ; if tr . pm ( ) . bit_is_set ( ) { hour += 12 ; } let minute = tr . mnt ( ) . bits ( ) * 10 + tr . mnu ( ) . bits ( ) ; let second = tr . st ( ) . bits ( ) * 10 + tr . su ( ) . bits ( ) ; let micro = self . ss_to_us ( ss ) ; let time = NaiveTime :: from_hms_micro_opt ( u32 ( hour ) , u32 ( minute ) , u32 ( second ) , micro , ) ? ; return Some ( date . and_time ( time ) ) ; } } }
Calendar Date and Time
Returns `None` if the calendar has not been initialized
Calendar Date and Time Returns ` None ` if the calendar has not been initialized
&self
&self