DS1307 RTC Driver
A Rust driver for the DS1307 Real-Time Clock (RTC) chip, implementing the embedded-hal and rtc-hal traits for integration with embedded Rust projects.
Features
- Read and set date/time
- Control power (start/stop the clock)
- Use 56 bytes of memory storage
- Generate square wave signals
- Control output pin
Basic usage
use Ds1307;
use Rtc; // rtc_hal trait required to be imported to be used
use DateTime;
// Set up I2C (depends on your board)
let i2c = /* your I2C setup */;
// Create the driver
let mut rtc = new;
// Set time to August 21, 2025 at 2:30 PM
let time = new.unwrap;
rtc.set_datetime.unwrap;
// Read current time
let now = rtc.get_datetime.unwrap;
Examples
Example projects are available in the separate ds1307-examples repository to help you get started.
License
This project is licensed under the MIT License.