pub type R = crate::R<CFGR1rs>;
pub type W = crate::W<CFGR1rs>;
pub type HBITCLKDIV_R = crate::FieldReader;
pub type HBITCLKDIV_W<'a, REG> = crate::FieldWriter<'a, REG, 6, u8, crate::Safe>;
pub type IFRGAP_R = crate::FieldReader;
pub type IFRGAP_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
pub type TRANSWIN_R = crate::FieldReader;
pub type TRANSWIN_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PSC_USBPDCLK {
Div1 = 0,
Div2 = 1,
Div4 = 2,
Div8 = 3,
Div16 = 4,
}
impl From<PSC_USBPDCLK> for u8 {
#[inline(always)]
fn from(variant: PSC_USBPDCLK) -> Self {
variant as _
}
}
impl crate::FieldSpec for PSC_USBPDCLK {
type Ux = u8;
}
impl crate::IsEnum for PSC_USBPDCLK {}
pub type PSC_USBPDCLK_R = crate::FieldReader<PSC_USBPDCLK>;
impl PSC_USBPDCLK_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PSC_USBPDCLK> {
match self.bits {
0 => Some(PSC_USBPDCLK::Div1),
1 => Some(PSC_USBPDCLK::Div2),
2 => Some(PSC_USBPDCLK::Div4),
3 => Some(PSC_USBPDCLK::Div8),
4 => Some(PSC_USBPDCLK::Div16),
_ => None,
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == PSC_USBPDCLK::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == PSC_USBPDCLK::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == PSC_USBPDCLK::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == PSC_USBPDCLK::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == PSC_USBPDCLK::Div16
}
}
pub type PSC_USBPDCLK_W<'a, REG> = crate::FieldWriter<'a, REG, 3, PSC_USBPDCLK>;
impl<'a, REG> PSC_USBPDCLK_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(PSC_USBPDCLK::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(PSC_USBPDCLK::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(PSC_USBPDCLK::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(PSC_USBPDCLK::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(PSC_USBPDCLK::Div16)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXORDSETEN0 {
Disabled = 0,
Enabled = 1,
}
impl From<RXORDSETEN0> for bool {
#[inline(always)]
fn from(variant: RXORDSETEN0) -> Self {
variant as u8 != 0
}
}
pub type RXORDSETEN0_R = crate::BitReader<RXORDSETEN0>;
impl RXORDSETEN0_R {
#[inline(always)]
pub const fn variant(&self) -> RXORDSETEN0 {
match self.bits {
false => RXORDSETEN0::Disabled,
true => RXORDSETEN0::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == RXORDSETEN0::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == RXORDSETEN0::Enabled
}
}
pub type RXORDSETEN0_W<'a, REG> = crate::BitWriter<'a, REG, RXORDSETEN0>;
impl<'a, REG> RXORDSETEN0_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(RXORDSETEN0::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(RXORDSETEN0::Enabled)
}
}
pub use RXORDSETEN0_R as RXORDSETEN1_R;
pub use RXORDSETEN0_R as RXORDSETEN2_R;
pub use RXORDSETEN0_R as RXORDSETEN3_R;
pub use RXORDSETEN0_R as RXORDSETEN4_R;
pub use RXORDSETEN0_R as RXORDSETEN5_R;
pub use RXORDSETEN0_R as RXORDSETEN6_R;
pub use RXORDSETEN0_R as RXORDSETEN7_R;
pub use RXORDSETEN0_R as RXORDSETEN8_R;
pub use RXORDSETEN0_W as RXORDSETEN1_W;
pub use RXORDSETEN0_W as RXORDSETEN2_W;
pub use RXORDSETEN0_W as RXORDSETEN3_W;
pub use RXORDSETEN0_W as RXORDSETEN4_W;
pub use RXORDSETEN0_W as RXORDSETEN5_W;
pub use RXORDSETEN0_W as RXORDSETEN6_W;
pub use RXORDSETEN0_W as RXORDSETEN7_W;
pub use RXORDSETEN0_W as RXORDSETEN8_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TXDMAEN {
Disabled = 0,
Enabled = 1,
}
impl From<TXDMAEN> for bool {
#[inline(always)]
fn from(variant: TXDMAEN) -> Self {
variant as u8 != 0
}
}
pub type TXDMAEN_R = crate::BitReader<TXDMAEN>;
impl TXDMAEN_R {
#[inline(always)]
pub const fn variant(&self) -> TXDMAEN {
match self.bits {
false => TXDMAEN::Disabled,
true => TXDMAEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TXDMAEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TXDMAEN::Enabled
}
}
pub type TXDMAEN_W<'a, REG> = crate::BitWriter<'a, REG, TXDMAEN>;
impl<'a, REG> TXDMAEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(TXDMAEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(TXDMAEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXDMAEN {
Disabled = 0,
Enabled = 1,
}
impl From<RXDMAEN> for bool {
#[inline(always)]
fn from(variant: RXDMAEN) -> Self {
variant as u8 != 0
}
}
pub type RXDMAEN_R = crate::BitReader<RXDMAEN>;
impl RXDMAEN_R {
#[inline(always)]
pub const fn variant(&self) -> RXDMAEN {
match self.bits {
false => RXDMAEN::Disabled,
true => RXDMAEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == RXDMAEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == RXDMAEN::Enabled
}
}
pub type RXDMAEN_W<'a, REG> = crate::BitWriter<'a, REG, RXDMAEN>;
impl<'a, REG> RXDMAEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(RXDMAEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(RXDMAEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum UCPDEN {
Disabled = 0,
Enabled = 1,
}
impl From<UCPDEN> for bool {
#[inline(always)]
fn from(variant: UCPDEN) -> Self {
variant as u8 != 0
}
}
pub type UCPDEN_R = crate::BitReader<UCPDEN>;
impl UCPDEN_R {
#[inline(always)]
pub const fn variant(&self) -> UCPDEN {
match self.bits {
false => UCPDEN::Disabled,
true => UCPDEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == UCPDEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == UCPDEN::Enabled
}
}
pub type UCPDEN_W<'a, REG> = crate::BitWriter<'a, REG, UCPDEN>;
impl<'a, REG> UCPDEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(UCPDEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(UCPDEN::Enabled)
}
}
impl R {
#[inline(always)]
pub fn hbitclkdiv(&self) -> HBITCLKDIV_R {
HBITCLKDIV_R::new((self.bits & 0x3f) as u8)
}
#[inline(always)]
pub fn ifrgap(&self) -> IFRGAP_R {
IFRGAP_R::new(((self.bits >> 6) & 0x1f) as u8)
}
#[inline(always)]
pub fn transwin(&self) -> TRANSWIN_R {
TRANSWIN_R::new(((self.bits >> 11) & 0x1f) as u8)
}
#[inline(always)]
pub fn psc_usbpdclk(&self) -> PSC_USBPDCLK_R {
PSC_USBPDCLK_R::new(((self.bits >> 17) & 7) as u8)
}
#[inline(always)]
pub fn rxordseten0(&self) -> RXORDSETEN0_R {
RXORDSETEN0_R::new(((self.bits >> 20) & 1) != 0)
}
#[inline(always)]
pub fn rxordseten1(&self) -> RXORDSETEN1_R {
RXORDSETEN1_R::new(((self.bits >> 21) & 1) != 0)
}
#[inline(always)]
pub fn rxordseten2(&self) -> RXORDSETEN2_R {
RXORDSETEN2_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn rxordseten3(&self) -> RXORDSETEN3_R {
RXORDSETEN3_R::new(((self.bits >> 23) & 1) != 0)
}
#[inline(always)]
pub fn rxordseten4(&self) -> RXORDSETEN4_R {
RXORDSETEN4_R::new(((self.bits >> 24) & 1) != 0)
}
#[inline(always)]
pub fn rxordseten5(&self) -> RXORDSETEN5_R {
RXORDSETEN5_R::new(((self.bits >> 25) & 1) != 0)
}
#[inline(always)]
pub fn rxordseten6(&self) -> RXORDSETEN6_R {
RXORDSETEN6_R::new(((self.bits >> 26) & 1) != 0)
}
#[inline(always)]
pub fn rxordseten7(&self) -> RXORDSETEN7_R {
RXORDSETEN7_R::new(((self.bits >> 27) & 1) != 0)
}
#[inline(always)]
pub fn rxordseten8(&self) -> RXORDSETEN8_R {
RXORDSETEN8_R::new(((self.bits >> 28) & 1) != 0)
}
#[inline(always)]
pub fn txdmaen(&self) -> TXDMAEN_R {
TXDMAEN_R::new(((self.bits >> 29) & 1) != 0)
}
#[inline(always)]
pub fn rxdmaen(&self) -> RXDMAEN_R {
RXDMAEN_R::new(((self.bits >> 30) & 1) != 0)
}
#[inline(always)]
pub fn ucpden(&self) -> UCPDEN_R {
UCPDEN_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CFGR1")
.field("hbitclkdiv", &self.hbitclkdiv())
.field("ifrgap", &self.ifrgap())
.field("transwin", &self.transwin())
.field("psc_usbpdclk", &self.psc_usbpdclk())
.field("txdmaen", &self.txdmaen())
.field("rxdmaen", &self.rxdmaen())
.field("ucpden", &self.ucpden())
.field("rxordseten0", &self.rxordseten0())
.field("rxordseten1", &self.rxordseten1())
.field("rxordseten2", &self.rxordseten2())
.field("rxordseten3", &self.rxordseten3())
.field("rxordseten4", &self.rxordseten4())
.field("rxordseten5", &self.rxordseten5())
.field("rxordseten6", &self.rxordseten6())
.field("rxordseten7", &self.rxordseten7())
.field("rxordseten8", &self.rxordseten8())
.finish()
}
}
impl W {
#[inline(always)]
pub fn hbitclkdiv(&mut self) -> HBITCLKDIV_W<CFGR1rs> {
HBITCLKDIV_W::new(self, 0)
}
#[inline(always)]
pub fn ifrgap(&mut self) -> IFRGAP_W<CFGR1rs> {
IFRGAP_W::new(self, 6)
}
#[inline(always)]
pub fn transwin(&mut self) -> TRANSWIN_W<CFGR1rs> {
TRANSWIN_W::new(self, 11)
}
#[inline(always)]
pub fn psc_usbpdclk(&mut self) -> PSC_USBPDCLK_W<CFGR1rs> {
PSC_USBPDCLK_W::new(self, 17)
}
#[inline(always)]
pub fn rxordseten0(&mut self) -> RXORDSETEN0_W<CFGR1rs> {
RXORDSETEN0_W::new(self, 20)
}
#[inline(always)]
pub fn rxordseten1(&mut self) -> RXORDSETEN1_W<CFGR1rs> {
RXORDSETEN1_W::new(self, 21)
}
#[inline(always)]
pub fn rxordseten2(&mut self) -> RXORDSETEN2_W<CFGR1rs> {
RXORDSETEN2_W::new(self, 22)
}
#[inline(always)]
pub fn rxordseten3(&mut self) -> RXORDSETEN3_W<CFGR1rs> {
RXORDSETEN3_W::new(self, 23)
}
#[inline(always)]
pub fn rxordseten4(&mut self) -> RXORDSETEN4_W<CFGR1rs> {
RXORDSETEN4_W::new(self, 24)
}
#[inline(always)]
pub fn rxordseten5(&mut self) -> RXORDSETEN5_W<CFGR1rs> {
RXORDSETEN5_W::new(self, 25)
}
#[inline(always)]
pub fn rxordseten6(&mut self) -> RXORDSETEN6_W<CFGR1rs> {
RXORDSETEN6_W::new(self, 26)
}
#[inline(always)]
pub fn rxordseten7(&mut self) -> RXORDSETEN7_W<CFGR1rs> {
RXORDSETEN7_W::new(self, 27)
}
#[inline(always)]
pub fn rxordseten8(&mut self) -> RXORDSETEN8_W<CFGR1rs> {
RXORDSETEN8_W::new(self, 28)
}
#[inline(always)]
pub fn txdmaen(&mut self) -> TXDMAEN_W<CFGR1rs> {
TXDMAEN_W::new(self, 29)
}
#[inline(always)]
pub fn rxdmaen(&mut self) -> RXDMAEN_W<CFGR1rs> {
RXDMAEN_W::new(self, 30)
}
#[inline(always)]
pub fn ucpden(&mut self) -> UCPDEN_W<CFGR1rs> {
UCPDEN_W::new(self, 31)
}
}
pub struct CFGR1rs;
impl crate::RegisterSpec for CFGR1rs {
type Ux = u32;
}
impl crate::Readable for CFGR1rs {}
impl crate::Writable for CFGR1rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CFGR1rs {}