Crate ds1302[][src]

Expand description

DS1302 real time clock-calendar platform agnostic driver


The DS1302 trickle-charge timekeeping chip contains a real-time clock/calendar and 31 bytes of static RAM. It communicates with a microprocessor via a simple serial interface. The real-time 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 an AM/PM indicator. The chip driver is based on embedded-hal traits.

Datasheet: DS1302

Driver features:

  • Reading/setting clock/calendar data
  • 12-hour (AM/PM) or 24-hour format
  • Changing the time format while the chip is working

NEW (4.0.0 release):

  • Programmable Trickle Charger configuration
  • 31 x 8 Battery-Backed General-Purpose RAM operations


Calendar information

Clock information

DS1302 RTCC driver


Trickle charger diode select. diode drop 0.7v or 1.4v.

DS1302 error

Hour information: 12-hour (AM/PM) or 24-hour

Hour format: 12-hour (AM/PM) or 24-hour

Trickle charger resistor select.


For timing ds1302 uses fugit crate which only provides Duration and Instant types. It does not provide any clock or timer traits. Therefore ds1302 has its own Delay trait that provides all timing capabilities that are needed for the library. User must implement this trait for the timer by itself.