Struct ds323x::Ds323x

source ·
pub struct Ds323x<DI, IC> { /* private fields */ }
Expand description

DS3231, DS3232 and DS3234 RTC driver

Implementations

Enable the oscillator (set the clock running) (default).

Disable the oscillator (stops the clock).

Force a temperature conversion and time compensation with TXCO algorithm.

The busy status should be checked before doing this. See is_busy()

Enable the 32kHz output. (enabled per default)

Disable the 32kHz output.

Set the aging offset.

Read the aging offset.

Set the interrupt/square-wave output to be used as interrupt output.

Set the interrupt/square-wave output to be used as square-wave output. (default)

Enable battery-backed square wave generation.

Disable battery-backed square wave generation.

Set the square-wave output frequency.

Enable Alarm1 interrupts.

Disable Alarm1 interrupts.

Enable Alarm2 interrupts.

Disable Alarm2 interrupts.

Read whether the oscillator is running

Read the busy status

Read whether the oscillator is stopped or has been stopped at some point.

This allows a better assessment of the validity of the timekeeping data.

Once this is true, it will stay as such until cleared with clear_has_been_stopped_flag()

Clear flag signalling whether the oscillator is stopped or has been stopped at some point.

See also: has_been_stopped()

Read whether the Alarm1 has matched at some point.

Once this is true, it will stay as such until cleared with clear_alarm1_matched_flag()

Clear flag signalling whether the Alarm1 has matched at some point.

See also: has_alarm1_matched()

Read whether the Alarm2 has matched at some point.

Once this is true, it will stay as such until cleared with clear_alarm2_matched_flag()

Clear flag signalling whether the Alarm2 has matched at some point.

See also: has_alarm2_matched()

Read the temperature.

Note: It is possible to manually force a temperature conversion with convert_temperature()

Set Alarm1 for day of the month.

Will return an Error::InvalidInputData if any of the parameters is out of range.

Set Alarm1 for weekday.

Will return an Error::InvalidInputData if any of the parameters is out of range.

Set Alarm2 for date (day of month).

Will return an Error::InvalidInputData if any of the parameters is out of range.

Set Alarm2 for weekday.

Will return an Error::InvalidInputData if any of the parameters is out of range.

Read the seconds.

Read the minutes.

Read the hours.

Read the day of the week [1-7].

Read the day of the month [1-31].

Read the month [1-12].

Read the year [2000-2100].

Read the date and time.

Set the seconds [0-59].

Will return an Error::InvalidInputData if the seconds are out of range.

Set the minutes [0-59].

Will return an Error::InvalidInputData if the minutes are out of range.

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.

Set the day of week [1-7].

Will return an Error::InvalidInputData if the day is out of range.

Set the day of month [1-31].

Will return an Error::InvalidInputData if the day is out of range.

Set the month [1-12].

Will return an Error::InvalidInputData if the month is out of range.

Set the year [2000-2100].

Will return an Error::InvalidInputData if the year is out of range.

Set the date and time.

Will return an Error::InvalidInputData if any of the parameters is out of range.

Create a new instance of the DS3231 device.

Destroy driver instance, return I²C bus instance.

Create a new instance of the DS3232 device.

Destroy driver instance, return I²C bus instance.

Enable the 32kHz output when battery-powered. (enabled per default)

Additionally, the 32kHz output needs to be enabled. See enable_32khz_output().

Note: This is only available for DS3232 and DS3234 devices.

Disable the 32kHz output when battery-powered.

The 32kHz output will still generate a wave when not battery-powered if it enabled. See enable_32khz_output().

Note: This is only available for DS3232 and DS3234 devices.

Set the temperature conversion rate.

Set how often the temperature is measured and applies compensation to the oscillator. This can be used to reduce power consumption but sudden temperature changes will not be compensated for.

Note: This is only available for DS3232 and DS3234 devices.

Create a new instance.

Destroy driver instance, return SPI bus instance and CS output pin.

Enable the 32kHz output when battery-powered. (enabled per default)

Additionally, the 32kHz output needs to be enabled. See enable_32khz_output().

Note: This is only available for DS3232 and DS3234 devices.

Disable the 32kHz output when battery-powered.

The 32kHz output will still generate a wave when not battery-powered if it enabled. See enable_32khz_output().

Note: This is only available for DS3232 and DS3234 devices.

Set the temperature conversion rate.

Set how often the temperature is measured and applies compensation to the oscillator. This can be used to reduce power consumption but sudden temperature changes will not be compensated for.

Note: This is only available for DS3232 and DS3234 devices.

Enable the temperature conversions when battery-powered. (enabled per default)

Note: This is only available for DS3234 devices.

Disable the temperature conversions when battery-powered.

Note: This is only available for DS3234 devices.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.