#[doc = "Calendar Alarm Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Calalr(pub u32);
impl Calalr {
#[doc = "Month Alarm"]
#[must_use]
#[inline(always)]
pub const fn month(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x1f;
val as u8
}
#[doc = "Month Alarm"]
#[inline(always)]
pub const fn set_month(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 16usize)) | (((val as u32) & 0x1f) << 16usize);
}
#[doc = "Month Alarm Enable"]
#[must_use]
#[inline(always)]
pub const fn mthen(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "Month Alarm Enable"]
#[inline(always)]
pub const fn set_mthen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
#[doc = "Date Alarm"]
#[must_use]
#[inline(always)]
pub const fn date(&self) -> u8 {
let val = (self.0 >> 24usize) & 0x3f;
val as u8
}
#[doc = "Date Alarm"]
#[inline(always)]
pub const fn set_date(&mut self, val: u8) {
self.0 = (self.0 & !(0x3f << 24usize)) | (((val as u32) & 0x3f) << 24usize);
}
#[doc = "Date Alarm Enable"]
#[must_use]
#[inline(always)]
pub const fn dateen(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "Date Alarm Enable"]
#[inline(always)]
pub const fn set_dateen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for Calalr {
#[inline(always)]
fn default() -> Calalr {
Calalr(0)
}
}
impl core::fmt::Debug for Calalr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Calalr")
.field("month", &self.month())
.field("mthen", &self.mthen())
.field("date", &self.date())
.field("dateen", &self.dateen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Calalr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Calalr {{ month: {=u8:?}, mthen: {=bool:?}, date: {=u8:?}, dateen: {=bool:?} }}",
self.month(),
self.mthen(),
self.date(),
self.dateen()
)
}
}
#[doc = "Calendar Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Calr(pub u32);
impl Calr {
#[doc = "Current Century"]
#[must_use]
#[inline(always)]
pub const fn cent(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Current Century"]
#[inline(always)]
pub const fn set_cent(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
#[doc = "Current Year"]
#[must_use]
#[inline(always)]
pub const fn year(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Current Year"]
#[inline(always)]
pub const fn set_year(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Current Month"]
#[must_use]
#[inline(always)]
pub const fn month(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x1f;
val as u8
}
#[doc = "Current Month"]
#[inline(always)]
pub const fn set_month(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 16usize)) | (((val as u32) & 0x1f) << 16usize);
}
#[doc = "Current Day in Current Week"]
#[must_use]
#[inline(always)]
pub const fn day(&self) -> u8 {
let val = (self.0 >> 21usize) & 0x07;
val as u8
}
#[doc = "Current Day in Current Week"]
#[inline(always)]
pub const fn set_day(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 21usize)) | (((val as u32) & 0x07) << 21usize);
}
#[doc = "Current Day in Current Month"]
#[must_use]
#[inline(always)]
pub const fn date(&self) -> u8 {
let val = (self.0 >> 24usize) & 0x3f;
val as u8
}
#[doc = "Current Day in Current Month"]
#[inline(always)]
pub const fn set_date(&mut self, val: u8) {
self.0 = (self.0 & !(0x3f << 24usize)) | (((val as u32) & 0x3f) << 24usize);
}
}
impl Default for Calr {
#[inline(always)]
fn default() -> Calr {
Calr(0)
}
}
impl core::fmt::Debug for Calr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Calr")
.field("cent", &self.cent())
.field("year", &self.year())
.field("month", &self.month())
.field("day", &self.day())
.field("date", &self.date())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Calr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Calr {{ cent: {=u8:?}, year: {=u8:?}, month: {=u8:?}, day: {=u8:?}, date: {=u8:?} }}",
self.cent(),
self.year(),
self.month(),
self.day(),
self.date()
)
}
}
#[doc = "Control Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr(pub u32);
impl Cr {
#[doc = "Update Request Time Register"]
#[must_use]
#[inline(always)]
pub const fn updtim(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Update Request Time Register"]
#[inline(always)]
pub const fn set_updtim(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Update Request Calendar Register"]
#[must_use]
#[inline(always)]
pub const fn updcal(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Update Request Calendar Register"]
#[inline(always)]
pub const fn set_updcal(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Time Event Selection"]
#[must_use]
#[inline(always)]
pub const fn timevsel(&self) -> super::vals::Timevsel {
let val = (self.0 >> 8usize) & 0x03;
super::vals::Timevsel::from_bits(val as u8)
}
#[doc = "Time Event Selection"]
#[inline(always)]
pub const fn set_timevsel(&mut self, val: super::vals::Timevsel) {
self.0 = (self.0 & !(0x03 << 8usize)) | (((val.to_bits() as u32) & 0x03) << 8usize);
}
#[doc = "Calendar Event Selection"]
#[must_use]
#[inline(always)]
pub const fn calevsel(&self) -> super::vals::Calevsel {
let val = (self.0 >> 16usize) & 0x03;
super::vals::Calevsel::from_bits(val as u8)
}
#[doc = "Calendar Event Selection"]
#[inline(always)]
pub const fn set_calevsel(&mut self, val: super::vals::Calevsel) {
self.0 = (self.0 & !(0x03 << 16usize)) | (((val.to_bits() as u32) & 0x03) << 16usize);
}
}
impl Default for Cr {
#[inline(always)]
fn default() -> Cr {
Cr(0)
}
}
impl core::fmt::Debug for Cr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cr")
.field("updtim", &self.updtim())
.field("updcal", &self.updcal())
.field("timevsel", &self.timevsel())
.field("calevsel", &self.calevsel())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cr {{ updtim: {=bool:?}, updcal: {=bool:?}, timevsel: {:?}, calevsel: {:?} }}",
self.updtim(),
self.updcal(),
self.timevsel(),
self.calevsel()
)
}
}
#[doc = "Interrupt Disable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Idr(pub u32);
impl Idr {
#[doc = "Acknowledge Update Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn ackdis(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Acknowledge Update Interrupt Disable"]
#[inline(always)]
pub const fn set_ackdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Alarm Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn alrdis(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Alarm Interrupt Disable"]
#[inline(always)]
pub const fn set_alrdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Second Event Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn secdis(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Second Event Interrupt Disable"]
#[inline(always)]
pub const fn set_secdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Time Event Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn timdis(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Time Event Interrupt Disable"]
#[inline(always)]
pub const fn set_timdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Calendar Event Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn caldis(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Calendar Event Interrupt Disable"]
#[inline(always)]
pub const fn set_caldis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Idr {
#[inline(always)]
fn default() -> Idr {
Idr(0)
}
}
impl core::fmt::Debug for Idr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Idr")
.field("ackdis", &self.ackdis())
.field("alrdis", &self.alrdis())
.field("secdis", &self.secdis())
.field("timdis", &self.timdis())
.field("caldis", &self.caldis())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Idr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Idr {{ ackdis: {=bool:?}, alrdis: {=bool:?}, secdis: {=bool:?}, timdis: {=bool:?}, caldis: {=bool:?} }}",
self.ackdis(),
self.alrdis(),
self.secdis(),
self.timdis(),
self.caldis()
)
}
}
#[doc = "Interrupt Enable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ier(pub u32);
impl Ier {
#[doc = "Acknowledge Update Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn acken(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Acknowledge Update Interrupt Enable"]
#[inline(always)]
pub const fn set_acken(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Alarm Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn alren(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Alarm Interrupt Enable"]
#[inline(always)]
pub const fn set_alren(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Second Event Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn secen(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Second Event Interrupt Enable"]
#[inline(always)]
pub const fn set_secen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Time Event Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn timen(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Time Event Interrupt Enable"]
#[inline(always)]
pub const fn set_timen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Calendar Event Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn calen(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Calendar Event Interrupt Enable"]
#[inline(always)]
pub const fn set_calen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Ier {
#[inline(always)]
fn default() -> Ier {
Ier(0)
}
}
impl core::fmt::Debug for Ier {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ier")
.field("acken", &self.acken())
.field("alren", &self.alren())
.field("secen", &self.secen())
.field("timen", &self.timen())
.field("calen", &self.calen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ier {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Ier {{ acken: {=bool:?}, alren: {=bool:?}, secen: {=bool:?}, timen: {=bool:?}, calen: {=bool:?} }}",
self.acken(),
self.alren(),
self.secen(),
self.timen(),
self.calen()
)
}
}
#[doc = "Interrupt Mask Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Imr(pub u32);
impl Imr {
#[doc = "Acknowledge Update Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn ack(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Acknowledge Update Interrupt Mask"]
#[inline(always)]
pub const fn set_ack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Alarm Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn alr(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Alarm Interrupt Mask"]
#[inline(always)]
pub const fn set_alr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Second Event Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn sec(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Second Event Interrupt Mask"]
#[inline(always)]
pub const fn set_sec(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Time Event Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn tim(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Time Event Interrupt Mask"]
#[inline(always)]
pub const fn set_tim(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Calendar Event Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn cal(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Calendar Event Interrupt Mask"]
#[inline(always)]
pub const fn set_cal(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Imr {
#[inline(always)]
fn default() -> Imr {
Imr(0)
}
}
impl core::fmt::Debug for Imr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Imr")
.field("ack", &self.ack())
.field("alr", &self.alr())
.field("sec", &self.sec())
.field("tim", &self.tim())
.field("cal", &self.cal())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Imr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Imr {{ ack: {=bool:?}, alr: {=bool:?}, sec: {=bool:?}, tim: {=bool:?}, cal: {=bool:?} }}",
self.ack(),
self.alr(),
self.sec(),
self.tim(),
self.cal()
)
}
}
#[doc = "Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mr(pub u32);
impl Mr {
#[doc = "12-/24-hour Mode"]
#[must_use]
#[inline(always)]
pub const fn hrmod(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "12-/24-hour Mode"]
#[inline(always)]
pub const fn set_hrmod(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
}
impl Default for Mr {
#[inline(always)]
fn default() -> Mr {
Mr(0)
}
}
impl core::fmt::Debug for Mr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mr").field("hrmod", &self.hrmod()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Mr {{ hrmod: {=bool:?} }}", self.hrmod())
}
}
#[doc = "Status Clear Command Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Sccr(pub u32);
impl Sccr {
#[doc = "Acknowledge Clear"]
#[must_use]
#[inline(always)]
pub const fn ackclr(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Acknowledge Clear"]
#[inline(always)]
pub const fn set_ackclr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Alarm Clear"]
#[must_use]
#[inline(always)]
pub const fn alrclr(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Alarm Clear"]
#[inline(always)]
pub const fn set_alrclr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Second Clear"]
#[must_use]
#[inline(always)]
pub const fn secclr(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Second Clear"]
#[inline(always)]
pub const fn set_secclr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Time Clear"]
#[must_use]
#[inline(always)]
pub const fn timclr(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Time Clear"]
#[inline(always)]
pub const fn set_timclr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Calendar Clear"]
#[must_use]
#[inline(always)]
pub const fn calclr(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Calendar Clear"]
#[inline(always)]
pub const fn set_calclr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Sccr {
#[inline(always)]
fn default() -> Sccr {
Sccr(0)
}
}
impl core::fmt::Debug for Sccr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Sccr")
.field("ackclr", &self.ackclr())
.field("alrclr", &self.alrclr())
.field("secclr", &self.secclr())
.field("timclr", &self.timclr())
.field("calclr", &self.calclr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Sccr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Sccr {{ ackclr: {=bool:?}, alrclr: {=bool:?}, secclr: {=bool:?}, timclr: {=bool:?}, calclr: {=bool:?} }}",
self.ackclr(),
self.alrclr(),
self.secclr(),
self.timclr(),
self.calclr()
)
}
}
#[doc = "Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Sr(pub u32);
impl Sr {
#[doc = "Acknowledge for Update"]
#[must_use]
#[inline(always)]
pub const fn ackupd(&self) -> super::vals::Ackupd {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Ackupd::from_bits(val as u8)
}
#[doc = "Acknowledge for Update"]
#[inline(always)]
pub const fn set_ackupd(&mut self, val: super::vals::Ackupd) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Alarm Flag"]
#[must_use]
#[inline(always)]
pub const fn alarm(&self) -> super::vals::Alarm {
let val = (self.0 >> 1usize) & 0x01;
super::vals::Alarm::from_bits(val as u8)
}
#[doc = "Alarm Flag"]
#[inline(always)]
pub const fn set_alarm(&mut self, val: super::vals::Alarm) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val.to_bits() as u32) & 0x01) << 1usize);
}
#[doc = "Second Event"]
#[must_use]
#[inline(always)]
pub const fn sec(&self) -> super::vals::Sec {
let val = (self.0 >> 2usize) & 0x01;
super::vals::Sec::from_bits(val as u8)
}
#[doc = "Second Event"]
#[inline(always)]
pub const fn set_sec(&mut self, val: super::vals::Sec) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
}
#[doc = "Time Event"]
#[must_use]
#[inline(always)]
pub const fn timev(&self) -> super::vals::Timev {
let val = (self.0 >> 3usize) & 0x01;
super::vals::Timev::from_bits(val as u8)
}
#[doc = "Time Event"]
#[inline(always)]
pub const fn set_timev(&mut self, val: super::vals::Timev) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
}
#[doc = "Calendar Event"]
#[must_use]
#[inline(always)]
pub const fn calev(&self) -> super::vals::Calev {
let val = (self.0 >> 4usize) & 0x01;
super::vals::Calev::from_bits(val as u8)
}
#[doc = "Calendar Event"]
#[inline(always)]
pub const fn set_calev(&mut self, val: super::vals::Calev) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
}
}
impl Default for Sr {
#[inline(always)]
fn default() -> Sr {
Sr(0)
}
}
impl core::fmt::Debug for Sr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Sr")
.field("ackupd", &self.ackupd())
.field("alarm", &self.alarm())
.field("sec", &self.sec())
.field("timev", &self.timev())
.field("calev", &self.calev())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Sr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Sr {{ ackupd: {:?}, alarm: {:?}, sec: {:?}, timev: {:?}, calev: {:?} }}",
self.ackupd(),
self.alarm(),
self.sec(),
self.timev(),
self.calev()
)
}
}
#[doc = "Time Alarm Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Timalr(pub u32);
impl Timalr {
#[doc = "Second Alarm"]
#[must_use]
#[inline(always)]
pub const fn sec(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Second Alarm"]
#[inline(always)]
pub const fn set_sec(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
#[doc = "Second Alarm Enable"]
#[must_use]
#[inline(always)]
pub const fn secen(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Second Alarm Enable"]
#[inline(always)]
pub const fn set_secen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Minute Alarm"]
#[must_use]
#[inline(always)]
pub const fn min(&self) -> u8 {
let val = (self.0 >> 8usize) & 0x7f;
val as u8
}
#[doc = "Minute Alarm"]
#[inline(always)]
pub const fn set_min(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 8usize)) | (((val as u32) & 0x7f) << 8usize);
}
#[doc = "Minute Alarm Enable"]
#[must_use]
#[inline(always)]
pub const fn minen(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Minute Alarm Enable"]
#[inline(always)]
pub const fn set_minen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "Hour Alarm"]
#[must_use]
#[inline(always)]
pub const fn hour(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x3f;
val as u8
}
#[doc = "Hour Alarm"]
#[inline(always)]
pub const fn set_hour(&mut self, val: u8) {
self.0 = (self.0 & !(0x3f << 16usize)) | (((val as u32) & 0x3f) << 16usize);
}
#[doc = "AM/PM Indicator"]
#[must_use]
#[inline(always)]
pub const fn ampm(&self) -> bool {
let val = (self.0 >> 22usize) & 0x01;
val != 0
}
#[doc = "AM/PM Indicator"]
#[inline(always)]
pub const fn set_ampm(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
}
#[doc = "Hour Alarm Enable"]
#[must_use]
#[inline(always)]
pub const fn houren(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "Hour Alarm Enable"]
#[inline(always)]
pub const fn set_houren(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
}
impl Default for Timalr {
#[inline(always)]
fn default() -> Timalr {
Timalr(0)
}
}
impl core::fmt::Debug for Timalr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Timalr")
.field("sec", &self.sec())
.field("secen", &self.secen())
.field("min", &self.min())
.field("minen", &self.minen())
.field("hour", &self.hour())
.field("ampm", &self.ampm())
.field("houren", &self.houren())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Timalr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Timalr {{ sec: {=u8:?}, secen: {=bool:?}, min: {=u8:?}, minen: {=bool:?}, hour: {=u8:?}, ampm: {=bool:?}, houren: {=bool:?} }}",
self.sec(),
self.secen(),
self.min(),
self.minen(),
self.hour(),
self.ampm(),
self.houren()
)
}
}
#[doc = "Time Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Timr(pub u32);
impl Timr {
#[doc = "Current Second"]
#[must_use]
#[inline(always)]
pub const fn sec(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x7f;
val as u8
}
#[doc = "Current Second"]
#[inline(always)]
pub const fn set_sec(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 0usize)) | (((val as u32) & 0x7f) << 0usize);
}
#[doc = "Current Minute"]
#[must_use]
#[inline(always)]
pub const fn min(&self) -> u8 {
let val = (self.0 >> 8usize) & 0x7f;
val as u8
}
#[doc = "Current Minute"]
#[inline(always)]
pub const fn set_min(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 8usize)) | (((val as u32) & 0x7f) << 8usize);
}
#[doc = "Current Hour"]
#[must_use]
#[inline(always)]
pub const fn hour(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x3f;
val as u8
}
#[doc = "Current Hour"]
#[inline(always)]
pub const fn set_hour(&mut self, val: u8) {
self.0 = (self.0 & !(0x3f << 16usize)) | (((val as u32) & 0x3f) << 16usize);
}
#[doc = "Ante Meridiem Post Meridiem Indicator"]
#[must_use]
#[inline(always)]
pub const fn ampm(&self) -> bool {
let val = (self.0 >> 22usize) & 0x01;
val != 0
}
#[doc = "Ante Meridiem Post Meridiem Indicator"]
#[inline(always)]
pub const fn set_ampm(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
}
}
impl Default for Timr {
#[inline(always)]
fn default() -> Timr {
Timr(0)
}
}
impl core::fmt::Debug for Timr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Timr")
.field("sec", &self.sec())
.field("min", &self.min())
.field("hour", &self.hour())
.field("ampm", &self.ampm())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Timr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Timr {{ sec: {=u8:?}, min: {=u8:?}, hour: {=u8:?}, ampm: {=bool:?} }}",
self.sec(),
self.min(),
self.hour(),
self.ampm()
)
}
}
#[doc = "Valid Entry Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ver(pub u32);
impl Ver {
#[doc = "Non-valid Time"]
#[must_use]
#[inline(always)]
pub const fn nvtim(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Non-valid Time"]
#[inline(always)]
pub const fn set_nvtim(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Non-valid Calendar"]
#[must_use]
#[inline(always)]
pub const fn nvcal(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Non-valid Calendar"]
#[inline(always)]
pub const fn set_nvcal(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Non-valid Time Alarm"]
#[must_use]
#[inline(always)]
pub const fn nvtimalr(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Non-valid Time Alarm"]
#[inline(always)]
pub const fn set_nvtimalr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Non-valid Calendar Alarm"]
#[must_use]
#[inline(always)]
pub const fn nvcalalr(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Non-valid Calendar Alarm"]
#[inline(always)]
pub const fn set_nvcalalr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Ver {
#[inline(always)]
fn default() -> Ver {
Ver(0)
}
}
impl core::fmt::Debug for Ver {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ver")
.field("nvtim", &self.nvtim())
.field("nvcal", &self.nvcal())
.field("nvtimalr", &self.nvtimalr())
.field("nvcalalr", &self.nvcalalr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ver {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Ver {{ nvtim: {=bool:?}, nvcal: {=bool:?}, nvtimalr: {=bool:?}, nvcalalr: {=bool:?} }}",
self.nvtim(),
self.nvcal(),
self.nvtimalr(),
self.nvcalalr()
)
}
}
#[doc = "Write Protect Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wpmr(pub u32);
impl Wpmr {
#[doc = "Write Protect Enable"]
#[must_use]
#[inline(always)]
pub const fn wpen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write Protect Enable"]
#[inline(always)]
pub const fn set_wpen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Write Protect KEY"]
#[must_use]
#[inline(always)]
pub const fn wpkey(&self) -> super::vals::Wpkey {
let val = (self.0 >> 8usize) & 0x00ff_ffff;
super::vals::Wpkey::from_bits(val as u32)
}
#[doc = "Write Protect KEY"]
#[inline(always)]
pub const fn set_wpkey(&mut self, val: super::vals::Wpkey) {
self.0 = (self.0 & !(0x00ff_ffff << 8usize))
| (((val.to_bits() as u32) & 0x00ff_ffff) << 8usize);
}
}
impl Default for Wpmr {
#[inline(always)]
fn default() -> Wpmr {
Wpmr(0)
}
}
impl core::fmt::Debug for Wpmr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Wpmr")
.field("wpen", &self.wpen())
.field("wpkey", &self.wpkey())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wpmr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Wpmr {{ wpen: {=bool:?}, wpkey: {:?} }}",
self.wpen(),
self.wpkey()
)
}
}