#rtc #clock #driver #embedded-hal-driver #ds1307

no-std ds1307

Platform-agnostic Rust driver for the DS1307 real-time clock

2 unstable releases

0.2.0 Sep 7, 2018
0.1.0 Aug 15, 2018

#11 in #clock

Download history 2/week @ 2018-10-03 1/week @ 2018-10-10 17/week @ 2018-10-17 4/week @ 2018-10-24 2/week @ 2018-10-31 14/week @ 2018-11-07 6/week @ 2018-11-14 8/week @ 2018-11-21 4/week @ 2018-11-28 10/week @ 2018-12-05 5/week @ 2018-12-12 5/week @ 2018-12-19 10/week @ 2018-12-26

8 downloads per month


419 lines

Rust DS1307 Real-Time Clock Driver Docs Docs

This is a platform agnostic Rust driver for the DS1307 real-time clock, 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
  • Enable and disable the real-time clock. See: set_running
  • Read and write user RAM. See: read_ram
  • Control square-wave output. See: enable_square_wave_output

The device

The DS1307 serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through an I2C, bidirectional bus.

The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date 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.

The DS1307 has a built-in power-sense circuit that detects power failures and automatically switches to the backup supply. Timekeeping operation continues while the part operates from the backup supply.

Datasheet: DS1307


Licensed under either of


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.