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 {
Hsi = 0,
Hse = 1,
Pll = 2,
}
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) -> Option<SW> {
match self.bits {
0 => Some(SW::Hsi),
1 => Some(SW::Hse),
2 => Some(SW::Pll),
_ => None,
}
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == SW::Hsi
}
#[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>;
impl<'a, REG> SW_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn hsi(self) -> &'a mut crate::W<REG> {
self.variant(SW::Hsi)
}
#[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 SWSR {
Hsi = 0,
Hse = 1,
Pll = 2,
}
impl From<SWSR> for u8 {
#[inline(always)]
fn from(variant: SWSR) -> Self {
variant as _
}
}
impl crate::FieldSpec for SWSR {
type Ux = u8;
}
impl crate::IsEnum for SWSR {}
pub type SWS_R = crate::FieldReader<SWSR>;
impl SWS_R {
#[inline(always)]
pub const fn variant(&self) -> Option<SWSR> {
match self.bits {
0 => Some(SWSR::Hsi),
1 => Some(SWSR::Hse),
2 => Some(SWSR::Pll),
_ => None,
}
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == SWSR::Hsi
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == SWSR::Hse
}
#[inline(always)]
pub fn is_pll(&self) -> bool {
*self == SWSR::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)]
#[repr(u8)]
pub enum ADCPRE {
Div2 = 0,
Div4 = 1,
Div6 = 2,
Div8 = 3,
}
impl From<ADCPRE> for u8 {
#[inline(always)]
fn from(variant: ADCPRE) -> Self {
variant as _
}
}
impl crate::FieldSpec for ADCPRE {
type Ux = u8;
}
impl crate::IsEnum for ADCPRE {}
pub type ADCPRE_R = crate::FieldReader<ADCPRE>;
impl ADCPRE_R {
#[inline(always)]
pub const fn variant(&self) -> ADCPRE {
match self.bits {
0 => ADCPRE::Div2,
1 => ADCPRE::Div4,
2 => ADCPRE::Div6,
3 => ADCPRE::Div8,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == ADCPRE::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == ADCPRE::Div4
}
#[inline(always)]
pub fn is_div6(&self) -> bool {
*self == ADCPRE::Div6
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == ADCPRE::Div8
}
}
pub type ADCPRE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, ADCPRE, crate::Safe>;
impl<'a, REG> ADCPRE_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(ADCPRE::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(ADCPRE::Div4)
}
#[inline(always)]
pub fn div6(self) -> &'a mut crate::W<REG> {
self.variant(ADCPRE::Div6)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(ADCPRE::Div8)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PLLSRC {
HsiDiv2 = 0,
HseDivPrediv = 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::HsiDiv2,
true => PLLSRC::HseDivPrediv,
}
}
#[inline(always)]
pub fn is_hsi_div2(&self) -> bool {
*self == PLLSRC::HsiDiv2
}
#[inline(always)]
pub fn is_hse_div_prediv(&self) -> bool {
*self == PLLSRC::HseDivPrediv
}
}
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 hsi_div2(self) -> &'a mut crate::W<REG> {
self.variant(PLLSRC::HsiDiv2)
}
#[inline(always)]
pub fn hse_div_prediv(self) -> &'a mut crate::W<REG> {
self.variant(PLLSRC::HseDivPrediv)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PLLXTPRE {
Div1 = 0,
Div2 = 1,
}
impl From<PLLXTPRE> for bool {
#[inline(always)]
fn from(variant: PLLXTPRE) -> Self {
variant as u8 != 0
}
}
pub type PLLXTPRE_R = crate::BitReader<PLLXTPRE>;
impl PLLXTPRE_R {
#[inline(always)]
pub const fn variant(&self) -> PLLXTPRE {
match self.bits {
false => PLLXTPRE::Div1,
true => PLLXTPRE::Div2,
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == PLLXTPRE::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == PLLXTPRE::Div2
}
}
pub type PLLXTPRE_W<'a, REG> = crate::BitWriter<'a, REG, PLLXTPRE>;
impl<'a, REG> PLLXTPRE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(PLLXTPRE::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(PLLXTPRE::Div2)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PLLMUL {
Mul2 = 0,
Mul3 = 1,
Mul4 = 2,
Mul5 = 3,
Mul6 = 4,
Mul7 = 5,
Mul8 = 6,
Mul9 = 7,
Mul10 = 8,
Mul11 = 9,
Mul12 = 10,
Mul13 = 11,
Mul14 = 12,
Mul15 = 13,
Mul16 = 14,
Mul16x = 15,
}
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) -> PLLMUL {
match self.bits {
0 => PLLMUL::Mul2,
1 => PLLMUL::Mul3,
2 => PLLMUL::Mul4,
3 => PLLMUL::Mul5,
4 => PLLMUL::Mul6,
5 => PLLMUL::Mul7,
6 => PLLMUL::Mul8,
7 => PLLMUL::Mul9,
8 => PLLMUL::Mul10,
9 => PLLMUL::Mul11,
10 => PLLMUL::Mul12,
11 => PLLMUL::Mul13,
12 => PLLMUL::Mul14,
13 => PLLMUL::Mul15,
14 => PLLMUL::Mul16,
15 => PLLMUL::Mul16x,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_mul2(&self) -> bool {
*self == PLLMUL::Mul2
}
#[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_mul5(&self) -> bool {
*self == PLLMUL::Mul5
}
#[inline(always)]
pub fn is_mul6(&self) -> bool {
*self == PLLMUL::Mul6
}
#[inline(always)]
pub fn is_mul7(&self) -> bool {
*self == PLLMUL::Mul7
}
#[inline(always)]
pub fn is_mul8(&self) -> bool {
*self == PLLMUL::Mul8
}
#[inline(always)]
pub fn is_mul9(&self) -> bool {
*self == PLLMUL::Mul9
}
#[inline(always)]
pub fn is_mul10(&self) -> bool {
*self == PLLMUL::Mul10
}
#[inline(always)]
pub fn is_mul11(&self) -> bool {
*self == PLLMUL::Mul11
}
#[inline(always)]
pub fn is_mul12(&self) -> bool {
*self == PLLMUL::Mul12
}
#[inline(always)]
pub fn is_mul13(&self) -> bool {
*self == PLLMUL::Mul13
}
#[inline(always)]
pub fn is_mul14(&self) -> bool {
*self == PLLMUL::Mul14
}
#[inline(always)]
pub fn is_mul15(&self) -> bool {
*self == PLLMUL::Mul15
}
#[inline(always)]
pub fn is_mul16(&self) -> bool {
*self == PLLMUL::Mul16
}
#[inline(always)]
pub fn is_mul16x(&self) -> bool {
*self == PLLMUL::Mul16x
}
}
pub type PLLMUL_W<'a, REG> = crate::FieldWriter<'a, REG, 4, PLLMUL, crate::Safe>;
impl<'a, REG> PLLMUL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn mul2(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul2)
}
#[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 mul5(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul5)
}
#[inline(always)]
pub fn mul6(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul6)
}
#[inline(always)]
pub fn mul7(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul7)
}
#[inline(always)]
pub fn mul8(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul8)
}
#[inline(always)]
pub fn mul9(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul9)
}
#[inline(always)]
pub fn mul10(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul10)
}
#[inline(always)]
pub fn mul11(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul11)
}
#[inline(always)]
pub fn mul12(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul12)
}
#[inline(always)]
pub fn mul13(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul13)
}
#[inline(always)]
pub fn mul14(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul14)
}
#[inline(always)]
pub fn mul15(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul15)
}
#[inline(always)]
pub fn mul16(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul16)
}
#[inline(always)]
pub fn mul16x(self) -> &'a mut crate::W<REG> {
self.variant(PLLMUL::Mul16x)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum USBPRE {
Div1_5 = 0,
Div1 = 1,
}
impl From<USBPRE> for bool {
#[inline(always)]
fn from(variant: USBPRE) -> Self {
variant as u8 != 0
}
}
pub type USBPRE_R = crate::BitReader<USBPRE>;
impl USBPRE_R {
#[inline(always)]
pub const fn variant(&self) -> USBPRE {
match self.bits {
false => USBPRE::Div1_5,
true => USBPRE::Div1,
}
}
#[inline(always)]
pub fn is_div1_5(&self) -> bool {
*self == USBPRE::Div1_5
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == USBPRE::Div1
}
}
pub type USBPRE_W<'a, REG> = crate::BitWriter<'a, REG, USBPRE>;
impl<'a, REG> USBPRE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn div1_5(self) -> &'a mut crate::W<REG> {
self.variant(USBPRE::Div1_5)
}
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(USBPRE::Div1)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MCO {
NoMco = 0,
Lsi = 2,
Lse = 3,
Sysclk = 4,
Hsi = 5,
Hse = 6,
Pll = 7,
}
impl From<MCO> for u8 {
#[inline(always)]
fn from(variant: MCO) -> Self {
variant as _
}
}
impl crate::FieldSpec for MCO {
type Ux = u8;
}
impl crate::IsEnum for MCO {}
pub type MCO_R = crate::FieldReader<MCO>;
impl MCO_R {
#[inline(always)]
pub const fn variant(&self) -> Option<MCO> {
match self.bits {
0 => Some(MCO::NoMco),
2 => Some(MCO::Lsi),
3 => Some(MCO::Lse),
4 => Some(MCO::Sysclk),
5 => Some(MCO::Hsi),
6 => Some(MCO::Hse),
7 => Some(MCO::Pll),
_ => None,
}
}
#[inline(always)]
pub fn is_no_mco(&self) -> bool {
*self == MCO::NoMco
}
#[inline(always)]
pub fn is_lsi(&self) -> bool {
*self == MCO::Lsi
}
#[inline(always)]
pub fn is_lse(&self) -> bool {
*self == MCO::Lse
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == MCO::Sysclk
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == MCO::Hsi
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == MCO::Hse
}
#[inline(always)]
pub fn is_pll(&self) -> bool {
*self == MCO::Pll
}
}
pub type MCO_W<'a, REG> = crate::FieldWriter<'a, REG, 3, MCO>;
impl<'a, REG> MCO_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn no_mco(self) -> &'a mut crate::W<REG> {
self.variant(MCO::NoMco)
}
#[inline(always)]
pub fn lsi(self) -> &'a mut crate::W<REG> {
self.variant(MCO::Lsi)
}
#[inline(always)]
pub fn lse(self) -> &'a mut crate::W<REG> {
self.variant(MCO::Lse)
}
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(MCO::Sysclk)
}
#[inline(always)]
pub fn hsi(self) -> &'a mut crate::W<REG> {
self.variant(MCO::Hsi)
}
#[inline(always)]
pub fn hse(self) -> &'a mut crate::W<REG> {
self.variant(MCO::Hse)
}
#[inline(always)]
pub fn pll(self) -> &'a mut crate::W<REG> {
self.variant(MCO::Pll)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SDPRE {
Div4 = 17,
Div6 = 18,
Div8 = 19,
Div10 = 20,
Div12 = 21,
Div14 = 22,
Div16 = 23,
Div20 = 24,
Div24 = 25,
Div28 = 26,
Div32 = 27,
Div36 = 28,
Div40 = 29,
Div44 = 30,
Div48 = 31,
Div2 = 0,
}
impl From<SDPRE> for u8 {
#[inline(always)]
fn from(variant: SDPRE) -> Self {
variant as _
}
}
impl crate::FieldSpec for SDPRE {
type Ux = u8;
}
impl crate::IsEnum for SDPRE {}
pub type SDPRE_R = crate::FieldReader<SDPRE>;
impl SDPRE_R {
#[inline(always)]
pub const fn variant(&self) -> SDPRE {
match self.bits {
17 => SDPRE::Div4,
18 => SDPRE::Div6,
19 => SDPRE::Div8,
20 => SDPRE::Div10,
21 => SDPRE::Div12,
22 => SDPRE::Div14,
23 => SDPRE::Div16,
24 => SDPRE::Div20,
25 => SDPRE::Div24,
26 => SDPRE::Div28,
27 => SDPRE::Div32,
28 => SDPRE::Div36,
29 => SDPRE::Div40,
30 => SDPRE::Div44,
31 => SDPRE::Div48,
_ => SDPRE::Div2,
}
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == SDPRE::Div4
}
#[inline(always)]
pub fn is_div6(&self) -> bool {
*self == SDPRE::Div6
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == SDPRE::Div8
}
#[inline(always)]
pub fn is_div10(&self) -> bool {
*self == SDPRE::Div10
}
#[inline(always)]
pub fn is_div12(&self) -> bool {
*self == SDPRE::Div12
}
#[inline(always)]
pub fn is_div14(&self) -> bool {
*self == SDPRE::Div14
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == SDPRE::Div16
}
#[inline(always)]
pub fn is_div20(&self) -> bool {
*self == SDPRE::Div20
}
#[inline(always)]
pub fn is_div24(&self) -> bool {
*self == SDPRE::Div24
}
#[inline(always)]
pub fn is_div28(&self) -> bool {
*self == SDPRE::Div28
}
#[inline(always)]
pub fn is_div32(&self) -> bool {
*self == SDPRE::Div32
}
#[inline(always)]
pub fn is_div36(&self) -> bool {
*self == SDPRE::Div36
}
#[inline(always)]
pub fn is_div40(&self) -> bool {
*self == SDPRE::Div40
}
#[inline(always)]
pub fn is_div44(&self) -> bool {
*self == SDPRE::Div44
}
#[inline(always)]
pub fn is_div48(&self) -> bool {
*self == SDPRE::Div48
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
matches!(self.variant(), SDPRE::Div2)
}
}
pub type SDPRE_W<'a, REG> = crate::FieldWriter<'a, REG, 5, SDPRE, crate::Safe>;
impl<'a, REG> SDPRE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div4)
}
#[inline(always)]
pub fn div6(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div6)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div8)
}
#[inline(always)]
pub fn div10(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div10)
}
#[inline(always)]
pub fn div12(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div12)
}
#[inline(always)]
pub fn div14(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div14)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div16)
}
#[inline(always)]
pub fn div20(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div20)
}
#[inline(always)]
pub fn div24(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div24)
}
#[inline(always)]
pub fn div28(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div28)
}
#[inline(always)]
pub fn div32(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div32)
}
#[inline(always)]
pub fn div36(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div36)
}
#[inline(always)]
pub fn div40(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div40)
}
#[inline(always)]
pub fn div44(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div44)
}
#[inline(always)]
pub fn div48(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div48)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(SDPRE::Div2)
}
}
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 adcpre(&self) -> ADCPRE_R {
ADCPRE_R::new(((self.bits >> 14) & 3) as u8)
}
#[inline(always)]
pub fn pllsrc(&self) -> PLLSRC_R {
PLLSRC_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn pllxtpre(&self) -> PLLXTPRE_R {
PLLXTPRE_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn pllmul(&self) -> PLLMUL_R {
PLLMUL_R::new(((self.bits >> 18) & 0x0f) as u8)
}
#[inline(always)]
pub fn usbpre(&self) -> USBPRE_R {
USBPRE_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn mco(&self) -> MCO_R {
MCO_R::new(((self.bits >> 24) & 7) as u8)
}
#[inline(always)]
pub fn sdpre(&self) -> SDPRE_R {
SDPRE_R::new(((self.bits >> 27) & 0x1f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CFGR")
.field("sw", &self.sw())
.field("sws", &self.sws())
.field("hpre", &self.hpre())
.field("ppre1", &self.ppre1())
.field("ppre2", &self.ppre2())
.field("adcpre", &self.adcpre())
.field("pllsrc", &self.pllsrc())
.field("pllxtpre", &self.pllxtpre())
.field("pllmul", &self.pllmul())
.field("usbpre", &self.usbpre())
.field("mco", &self.mco())
.field("sdpre", &self.sdpre())
.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 adcpre(&mut self) -> ADCPRE_W<CFGRrs> {
ADCPRE_W::new(self, 14)
}
#[inline(always)]
pub fn pllsrc(&mut self) -> PLLSRC_W<CFGRrs> {
PLLSRC_W::new(self, 16)
}
#[inline(always)]
pub fn pllxtpre(&mut self) -> PLLXTPRE_W<CFGRrs> {
PLLXTPRE_W::new(self, 17)
}
#[inline(always)]
pub fn pllmul(&mut self) -> PLLMUL_W<CFGRrs> {
PLLMUL_W::new(self, 18)
}
#[inline(always)]
pub fn usbpre(&mut self) -> USBPRE_W<CFGRrs> {
USBPRE_W::new(self, 22)
}
#[inline(always)]
pub fn mco(&mut self) -> MCO_W<CFGRrs> {
MCO_W::new(self, 24)
}
#[inline(always)]
pub fn sdpre(&mut self) -> SDPRE_W<CFGRrs> {
SDPRE_W::new(self, 27)
}
}
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 {}