Struct stm32f4xx_hal::rtc::Rtc
source · [−]Expand description
Real Time Clock peripheral
Fields
regs: RTC
RTC Peripheral register
Implementations
sourceimpl Rtc<Lse>
impl Rtc<Lse>
sourcepub fn new(regs: RTC, pwr: &mut PWR) -> Self
pub fn new(regs: RTC, pwr: &mut PWR) -> Self
Create and enable a new RTC with external crystal or ceramic resonator and default prescalers.
sourcepub fn with_config(
regs: RTC,
pwr: &mut PWR,
mode: LSEClockMode,
prediv_s: u16,
prediv_a: u8
) -> Self
pub fn with_config(
regs: RTC,
pwr: &mut PWR,
mode: LSEClockMode,
prediv_s: u16,
prediv_a: u8
) -> Self
Create and enable a new RTC, and configure its clock source and prescalers.
From AN3371, Table 3, when using the LSE,
set prediv_s
to 255, and prediv_a
to 127 to get a calendar clock of 1Hz.
sourceimpl Rtc<Lsi>
impl Rtc<Lsi>
sourceimpl<CS> Rtc<CS>
impl<CS> Rtc<CS>
pub fn set_prescalers(&mut self, prediv_s: u16, prediv_a: u8)
sourcepub fn set_year(&mut self, year: u16) -> Result<(), Error>
pub fn set_year(&mut self, year: u16) -> Result<(), Error>
Set the year [1970-2069].
The year cannot be less than 1970, since the Unix epoch is assumed (1970-01-01 00:00:00). Also, the year cannot be greater than 2069 since the RTC range is 0 - 99.
sourcepub fn set_date(&mut self, date: &Date) -> Result<(), Error>
pub fn set_date(&mut self, date: &Date) -> Result<(), Error>
Set the date.
The year cannot be less than 1970, since the Unix epoch is assumed (1970-01-01 00:00:00). Also, the year cannot be greater than 2069 since the RTC range is 0 - 99.
sourcepub fn set_datetime(&mut self, date: &PrimitiveDateTime) -> Result<(), Error>
pub fn set_datetime(&mut self, date: &PrimitiveDateTime) -> Result<(), Error>
Set the date and time.
The year cannot be less than 1970, since the Unix epoch is assumed (1970-01-01 00:00:00). Also, the year cannot be greater than 2069 since the RTC range is 0 - 99.
pub fn get_datetime(&mut self) -> PrimitiveDateTime
Trait Implementations
Auto Trait Implementations
impl<CS> RefUnwindSafe for Rtc<CS> where
CS: RefUnwindSafe,
impl<CS> Send for Rtc<CS> where
CS: Send,
impl<CS = Lse> !Sync for Rtc<CS>
impl<CS> Unpin for Rtc<CS> where
CS: Unpin,
impl<CS> UnwindSafe for Rtc<CS> where
CS: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more