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

            // If an RTCCLK edge occurs during a read we may see inconsistent values
            // so read ssr again and see if it has changed
            // see RM0453 Rev 2 32.3.10 page 1002 "Reading the calendar"
            let ss_after: u32 = self.rtc.ssr.read().ss().bits();
            if ss == ss_after {
                let year: i32 = 2000 + (dr.yt().bits() as i32) * 10 + (dr.yu().bits() as i32);
                let month: u8 = dr.mt().bits() as u8 * 10 + dr.mu().bits();
                let day: u8 = dr.dt().bits() * 10 + dr.du().bits();

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

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

                let time = NaiveTime::from_hms_micro_opt(
                    hour as u32,
                    minute as u32,
                    second as u32,
                    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: u32 = self.rtc.ssr.read().ss().bits();
            let dr = self.rtc.dr.read();
            let tr = self.rtc.tr.read();
            // If an RTCCLK edge occurs during a read we may see inconsistent values
            // so read ssr again and see if it has changed
            // see RM0453 Rev 2 32.3.10 page 1002 "Reading the calendar"
            let ss_after: u32 = self.rtc.ssr.read().ss().bits();
            if ss == ss_after {
                let year: i32 = 2000 + (dr.yt().bits() as i32) * 10 + (dr.yu().bits() as i32);
                let month: u8 = dr.mt().bits() as u8 * 10 + dr.mu().bits();
                let day: u8 = dr.dt().bits() * 10 + dr.du().bits();
                let date: NaiveDate = NaiveDate::from_ymd_opt(year, month as u32, day as u32)?;
                let mut hour: u8 = tr.ht().bits() * 10 + tr.hu().bits();
                if tr.pm().is_pm() {
                    hour += 12;
                }
                let minute: u8 = tr.mnt().bits() * 10 + tr.mnu().bits();
                let second: u8 = tr.st().bits() * 10 + tr.su().bits();
                let micro: u32 = self.ss_to_us(ss);
                let time = NaiveTime::from_hms_micro_opt(
                    hour as u32,
                    minute as u32,
                    second as u32,
                    micro,
                )?;
                return Some(date.and_time(time));
            }
        }
    }
pub fn date_time ( & self ) -> Option < NaiveDateTime > { loop { self . calendar_initialized ( ) ? ; let ss : u32 = self . rtc . ssr . read ( ) . ss ( ) . bits ( ) ; let dr = self . rtc . dr . read ( ) ; let tr = self . rtc . tr . read ( ) ; // If an RTCCLK edge occurs during a read we may see inconsistent values // so read ssr again and see if it has changed // see RM0453 Rev 2 32.3.10 page 1002 "Reading the calendar" let ss_after : u32 = self . rtc . ssr . read ( ) . ss ( ) . bits ( ) ; if ss == ss_after { let year : i32 = 2000 + ( dr . yt ( ) . bits ( ) as i32 ) * 10 + ( dr . yu ( ) . bits ( ) as i32 ) ; let month : u8 = dr . mt ( ) . bits ( ) as u8 * 10 + dr . mu ( ) . bits ( ) ; let day : u8 = dr . dt ( ) . bits ( ) * 10 + dr . du ( ) . bits ( ) ; let date : NaiveDate = NaiveDate :: from_ymd_opt ( year , month as u32 , day as u32 ) ? ; let mut hour : u8 = tr . ht ( ) . bits ( ) * 10 + tr . hu ( ) . bits ( ) ; if tr . pm ( ) . is_pm ( ) { hour += 12 ; } let minute : u8 = tr . mnt ( ) . bits ( ) * 10 + tr . mnu ( ) . bits ( ) ; let second : u8 = tr . st ( ) . bits ( ) * 10 + tr . su ( ) . bits ( ) ; let micro : u32 = self . ss_to_us ( ss ) ; let time = NaiveTime :: from_hms_micro_opt ( hour as u32 , minute as u32 , second as u32 , 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