Platform-agnostic Rust driver for the DS3231, DS3232 and DS3234 extremely accurate real-time clocks (RTC).
Go to file
Diego Barrios Romero 2b86ac70d2 Update driver capabilities 2018-10-29 18:48:07 +01:00
ci Add CI 2018-10-28 10:31:28 +01:00
examples Add linux example 2018-10-28 10:32:41 +01:00
src Update driver capabilities 2018-10-29 18:48:07 +01:00
tests Add function to read the temperature 2018-10-29 18:36:15 +01:00
.gitignore Initial version 2018-10-28 10:31:13 +01:00
.travis.yml Add CI 2018-10-28 10:31:28 +01:00
CHANGELOG.md Initial version 2018-10-28 10:31:13 +01:00
Cargo.toml Initial version 2018-10-28 10:31:13 +01:00
LICENSE-APACHE Initial version 2018-10-28 10:31:13 +01:00
LICENSE-MIT Initial version 2018-10-28 10:31:13 +01:00
README.md Update driver capabilities 2018-10-29 18:48:07 +01:00

README.md

Rust DS3231, DS3232 and DS3234 Extremely Accurate Real-Time Clock Driver crates.io Docs Build Status

This is a platform agnostic Rust driver for the DS3231, DS3232 and DS3234 extremely accurate real-time clocks, based on the embedded-hal traits.

This driver allows you to:

  • Read and set date and time in 12-hour and 24-hour format. See: get_datetime.
  • Read and set date and time elements. For example, see: get_year.
  • Enable and disable the real-time clock. See: enable.
  • Read the temperature. See get_temperature.
  • Force a temperature conversion and time compensation. See convert_temperature.
  • Read the busy status. See is_busy.
  • Read whether the oscillator is or has been stopped. See has_been_stopped.
  • Clear the has-been-stopped flag. See clear_has_been_stopped_flag.
  • Enable/disable the 32kHz output. See enable_32khz_output.
  • Set the aging offset. See set_aging_offset.

The devices

This driver is compatible with the DS3231 and DS3232 I2C devices and the DS3234 SPI device.

DS3231

The DS3231 is a low-cost, extremely accurate I2C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal.

The device incorporates a battery input, and maintains accurate timekeeping when main power to the device is interrupted. The integration of the crystal resonator enhances the long-term accuracy of the device as well as reduces the piece-part count in a manufacturing line. The DS3231 is available in commercial and industrial temperature ranges, and is offered in a 16-pin, 300-mil SO package.

The RTC maintains seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with an AM/PM indicator. Two programmable time-of-day alarms and a programmable square-wave output are provided. Address and data are transferred serially through an I2C bidirectional bus.

A precision temperature-compensated voltage reference and comparator circuit monitors the status of VCC to detect power failures, to provide a reset output, and to automatically switch to the backup supply when necessary. Additionally, the RST pin is monitored as a pushbutton input for generating a μP reset.

DS3232

The DS3232 is a low-cost temperature-compensated crystal oscillator (TCXO) with a very accurate, temperature-compensated, integrated real-time clock (RTC) and 236 bytes of battery-backed SRAM.

Additionally, the DS3232 incorporates a battery input and maintains accurate timekeeping when main power to the device is interrupted. The integration of the crystal resonator enhances the long-term accuracy of the device as well as reduces the piece-part count in a manufacturing line. The DS3232 is available in commercial and industrial temperature ranges, and is offered in an industry-standard 20-pin, 300-mil SO package.

The RTC maintains seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with an AM/PM indicator. Two programmable time-of-day alarms and a programmable square-wave output are provided. Address and data are transferred serially through an I2C bidirectional bus.

A precision temperature-compensated voltage reference and comparator circuit monitors the status of VCC to detect power failures, to provide a reset output, and to automatically switch to the backup supply when necessary. Additionally, the RST pin is monitored as a pushbutton input for generating a μP reset.

DS3234

The DS3234 is a low-cost, extremely accurate SPI bus real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal.

The DS3234 incorporates a precision, temperature-compensated voltage reference and comparator circuit to monitor VCC. When VCC drops below the power-fail voltage (VPF), the device asserts the RST output and also disables read and write access to the part when VCC drops below both VPF and VBAT. The RST pin is monitored as a pushbutton input for generating a μP reset. The device switches to the backup supply input and maintains accurate timekeeping when main power to the device is interrupted. The integration of the crystal resonator enhances the long-term accuracy of the device as well as reduces the piece-part count in a manufacturing line. The DS3234 is available in commercial and industrial temperature ranges, and is offered in an industry-standard 300-mil, 20-pin SO package.

The DS3234 also integrates 256 bytes of battery-backed SRAM. In the event of main power loss, the contents of the memory are maintained by the power source connected to the V BAT pin. The RTC maintains seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with AM/PM indicator. Two programmable time-of-day alarms and a programmable square-wave output are provided. Address and data are transferred serially by an SPI bidirectional bus.

Datasheets:

License

Licensed under either of

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.