pub type R = crate::R<D1CCIPRrs>;
pub type W = crate::W<D1CCIPRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum FMCSEL {
RccHclk3 = 0,
Pll1Q = 1,
Pll2R = 2,
Per = 3,
}
impl From<FMCSEL> for u8 {
#[inline(always)]
fn from(variant: FMCSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for FMCSEL {
type Ux = u8;
}
impl crate::IsEnum for FMCSEL {}
pub type FMCSEL_R = crate::FieldReader<FMCSEL>;
impl FMCSEL_R {
#[inline(always)]
pub const fn variant(&self) -> FMCSEL {
match self.bits {
0 => FMCSEL::RccHclk3,
1 => FMCSEL::Pll1Q,
2 => FMCSEL::Pll2R,
3 => FMCSEL::Per,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_rcc_hclk3(&self) -> bool {
*self == FMCSEL::RccHclk3
}
#[inline(always)]
pub fn is_pll1_q(&self) -> bool {
*self == FMCSEL::Pll1Q
}
#[inline(always)]
pub fn is_pll2_r(&self) -> bool {
*self == FMCSEL::Pll2R
}
#[inline(always)]
pub fn is_per(&self) -> bool {
*self == FMCSEL::Per
}
}
pub type FMCSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, FMCSEL, crate::Safe>;
impl<'a, REG> FMCSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn rcc_hclk3(self) -> &'a mut crate::W<REG> {
self.variant(FMCSEL::RccHclk3)
}
#[inline(always)]
pub fn pll1_q(self) -> &'a mut crate::W<REG> {
self.variant(FMCSEL::Pll1Q)
}
#[inline(always)]
pub fn pll2_r(self) -> &'a mut crate::W<REG> {
self.variant(FMCSEL::Pll2R)
}
#[inline(always)]
pub fn per(self) -> &'a mut crate::W<REG> {
self.variant(FMCSEL::Per)
}
}
pub use FMCSEL_R as QSPISEL_R;
pub use FMCSEL_W as QSPISEL_W;
pub type DSISEL_R = crate::BitReader;
pub type DSISEL_W<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SDMMCSEL {
Pll1Q = 0,
Pll2R = 1,
}
impl From<SDMMCSEL> for bool {
#[inline(always)]
fn from(variant: SDMMCSEL) -> Self {
variant as u8 != 0
}
}
pub type SDMMCSEL_R = crate::BitReader<SDMMCSEL>;
impl SDMMCSEL_R {
#[inline(always)]
pub const fn variant(&self) -> SDMMCSEL {
match self.bits {
false => SDMMCSEL::Pll1Q,
true => SDMMCSEL::Pll2R,
}
}
#[inline(always)]
pub fn is_pll1_q(&self) -> bool {
*self == SDMMCSEL::Pll1Q
}
#[inline(always)]
pub fn is_pll2_r(&self) -> bool {
*self == SDMMCSEL::Pll2R
}
}
pub type SDMMCSEL_W<'a, REG> = crate::BitWriter<'a, REG, SDMMCSEL>;
impl<'a, REG> SDMMCSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn pll1_q(self) -> &'a mut crate::W<REG> {
self.variant(SDMMCSEL::Pll1Q)
}
#[inline(always)]
pub fn pll2_r(self) -> &'a mut crate::W<REG> {
self.variant(SDMMCSEL::Pll2R)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CKPERSEL {
Hsi = 0,
Csi = 1,
Hse = 2,
}
impl From<CKPERSEL> for u8 {
#[inline(always)]
fn from(variant: CKPERSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for CKPERSEL {
type Ux = u8;
}
impl crate::IsEnum for CKPERSEL {}
pub type CKPERSEL_R = crate::FieldReader<CKPERSEL>;
impl CKPERSEL_R {
#[inline(always)]
pub const fn variant(&self) -> Option<CKPERSEL> {
match self.bits {
0 => Some(CKPERSEL::Hsi),
1 => Some(CKPERSEL::Csi),
2 => Some(CKPERSEL::Hse),
_ => None,
}
}
#[inline(always)]
pub fn is_hsi(&self) -> bool {
*self == CKPERSEL::Hsi
}
#[inline(always)]
pub fn is_csi(&self) -> bool {
*self == CKPERSEL::Csi
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == CKPERSEL::Hse
}
}
pub type CKPERSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CKPERSEL>;
impl<'a, REG> CKPERSEL_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(CKPERSEL::Hsi)
}
#[inline(always)]
pub fn csi(self) -> &'a mut crate::W<REG> {
self.variant(CKPERSEL::Csi)
}
#[inline(always)]
pub fn hse(self) -> &'a mut crate::W<REG> {
self.variant(CKPERSEL::Hse)
}
}
impl R {
#[inline(always)]
pub fn fmcsel(&self) -> FMCSEL_R {
FMCSEL_R::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn qspisel(&self) -> QSPISEL_R {
QSPISEL_R::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn dsisel(&self) -> DSISEL_R {
DSISEL_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn sdmmcsel(&self) -> SDMMCSEL_R {
SDMMCSEL_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn ckpersel(&self) -> CKPERSEL_R {
CKPERSEL_R::new(((self.bits >> 28) & 3) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("D1CCIPR")
.field("fmcsel", &self.fmcsel())
.field("qspisel", &self.qspisel())
.field("sdmmcsel", &self.sdmmcsel())
.field("ckpersel", &self.ckpersel())
.field("dsisel", &self.dsisel())
.finish()
}
}
impl W {
#[inline(always)]
pub fn fmcsel(&mut self) -> FMCSEL_W<D1CCIPRrs> {
FMCSEL_W::new(self, 0)
}
#[inline(always)]
pub fn qspisel(&mut self) -> QSPISEL_W<D1CCIPRrs> {
QSPISEL_W::new(self, 4)
}
#[inline(always)]
pub fn dsisel(&mut self) -> DSISEL_W<D1CCIPRrs> {
DSISEL_W::new(self, 8)
}
#[inline(always)]
pub fn sdmmcsel(&mut self) -> SDMMCSEL_W<D1CCIPRrs> {
SDMMCSEL_W::new(self, 16)
}
#[inline(always)]
pub fn ckpersel(&mut self) -> CKPERSEL_W<D1CCIPRrs> {
CKPERSEL_W::new(self, 28)
}
}
pub struct D1CCIPRrs;
impl crate::RegisterSpec for D1CCIPRrs {
type Ux = u32;
}
impl crate::Readable for D1CCIPRrs {}
impl crate::Writable for D1CCIPRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for D1CCIPRrs {}