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 HSI16ON {
Disabled = 0,
Enabled = 1,
}
impl From<HSI16ON> for bool {
#[inline(always)]
fn from(variant: HSI16ON) -> Self {
variant as u8 != 0
}
}
pub type HSI16ON_R = crate::BitReader<HSI16ON>;
impl HSI16ON_R {
#[inline(always)]
pub const fn variant(&self) -> HSI16ON {
match self.bits {
false => HSI16ON::Disabled,
true => HSI16ON::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == HSI16ON::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == HSI16ON::Enabled
}
}
pub type HSI16ON_W<'a, REG> = crate::BitWriter<'a, REG, HSI16ON>;
impl<'a, REG> HSI16ON_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(HSI16ON::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(HSI16ON::Enabled)
}
}
pub use HSI16ON_R as HSI16KERON_R;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HSI16RDYFR {
NotReady = 0,
Ready = 1,
}
impl From<HSI16RDYFR> for bool {
#[inline(always)]
fn from(variant: HSI16RDYFR) -> Self {
variant as u8 != 0
}
}
pub type HSI16RDYF_R = crate::BitReader<HSI16RDYFR>;
impl HSI16RDYF_R {
#[inline(always)]
pub const fn variant(&self) -> HSI16RDYFR {
match self.bits {
false => HSI16RDYFR::NotReady,
true => HSI16RDYFR::Ready,
}
}
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == HSI16RDYFR::NotReady
}
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == HSI16RDYFR::Ready
}
}
pub type HSI16RDYF_W<'a, REG> = crate::BitWriter<'a, REG, HSI16RDYFR>;
impl<'a, REG> HSI16RDYF_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_ready(self) -> &'a mut crate::W<REG> {
self.variant(HSI16RDYFR::NotReady)
}
#[inline(always)]
pub fn ready(self) -> &'a mut crate::W<REG> {
self.variant(HSI16RDYFR::Ready)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HSI16DIVEN {
NotDivided = 0,
Div4 = 1,
}
impl From<HSI16DIVEN> for bool {
#[inline(always)]
fn from(variant: HSI16DIVEN) -> Self {
variant as u8 != 0
}
}
pub type HSI16DIVEN_R = crate::BitReader<HSI16DIVEN>;
impl HSI16DIVEN_R {
#[inline(always)]
pub const fn variant(&self) -> HSI16DIVEN {
match self.bits {
false => HSI16DIVEN::NotDivided,
true => HSI16DIVEN::Div4,
}
}
#[inline(always)]
pub fn is_not_divided(&self) -> bool {
*self == HSI16DIVEN::NotDivided
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == HSI16DIVEN::Div4
}
}
pub type HSI16DIVEN_W<'a, REG> = crate::BitWriter<'a, REG, HSI16DIVEN>;
impl<'a, REG> HSI16DIVEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_divided(self) -> &'a mut crate::W<REG> {
self.variant(HSI16DIVEN::NotDivided)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(HSI16DIVEN::Div4)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HSI16DIVFR {
NotDivided = 0,
Div4 = 1,
}
impl From<HSI16DIVFR> for bool {
#[inline(always)]
fn from(variant: HSI16DIVFR) -> Self {
variant as u8 != 0
}
}
pub type HSI16DIVF_R = crate::BitReader<HSI16DIVFR>;
impl HSI16DIVF_R {
#[inline(always)]
pub const fn variant(&self) -> HSI16DIVFR {
match self.bits {
false => HSI16DIVFR::NotDivided,
true => HSI16DIVFR::Div4,
}
}
#[inline(always)]
pub fn is_not_divided(&self) -> bool {
*self == HSI16DIVFR::NotDivided
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == HSI16DIVFR::Div4
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HSI16OUTEN {
Disabled = 0,
Enabled = 1,
}
impl From<HSI16OUTEN> for bool {
#[inline(always)]
fn from(variant: HSI16OUTEN) -> Self {
variant as u8 != 0
}
}
pub type HSI16OUTEN_R = crate::BitReader<HSI16OUTEN>;
impl HSI16OUTEN_R {
#[inline(always)]
pub const fn variant(&self) -> HSI16OUTEN {
match self.bits {
false => HSI16OUTEN::Disabled,
true => HSI16OUTEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == HSI16OUTEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == HSI16OUTEN::Enabled
}
}
pub type HSI16OUTEN_W<'a, REG> = crate::BitWriter<'a, REG, HSI16OUTEN>;
impl<'a, REG> HSI16OUTEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(HSI16OUTEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(HSI16OUTEN::Enabled)
}
}
pub use HSI16ON_R as MSION_R;
pub use HSI16ON_W as MSION_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MSIRDYR {
NotReady = 0,
Ready = 1,
}
impl From<MSIRDYR> for bool {
#[inline(always)]
fn from(variant: MSIRDYR) -> Self {
variant as u8 != 0
}
}
pub type MSIRDY_R = crate::BitReader<MSIRDYR>;
impl MSIRDY_R {
#[inline(always)]
pub const fn variant(&self) -> MSIRDYR {
match self.bits {
false => MSIRDYR::NotReady,
true => MSIRDYR::Ready,
}
}
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == MSIRDYR::NotReady
}
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == MSIRDYR::Ready
}
}
pub use HSI16ON_R as HSEON_R;
pub use HSI16ON_W as HSEON_W;
pub use MSIRDY_R as HSERDY_R;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HSEBYP {
NotBypassed = 0,
Bypassed = 1,
}
impl From<HSEBYP> for bool {
#[inline(always)]
fn from(variant: HSEBYP) -> Self {
variant as u8 != 0
}
}
pub type HSEBYP_R = crate::BitReader<HSEBYP>;
impl HSEBYP_R {
#[inline(always)]
pub const fn variant(&self) -> HSEBYP {
match self.bits {
false => HSEBYP::NotBypassed,
true => HSEBYP::Bypassed,
}
}
#[inline(always)]
pub fn is_not_bypassed(&self) -> bool {
*self == HSEBYP::NotBypassed
}
#[inline(always)]
pub fn is_bypassed(&self) -> bool {
*self == HSEBYP::Bypassed
}
}
pub type HSEBYP_W<'a, REG> = crate::BitWriter<'a, REG, HSEBYP>;
impl<'a, REG> HSEBYP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_bypassed(self) -> &'a mut crate::W<REG> {
self.variant(HSEBYP::NotBypassed)
}
#[inline(always)]
pub fn bypassed(self) -> &'a mut crate::W<REG> {
self.variant(HSEBYP::Bypassed)
}
}
pub use HSI16ON_R as CSSHSEON_R;
pub use HSI16ON_W as CSSHSEON_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RTCPRE {
Div2 = 0,
Div4 = 1,
Div8 = 2,
Div16 = 3,
}
impl From<RTCPRE> for u8 {
#[inline(always)]
fn from(variant: RTCPRE) -> Self {
variant as _
}
}
impl crate::FieldSpec for RTCPRE {
type Ux = u8;
}
impl crate::IsEnum for RTCPRE {}
pub type RTCPRE_R = crate::FieldReader<RTCPRE>;
impl RTCPRE_R {
#[inline(always)]
pub const fn variant(&self) -> RTCPRE {
match self.bits {
0 => RTCPRE::Div2,
1 => RTCPRE::Div4,
2 => RTCPRE::Div8,
3 => RTCPRE::Div16,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == RTCPRE::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == RTCPRE::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == RTCPRE::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == RTCPRE::Div16
}
}
pub type RTCPRE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, RTCPRE, crate::Safe>;
impl<'a, REG> RTCPRE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(RTCPRE::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(RTCPRE::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(RTCPRE::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(RTCPRE::Div16)
}
}
pub use HSI16ON_R as PLLON_R;
pub use HSI16ON_W as PLLON_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PLLRDYR {
Unlocked = 0,
Locked = 1,
}
impl From<PLLRDYR> for bool {
#[inline(always)]
fn from(variant: PLLRDYR) -> Self {
variant as u8 != 0
}
}
pub type PLLRDY_R = crate::BitReader<PLLRDYR>;
impl PLLRDY_R {
#[inline(always)]
pub const fn variant(&self) -> PLLRDYR {
match self.bits {
false => PLLRDYR::Unlocked,
true => PLLRDYR::Locked,
}
}
#[inline(always)]
pub fn is_unlocked(&self) -> bool {
*self == PLLRDYR::Unlocked
}
#[inline(always)]
pub fn is_locked(&self) -> bool {
*self == PLLRDYR::Locked
}
}
impl R {
#[inline(always)]
pub fn hsi16on(&self) -> HSI16ON_R {
HSI16ON_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn hsi16keron(&self) -> HSI16KERON_R {
HSI16KERON_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn hsi16rdyf(&self) -> HSI16RDYF_R {
HSI16RDYF_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn hsi16diven(&self) -> HSI16DIVEN_R {
HSI16DIVEN_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn hsi16divf(&self) -> HSI16DIVF_R {
HSI16DIVF_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn hsi16outen(&self) -> HSI16OUTEN_R {
HSI16OUTEN_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn msion(&self) -> MSION_R {
MSION_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn msirdy(&self) -> MSIRDY_R {
MSIRDY_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn hseon(&self) -> HSEON_R {
HSEON_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn hserdy(&self) -> HSERDY_R {
HSERDY_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn hsebyp(&self) -> HSEBYP_R {
HSEBYP_R::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn csshseon(&self) -> CSSHSEON_R {
CSSHSEON_R::new(((self.bits >> 19) & 1) != 0)
}
#[inline(always)]
pub fn rtcpre(&self) -> RTCPRE_R {
RTCPRE_R::new(((self.bits >> 20) & 3) as u8)
}
#[inline(always)]
pub fn pllon(&self) -> PLLON_R {
PLLON_R::new(((self.bits >> 24) & 1) != 0)
}
#[inline(always)]
pub fn pllrdy(&self) -> PLLRDY_R {
PLLRDY_R::new(((self.bits >> 25) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR")
.field("pllrdy", &self.pllrdy())
.field("hsi16on", &self.hsi16on())
.field("pllon", &self.pllon())
.field("rtcpre", &self.rtcpre())
.field("csshseon", &self.csshseon())
.field("hsebyp", &self.hsebyp())
.field("msirdy", &self.msirdy())
.field("hserdy", &self.hserdy())
.field("hseon", &self.hseon())
.field("msion", &self.msion())
.field("hsi16divf", &self.hsi16divf())
.field("hsi16diven", &self.hsi16diven())
.field("hsi16rdyf", &self.hsi16rdyf())
.field("hsi16keron", &self.hsi16keron())
.field("hsi16outen", &self.hsi16outen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn hsi16on(&mut self) -> HSI16ON_W<CRrs> {
HSI16ON_W::new(self, 0)
}
#[inline(always)]
pub fn hsi16rdyf(&mut self) -> HSI16RDYF_W<CRrs> {
HSI16RDYF_W::new(self, 2)
}
#[inline(always)]
pub fn hsi16diven(&mut self) -> HSI16DIVEN_W<CRrs> {
HSI16DIVEN_W::new(self, 3)
}
#[inline(always)]
pub fn hsi16outen(&mut self) -> HSI16OUTEN_W<CRrs> {
HSI16OUTEN_W::new(self, 5)
}
#[inline(always)]
pub fn msion(&mut self) -> MSION_W<CRrs> {
MSION_W::new(self, 8)
}
#[inline(always)]
pub fn hseon(&mut self) -> HSEON_W<CRrs> {
HSEON_W::new(self, 16)
}
#[inline(always)]
pub fn hsebyp(&mut self) -> HSEBYP_W<CRrs> {
HSEBYP_W::new(self, 18)
}
#[inline(always)]
pub fn csshseon(&mut self) -> CSSHSEON_W<CRrs> {
CSSHSEON_W::new(self, 19)
}
#[inline(always)]
pub fn rtcpre(&mut self) -> RTCPRE_W<CRrs> {
RTCPRE_W::new(self, 20)
}
#[inline(always)]
pub fn pllon(&mut self) -> PLLON_W<CRrs> {
PLLON_W::new(self, 24)
}
}
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 {
const RESET_VALUE: u32 = 0x0300;
}