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)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CED {
Enabled = 0,
Disabled = 1,
}
impl From<CED> for bool {
#[inline(always)]
fn from(variant: CED) -> Self {
variant as u8 != 0
}
}
pub type CED_R = crate::BitReader<CED>;
impl CED_R {
#[inline(always)]
pub const fn variant(&self) -> CED {
match self.bits {
false => CED::Enabled,
true => CED::Disabled,
}
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CED::Enabled
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CED::Disabled
}
}
pub type CED_W<'a, REG> = crate::BitWriter<'a, REG, CED>;
impl<'a, REG> CED_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CED::Enabled)
}
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CED::Disabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RNG_CONFIG3 {
ConfigB = 0,
ConfigA = 13,
}
impl From<RNG_CONFIG3> for u8 {
#[inline(always)]
fn from(variant: RNG_CONFIG3) -> Self {
variant as _
}
}
impl crate::FieldSpec for RNG_CONFIG3 {
type Ux = u8;
}
impl crate::IsEnum for RNG_CONFIG3 {}
pub type RNG_CONFIG3_R = crate::FieldReader<RNG_CONFIG3>;
impl RNG_CONFIG3_R {
#[inline(always)]
pub const fn variant(&self) -> Option<RNG_CONFIG3> {
match self.bits {
0 => Some(RNG_CONFIG3::ConfigB),
13 => Some(RNG_CONFIG3::ConfigA),
_ => None,
}
}
#[inline(always)]
pub fn is_config_b(&self) -> bool {
*self == RNG_CONFIG3::ConfigB
}
#[inline(always)]
pub fn is_config_a(&self) -> bool {
*self == RNG_CONFIG3::ConfigA
}
}
pub type RNG_CONFIG3_W<'a, REG> = crate::FieldWriter<'a, REG, 4, RNG_CONFIG3>;
impl<'a, REG> RNG_CONFIG3_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn config_b(self) -> &'a mut crate::W<REG> {
self.variant(RNG_CONFIG3::ConfigB)
}
#[inline(always)]
pub fn config_a(self) -> &'a mut crate::W<REG> {
self.variant(RNG_CONFIG3::ConfigA)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NISTC {
Default = 0,
Custom = 1,
}
impl From<NISTC> for bool {
#[inline(always)]
fn from(variant: NISTC) -> Self {
variant as u8 != 0
}
}
pub type NISTC_R = crate::BitReader<NISTC>;
impl NISTC_R {
#[inline(always)]
pub const fn variant(&self) -> NISTC {
match self.bits {
false => NISTC::Default,
true => NISTC::Custom,
}
}
#[inline(always)]
pub fn is_default(&self) -> bool {
*self == NISTC::Default
}
#[inline(always)]
pub fn is_custom(&self) -> bool {
*self == NISTC::Custom
}
}
pub type NISTC_W<'a, REG> = crate::BitWriter<'a, REG, NISTC>;
impl<'a, REG> NISTC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn default(self) -> &'a mut crate::W<REG> {
self.variant(NISTC::Default)
}
#[inline(always)]
pub fn custom(self) -> &'a mut crate::W<REG> {
self.variant(NISTC::Custom)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RNG_CONFIG2 {
ConfigAB = 0,
}
impl From<RNG_CONFIG2> for u8 {
#[inline(always)]
fn from(variant: RNG_CONFIG2) -> Self {
variant as _
}
}
impl crate::FieldSpec for RNG_CONFIG2 {
type Ux = u8;
}
impl crate::IsEnum for RNG_CONFIG2 {}
pub type RNG_CONFIG2_R = crate::FieldReader<RNG_CONFIG2>;
impl RNG_CONFIG2_R {
#[inline(always)]
pub const fn variant(&self) -> Option<RNG_CONFIG2> {
match self.bits {
0 => Some(RNG_CONFIG2::ConfigAB),
_ => None,
}
}
#[inline(always)]
pub fn is_config_a_b(&self) -> bool {
*self == RNG_CONFIG2::ConfigAB
}
}
pub type RNG_CONFIG2_W<'a, REG> = crate::FieldWriter<'a, REG, 3, RNG_CONFIG2>;
impl<'a, REG> RNG_CONFIG2_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn config_a_b(self) -> &'a mut crate::W<REG> {
self.variant(RNG_CONFIG2::ConfigAB)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CLKDIV {
Div1 = 0,
Div2 = 1,
Div4 = 2,
Div8 = 3,
Div16 = 4,
Div32 = 5,
Div64 = 6,
Div128 = 7,
Div256 = 8,
Div512 = 9,
Div1024 = 10,
Div2048 = 11,
Div4096 = 12,
Div8192 = 13,
Div16384 = 14,
Div32768 = 15,
}
impl From<CLKDIV> for u8 {
#[inline(always)]
fn from(variant: CLKDIV) -> Self {
variant as _
}
}
impl crate::FieldSpec for CLKDIV {
type Ux = u8;
}
impl crate::IsEnum for CLKDIV {}
pub type CLKDIV_R = crate::FieldReader<CLKDIV>;
impl CLKDIV_R {
#[inline(always)]
pub const fn variant(&self) -> CLKDIV {
match self.bits {
0 => CLKDIV::Div1,
1 => CLKDIV::Div2,
2 => CLKDIV::Div4,
3 => CLKDIV::Div8,
4 => CLKDIV::Div16,
5 => CLKDIV::Div32,
6 => CLKDIV::Div64,
7 => CLKDIV::Div128,
8 => CLKDIV::Div256,
9 => CLKDIV::Div512,
10 => CLKDIV::Div1024,
11 => CLKDIV::Div2048,
12 => CLKDIV::Div4096,
13 => CLKDIV::Div8192,
14 => CLKDIV::Div16384,
15 => CLKDIV::Div32768,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == CLKDIV::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == CLKDIV::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == CLKDIV::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == CLKDIV::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == CLKDIV::Div16
}
#[inline(always)]
pub fn is_div32(&self) -> bool {
*self == CLKDIV::Div32
}
#[inline(always)]
pub fn is_div64(&self) -> bool {
*self == CLKDIV::Div64
}
#[inline(always)]
pub fn is_div128(&self) -> bool {
*self == CLKDIV::Div128
}
#[inline(always)]
pub fn is_div256(&self) -> bool {
*self == CLKDIV::Div256
}
#[inline(always)]
pub fn is_div512(&self) -> bool {
*self == CLKDIV::Div512
}
#[inline(always)]
pub fn is_div1024(&self) -> bool {
*self == CLKDIV::Div1024
}
#[inline(always)]
pub fn is_div2048(&self) -> bool {
*self == CLKDIV::Div2048
}
#[inline(always)]
pub fn is_div4096(&self) -> bool {
*self == CLKDIV::Div4096
}
#[inline(always)]
pub fn is_div8192(&self) -> bool {
*self == CLKDIV::Div8192
}
#[inline(always)]
pub fn is_div16384(&self) -> bool {
*self == CLKDIV::Div16384
}
#[inline(always)]
pub fn is_div32768(&self) -> bool {
*self == CLKDIV::Div32768
}
}
pub type CLKDIV_W<'a, REG> = crate::FieldWriter<'a, REG, 4, CLKDIV, crate::Safe>;
impl<'a, REG> CLKDIV_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div16)
}
#[inline(always)]
pub fn div32(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div32)
}
#[inline(always)]
pub fn div64(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div64)
}
#[inline(always)]
pub fn div128(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div128)
}
#[inline(always)]
pub fn div256(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div256)
}
#[inline(always)]
pub fn div512(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div512)
}
#[inline(always)]
pub fn div1024(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div1024)
}
#[inline(always)]
pub fn div2048(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div2048)
}
#[inline(always)]
pub fn div4096(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div4096)
}
#[inline(always)]
pub fn div8192(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div8192)
}
#[inline(always)]
pub fn div16384(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div16384)
}
#[inline(always)]
pub fn div32768(self) -> &'a mut crate::W<REG> {
self.variant(CLKDIV::Div32768)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RNG_CONFIG1 {
ConfigA = 15,
ConfigB = 24,
}
impl From<RNG_CONFIG1> for u8 {
#[inline(always)]
fn from(variant: RNG_CONFIG1) -> Self {
variant as _
}
}
impl crate::FieldSpec for RNG_CONFIG1 {
type Ux = u8;
}
impl crate::IsEnum for RNG_CONFIG1 {}
pub type RNG_CONFIG1_R = crate::FieldReader<RNG_CONFIG1>;
impl RNG_CONFIG1_R {
#[inline(always)]
pub const fn variant(&self) -> Option<RNG_CONFIG1> {
match self.bits {
15 => Some(RNG_CONFIG1::ConfigA),
24 => Some(RNG_CONFIG1::ConfigB),
_ => None,
}
}
#[inline(always)]
pub fn is_config_a(&self) -> bool {
*self == RNG_CONFIG1::ConfigA
}
#[inline(always)]
pub fn is_config_b(&self) -> bool {
*self == RNG_CONFIG1::ConfigB
}
}
pub type RNG_CONFIG1_W<'a, REG> = crate::FieldWriter<'a, REG, 6, RNG_CONFIG1>;
impl<'a, REG> RNG_CONFIG1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn config_a(self) -> &'a mut crate::W<REG> {
self.variant(RNG_CONFIG1::ConfigA)
}
#[inline(always)]
pub fn config_b(self) -> &'a mut crate::W<REG> {
self.variant(RNG_CONFIG1::ConfigB)
}
}
pub type CONDRST_R = crate::BitReader;
pub type CONDRST_W<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CONFIGLOCK {
Enabled = 0,
Disabled = 1,
}
impl From<CONFIGLOCK> for bool {
#[inline(always)]
fn from(variant: CONFIGLOCK) -> Self {
variant as u8 != 0
}
}
pub type CONFIGLOCK_R = crate::BitReader<CONFIGLOCK>;
impl CONFIGLOCK_R {
#[inline(always)]
pub const fn variant(&self) -> CONFIGLOCK {
match self.bits {
false => CONFIGLOCK::Enabled,
true => CONFIGLOCK::Disabled,
}
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CONFIGLOCK::Enabled
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CONFIGLOCK::Disabled
}
}
pub type CONFIGLOCK_W<'a, REG> = crate::BitWriter<'a, REG, CONFIGLOCK>;
impl<'a, REG> CONFIGLOCK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CONFIGLOCK::Enabled)
}
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CONFIGLOCK::Disabled)
}
}
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)
}
#[inline(always)]
pub fn ced(&self) -> CED_R {
CED_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn rng_config3(&self) -> RNG_CONFIG3_R {
RNG_CONFIG3_R::new(((self.bits >> 8) & 0x0f) as u8)
}
#[inline(always)]
pub fn nistc(&self) -> NISTC_R {
NISTC_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn rng_config2(&self) -> RNG_CONFIG2_R {
RNG_CONFIG2_R::new(((self.bits >> 13) & 7) as u8)
}
#[inline(always)]
pub fn clkdiv(&self) -> CLKDIV_R {
CLKDIV_R::new(((self.bits >> 16) & 0x0f) as u8)
}
#[inline(always)]
pub fn rng_config1(&self) -> RNG_CONFIG1_R {
RNG_CONFIG1_R::new(((self.bits >> 20) & 0x3f) as u8)
}
#[inline(always)]
pub fn condrst(&self) -> CONDRST_R {
CONDRST_R::new(((self.bits >> 30) & 1) != 0)
}
#[inline(always)]
pub fn configlock(&self) -> CONFIGLOCK_R {
CONFIGLOCK_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("CR")
.field("rngen", &self.rngen())
.field("ie", &self.ie())
.field("ced", &self.ced())
.field("configlock", &self.configlock())
.field("condrst", &self.condrst())
.field("rng_config1", &self.rng_config1())
.field("clkdiv", &self.clkdiv())
.field("rng_config2", &self.rng_config2())
.field("nistc", &self.nistc())
.field("rng_config3", &self.rng_config3())
.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)
}
#[inline(always)]
pub fn ced(&mut self) -> CED_W<CRrs> {
CED_W::new(self, 5)
}
#[inline(always)]
pub fn rng_config3(&mut self) -> RNG_CONFIG3_W<CRrs> {
RNG_CONFIG3_W::new(self, 8)
}
#[inline(always)]
pub fn nistc(&mut self) -> NISTC_W<CRrs> {
NISTC_W::new(self, 12)
}
#[inline(always)]
pub fn rng_config2(&mut self) -> RNG_CONFIG2_W<CRrs> {
RNG_CONFIG2_W::new(self, 13)
}
#[inline(always)]
pub fn clkdiv(&mut self) -> CLKDIV_W<CRrs> {
CLKDIV_W::new(self, 16)
}
#[inline(always)]
pub fn rng_config1(&mut self) -> RNG_CONFIG1_W<CRrs> {
RNG_CONFIG1_W::new(self, 20)
}
#[inline(always)]
pub fn condrst(&mut self) -> CONDRST_W<CRrs> {
CONDRST_W::new(self, 30)
}
#[inline(always)]
pub fn configlock(&mut self) -> CONFIGLOCK_W<CRrs> {
CONFIGLOCK_W::new(self, 31)
}
}
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 {}