#rtc #io #port #osdev #read-write #date-time

no-std cmos

A utility to read, write CMOS and RTC data. Standard library not required.

3 releases

0.1.2 Sep 15, 2020
0.1.1 Dec 9, 2018
0.1.0 Dec 9, 2018

#275 in Date and time

MIT license

15KB
180 lines

CMOS

A utility to read, write CMOS and RTC data. Standard library not required.

Linux build status Coverage Status

Requirements

Using the library (only tested on x86, nightly compiler required)

Add the crate to your project

# Cargo.toml
cmos = "0.1.2"

Examples

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.

Contributing

Feel free to contribute what you want. Just send in a pull request!

License

MIT

Dependencies

~8KB