mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-24 09:40:52 +00:00
Saves a bit on resources and the RTC crate doesn't need to be stand-alone now that the modals crate is a thing; we are able to split the UX routine to manage the RTC out of the code that actually manages the hardware. The hardware code ended up in LLIO, and the UX ended up in the status routine.
77 lines
2.1 KiB
Rust
77 lines
2.1 KiB
Rust
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)]
|
|
pub enum Weekday {
|
|
Sunday,
|
|
Monday,
|
|
Tuesday,
|
|
Wednesday,
|
|
Thursday,
|
|
Friday,
|
|
Saturday,
|
|
}
|
|
|
|
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
|
pub enum TimeUnits {
|
|
Seconds,
|
|
Minutes,
|
|
Hours,
|
|
}
|
|
|
|
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)]
|
|
pub struct DateTime {
|
|
pub seconds: u8,
|
|
pub minutes: u8,
|
|
pub hours: u8,
|
|
pub days: u8,
|
|
pub months: u8,
|
|
pub years: u8,
|
|
pub weekday: Weekday,
|
|
}
|
|
|
|
pub(crate) const SERVER_NAME_RTC: &str = "_Real time clock application server_";
|
|
|
|
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
|
pub(crate) enum RtcOpcode {
|
|
/// register a callback for the datetime
|
|
RegisterDateTimeCallback,
|
|
|
|
/// unregister a callback for the datetime
|
|
UnregisterDateTimeCallback,
|
|
|
|
/// sets the datetime
|
|
SetDateTime, //(DateTime),
|
|
|
|
/// Get datetime. Causes users with registered callbacks to receive the current DateTime
|
|
RequestDateTime,
|
|
|
|
/// the datetime response, used internally from the callback manager
|
|
ResponseDateTime,
|
|
|
|
/// sets a wake-up alarm. This forces the SoC into power-on state, if it happens to be off.
|
|
/// primarily used to trigger cold reboots, but could have other reasons
|
|
SetWakeupAlarm, //(u8, TimeUnits),
|
|
|
|
/// clear any wakeup alarms that have been set
|
|
ClearWakeupAlarm,
|
|
|
|
/// sets an RTC alarm. This just triggers a regular interrupt, no other side-effect
|
|
SetRtcAlarm,
|
|
|
|
/// clears any RTC alarms that have been set
|
|
ClearRtcAlarm,
|
|
|
|
/// Quit
|
|
Quit
|
|
}
|
|
|
|
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
|
pub(crate) enum Return {
|
|
ReturnDateTime,
|
|
Drop,
|
|
}
|
|
|
|
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)]
|
|
pub(crate) struct ScalarHook {
|
|
pub sid: (u32, u32, u32, u32),
|
|
pub id: u32, // ID of the scalar message to send through (e.g. the discriminant of the Enum on the caller's side API)
|
|
pub cid: xous::CID, // caller-side connection ID for the scalar message to route to. Created by the caller before hooking.
|
|
}
|