#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Ackupd {
#[doc = "Time and calendar registers cannot be updated."]
FREERUN = 0x0,
#[doc = "Time and calendar registers can be updated."]
UPDATE = 0x01,
}
impl Ackupd {
#[inline(always)]
pub const fn from_bits(val: u8) -> Ackupd {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Ackupd {
#[inline(always)]
fn from(val: u8) -> Ackupd {
Ackupd::from_bits(val)
}
}
impl From<Ackupd> for u8 {
#[inline(always)]
fn from(val: Ackupd) -> u8 {
Ackupd::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Alarm {
#[doc = "No alarm matching condition occurred."]
NO_ALARMEVENT = 0x0,
#[doc = "An alarm matching condition has occurred."]
ALARMEVENT = 0x01,
}
impl Alarm {
#[inline(always)]
pub const fn from_bits(val: u8) -> Alarm {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Alarm {
#[inline(always)]
fn from(val: u8) -> Alarm {
Alarm::from_bits(val)
}
}
impl From<Alarm> for u8 {
#[inline(always)]
fn from(val: Alarm) -> u8 {
Alarm::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Calev {
#[doc = "No calendar event has occurred since the last clear."]
NO_CALEVENT = 0x0,
#[doc = "At least one calendar event has occurred since the last clear."]
CALEVENT = 0x01,
}
impl Calev {
#[inline(always)]
pub const fn from_bits(val: u8) -> Calev {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Calev {
#[inline(always)]
fn from(val: u8) -> Calev {
Calev::from_bits(val)
}
}
impl From<Calev> for u8 {
#[inline(always)]
fn from(val: Calev) -> u8 {
Calev::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Calevsel {
#[doc = "Week change (every Monday at time 00:00:00)"]
WEEK = 0x0,
#[doc = "Month change (every 01 of each month at time 00:00:00)"]
MONTH = 0x01,
#[doc = "Year change (every January 1 at time 00:00:00)"]
YEAR = 0x02,
_RESERVED_3 = 0x03,
}
impl Calevsel {
#[inline(always)]
pub const fn from_bits(val: u8) -> Calevsel {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Calevsel {
#[inline(always)]
fn from(val: u8) -> Calevsel {
Calevsel::from_bits(val)
}
}
impl From<Calevsel> for u8 {
#[inline(always)]
fn from(val: Calevsel) -> u8 {
Calevsel::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Sec {
#[doc = "No second event has occurred since the last clear."]
NO_SECEVENT = 0x0,
#[doc = "At least one second event has occurred since the last clear."]
SECEVENT = 0x01,
}
impl Sec {
#[inline(always)]
pub const fn from_bits(val: u8) -> Sec {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Sec {
#[inline(always)]
fn from(val: u8) -> Sec {
Sec::from_bits(val)
}
}
impl From<Sec> for u8 {
#[inline(always)]
fn from(val: Sec) -> u8 {
Sec::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Timev {
#[doc = "No time event has occurred since the last clear."]
NO_TIMEVENT = 0x0,
#[doc = "At least one time event has occurred since the last clear."]
TIMEVENT = 0x01,
}
impl Timev {
#[inline(always)]
pub const fn from_bits(val: u8) -> Timev {
unsafe { core::mem::transmute(val & 0x01) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Timev {
#[inline(always)]
fn from(val: u8) -> Timev {
Timev::from_bits(val)
}
}
impl From<Timev> for u8 {
#[inline(always)]
fn from(val: Timev) -> u8 {
Timev::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Timevsel {
#[doc = "Minute change"]
MINUTE = 0x0,
#[doc = "Hour change"]
HOUR = 0x01,
#[doc = "Every day at midnight"]
MIDNIGHT = 0x02,
#[doc = "Every day at noon"]
NOON = 0x03,
}
impl Timevsel {
#[inline(always)]
pub const fn from_bits(val: u8) -> Timevsel {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Timevsel {
#[inline(always)]
fn from(val: u8) -> Timevsel {
Timevsel::from_bits(val)
}
}
impl From<Timevsel> for u8 {
#[inline(always)]
fn from(val: Timevsel) -> u8 {
Timevsel::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Wpkey(u32);
impl Wpkey {
#[doc = "Writing any other value in this field aborts the write operation of the WPEN bit.Always reads as 0."]
pub const PASSWD: Self = Self(0x0052_5443);
}
impl Wpkey {
pub const fn from_bits(val: u32) -> Wpkey {
Self(val & 0x00ff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Wpkey {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0052_5443 => f.write_str("PASSWD"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wpkey {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0052_5443 => defmt::write!(f, "PASSWD"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Wpkey {
#[inline(always)]
fn from(val: u32) -> Wpkey {
Wpkey::from_bits(val)
}
}
impl From<Wpkey> for u32 {
#[inline(always)]
fn from(val: Wpkey) -> u32 {
Wpkey::to_bits(val)
}
}