Module capsules_extra::date_time
source · Expand description
Real Time Clock driver
Allows handling of the current date and time
Authors: Irina Bradu irinabradu.a@gmail.com Remus Rughinis remus.rughinis.007@gmail.com
§Usage
ⓘ
let grant_dt = create_capability!(capabilities::MemoryAllocationCapability);
let grant_date_time = board_kernel.create_grant(capsules::date_time::DRIVER_NUM, &grant_dt);
let date_time = static_init!(
capsules::date_time::DateTime<'static>,
capsules::date_time::DateTime::new(&peripherals.rtc, grant_date_time)
);
kernel::hil::date_time::DateTime::set_client(&peripherals.rtc, date_time);
A DateTimeValues structure can be transformed to and from a u32 tuple in the following way: first number (year, month, day_of_the_month): -last 5 bits store the day_of_the_month -previous 4 bits store the month -previous 12 bits store the year second number (day_of_the_week, hour, minute, seconds): -last 6 bits store the seconds -previous 6 store the minute -previous 5 store the hour -previous 3 store the day_of_the_week