| Crates.io | ds1307-rtc |
| lib.rs | ds1307-rtc |
| version | 0.2.3 |
| created_at | 2025-08-31 16:41:21.428526+00 |
| updated_at | 2025-09-09 01:44:17.806888+00 |
| description | A no_std driver for the DS1307 Real Time Clock (RTC) module |
| homepage | |
| repository | https://github.com/implferris/ds1307-rtc |
| max_upload_size | |
| id | 1818685 |
| size | 101,013 |
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.
use ds1307_rtc::Ds1307;
use rtc_hal::rtc::Rtc; // rtc_hal trait required to be imported to be used
use rtc_hal::datetime::DateTime;
// Set up I2C (depends on your board)
let i2c = /* your I2C setup */;
// Create the driver
let mut rtc = Ds1307::new(i2c);
// Set time to August 21, 2025 at 2:30 PM
let time = DateTime::new(2025, 8, 21, 14, 30, 0).unwrap();
rtc.set_datetime(&time).unwrap();
// Read current time
let now = rtc.get_datetime().unwrap();
Example projects are available in the separate ds1307-examples repository to help you get started.
This project is licensed under the MIT License.