Crates.io | cmos |
lib.rs | cmos |
version | 0.1.2 |
source | src |
created_at | 2018-12-09 18:50:54.328242 |
updated_at | 2020-09-15 03:24:16.171066 |
description | A utility to read, write CMOS and RTC data. Standard library not required. |
homepage | https://github.com/noahrinehart/cmos |
repository | https://github.com/noahrinehart/cmos |
max_upload_size | |
id | 100972 |
size | 16,253 |
A utility to read, write CMOS and RTC data. Standard library not required.
Add the crate to your project
# Cargo.toml
cmos = "0.1.2"
To read the RTC using the century register.
use cmos::{CMOS, CMOSCenturyHandler};
// Create a CMOS object (unsafe due to the use of port I/O)
let mut cmos = unsafe { CMOS::new() };
// Read the rtc date time using this year
let rtc = cmos.read_rtc(CMOSCenturyHandler::CenturyRegister(32));
To read the RTC using the current year.
use cmos::{CMOS, CMOSCenturyHandler};
// Create a CMOS object (unsafe due to the use of port I/O)
let mut cmos = unsafe { CMOS::new() };
// Read the rtc date time using this year
let rtc = cmos.read_rtc(CMOSCenturyHandler::CurrentYear(2018));
Check the docs for more information.
Feel free to contribute what you want. Just send in a pull request!
MIT