pub type R = crate::R<CFGRrs>;
pub type W = crate::W<CFGRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SW {
Msi = 0,
Hsi16 = 1,
Hse = 2,
Pll = 3,
}
impl From<SW> for u8 {
#[inline(always)]
fn from(variant: SW) -> Self {
variant as _
}
}
impl crate::FieldSpec for SW {
type Ux = u8;
}
impl crate::IsEnum for SW {}
pub type SW_R = crate::FieldReader<SW>;
impl SW_R {
#[inline(always)]
pub const fn variant(&self) -> SW {
match self.bits {
0 => SW::Msi,
1 => SW::Hsi16,
2 => SW::Hse,
3 => SW::Pll,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_msi(&self) -> bool {
*self == SW::Msi
}
#[inline(always)]
pub fn is_hsi16(&self) -> bool {
*self == SW::Hsi16
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == SW::Hse
}
#[inline(always)]
pub fn is_pll(&self) -> bool {
*self == SW::Pll
}
}
pub type SW_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SW, crate::Safe>;
impl<'a, REG> SW_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn msi(self) -> &'a mut crate::W<REG> {
self.variant(SW::Msi)
}
#[inline(always)]
pub fn hsi16(self) -> &'a mut crate::W<REG> {
self.variant(SW::Hsi16)
}
#[inline(always)]
pub fn hse(self) -> &'a mut crate::W<REG> {
self.variant(SW::Hse)
}
#[inline(always)]
pub fn pll(self) -> &'a mut crate::W<REG> {
self.variant(SW::Pll)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SWS {
Msi = 0,
Hsi16 = 1,
Hse = 2,
Pll = 3,
}
impl From<SWS> for u8 {
#[inline(always)]
fn from(variant: SWS) -> Self {
variant as _
}
}
impl crate::FieldSpec for SWS {
type Ux = u8;
}
impl crate::IsEnum for SWS {}
pub type SWS_R = crate::FieldReader<SWS>;
impl SWS_R {
#[inline(always)]
pub const fn variant(&self) -> SWS {
match self.bits {
0 => SWS::Msi,
1 => SWS::Hsi16,
2 => SWS::Hse,
3 => SWS::Pll,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_msi(&self) -> bool {
*self == SWS::Msi
}
#[inline(always)]
pub fn is_hsi16(&self) -> bool {
*self == SWS::Hsi16
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == SWS::Hse
}
#[inline(always)]
pub fn is_pll(&self) -> bool {
*self == SWS::Pll
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum HPRE {
Div2 = 8,
Div4 = 9,
Div8 = 10,
Div16 = 11,
Div64 = 12,
Div128 = 13,
Div256 = 14,
Div512 = 15,
Div1 = 0,
}
impl From<HPRE> for u8 {
#[inline(always)]
fn from(variant: HPRE) -> Self {
variant as _
}
}
impl crate::FieldSpec for HPRE {
type Ux = u8;
}
impl crate::IsEnum for HPRE {}
pub type HPRE_R = crate::FieldReader<HPRE>;
impl HPRE_R {
#[inline(always)]
pub const fn variant(&self) -> HPRE {
match self.bits {
8 => HPRE::Div2,
9 => HPRE::Div4,
10 => HPRE::Div8,
11 => HPRE::Div16,
12 => HPRE::Div64,
13 => HPRE::Div128,
14 => HPRE::Div256,
15 => HPRE::Div512,
_ => HPRE::Div1,
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == HPRE::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == HPRE::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == HPRE::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == HPRE::Div16
}
#[inline(always)]
pub fn is_div64(&self) -> bool {
*self == HPRE::Div64
}
#[inline(always)]
pub fn is_div128(&self) -> bool {
*self == HPRE::Div128
}
#[inline(always)]
pub fn is_div256(&self) -> bool {
*self == HPRE::Div256
}
#[inline(always)]
pub fn is_div512(&self) -> bool {
*self == HPRE::Div512
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
matches!(self.variant(), HPRE::Div1)
}
}
pub type HPRE_W<'a, REG> = crate::FieldWriter<'a, REG, 4, HPRE, crate::Safe>;
impl<'a, REG> HPRE_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(HPRE::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div16)
}
#[inline(always)]
pub fn div64(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div64)
}
#[inline(always)]
pub fn div128(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div128)
}
#[inline(always)]
pub fn div256(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div256)
}
#[inline(always)]
pub fn div512(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div512)
}
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div1)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PPRE1 {
Div2 = 4,
Div4 = 5,
Div8 = 6,
Div16 = 7,
Div1 = 0,
}
impl From<PPRE1> for u8 {
#[inline(always)]
fn from(variant: PPRE1) -> Self {
variant as _
}
}
impl crate::FieldSpec for PPRE1 {
type Ux = u8;
}
impl crate::IsEnum for PPRE1 {}
pub type PPRE1_R = crate::FieldReader<PPRE1>;
impl PPRE1_R {
#[inline(always)]
pub const fn variant(&self) -> PPRE1 {
match self.bits {
4 => PPRE1::Div2,
5 => PPRE1::Div4,
6 => PPRE1::Div8,
7 => PPRE1::Div16,
_ => PPRE1::Div1,
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == PPRE1::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == PPRE1::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == PPRE1::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == PPRE1::Div16
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
matches!(self.variant(), PPRE1::Div1)
}
}
pub type PPRE1_W<'a, REG> = crate::FieldWriter<'a, REG, 3, PPRE1, crate::Safe>;
impl<'a, REG> PPRE1_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(PPRE1::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(PPRE1::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(PPRE1::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(PPRE1::Div16)
}
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(PPRE1::Div1)
}
}
pub use PPRE1_R as PPRE2_R;
pub use PPRE1_W as PPRE2_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum STOPWUCK {
Msi = 0,
Hsi16 = 1,
}
impl From<STOPWUCK> for bool {
#[inline(always)]
fn from(variant: STOPWUCK) -> Self {
variant as u8 != 0
}
}
pub type STOPWUCK_R = crate::BitReader<STOPWUCK>;
impl STOPWUCK_R {
#[inline(always)]
pub const fn variant(&self) -> STOPWUCK {
match self.bits {
false => STOPWUCK::Msi,
true => STOPWUCK::Hsi16,
}
}
#[inline(always)]
pub fn is_msi(&self) -> bool {
*self == STOPWUCK::Msi
}
#[inline(always)]
pub fn is_hsi16(&self) -> bool {
*self == STOPWUCK::Hsi16
}
}
pub type STOPWUCK_W<'a, REG> = crate::BitWriter<'a, REG, STOPWUCK>;
impl<'a, REG> STOPWUCK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn msi(self) -> &'a mut crate::W<REG> {
self.variant(STOPWUCK::Msi)
}
#[inline(always)]
pub fn hsi16(self) -> &'a mut crate::W<REG> {
self.variant(STOPWUCK::Hsi16)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PLLSRC {
Hsi16 = 0,
Hse = 1,
}
impl From<PLLSRC> for bool {
#[inline(always)]
fn from(variant: PLLSRC) -> Self {
variant as u8 != 0
}
}
pub type PLLSRC_R = crate::BitReader<PLLSRC>;
impl PLLSRC_R {
#[inline(always)]
pub const fn variant(&self) -> PLLSRC {
match self.bits {
false => PLLSRC::Hsi16,
true => PLLSRC::Hse,
}
}
#[inline(always)]
pub fn is_hsi16(&self) -> bool {
*self == PLLSRC::Hsi16
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == PLLSRC::Hse
}
}
pub type PLLSRC_W<'a, REG> = crate::BitWriter<'a, REG, PLLSRC>;
impl<'a, REG> PLLSRC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn hsi16(self) -> &'a mut crate::W<REG> {
self.variant(PLLSRC::Hsi16)
}
#[inline(always)]
pub fn hse(self) -> &'a mut crate::W<REG> {
self.variant(PLLSRC::Hse)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PLLMUL {
Mul3 = 0,
Mul4 = 1,
Mul6 = 2,
Mul8 = 3,
Mul12 = 4,
Mul16 = 5,
Mul24 = 6,
Mul32 = 7,
Mul48 = 8,
}
impl From<PLLMUL> for u8 {
#[inline(always)]
fn from(variant: PLLMUL) -> Self {
variant as _
}
}
impl crate::FieldSpec for PLLMUL {
type Ux = u8;
}
impl crate::IsEnum for PLLMUL {}
pub type PLLMUL_R = crate::FieldReader<PLLMUL>;
impl PLLMUL_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PLLMUL> {
match self.bits {
0 => Some(PLLMUL::Mul3),
1 => Some(PLLMUL::Mul4),
2 => Some(PLLMUL::Mul6),
3 => Some(PLLMUL::Mul8),
4 => Some(PLLMUL::Mul12),
5 => Some(PLLMUL::Mul16),
6 => Some(PLLMUL::Mul24),
7 => Some(PLLMUL::Mul32),
8 => Some(PLLMUL::Mul48),
_ => None,
}
}
#[inline(always)]
pub fn is_mul3(&self) -> bool {
*self == PLLMUL::Mul3
}
#[inline(always)]
pub fn is_mul4(&self) -> bool {
*self == PLLMUL::Mul4
}
#[inline(always)]
pub fn is_mul6(&self) -> bool {
*self == PLLMUL::Mul6
}
#[inline(always)]
pub fn is_mul8(&self) -> bool {
*self == PLLMUL::Mul8
}
#[inline(always)]
pub fn is_mul12(&self) -> bool {
*self == PLLMUL::Mul12
}
#[inline(always)]
pub fn is_mul16(&self) -> bool {
*self == PLLMUL::Mul16
}
#[inline(always)]
pub fn is_mul24(&self) -> bool {
*self == PLLMUL::Mul24
}
#[inline(always)]
pub fn is_mul32(&self) -> bool {
*self == PLLMUL::Mul32
}
#[inline(always)]
pub fn is_mul48(&self) -> bool {
*self == PLLMUL::Mul48
}
}
pub type PLLMUL_W<'a, REG> = crate::FieldWriter<'a, REG, 4, PLLMUL>;
impl<'a, REG> PLLMUL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn mul3(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul3)
}
#[inline(always)]
pub fn mul4(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul4)
}
#[inline(always)]
pub fn mul6(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul6)
}
#[inline(always)]
pub fn mul8(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul8)
}
#[inline(always)]
pub fn mul12(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul12)
}
#[inline(always)]
pub fn mul16(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul16)
}
#[inline(always)]
pub fn mul24(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul24)
}
#[inline(always)]
pub fn mul32(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul32)
}
#[inline(always)]
pub fn mul48(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul48)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PLLDIV {
Div2 = 1,
Div3 = 2,
Div4 = 3,
}
impl From<PLLDIV> for u8 {
#[inline(always)]
fn from(variant: PLLDIV) -> Self {
variant as _
}
}
impl crate::FieldSpec for PLLDIV {
type Ux = u8;
}
impl crate::IsEnum for PLLDIV {}
pub type PLLDIV_R = crate::FieldReader<PLLDIV>;
impl PLLDIV_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PLLDIV> {
match self.bits {
1 => Some(PLLDIV::Div2),
2 => Some(PLLDIV::Div3),
3 => Some(PLLDIV::Div4),
_ => None,
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == PLLDIV::Div2
}
#[inline(always)]
pub fn is_div3(&self) -> bool {
*self == PLLDIV::Div3
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == PLLDIV::Div4
}
}
pub type PLLDIV_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PLLDIV>;
impl<'a, REG> PLLDIV_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(PLLDIV::Div2)
}
#[inline(always)]
pub fn div3(self) -> &'a mut crate::W<REG> {
self.variant(PLLDIV::Div3)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(PLLDIV::Div4)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MCOSEL {
NoClock = 0,
Sysclk = 1,
Hsi16 = 2,
Msi = 3,
Hse = 4,
Pll = 5,
Lsi = 6,
Lse = 7,
}
impl From<MCOSEL> for u8 {
#[inline(always)]
fn from(variant: MCOSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for MCOSEL {
type Ux = u8;
}
impl crate::IsEnum for MCOSEL {}
pub type MCOSEL_R = crate::FieldReader<MCOSEL>;
impl MCOSEL_R {
#[inline(always)]
pub const fn variant(&self) -> Option<MCOSEL> {
match self.bits {
0 => Some(MCOSEL::NoClock),
1 => Some(MCOSEL::Sysclk),
2 => Some(MCOSEL::Hsi16),
3 => Some(MCOSEL::Msi),
4 => Some(MCOSEL::Hse),
5 => Some(MCOSEL::Pll),
6 => Some(MCOSEL::Lsi),
7 => Some(MCOSEL::Lse),
_ => None,
}
}
#[inline(always)]
pub fn is_no_clock(&self) -> bool {
*self == MCOSEL::NoClock
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == MCOSEL::Sysclk
}
#[inline(always)]
pub fn is_hsi16(&self) -> bool {
*self == MCOSEL::Hsi16
}
#[inline(always)]
pub fn is_msi(&self) -> bool {
*self == MCOSEL::Msi
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == MCOSEL::Hse
}
#[inline(always)]
pub fn is_pll(&self) -> bool {
*self == MCOSEL::Pll
}
#[inline(always)]
pub fn is_lsi(&self) -> bool {
*self == MCOSEL::Lsi
}
#[inline(always)]
pub fn is_lse(&self) -> bool {
*self == MCOSEL::Lse
}
}
pub type MCOSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 4, MCOSEL>;
impl<'a, REG> MCOSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn no_clock(self) -> &'a mut crate::W<REG> {
self.variant(MCOSEL::NoClock)
}
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(MCOSEL::Sysclk)
}
#[inline(always)]
pub fn hsi16(self) -> &'a mut crate::W<REG> {
self.variant(MCOSEL::Hsi16)
}
#[inline(always)]
pub fn msi(self) -> &'a mut crate::W<REG> {
self.variant(MCOSEL::Msi)
}
#[inline(always)]
pub fn hse(self) -> &'a mut crate::W<REG> {
self.variant(MCOSEL::Hse)
}
#[inline(always)]
pub fn pll(self) -> &'a mut crate::W<REG> {
self.variant(MCOSEL::Pll)
}
#[inline(always)]
pub fn lsi(self) -> &'a mut crate::W<REG> {
self.variant(MCOSEL::Lsi)
}
#[inline(always)]
pub fn lse(self) -> &'a mut crate::W<REG> {
self.variant(MCOSEL::Lse)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MCOPRE {
Div1 = 0,
Div2 = 1,
Div4 = 2,
Div8 = 3,
Div16 = 4,
}
impl From<MCOPRE> for u8 {
#[inline(always)]
fn from(variant: MCOPRE) -> Self {
variant as _
}
}
impl crate::FieldSpec for MCOPRE {
type Ux = u8;
}
impl crate::IsEnum for MCOPRE {}
pub type MCOPRE_R = crate::FieldReader<MCOPRE>;
impl MCOPRE_R {
#[inline(always)]
pub const fn variant(&self) -> Option<MCOPRE> {
match self.bits {
0 => Some(MCOPRE::Div1),
1 => Some(MCOPRE::Div2),
2 => Some(MCOPRE::Div4),
3 => Some(MCOPRE::Div8),
4 => Some(MCOPRE::Div16),
_ => None,
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == MCOPRE::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == MCOPRE::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == MCOPRE::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == MCOPRE::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == MCOPRE::Div16
}
}
pub type MCOPRE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, MCOPRE>;
impl<'a, REG> MCOPRE_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(MCOPRE::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(MCOPRE::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(MCOPRE::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(MCOPRE::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(MCOPRE::Div16)
}
}
impl R {
#[inline(always)]
pub fn sw(&self) -> SW_R {
SW_R::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn sws(&self) -> SWS_R {
SWS_R::new(((self.bits >> 2) & 3) as u8)
}
#[inline(always)]
pub fn hpre(&self) -> HPRE_R {
HPRE_R::new(((self.bits >> 4) & 0x0f) as u8)
}
#[inline(always)]
pub fn ppre1(&self) -> PPRE1_R {
PPRE1_R::new(((self.bits >> 8) & 7) as u8)
}
#[inline(always)]
pub fn ppre2(&self) -> PPRE2_R {
PPRE2_R::new(((self.bits >> 11) & 7) as u8)
}
#[inline(always)]
pub fn stopwuck(&self) -> STOPWUCK_R {
STOPWUCK_R::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn pllsrc(&self) -> PLLSRC_R {
PLLSRC_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn pllmul(&self) -> PLLMUL_R {
PLLMUL_R::new(((self.bits >> 18) & 0x0f) as u8)
}
#[inline(always)]
pub fn plldiv(&self) -> PLLDIV_R {
PLLDIV_R::new(((self.bits >> 22) & 3) as u8)
}
#[inline(always)]
pub fn mcosel(&self) -> MCOSEL_R {
MCOSEL_R::new(((self.bits >> 24) & 0x0f) as u8)
}
#[inline(always)]
pub fn mcopre(&self) -> MCOPRE_R {
MCOPRE_R::new(((self.bits >> 28) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CFGR")
.field("mcopre", &self.mcopre())
.field("mcosel", &self.mcosel())
.field("plldiv", &self.plldiv())
.field("pllmul", &self.pllmul())
.field("pllsrc", &self.pllsrc())
.field("stopwuck", &self.stopwuck())
.field("ppre1", &self.ppre1())
.field("ppre2", &self.ppre2())
.field("hpre", &self.hpre())
.field("sws", &self.sws())
.field("sw", &self.sw())
.finish()
}
}
impl W {
#[inline(always)]
pub fn sw(&mut self) -> SW_W<CFGRrs> {
SW_W::new(self, 0)
}
#[inline(always)]
pub fn hpre(&mut self) -> HPRE_W<CFGRrs> {
HPRE_W::new(self, 4)
}
#[inline(always)]
pub fn ppre1(&mut self) -> PPRE1_W<CFGRrs> {
PPRE1_W::new(self, 8)
}
#[inline(always)]
pub fn ppre2(&mut self) -> PPRE2_W<CFGRrs> {
PPRE2_W::new(self, 11)
}
#[inline(always)]
pub fn stopwuck(&mut self) -> STOPWUCK_W<CFGRrs> {
STOPWUCK_W::new(self, 15)
}
#[inline(always)]
pub fn pllsrc(&mut self) -> PLLSRC_W<CFGRrs> {
PLLSRC_W::new(self, 16)
}
#[inline(always)]
pub fn pllmul(&mut self) -> PLLMUL_W<CFGRrs> {
PLLMUL_W::new(self, 18)
}
#[inline(always)]
pub fn plldiv(&mut self) -> PLLDIV_W<CFGRrs> {
PLLDIV_W::new(self, 22)
}
#[inline(always)]
pub fn mcosel(&mut self) -> MCOSEL_W<CFGRrs> {
MCOSEL_W::new(self, 24)
}
#[inline(always)]
pub fn mcopre(&mut self) -> MCOPRE_W<CFGRrs> {
MCOPRE_W::new(self, 28)
}
}
pub struct CFGRrs;
impl crate::RegisterSpec for CFGRrs {
type Ux = u32;
}
impl crate::Readable for CFGRrs {}
impl crate::Writable for CFGRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CFGRrs {}