[−][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 get_seconds(&mut self) -> Result<u8, Error<E>>
[src]
Read the seconds.
pub fn get_minutes(&mut self) -> Result<u8, Error<E>>
[src]
Read the minutes.
pub fn get_hours(&mut self) -> Result<Hours, Error<E>>
[src]
Read the hours.
pub fn get_weekday(&mut self) -> Result<u8, Error<E>>
[src]
Read the day of the week [1-7].
pub fn get_day(&mut self) -> Result<u8, Error<E>>
[src]
Read the day of the month [1-31].
pub fn get_month(&mut self) -> Result<u8, Error<E>>
[src]
Read the month [1-12].
pub fn get_year(&mut self) -> Result<u16, Error<E>>
[src]
Read the year [2000-2099].
pub fn get_datetime(&mut self) -> Result<DateTime, Error<E>>
[src]
Read the date and time.
pub fn set_seconds(&mut self, seconds: u8) -> Result<(), Error<E>>
[src]
Set the seconds [0-59].
Will return an Error::InvalidInputData
if the seconds are out of range.
pub fn set_minutes(&mut self, minutes: u8) -> Result<(), Error<E>>
[src]
Set the minutes [0-59].
Will return an Error::InvalidInputData
if the minutes are out of range.
pub fn set_hours(&mut self, hours: Hours) -> Result<(), Error<E>>
[src]
Set the hours.
Changes the operating mode to 12h/24h depending on the parameter.
Will return an Error::InvalidInputData
if the hours are out of range.
pub fn set_weekday(&mut self, weekday: u8) -> Result<(), Error<E>>
[src]
Set the day of week [1-7].
Will return an Error::InvalidInputData
if the day is out of range.
pub fn set_day(&mut self, day: u8) -> Result<(), Error<E>>
[src]
Set the day of month [1-31].
Will return an Error::InvalidInputData
if the day is out of range.
pub fn set_month(&mut self, month: u8) -> Result<(), Error<E>>
[src]
Set the month [1-12].
Will return an Error::InvalidInputData
if the month is out of range.
pub fn set_year(&mut self, year: u16) -> Result<(), Error<E>>
[src]
Set the year [2000-2099].
Will return an Error::InvalidInputData
if the year is out of range.
pub fn set_datetime(&mut self, datetime: &DateTime) -> Result<(), Error<E>>
[src]
Set the date and time.
Will return an Error::InvalidInputData
if any of the parameters is out of range.
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 is_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 is_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<bool, Error<E>>
[src]
Read status of square-wave output level control bit.
pub fn set_square_wave_output_level_high(&mut self) -> Result<(), Error<E>>
[src]
Set square-wave output level high. (Does not alter the device register if level is already high).
pub fn set_square_wave_output_level_low(&mut self) -> Result<(), Error<E>>
[src]
Set square-wave output level low. (Does not alter the device register if level is already low).
pub fn set_square_wave_output_level(
&mut self,
should_level_be_high: bool
) -> Result<(), Error<E>>
[src]
&mut self,
should_level_be_high: bool
) -> 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<SQWOUTRateBits, Error<E>>
[src]
&mut self
) -> Result<SQWOUTRateBits, Error<E>>
Read square-wave output rate control bits.
pub fn set_square_wave_output_rate(
&mut self,
rate_bits: SQWOUTRateBits
) -> Result<(), Error<E>>
[src]
&mut self,
rate_bits: SQWOUTRateBits
) -> Result<(), Error<E>>
Set square-wave output rate control bits. (Does not alter the device register if the same rate is already configured).
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
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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 for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,