[][src]Struct stm32f1xx_hal::rtc::Rtc

pub struct Rtc { /* fields omitted */ }

Interface to the real time clock

Methods

impl Rtc[src]

pub fn rtc(regs: RTC, bkp: &mut BackupDomain) -> Self[src]

Initialises the RTC. The BackupDomain struct is created by Rcc.bkp.constrain().

pub fn set_seconds(&mut self, seconds: u32)[src]

Set the current rtc value to the specified amount of seconds

pub fn set_alarm(&mut self, seconds: u32)[src]

Sets the time at which an alarm will be triggered

This also clears the alarm flag if it is set

pub fn listen_alarm(&mut self)[src]

Enables the RTCALARM interrupt

pub fn unlisten_alarm(&mut self)[src]

Disables the RTCALARM interrupt

pub fn seconds(&self) -> u32[src]

Reads the current time

pub fn listen_seconds(&mut self)[src]

Enables the RTC second interrupt

pub fn unlisten_seconds(&mut self)[src]

Disables the RTC second interrupt

pub fn clear_second_flag(&mut self)[src]

Clears the RTC second interrupt flag

pub fn clear_alarm_flag(&mut self)[src]

Clears the RTC alarm interrupt flag

pub fn wait_alarm(&mut self) -> Result<(), Void>[src]

Return Ok(()) if the alarm flag is set, Err(nb::WouldBlock) otherwise.

use nb::block;

rtc.set_alarm(rtc.read_counts() + 5);
// NOTE: Safe unwrap because Void can't be returned
block!(rtc.wait_alarm()).unwrap();

Auto Trait Implementations

impl Send for Rtc

impl !Sync for Rtc

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self