[−][src]Struct ds1307::Ds1307
DS1307 driver
Methods
impl<I2C, E> Ds1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
[src]
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn read_ram(
&mut self,
address_offset: u8,
data: &mut [u8]
) -> Result<(), Error<E>>
[src]
&mut self,
address_offset: u8,
data: &mut [u8]
) -> Result<(), Error<E>>
Read a data array from the user RAM starting at the given offset.
There is a total of 56 bytes of user RAM available so the valid ranges for
the parameters are: address_offset
: [0-55] and data
array length: [0-56].
Will return an Error::InvalidInputData
if attempting to access a position not
available or if attempting to read too much data.
pub fn write_ram(
&mut self,
address_offset: u8,
data: &[u8]
) -> Result<(), Error<E>>
[src]
&mut self,
address_offset: u8,
data: &[u8]
) -> Result<(), Error<E>>
Write a data array to the user RAM starting at the given offset.
There is a total of 56 bytes of user RAM available so the valid ranges for
the parameters are: address_offset
: [0-55] and data
array length: [0-56].
Will return an Error::InvalidInputData
if attempting to access a position not
available or if attempting to write too much data.
impl<I2C, E> Ds1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
[src]
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn running(&mut self) -> Result<bool, Error<E>>
[src]
Read if the clock is running.
pub fn set_running(&mut self) -> Result<(), Error<E>>
[src]
Set the clock to run (default on power-on). (Does not alter the device register if already running).
pub fn halt(&mut self) -> Result<(), Error<E>>
[src]
Halt the clock. (Does not alter the device register if already halted).
impl<I2C, E> Ds1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
[src]
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn square_wave_output_enabled(&mut self) -> Result<bool, Error<E>>
[src]
Read whether the square-wave output is enabled.
pub fn enable_square_wave_output(&mut self) -> Result<(), Error<E>>
[src]
Enable the square-wave output. (Does not alter the device register if already enabled).
pub fn disable_square_wave_output(&mut self) -> Result<(), Error<E>>
[src]
Disable the square-wave output. (Does not alter the device register if already disabled).
pub fn get_square_wave_output_level(&mut self) -> Result<SqwOutLevel, Error<E>>
[src]
Read status of square-wave output level control bit.
pub fn set_square_wave_output_level(
&mut self,
level: SqwOutLevel
) -> Result<(), Error<E>>
[src]
&mut self,
level: SqwOutLevel
) -> Result<(), Error<E>>
Set square-wave output level. (Does not alter the device register if same level is already configured).
pub fn get_square_wave_output_rate(&mut self) -> Result<SqwOutRate, Error<E>>
[src]
Read square-wave output rate control bits.
pub fn set_square_wave_output_rate(
&mut self,
rate: SqwOutRate
) -> Result<(), Error<E>>
[src]
&mut self,
rate: SqwOutRate
) -> Result<(), Error<E>>
Set square-wave output rate.
impl<I2C, E> Ds1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
[src]
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn new(i2c: I2C) -> Self
[src]
Create a new instance.
pub fn destroy(self) -> I2C
[src]
Destroy driver instance, return I²C bus instance.
Trait Implementations
impl<I2C: Debug> Debug for Ds1307<I2C>
[src]
impl<I2C: Default> Default for Ds1307<I2C>
[src]
impl<I2C, E> Rtcc for Ds1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
[src]
I2C: Write<Error = E> + WriteRead<Error = E>,
type Error = Error<E>
Error type
fn get_seconds(&mut self) -> Result<u8, Self::Error>
[src]
fn get_minutes(&mut self) -> Result<u8, Self::Error>
[src]
fn get_hours(&mut self) -> Result<Hours, Self::Error>
[src]
fn get_weekday(&mut self) -> Result<u8, Self::Error>
[src]
fn get_day(&mut self) -> Result<u8, Self::Error>
[src]
fn get_month(&mut self) -> Result<u8, Self::Error>
[src]
fn get_year(&mut self) -> Result<u16, Self::Error>
[src]
fn get_date(&mut self) -> Result<NaiveDate, Self::Error>
[src]
fn get_time(&mut self) -> Result<NaiveTime, Self::Error>
[src]
fn get_datetime(&mut self) -> Result<NaiveDateTime, Self::Error>
[src]
fn set_seconds(&mut self, seconds: u8) -> Result<(), Self::Error>
[src]
fn set_minutes(&mut self, minutes: u8) -> Result<(), Self::Error>
[src]
fn set_hours(&mut self, hours: Hours) -> Result<(), Self::Error>
[src]
fn set_weekday(&mut self, weekday: u8) -> Result<(), Self::Error>
[src]
fn set_day(&mut self, day: u8) -> Result<(), Self::Error>
[src]
fn set_month(&mut self, month: u8) -> Result<(), Self::Error>
[src]
fn set_year(&mut self, year: u16) -> Result<(), Self::Error>
[src]
fn set_date(&mut self, date: &NaiveDate) -> Result<(), Self::Error>
[src]
fn set_time(&mut self, time: &NaiveTime) -> Result<(), Self::Error>
[src]
fn set_datetime(&mut self, datetime: &NaiveDateTime) -> Result<(), Self::Error>
[src]
Auto Trait Implementations
impl<I2C> RefUnwindSafe for Ds1307<I2C> where
I2C: RefUnwindSafe,
I2C: RefUnwindSafe,
impl<I2C> Send for Ds1307<I2C> where
I2C: Send,
I2C: Send,
impl<I2C> Sync for Ds1307<I2C> where
I2C: Sync,
I2C: Sync,
impl<I2C> Unpin for Ds1307<I2C> where
I2C: Unpin,
I2C: Unpin,
impl<I2C> UnwindSafe for Ds1307<I2C> where
I2C: UnwindSafe,
I2C: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,