[][src]Struct pcf8523::Pcf8523

pub struct Pcf8523 { /* fields omitted */ }

Methods

impl Pcf8523[src]

pub fn new(i2cpath: &str) -> Pcf8523[src]

Returns a new Pcf8523 using the specified path to an i2c-dev device.

Arguments

  • i2cpath - Path to the I2C device, e.g. /dev/i2c-1

Panics

This function panics if there is an issue opening the device.

pub fn get_time(&mut self) -> DateTime<Utc>[src]

Returns the time in UTC from the device.

Panics

Panics if there is an issue reading the I2C bus, or if the data stored on the chip is not a valid UTC time.

pub fn set_time(&mut self, time: DateTime<Utc>)[src]

Programs the given time, in UTC, to the device.

Panics

Panics if:

  • The current year is < 2000 or >= 2100, or
  • If there is an error writing to the I2C bus.

Auto Trait Implementations

impl Sync for Pcf8523

impl Send for Pcf8523

impl Unpin for Pcf8523

impl RefUnwindSafe for Pcf8523

impl UnwindSafe for Pcf8523

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<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.

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

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

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