Struct ds1307::DS1307 [−][src]
pub struct DS1307<I2C> { /* fields omitted */ }
DS1307 driver
Methods
impl<I2C, E> DS1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
[src]
impl<I2C, E> DS1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn get_seconds(&mut self) -> Result<u8, Error<E>>
[src]
pub fn get_seconds(&mut self) -> Result<u8, Error<E>>
Read the seconds.
pub fn get_minutes(&mut self) -> Result<u8, Error<E>>
[src]
pub fn get_minutes(&mut self) -> Result<u8, Error<E>>
Read the minutes.
pub fn get_hours(&mut self) -> Result<Hours, Error<E>>
[src]
pub fn get_hours(&mut self) -> Result<Hours, Error<E>>
Read the hours.
pub fn get_weekday(&mut self) -> Result<u8, Error<E>>
[src]
pub fn get_weekday(&mut self) -> Result<u8, Error<E>>
Read the day of the week [1-7].
pub fn get_day(&mut self) -> Result<u8, Error<E>>
[src]
pub fn get_day(&mut self) -> Result<u8, Error<E>>
Read the day of the month [1-31].
pub fn get_month(&mut self) -> Result<u8, Error<E>>
[src]
pub fn get_month(&mut self) -> Result<u8, Error<E>>
Read the month [1-12].
pub fn get_year(&mut self) -> Result<u16, Error<E>>
[src]
pub fn get_year(&mut self) -> Result<u16, Error<E>>
Read the year [2000-2099].
pub fn get_datetime(&mut self) -> Result<DateTime, Error<E>>
[src]
pub fn get_datetime(&mut self) -> Result<DateTime, Error<E>>
Read the date and time.
pub fn set_seconds(&mut self, seconds: u8) -> Result<(), Error<E>>
[src]
pub fn set_seconds(&mut self, seconds: u8) -> Result<(), Error<E>>
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]
pub fn set_minutes(&mut self, minutes: u8) -> Result<(), Error<E>>
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]
pub fn set_hours(&mut self, hours: Hours) -> Result<(), Error<E>>
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]
pub fn set_weekday(&mut self, weekday: u8) -> Result<(), Error<E>>
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]
pub fn set_day(&mut self, day: u8) -> Result<(), Error<E>>
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]
pub fn set_month(&mut self, month: u8) -> Result<(), Error<E>>
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]
pub fn set_year(&mut self, year: u16) -> Result<(), Error<E>>
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]
pub fn set_datetime(&mut self, datetime: &DateTime) -> Result<(), Error<E>>
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]
impl<I2C, E> DS1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn read_ram(
&mut self,
address_offset: u8,
data: &mut [u8]
) -> Result<(), Error<E>>
[src]
pub fn read_ram(
&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]
pub fn write_ram(
&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]
impl<I2C, E> DS1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn is_running(&mut self) -> Result<bool, Error<E>>
[src]
pub fn is_running(&mut self) -> Result<bool, Error<E>>
Read if the clock is running.
pub fn set_running(&mut self) -> Result<(), Error<E>>
[src]
pub fn set_running(&mut self) -> Result<(), Error<E>>
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]
pub fn halt(&mut self) -> Result<(), Error<E>>
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]
impl<I2C, E> DS1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn is_square_wave_output_enabled(&mut self) -> Result<bool, Error<E>>
[src]
pub fn is_square_wave_output_enabled(&mut self) -> Result<bool, Error<E>>
Read whether the square-wave output is enabled.
pub fn enable_square_wave_output(&mut self) -> Result<(), Error<E>>
[src]
pub fn enable_square_wave_output(&mut self) -> Result<(), Error<E>>
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]
pub fn disable_square_wave_output(&mut self) -> Result<(), Error<E>>
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]
pub fn get_square_wave_output_level(&mut self) -> Result<bool, Error<E>>
Read status of square-wave output level control bit.
pub fn set_square_wave_output_level_high(&mut self) -> Result<(), Error<E>>
[src]
pub fn set_square_wave_output_level_high(&mut self) -> Result<(), Error<E>>
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]
pub fn set_square_wave_output_level_low(&mut self) -> Result<(), Error<E>>
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]
pub fn set_square_wave_output_level(
&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]
pub fn get_square_wave_output_rate(
&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]
pub fn set_square_wave_output_rate(
&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]
impl<I2C, E> DS1307<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn new(i2c: I2C) -> Self
[src]
pub fn new(i2c: I2C) -> Self
Create a new instance.
pub fn destroy(self) -> I2C
[src]
pub fn destroy(self) -> I2C
Destroy driver instance, return I²C bus instance.
Trait Implementations
impl<I2C: Debug> Debug for DS1307<I2C>
[src]
impl<I2C: Debug> Debug for DS1307<I2C>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<I2C: Default> Default for DS1307<I2C>
[src]
impl<I2C: Default> Default for DS1307<I2C>