[][src]Struct sunrise_time::Rtc

struct Rtc {
    registers: Mutex<(Pio<u8>, Pio<u8>)>,
    timestamp: Mutex<i64>,
    irq_event: Option<ReadableEvent>,
}

IBM Real Time Clock provides access to the current date and time (at second precision). The Real Time Clock is actually part of the CMOS on usual IBM/PC setups.

It is comprised of a command register and a data register. To access data store on the CMOS, one should first write the data address in the command register, then either read or write the data register to read/write to that data address. This is implemented and abstracted away by Rtc::read_reg and Rtc::write_reg.

Fields

registers: Mutex<(Pio<u8>, Pio<u8>)>

Command and Data Register.

timestamp: Mutex<i64>

Last RTC time value.

irq_event: Option<ReadableEvent>

The RTC event.

Implementations

impl Rtc[src]

pub fn new() -> Rtc[src]

Create a new RTC with the default IBM PC values.

pub fn get_time(&self) -> i64[src]

Get the last timestamp of the RTC.

pub fn get_irq_event_handle(&self) -> HandleRef<'static>[src]

Get the update event of the RTC. TODO: Implement get_rtc_event BODY: We need CreateEvent, SignalEvent and ClearEvent syscalls before being able to implement it

fn read_reg(&self, reg: u8) -> u8[src]

Read from a CMOS register.

fn write_reg(&self, reg: u8, val: u8)[src]

Write to the CMOS register.

pub fn enable_update_ended_int(&self)[src]

Enable the Update Ended RTC interrupt. This will enable an interruption on IRQ 8 that will be thrown when the RTC is finished updating its registers.

fn read_interrupt_kind(&self) -> u8[src]

Acknowledges an interrupt from the RTC. Necessary to receive further interrupts.

pub fn is_12hr_clock(&self) -> bool[src]

Checks if the RTC is in 12 hours or 24 hours mode. Depending on the mode, the date might be encoded in BCD.

Trait Implementations

impl Debug for Rtc[src]

impl Default for Rtc[src]

Auto Trait Implementations

impl !RefUnwindSafe for Rtc

impl Send for Rtc

impl Sync for Rtc

impl Unpin for Rtc

impl UnwindSafe for Rtc

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SizedIPCBuffer for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.