pub type R = crate::R<LOCKrs>;
pub type W = crate::W<LOCKrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u16)]
pub enum TIMERLOCKKEY {
Unlocked = 0,
Locked = 1,
}
impl From<TIMERLOCKKEY> for u16 {
#[inline(always)]
fn from(variant: TIMERLOCKKEY) -> Self {
variant as _
}
}
impl crate::FieldSpec for TIMERLOCKKEY {
type Ux = u16;
}
impl crate::IsEnum for TIMERLOCKKEY {}
pub type TimerlockkeyR = crate::FieldReader<TIMERLOCKKEY>;
impl TimerlockkeyR {
#[inline(always)]
pub const fn variant(&self) -> Option<TIMERLOCKKEY> {
match self.bits {
0 => Some(TIMERLOCKKEY::Unlocked),
1 => Some(TIMERLOCKKEY::Locked),
_ => None,
}
}
#[inline(always)]
pub fn is_unlocked(&self) -> bool {
*self == TIMERLOCKKEY::Unlocked
}
#[inline(always)]
pub fn is_locked(&self) -> bool {
*self == TIMERLOCKKEY::Locked
}
}
pub type TimerlockkeyW<'a, REG> = crate::FieldWriter<'a, REG, 16, TIMERLOCKKEY>;
impl<'a, REG> TimerlockkeyW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u16>,
{
#[inline(always)]
pub fn unlocked(self) -> &'a mut crate::W<REG> {
self.variant(TIMERLOCKKEY::Unlocked)
}
#[inline(always)]
pub fn locked(self) -> &'a mut crate::W<REG> {
self.variant(TIMERLOCKKEY::Locked)
}
}
impl R {
#[inline(always)]
pub fn timerlockkey(&self) -> TimerlockkeyR {
TimerlockkeyR::new((self.bits & 0xffff) as u16)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("LOCK")
.field("timerlockkey", &self.timerlockkey())
.finish()
}
}
impl W {
#[inline(always)]
pub fn timerlockkey(&mut self) -> TimerlockkeyW<'_, LOCKrs> {
TimerlockkeyW::new(self, 0)
}
}
pub struct LOCKrs;
impl crate::RegisterSpec for LOCKrs {
type Ux = u32;
}
impl crate::Readable for LOCKrs {}
impl crate::Writable for LOCKrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for LOCKrs {}