pub type R = crate::R<DCKCFGR2rs>;
pub type W = crate::W<DCKCFGR2rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum USART1SEL {
Apb2 = 0,
Sysclk = 1,
Hsi = 2,
Lse = 3,
}
impl From<USART1SEL> for u8 {
#[inline(always)]
fn from(variant: USART1SEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for USART1SEL {
type Ux = u8;
}
impl crate::IsEnum for USART1SEL {}
pub type USART1SEL_R = crate::FieldReader<USART1SEL>;
impl USART1SEL_R {
#[inline(always)]
pub const fn variant(&self) -> USART1SEL {
match self.bits {
0 => USART1SEL::Apb2,
1 => USART1SEL::Sysclk,
2 => USART1SEL::Hsi,
3 => USART1SEL::Lse,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_apb2(&self) -> bool {
*self == USART1SEL::Apb2
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == USART1SEL::Sysclk
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == USART1SEL::Hsi
}
#[inline(always)]
pub fn is_lse(&self) -> bool {
*self == USART1SEL::Lse
}
}
pub type USART1SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, USART1SEL, crate::Safe>;
impl<'a, REG> USART1SEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn apb2(self) -> &'a mut crate::W<REG> {
self.variant(USART1SEL::Apb2)
}
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(USART1SEL::Sysclk)
}
#[inline(always)]
pub fn hsi(self) -> &'a mut crate::W<REG> {
self.variant(USART1SEL::Hsi)
}
#[inline(always)]
pub fn lse(self) -> &'a mut crate::W<REG> {
self.variant(USART1SEL::Lse)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum USART2SEL {
Apb1 = 0,
Sysclk = 1,
Hsi = 2,
Lse = 3,
}
impl From<USART2SEL> for u8 {
#[inline(always)]
fn from(variant: USART2SEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for USART2SEL {
type Ux = u8;
}
impl crate::IsEnum for USART2SEL {}
pub type USART2SEL_R = crate::FieldReader<USART2SEL>;
impl USART2SEL_R {
#[inline(always)]
pub const fn variant(&self) -> USART2SEL {
match self.bits {
0 => USART2SEL::Apb1,
1 => USART2SEL::Sysclk,
2 => USART2SEL::Hsi,
3 => USART2SEL::Lse,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_apb1(&self) -> bool {
*self == USART2SEL::Apb1
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == USART2SEL::Sysclk
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == USART2SEL::Hsi
}
#[inline(always)]
pub fn is_lse(&self) -> bool {
*self == USART2SEL::Lse
}
}
pub type USART2SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, USART2SEL, crate::Safe>;
impl<'a, REG> USART2SEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn apb1(self) -> &'a mut crate::W<REG> {
self.variant(USART2SEL::Apb1)
}
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(USART2SEL::Sysclk)
}
#[inline(always)]
pub fn hsi(self) -> &'a mut crate::W<REG> {
self.variant(USART2SEL::Hsi)
}
#[inline(always)]
pub fn lse(self) -> &'a mut crate::W<REG> {
self.variant(USART2SEL::Lse)
}
}
pub use USART1SEL_R as USART6SEL_R;
pub use USART1SEL_W as USART6SEL_W;
pub use USART2SEL_R as USART3SEL_R;
pub use USART2SEL_R as UART4SEL_R;
pub use USART2SEL_R as UART5SEL_R;
pub use USART2SEL_R as UART7SEL_R;
pub use USART2SEL_R as UART8SEL_R;
pub use USART2SEL_W as USART3SEL_W;
pub use USART2SEL_W as UART4SEL_W;
pub use USART2SEL_W as UART5SEL_W;
pub use USART2SEL_W as UART7SEL_W;
pub use USART2SEL_W as UART8SEL_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum I2C1SEL {
Apb = 0,
Sysclk = 1,
Hsi = 2,
}
impl From<I2C1SEL> for u8 {
#[inline(always)]
fn from(variant: I2C1SEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for I2C1SEL {
type Ux = u8;
}
impl crate::IsEnum for I2C1SEL {}
pub type I2C1SEL_R = crate::FieldReader<I2C1SEL>;
impl I2C1SEL_R {
#[inline(always)]
pub const fn variant(&self) -> Option<I2C1SEL> {
match self.bits {
0 => Some(I2C1SEL::Apb),
1 => Some(I2C1SEL::Sysclk),
2 => Some(I2C1SEL::Hsi),
_ => None,
}
}
#[inline(always)]
pub fn is_apb(&self) -> bool {
*self == I2C1SEL::Apb
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == I2C1SEL::Sysclk
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == I2C1SEL::Hsi
}
}
pub type I2C1SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, I2C1SEL>;
impl<'a, REG> I2C1SEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn apb(self) -> &'a mut crate::W<REG> {
self.variant(I2C1SEL::Apb)
}
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(I2C1SEL::Sysclk)
}
#[inline(always)]
pub fn hsi(self) -> &'a mut crate::W<REG> {
self.variant(I2C1SEL::Hsi)
}
}
pub use I2C1SEL_R as I2C2SEL_R;
pub use I2C1SEL_R as I2C3SEL_R;
pub use I2C1SEL_R as I2C4SEL_R;
pub use I2C1SEL_W as I2C2SEL_W;
pub use I2C1SEL_W as I2C3SEL_W;
pub use I2C1SEL_W as I2C4SEL_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum LPTIM1SEL {
Apb1 = 0,
Lsi = 1,
Hsi = 2,
Lse = 3,
}
impl From<LPTIM1SEL> for u8 {
#[inline(always)]
fn from(variant: LPTIM1SEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for LPTIM1SEL {
type Ux = u8;
}
impl crate::IsEnum for LPTIM1SEL {}
pub type LPTIM1SEL_R = crate::FieldReader<LPTIM1SEL>;
impl LPTIM1SEL_R {
#[inline(always)]
pub const fn variant(&self) -> LPTIM1SEL {
match self.bits {
0 => LPTIM1SEL::Apb1,
1 => LPTIM1SEL::Lsi,
2 => LPTIM1SEL::Hsi,
3 => LPTIM1SEL::Lse,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_apb1(&self) -> bool {
*self == LPTIM1SEL::Apb1
}
#[inline(always)]
pub fn is_lsi(&self) -> bool {
*self == LPTIM1SEL::Lsi
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == LPTIM1SEL::Hsi
}
#[inline(always)]
pub fn is_lse(&self) -> bool {
*self == LPTIM1SEL::Lse
}
}
pub type LPTIM1SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, LPTIM1SEL, crate::Safe>;
impl<'a, REG> LPTIM1SEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn apb1(self) -> &'a mut crate::W<REG> {
self.variant(LPTIM1SEL::Apb1)
}
#[inline(always)]
pub fn lsi(self) -> &'a mut crate::W<REG> {
self.variant(LPTIM1SEL::Lsi)
}
#[inline(always)]
pub fn hsi(self) -> &'a mut crate::W<REG> {
self.variant(LPTIM1SEL::Hsi)
}
#[inline(always)]
pub fn lse(self) -> &'a mut crate::W<REG> {
self.variant(LPTIM1SEL::Lse)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CECSEL {
Lse = 0,
HsiDiv488 = 1,
}
impl From<CECSEL> for bool {
#[inline(always)]
fn from(variant: CECSEL) -> Self {
variant as u8 != 0
}
}
pub type CECSEL_R = crate::BitReader<CECSEL>;
impl CECSEL_R {
#[inline(always)]
pub const fn variant(&self) -> CECSEL {
match self.bits {
false => CECSEL::Lse,
true => CECSEL::HsiDiv488,
}
}
#[inline(always)]
pub fn is_lse(&self) -> bool {
*self == CECSEL::Lse
}
#[inline(always)]
pub fn is_hsi_div488(&self) -> bool {
*self == CECSEL::HsiDiv488
}
}
pub type CECSEL_W<'a, REG> = crate::BitWriter<'a, REG, CECSEL>;
impl<'a, REG> CECSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn lse(self) -> &'a mut crate::W<REG> {
self.variant(CECSEL::Lse)
}
#[inline(always)]
pub fn hsi_div488(self) -> &'a mut crate::W<REG> {
self.variant(CECSEL::HsiDiv488)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CK48MSEL {
Pll = 0,
Pllsai = 1,
}
impl From<CK48MSEL> for bool {
#[inline(always)]
fn from(variant: CK48MSEL) -> Self {
variant as u8 != 0
}
}
pub type CK48MSEL_R = crate::BitReader<CK48MSEL>;
impl CK48MSEL_R {
#[inline(always)]
pub const fn variant(&self) -> CK48MSEL {
match self.bits {
false => CK48MSEL::Pll,
true => CK48MSEL::Pllsai,
}
}
#[inline(always)]
pub fn is_pll(&self) -> bool {
*self == CK48MSEL::Pll
}
#[inline(always)]
pub fn is_pllsai(&self) -> bool {
*self == CK48MSEL::Pllsai
}
}
pub type CK48MSEL_W<'a, REG> = crate::BitWriter<'a, REG, CK48MSEL>;
impl<'a, REG> CK48MSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn pll(self) -> &'a mut crate::W<REG> {
self.variant(CK48MSEL::Pll)
}
#[inline(always)]
pub fn pllsai(self) -> &'a mut crate::W<REG> {
self.variant(CK48MSEL::Pllsai)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SDMMC1SEL {
Ck48m = 0,
Sysclk = 1,
}
impl From<SDMMC1SEL> for bool {
#[inline(always)]
fn from(variant: SDMMC1SEL) -> Self {
variant as u8 != 0
}
}
pub type SDMMC1SEL_R = crate::BitReader<SDMMC1SEL>;
impl SDMMC1SEL_R {
#[inline(always)]
pub const fn variant(&self) -> SDMMC1SEL {
match self.bits {
false => SDMMC1SEL::Ck48m,
true => SDMMC1SEL::Sysclk,
}
}
#[inline(always)]
pub fn is_ck48m(&self) -> bool {
*self == SDMMC1SEL::Ck48m
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == SDMMC1SEL::Sysclk
}
}
pub type SDMMC1SEL_W<'a, REG> = crate::BitWriter<'a, REG, SDMMC1SEL>;
impl<'a, REG> SDMMC1SEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn ck48m(self) -> &'a mut crate::W<REG> {
self.variant(SDMMC1SEL::Ck48m)
}
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(SDMMC1SEL::Sysclk)
}
}
pub use SDMMC1SEL_R as SDMMC2SEL_R;
pub use SDMMC1SEL_W as SDMMC2SEL_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DSISEL {
DsiPhy = 0,
Pllr = 1,
}
impl From<DSISEL> for bool {
#[inline(always)]
fn from(variant: DSISEL) -> Self {
variant as u8 != 0
}
}
pub type DSISEL_R = crate::BitReader<DSISEL>;
impl DSISEL_R {
#[inline(always)]
pub const fn variant(&self) -> DSISEL {
match self.bits {
false => DSISEL::DsiPhy,
true => DSISEL::Pllr,
}
}
#[inline(always)]
pub fn is_dsi_phy(&self) -> bool {
*self == DSISEL::DsiPhy
}
#[inline(always)]
pub fn is_pllr(&self) -> bool {
*self == DSISEL::Pllr
}
}
pub type DSISEL_W<'a, REG> = crate::BitWriter<'a, REG, DSISEL>;
impl<'a, REG> DSISEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn dsi_phy(self) -> &'a mut crate::W<REG> {
self.variant(DSISEL::DsiPhy)
}
#[inline(always)]
pub fn pllr(self) -> &'a mut crate::W<REG> {
self.variant(DSISEL::Pllr)
}
}
impl R {
#[inline(always)]
pub fn usart1sel(&self) -> USART1SEL_R {
USART1SEL_R::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn usart2sel(&self) -> USART2SEL_R {
USART2SEL_R::new(((self.bits >> 2) & 3) as u8)
}
#[inline(always)]
pub fn usart3sel(&self) -> USART3SEL_R {
USART3SEL_R::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn uart4sel(&self) -> UART4SEL_R {
UART4SEL_R::new(((self.bits >> 6) & 3) as u8)
}
#[inline(always)]
pub fn uart5sel(&self) -> UART5SEL_R {
UART5SEL_R::new(((self.bits >> 8) & 3) as u8)
}
#[inline(always)]
pub fn usart6sel(&self) -> USART6SEL_R {
USART6SEL_R::new(((self.bits >> 10) & 3) as u8)
}
#[inline(always)]
pub fn uart7sel(&self) -> UART7SEL_R {
UART7SEL_R::new(((self.bits >> 12) & 3) as u8)
}
#[inline(always)]
pub fn uart8sel(&self) -> UART8SEL_R {
UART8SEL_R::new(((self.bits >> 14) & 3) as u8)
}
#[inline(always)]
pub fn i2c1sel(&self) -> I2C1SEL_R {
I2C1SEL_R::new(((self.bits >> 16) & 3) as u8)
}
#[inline(always)]
pub fn i2c2sel(&self) -> I2C2SEL_R {
I2C2SEL_R::new(((self.bits >> 18) & 3) as u8)
}
#[inline(always)]
pub fn i2c3sel(&self) -> I2C3SEL_R {
I2C3SEL_R::new(((self.bits >> 20) & 3) as u8)
}
#[inline(always)]
pub fn i2c4sel(&self) -> I2C4SEL_R {
I2C4SEL_R::new(((self.bits >> 22) & 3) as u8)
}
#[inline(always)]
pub fn lptim1sel(&self) -> LPTIM1SEL_R {
LPTIM1SEL_R::new(((self.bits >> 24) & 3) as u8)
}
#[inline(always)]
pub fn cecsel(&self) -> CECSEL_R {
CECSEL_R::new(((self.bits >> 26) & 1) != 0)
}
#[inline(always)]
pub fn ck48msel(&self) -> CK48MSEL_R {
CK48MSEL_R::new(((self.bits >> 27) & 1) != 0)
}
#[inline(always)]
pub fn sdmmc1sel(&self) -> SDMMC1SEL_R {
SDMMC1SEL_R::new(((self.bits >> 28) & 1) != 0)
}
#[inline(always)]
pub fn sdmmc2sel(&self) -> SDMMC2SEL_R {
SDMMC2SEL_R::new(((self.bits >> 29) & 1) != 0)
}
#[inline(always)]
pub fn dsisel(&self) -> DSISEL_R {
DSISEL_R::new(((self.bits >> 30) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DCKCFGR2")
.field("usart1sel", &self.usart1sel())
.field("usart2sel", &self.usart2sel())
.field("usart3sel", &self.usart3sel())
.field("uart4sel", &self.uart4sel())
.field("uart5sel", &self.uart5sel())
.field("usart6sel", &self.usart6sel())
.field("uart7sel", &self.uart7sel())
.field("uart8sel", &self.uart8sel())
.field("i2c1sel", &self.i2c1sel())
.field("i2c2sel", &self.i2c2sel())
.field("i2c3sel", &self.i2c3sel())
.field("i2c4sel", &self.i2c4sel())
.field("lptim1sel", &self.lptim1sel())
.field("cecsel", &self.cecsel())
.field("ck48msel", &self.ck48msel())
.field("sdmmc1sel", &self.sdmmc1sel())
.field("sdmmc2sel", &self.sdmmc2sel())
.field("dsisel", &self.dsisel())
.finish()
}
}
impl W {
#[inline(always)]
pub fn usart1sel(&mut self) -> USART1SEL_W<DCKCFGR2rs> {
USART1SEL_W::new(self, 0)
}
#[inline(always)]
pub fn usart2sel(&mut self) -> USART2SEL_W<DCKCFGR2rs> {
USART2SEL_W::new(self, 2)
}
#[inline(always)]
pub fn usart3sel(&mut self) -> USART3SEL_W<DCKCFGR2rs> {
USART3SEL_W::new(self, 4)
}
#[inline(always)]
pub fn uart4sel(&mut self) -> UART4SEL_W<DCKCFGR2rs> {
UART4SEL_W::new(self, 6)
}
#[inline(always)]
pub fn uart5sel(&mut self) -> UART5SEL_W<DCKCFGR2rs> {
UART5SEL_W::new(self, 8)
}
#[inline(always)]
pub fn usart6sel(&mut self) -> USART6SEL_W<DCKCFGR2rs> {
USART6SEL_W::new(self, 10)
}
#[inline(always)]
pub fn uart7sel(&mut self) -> UART7SEL_W<DCKCFGR2rs> {
UART7SEL_W::new(self, 12)
}
#[inline(always)]
pub fn uart8sel(&mut self) -> UART8SEL_W<DCKCFGR2rs> {
UART8SEL_W::new(self, 14)
}
#[inline(always)]
pub fn i2c1sel(&mut self) -> I2C1SEL_W<DCKCFGR2rs> {
I2C1SEL_W::new(self, 16)
}
#[inline(always)]
pub fn i2c2sel(&mut self) -> I2C2SEL_W<DCKCFGR2rs> {
I2C2SEL_W::new(self, 18)
}
#[inline(always)]
pub fn i2c3sel(&mut self) -> I2C3SEL_W<DCKCFGR2rs> {
I2C3SEL_W::new(self, 20)
}
#[inline(always)]
pub fn i2c4sel(&mut self) -> I2C4SEL_W<DCKCFGR2rs> {
I2C4SEL_W::new(self, 22)
}
#[inline(always)]
pub fn lptim1sel(&mut self) -> LPTIM1SEL_W<DCKCFGR2rs> {
LPTIM1SEL_W::new(self, 24)
}
#[inline(always)]
pub fn cecsel(&mut self) -> CECSEL_W<DCKCFGR2rs> {
CECSEL_W::new(self, 26)
}
#[inline(always)]
pub fn ck48msel(&mut self) -> CK48MSEL_W<DCKCFGR2rs> {
CK48MSEL_W::new(self, 27)
}
#[inline(always)]
pub fn sdmmc1sel(&mut self) -> SDMMC1SEL_W<DCKCFGR2rs> {
SDMMC1SEL_W::new(self, 28)
}
#[inline(always)]
pub fn sdmmc2sel(&mut self) -> SDMMC2SEL_W<DCKCFGR2rs> {
SDMMC2SEL_W::new(self, 29)
}
#[inline(always)]
pub fn dsisel(&mut self) -> DSISEL_W<DCKCFGR2rs> {
DSISEL_W::new(self, 30)
}
}
pub struct DCKCFGR2rs;
impl crate::RegisterSpec for DCKCFGR2rs {
type Ux = u32;
}
impl crate::Readable for DCKCFGR2rs {}
impl crate::Writable for DCKCFGR2rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for DCKCFGR2rs {}