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 FMPI2C1SEL {
Apb = 0,
Sysclk = 1,
Hsi = 2,
}
impl From<FMPI2C1SEL> for u8 {
#[inline(always)]
fn from(variant: FMPI2C1SEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for FMPI2C1SEL {
type Ux = u8;
}
impl crate::IsEnum for FMPI2C1SEL {}
pub type FMPI2C1SEL_R = crate::FieldReader<FMPI2C1SEL>;
impl FMPI2C1SEL_R {
#[inline(always)]
pub const fn variant(&self) -> Option<FMPI2C1SEL> {
match self.bits {
0 => Some(FMPI2C1SEL::Apb),
1 => Some(FMPI2C1SEL::Sysclk),
2 => Some(FMPI2C1SEL::Hsi),
_ => None,
}
}
#[inline(always)]
pub fn is_apb(&self) -> bool {
*self == FMPI2C1SEL::Apb
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == FMPI2C1SEL::Sysclk
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == FMPI2C1SEL::Hsi
}
}
pub type FMPI2C1SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, FMPI2C1SEL>;
impl<'a, REG> FMPI2C1SEL_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(FMPI2C1SEL::Apb)
}
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(FMPI2C1SEL::Sysclk)
}
#[inline(always)]
pub fn hsi(self) -> &'a mut crate::W<REG> {
self.variant(FMPI2C1SEL::Hsi)
}
}
#[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 SDIOSEL {
Ck48m = 0,
Sysclk = 1,
}
impl From<SDIOSEL> for bool {
#[inline(always)]
fn from(variant: SDIOSEL) -> Self {
variant as u8 != 0
}
}
pub type SDIOSEL_R = crate::BitReader<SDIOSEL>;
impl SDIOSEL_R {
#[inline(always)]
pub const fn variant(&self) -> SDIOSEL {
match self.bits {
false => SDIOSEL::Ck48m,
true => SDIOSEL::Sysclk,
}
}
#[inline(always)]
pub fn is_ck48m(&self) -> bool {
*self == SDIOSEL::Ck48m
}
#[inline(always)]
pub fn is_sysclk(&self) -> bool {
*self == SDIOSEL::Sysclk
}
}
pub type SDIOSEL_W<'a, REG> = crate::BitWriter<'a, REG, SDIOSEL>;
impl<'a, REG> SDIOSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn ck48m(self) -> &'a mut crate::W<REG> {
self.variant(SDIOSEL::Ck48m)
}
#[inline(always)]
pub fn sysclk(self) -> &'a mut crate::W<REG> {
self.variant(SDIOSEL::Sysclk)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SPDIFRXSEL {
Pll = 0,
Plli2s = 1,
}
impl From<SPDIFRXSEL> for bool {
#[inline(always)]
fn from(variant: SPDIFRXSEL) -> Self {
variant as u8 != 0
}
}
pub type SPDIFRXSEL_R = crate::BitReader<SPDIFRXSEL>;
impl SPDIFRXSEL_R {
#[inline(always)]
pub const fn variant(&self) -> SPDIFRXSEL {
match self.bits {
false => SPDIFRXSEL::Pll,
true => SPDIFRXSEL::Plli2s,
}
}
#[inline(always)]
pub fn is_pll(&self) -> bool {
*self == SPDIFRXSEL::Pll
}
#[inline(always)]
pub fn is_plli2s(&self) -> bool {
*self == SPDIFRXSEL::Plli2s
}
}
pub type SPDIFRXSEL_W<'a, REG> = crate::BitWriter<'a, REG, SPDIFRXSEL>;
impl<'a, REG> SPDIFRXSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn pll(self) -> &'a mut crate::W<REG> {
self.variant(SPDIFRXSEL::Pll)
}
#[inline(always)]
pub fn plli2s(self) -> &'a mut crate::W<REG> {
self.variant(SPDIFRXSEL::Plli2s)
}
}
impl R {
#[inline(always)]
pub fn fmpi2c1sel(&self) -> FMPI2C1SEL_R {
FMPI2C1SEL_R::new(((self.bits >> 22) & 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 sdiosel(&self) -> SDIOSEL_R {
SDIOSEL_R::new(((self.bits >> 28) & 1) != 0)
}
#[inline(always)]
pub fn spdifrxsel(&self) -> SPDIFRXSEL_R {
SPDIFRXSEL_R::new(((self.bits >> 29) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DCKCFGR2")
.field("fmpi2c1sel", &self.fmpi2c1sel())
.field("cecsel", &self.cecsel())
.field("ck48msel", &self.ck48msel())
.field("sdiosel", &self.sdiosel())
.field("spdifrxsel", &self.spdifrxsel())
.finish()
}
}
impl W {
#[inline(always)]
pub fn fmpi2c1sel(&mut self) -> FMPI2C1SEL_W<DCKCFGR2rs> {
FMPI2C1SEL_W::new(self, 22)
}
#[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 sdiosel(&mut self) -> SDIOSEL_W<DCKCFGR2rs> {
SDIOSEL_W::new(self, 28)
}
#[inline(always)]
pub fn spdifrxsel(&mut self) -> SPDIFRXSEL_W<DCKCFGR2rs> {
SPDIFRXSEL_W::new(self, 29)
}
}
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 {}