pub type R = crate::R<CRrs>;
pub type W = crate::W<CRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RNGEN {
Disabled = 0,
Enabled = 1,
}
impl From<RNGEN> for bool {
#[inline(always)]
fn from(variant: RNGEN) -> Self {
variant as u8 != 0
}
}
pub type RNGEN_R = crate::BitReader<RNGEN>;
impl RNGEN_R {
#[inline(always)]
pub const fn variant(&self) -> RNGEN {
match self.bits {
false => RNGEN::Disabled,
true => RNGEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == RNGEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == RNGEN::Enabled
}
}
pub type RNGEN_W<'a, REG> = crate::BitWriter<'a, REG, RNGEN>;
impl<'a, REG> RNGEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(RNGEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(RNGEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum IE {
Disabled = 0,
Enabled = 1,
}
impl From<IE> for bool {
#[inline(always)]
fn from(variant: IE) -> Self {
variant as u8 != 0
}
}
pub type IE_R = crate::BitReader<IE>;
impl IE_R {
#[inline(always)]
pub const fn variant(&self) -> IE {
match self.bits {
false => IE::Disabled,
true => IE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == IE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == IE::Enabled
}
}
pub type IE_W<'a, REG> = crate::BitWriter<'a, REG, IE>;
impl<'a, REG> IE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(IE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(IE::Enabled)
}
}
impl R {
#[inline(always)]
pub fn rngen(&self) -> RNGEN_R {
RNGEN_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn ie(&self) -> IE_R {
IE_R::new(((self.bits >> 3) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR")
.field("ie", &self.ie())
.field("rngen", &self.rngen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn rngen(&mut self) -> RNGEN_W<CRrs> {
RNGEN_W::new(self, 2)
}
#[inline(always)]
pub fn ie(&mut self) -> IE_W<CRrs> {
IE_W::new(self, 3)
}
}
pub struct CRrs;
impl crate::RegisterSpec for CRrs {
type Ux = u32;
}
impl crate::Readable for CRrs {}
impl crate::Writable for CRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CRrs {}