pub type R = crate::R<Rrs>;
pub type W = crate::W<Rrs>;
pub type PROCID_R = crate::FieldReader;
pub type PROCID_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
pub type MASTERID_R = crate::FieldReader;
pub type MASTERID_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LOCKR {
Free = 0,
Locked = 1,
}
impl From<LOCKR> for bool {
#[inline(always)]
fn from(variant: LOCKR) -> Self {
variant as u8 != 0
}
}
pub type LOCK_R = crate::BitReader<LOCKR>;
impl LOCK_R {
#[inline(always)]
pub const fn variant(&self) -> LOCKR {
match self.bits {
false => LOCKR::Free,
true => LOCKR::Locked,
}
}
#[inline(always)]
pub fn is_free(&self) -> bool {
*self == LOCKR::Free
}
#[inline(always)]
pub fn is_locked(&self) -> bool {
*self == LOCKR::Locked
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LOCKW {
Free = 0,
TryLock = 1,
}
impl From<LOCKW> for bool {
#[inline(always)]
fn from(variant: LOCKW) -> Self {
variant as u8 != 0
}
}
pub type LOCK_W<'a, REG> = crate::BitWriter<'a, REG, LOCKW>;
impl<'a, REG> LOCK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn free(self) -> &'a mut crate::W<REG> {
self.variant(LOCKW::Free)
}
#[inline(always)]
pub fn try_lock(self) -> &'a mut crate::W<REG> {
self.variant(LOCKW::TryLock)
}
}
impl R {
#[inline(always)]
pub fn procid(&self) -> PROCID_R {
PROCID_R::new((self.bits & 0xff) as u8)
}
#[inline(always)]
pub fn masterid(&self) -> MASTERID_R {
MASTERID_R::new(((self.bits >> 8) & 0xff) as u8)
}
#[inline(always)]
pub fn lock(&self) -> LOCK_R {
LOCK_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("R")
.field("procid", &self.procid())
.field("masterid", &self.masterid())
.field("lock", &self.lock())
.finish()
}
}
impl W {
#[inline(always)]
pub fn procid(&mut self) -> PROCID_W<Rrs> {
PROCID_W::new(self, 0)
}
#[inline(always)]
pub fn masterid(&mut self) -> MASTERID_W<Rrs> {
MASTERID_W::new(self, 8)
}
#[inline(always)]
pub fn lock(&mut self) -> LOCK_W<Rrs> {
LOCK_W::new(self, 31)
}
}
pub struct Rrs;
impl crate::RegisterSpec for Rrs {
type Ux = u32;
}
impl crate::Readable for Rrs {}
impl crate::Writable for Rrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for Rrs {}