stm32f1_staging/stm32f107/rcc/
cfgr2.rspub type R = crate::R<CFGR2rs>;
pub type W = crate::W<CFGR2rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PREDIV1 {
Div1 = 0,
Div2 = 1,
Div3 = 2,
Div4 = 3,
Div5 = 4,
Div6 = 5,
Div7 = 6,
Div8 = 7,
Div9 = 8,
Div10 = 9,
Div11 = 10,
Div12 = 11,
Div13 = 12,
Div14 = 13,
Div15 = 14,
Div16 = 15,
}
impl From<PREDIV1> for u8 {
#[inline(always)]
fn from(variant: PREDIV1) -> Self {
variant as _
}
}
impl crate::FieldSpec for PREDIV1 {
type Ux = u8;
}
impl crate::IsEnum for PREDIV1 {}
pub type PREDIV1_R = crate::FieldReader<PREDIV1>;
impl PREDIV1_R {
#[inline(always)]
pub const fn variant(&self) -> PREDIV1 {
match self.bits {
0 => PREDIV1::Div1,
1 => PREDIV1::Div2,
2 => PREDIV1::Div3,
3 => PREDIV1::Div4,
4 => PREDIV1::Div5,
5 => PREDIV1::Div6,
6 => PREDIV1::Div7,
7 => PREDIV1::Div8,
8 => PREDIV1::Div9,
9 => PREDIV1::Div10,
10 => PREDIV1::Div11,
11 => PREDIV1::Div12,
12 => PREDIV1::Div13,
13 => PREDIV1::Div14,
14 => PREDIV1::Div15,
15 => PREDIV1::Div16,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == PREDIV1::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == PREDIV1::Div2
}
#[inline(always)]
pub fn is_div3(&self) -> bool {
*self == PREDIV1::Div3
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == PREDIV1::Div4
}
#[inline(always)]
pub fn is_div5(&self) -> bool {
*self == PREDIV1::Div5
}
#[inline(always)]
pub fn is_div6(&self) -> bool {
*self == PREDIV1::Div6
}
#[inline(always)]
pub fn is_div7(&self) -> bool {
*self == PREDIV1::Div7
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == PREDIV1::Div8
}
#[inline(always)]
pub fn is_div9(&self) -> bool {
*self == PREDIV1::Div9
}
#[inline(always)]
pub fn is_div10(&self) -> bool {
*self == PREDIV1::Div10
}
#[inline(always)]
pub fn is_div11(&self) -> bool {
*self == PREDIV1::Div11
}
#[inline(always)]
pub fn is_div12(&self) -> bool {
*self == PREDIV1::Div12
}
#[inline(always)]
pub fn is_div13(&self) -> bool {
*self == PREDIV1::Div13
}
#[inline(always)]
pub fn is_div14(&self) -> bool {
*self == PREDIV1::Div14
}
#[inline(always)]
pub fn is_div15(&self) -> bool {
*self == PREDIV1::Div15
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == PREDIV1::Div16
}
}
pub type PREDIV1_W<'a, REG> = crate::FieldWriter<'a, REG, 4, PREDIV1, crate::Safe>;
impl<'a, REG> PREDIV1_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(PREDIV1::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div2)
}
#[inline(always)]
pub fn div3(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div3)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div4)
}
#[inline(always)]
pub fn div5(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div5)
}
#[inline(always)]
pub fn div6(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div6)
}
#[inline(always)]
pub fn div7(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div7)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div8)
}
#[inline(always)]
pub fn div9(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div9)
}
#[inline(always)]
pub fn div10(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div10)
}
#[inline(always)]
pub fn div11(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div11)
}
#[inline(always)]
pub fn div12(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div12)
}
#[inline(always)]
pub fn div13(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div13)
}
#[inline(always)]
pub fn div14(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div14)
}
#[inline(always)]
pub fn div15(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div15)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1::Div16)
}
}
pub use PREDIV1_R as PREDIV2_R;
pub use PREDIV1_W as PREDIV2_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PLL2MUL {
Mul8 = 6,
Mul9 = 7,
Mul10 = 8,
Mul11 = 9,
Mul12 = 10,
Mul13 = 11,
Mul14 = 12,
Mul16 = 14,
Mul20 = 15,
}
impl From<PLL2MUL> for u8 {
#[inline(always)]
fn from(variant: PLL2MUL) -> Self {
variant as _
}
}
impl crate::FieldSpec for PLL2MUL {
type Ux = u8;
}
impl crate::IsEnum for PLL2MUL {}
pub type PLL2MUL_R = crate::FieldReader<PLL2MUL>;
impl PLL2MUL_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PLL2MUL> {
match self.bits {
6 => Some(PLL2MUL::Mul8),
7 => Some(PLL2MUL::Mul9),
8 => Some(PLL2MUL::Mul10),
9 => Some(PLL2MUL::Mul11),
10 => Some(PLL2MUL::Mul12),
11 => Some(PLL2MUL::Mul13),
12 => Some(PLL2MUL::Mul14),
14 => Some(PLL2MUL::Mul16),
15 => Some(PLL2MUL::Mul20),
_ => None,
}
}
#[inline(always)]
pub fn is_mul8(&self) -> bool {
*self == PLL2MUL::Mul8
}
#[inline(always)]
pub fn is_mul9(&self) -> bool {
*self == PLL2MUL::Mul9
}
#[inline(always)]
pub fn is_mul10(&self) -> bool {
*self == PLL2MUL::Mul10
}
#[inline(always)]
pub fn is_mul11(&self) -> bool {
*self == PLL2MUL::Mul11
}
#[inline(always)]
pub fn is_mul12(&self) -> bool {
*self == PLL2MUL::Mul12
}
#[inline(always)]
pub fn is_mul13(&self) -> bool {
*self == PLL2MUL::Mul13
}
#[inline(always)]
pub fn is_mul14(&self) -> bool {
*self == PLL2MUL::Mul14
}
#[inline(always)]
pub fn is_mul16(&self) -> bool {
*self == PLL2MUL::Mul16
}
#[inline(always)]
pub fn is_mul20(&self) -> bool {
*self == PLL2MUL::Mul20
}
}
pub type PLL2MUL_W<'a, REG> = crate::FieldWriter<'a, REG, 4, PLL2MUL>;
impl<'a, REG> PLL2MUL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn mul8(self) -> &'a mut crate::W<REG> {
self.variant(PLL2MUL::Mul8)
}
#[inline(always)]
pub fn mul9(self) -> &'a mut crate::W<REG> {
self.variant(PLL2MUL::Mul9)
}
#[inline(always)]
pub fn mul10(self) -> &'a mut crate::W<REG> {
self.variant(PLL2MUL::Mul10)
}
#[inline(always)]
pub fn mul11(self) -> &'a mut crate::W<REG> {
self.variant(PLL2MUL::Mul11)
}
#[inline(always)]
pub fn mul12(self) -> &'a mut crate::W<REG> {
self.variant(PLL2MUL::Mul12)
}
#[inline(always)]
pub fn mul13(self) -> &'a mut crate::W<REG> {
self.variant(PLL2MUL::Mul13)
}
#[inline(always)]
pub fn mul14(self) -> &'a mut crate::W<REG> {
self.variant(PLL2MUL::Mul14)
}
#[inline(always)]
pub fn mul16(self) -> &'a mut crate::W<REG> {
self.variant(PLL2MUL::Mul16)
}
#[inline(always)]
pub fn mul20(self) -> &'a mut crate::W<REG> {
self.variant(PLL2MUL::Mul20)
}
}
pub use PLL2MUL_R as PLL3MUL_R;
pub use PLL2MUL_W as PLL3MUL_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PREDIV1SRC {
Hse = 0,
Pll2 = 1,
}
impl From<PREDIV1SRC> for bool {
#[inline(always)]
fn from(variant: PREDIV1SRC) -> Self {
variant as u8 != 0
}
}
pub type PREDIV1SRC_R = crate::BitReader<PREDIV1SRC>;
impl PREDIV1SRC_R {
#[inline(always)]
pub const fn variant(&self) -> PREDIV1SRC {
match self.bits {
false => PREDIV1SRC::Hse,
true => PREDIV1SRC::Pll2,
}
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == PREDIV1SRC::Hse
}
#[inline(always)]
pub fn is_pll2(&self) -> bool {
*self == PREDIV1SRC::Pll2
}
}
pub type PREDIV1SRC_W<'a, REG> = crate::BitWriter<'a, REG, PREDIV1SRC>;
impl<'a, REG> PREDIV1SRC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn hse(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1SRC::Hse)
}
#[inline(always)]
pub fn pll2(self) -> &'a mut crate::W<REG> {
self.variant(PREDIV1SRC::Pll2)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum I2S2SRC {
Sysclk = 0,
Pll3 = 1,
}
impl From<I2S2SRC> for bool {
#[inline(always)]
fn from(variant: I2S2SRC) -> Self {
variant as u8 != 0
}
}
pub type I2S2SRC_R = crate::BitReader<I2S2SRC>;
impl I2S2SRC_R {
#[inline(always)]
pub const fn variant(&self) -> I2S2SRC {
match self.bits {
false => I2S2SRC::Sysclk,
true => I2S2SRC::Pll3,
}
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == I2S2SRC::Sysclk
}
#[inline(always)]
pub fn is_pll3(&self) -> bool {
*self == I2S2SRC::Pll3
}
}
pub type I2S2SRC_W<'a, REG> = crate::BitWriter<'a, REG, I2S2SRC>;
impl<'a, REG> I2S2SRC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(I2S2SRC::Sysclk)
}
#[inline(always)]
pub fn pll3(self) -> &'a mut crate::W<REG> {
self.variant(I2S2SRC::Pll3)
}
}
pub use I2S2SRC_R as I2S3SRC_R;
pub use I2S2SRC_W as I2S3SRC_W;
impl R {
#[inline(always)]
pub fn prediv1(&self) -> PREDIV1_R {
PREDIV1_R::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn prediv2(&self) -> PREDIV2_R {
PREDIV2_R::new(((self.bits >> 4) & 0x0f) as u8)
}
#[inline(always)]
pub fn pll2mul(&self) -> PLL2MUL_R {
PLL2MUL_R::new(((self.bits >> 8) & 0x0f) as u8)
}
#[inline(always)]
pub fn pll3mul(&self) -> PLL3MUL_R {
PLL3MUL_R::new(((self.bits >> 12) & 0x0f) as u8)
}
#[inline(always)]
pub fn prediv1src(&self) -> PREDIV1SRC_R {
PREDIV1SRC_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn i2s2src(&self) -> I2S2SRC_R {
I2S2SRC_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn i2s3src(&self) -> I2S3SRC_R {
I2S3SRC_R::new(((self.bits >> 18) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CFGR2")
.field("prediv1", &self.prediv1())
.field("prediv2", &self.prediv2())
.field("pll2mul", &self.pll2mul())
.field("pll3mul", &self.pll3mul())
.field("prediv1src", &self.prediv1src())
.field("i2s2src", &self.i2s2src())
.field("i2s3src", &self.i2s3src())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn prediv1(&mut self) -> PREDIV1_W<CFGR2rs> {
PREDIV1_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn prediv2(&mut self) -> PREDIV2_W<CFGR2rs> {
PREDIV2_W::new(self, 4)
}
#[inline(always)]
#[must_use]
pub fn pll2mul(&mut self) -> PLL2MUL_W<CFGR2rs> {
PLL2MUL_W::new(self, 8)
}
#[inline(always)]
#[must_use]
pub fn pll3mul(&mut self) -> PLL3MUL_W<CFGR2rs> {
PLL3MUL_W::new(self, 12)
}
#[inline(always)]
#[must_use]
pub fn prediv1src(&mut self) -> PREDIV1SRC_W<CFGR2rs> {
PREDIV1SRC_W::new(self, 16)
}
#[inline(always)]
#[must_use]
pub fn i2s2src(&mut self) -> I2S2SRC_W<CFGR2rs> {
I2S2SRC_W::new(self, 17)
}
#[inline(always)]
#[must_use]
pub fn i2s3src(&mut self) -> I2S3SRC_W<CFGR2rs> {
I2S3SRC_W::new(self, 18)
}
}
pub struct CFGR2rs;
impl crate::RegisterSpec for CFGR2rs {
type Ux = u32;
}
impl crate::Readable for CFGR2rs {}
impl crate::Writable for CFGR2rs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
impl crate::Resettable for CFGR2rs {
const RESET_VALUE: u32 = 0;
}