pub type R = crate::R<EPRrs>;
pub type W = crate::W<EPRrs>;
pub type EA_R = crate::FieldReader;
pub type EA_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum STAT_TXR {
Disabled = 0,
Stall = 1,
Nak = 2,
Valid = 3,
}
impl From<STAT_TXR> for u8 {
#[inline(always)]
fn from(variant: STAT_TXR) -> Self {
variant as _
}
}
impl crate::FieldSpec for STAT_TXR {
type Ux = u8;
}
impl crate::IsEnum for STAT_TXR {}
pub type STAT_TX_R = crate::FieldReader<STAT_TXR>;
impl STAT_TX_R {
#[inline(always)]
pub const fn variant(&self) -> STAT_TXR {
match self.bits {
0 => STAT_TXR::Disabled,
1 => STAT_TXR::Stall,
2 => STAT_TXR::Nak,
3 => STAT_TXR::Valid,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == STAT_TXR::Disabled
}
#[inline(always)]
pub fn is_stall(&self) -> bool {
*self == STAT_TXR::Stall
}
#[inline(always)]
pub fn is_nak(&self) -> bool {
*self == STAT_TXR::Nak
}
#[inline(always)]
pub fn is_valid(&self) -> bool {
*self == STAT_TXR::Valid
}
}
pub type STAT_TX_W<'a, REG> = crate::FieldWriter<'a, REG, 2, STAT_TXR, crate::Safe>;
impl<'a, REG> STAT_TX_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(STAT_TXR::Disabled)
}
#[inline(always)]
pub fn stall(self) -> &'a mut crate::W<REG> {
self.variant(STAT_TXR::Stall)
}
#[inline(always)]
pub fn nak(self) -> &'a mut crate::W<REG> {
self.variant(STAT_TXR::Nak)
}
#[inline(always)]
pub fn valid(self) -> &'a mut crate::W<REG> {
self.variant(STAT_TXR::Valid)
}
}
pub type DTOG_TX_R = crate::BitReader;
pub type DTOG_TX_W<'a, REG> = crate::BitWriter1T<'a, REG>;
pub type CTR_TX_R = crate::BitReader;
pub type CTR_TX_W<'a, REG> = crate::BitWriter0C<'a, REG>;
pub type EP_KIND_R = crate::BitReader;
pub type EP_KIND_W<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum EP_TYPE {
Bulk = 0,
Control = 1,
Iso = 2,
Interrupt = 3,
}
impl From<EP_TYPE> for u8 {
#[inline(always)]
fn from(variant: EP_TYPE) -> Self {
variant as _
}
}
impl crate::FieldSpec for EP_TYPE {
type Ux = u8;
}
impl crate::IsEnum for EP_TYPE {}
pub type EP_TYPE_R = crate::FieldReader<EP_TYPE>;
impl EP_TYPE_R {
#[inline(always)]
pub const fn variant(&self) -> EP_TYPE {
match self.bits {
0 => EP_TYPE::Bulk,
1 => EP_TYPE::Control,
2 => EP_TYPE::Iso,
3 => EP_TYPE::Interrupt,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_bulk(&self) -> bool {
*self == EP_TYPE::Bulk
}
#[inline(always)]
pub fn is_control(&self) -> bool {
*self == EP_TYPE::Control
}
#[inline(always)]
pub fn is_iso(&self) -> bool {
*self == EP_TYPE::Iso
}
#[inline(always)]
pub fn is_interrupt(&self) -> bool {
*self == EP_TYPE::Interrupt
}
}
pub type EP_TYPE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, EP_TYPE, crate::Safe>;
impl<'a, REG> EP_TYPE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn bulk(self) -> &'a mut crate::W<REG> {
self.variant(EP_TYPE::Bulk)
}
#[inline(always)]
pub fn control(self) -> &'a mut crate::W<REG> {
self.variant(EP_TYPE::Control)
}
#[inline(always)]
pub fn iso(self) -> &'a mut crate::W<REG> {
self.variant(EP_TYPE::Iso)
}
#[inline(always)]
pub fn interrupt(self) -> &'a mut crate::W<REG> {
self.variant(EP_TYPE::Interrupt)
}
}
pub type SETUP_R = crate::BitReader;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum STAT_RXR {
Disabled = 0,
Stall = 1,
Nak = 2,
Valid = 3,
}
impl From<STAT_RXR> for u8 {
#[inline(always)]
fn from(variant: STAT_RXR) -> Self {
variant as _
}
}
impl crate::FieldSpec for STAT_RXR {
type Ux = u8;
}
impl crate::IsEnum for STAT_RXR {}
pub type STAT_RX_R = crate::FieldReader<STAT_RXR>;
impl STAT_RX_R {
#[inline(always)]
pub const fn variant(&self) -> STAT_RXR {
match self.bits {
0 => STAT_RXR::Disabled,
1 => STAT_RXR::Stall,
2 => STAT_RXR::Nak,
3 => STAT_RXR::Valid,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == STAT_RXR::Disabled
}
#[inline(always)]
pub fn is_stall(&self) -> bool {
*self == STAT_RXR::Stall
}
#[inline(always)]
pub fn is_nak(&self) -> bool {
*self == STAT_RXR::Nak
}
#[inline(always)]
pub fn is_valid(&self) -> bool {
*self == STAT_RXR::Valid
}
}
pub type STAT_RX_W<'a, REG> = crate::FieldWriter<'a, REG, 2, STAT_RXR, crate::Safe>;
impl<'a, REG> STAT_RX_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(STAT_RXR::Disabled)
}
#[inline(always)]
pub fn stall(self) -> &'a mut crate::W<REG> {
self.variant(STAT_RXR::Stall)
}
#[inline(always)]
pub fn nak(self) -> &'a mut crate::W<REG> {
self.variant(STAT_RXR::Nak)
}
#[inline(always)]
pub fn valid(self) -> &'a mut crate::W<REG> {
self.variant(STAT_RXR::Valid)
}
}
pub type DTOG_RX_R = crate::BitReader;
pub type DTOG_RX_W<'a, REG> = crate::BitWriter1T<'a, REG>;
pub type CTR_RX_R = crate::BitReader;
pub type CTR_RX_W<'a, REG> = crate::BitWriter0C<'a, REG>;
impl R {
#[inline(always)]
pub fn ea(&self) -> EA_R {
EA_R::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn stat_tx(&self) -> STAT_TX_R {
STAT_TX_R::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn dtog_tx(&self) -> DTOG_TX_R {
DTOG_TX_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn ctr_tx(&self) -> CTR_TX_R {
CTR_TX_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn ep_kind(&self) -> EP_KIND_R {
EP_KIND_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn ep_type(&self) -> EP_TYPE_R {
EP_TYPE_R::new(((self.bits >> 9) & 3) as u8)
}
#[inline(always)]
pub fn setup(&self) -> SETUP_R {
SETUP_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn stat_rx(&self) -> STAT_RX_R {
STAT_RX_R::new(((self.bits >> 12) & 3) as u8)
}
#[inline(always)]
pub fn dtog_rx(&self) -> DTOG_RX_R {
DTOG_RX_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn ctr_rx(&self) -> CTR_RX_R {
CTR_RX_R::new(((self.bits >> 15) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("EPR")
.field("ea", &self.ea())
.field("stat_tx", &self.stat_tx())
.field("dtog_tx", &self.dtog_tx())
.field("ctr_tx", &self.ctr_tx())
.field("ep_kind", &self.ep_kind())
.field("ep_type", &self.ep_type())
.field("setup", &self.setup())
.field("stat_rx", &self.stat_rx())
.field("dtog_rx", &self.dtog_rx())
.field("ctr_rx", &self.ctr_rx())
.finish()
}
}
impl W {
#[inline(always)]
pub fn ea(&mut self) -> EA_W<EPRrs> {
EA_W::new(self, 0)
}
#[inline(always)]
pub fn stat_tx(&mut self) -> STAT_TX_W<EPRrs> {
STAT_TX_W::new(self, 4)
}
#[inline(always)]
pub fn dtog_tx(&mut self) -> DTOG_TX_W<EPRrs> {
DTOG_TX_W::new(self, 6)
}
#[inline(always)]
pub fn ctr_tx(&mut self) -> CTR_TX_W<EPRrs> {
CTR_TX_W::new(self, 7)
}
#[inline(always)]
pub fn ep_kind(&mut self) -> EP_KIND_W<EPRrs> {
EP_KIND_W::new(self, 8)
}
#[inline(always)]
pub fn ep_type(&mut self) -> EP_TYPE_W<EPRrs> {
EP_TYPE_W::new(self, 9)
}
#[inline(always)]
pub fn stat_rx(&mut self) -> STAT_RX_W<EPRrs> {
STAT_RX_W::new(self, 12)
}
#[inline(always)]
pub fn dtog_rx(&mut self) -> DTOG_RX_W<EPRrs> {
DTOG_RX_W::new(self, 14)
}
#[inline(always)]
pub fn ctr_rx(&mut self) -> CTR_RX_W<EPRrs> {
CTR_RX_W::new(self, 15)
}
}
pub struct EPRrs;
impl crate::RegisterSpec for EPRrs {
type Ux = u32;
}
impl crate::Readable for EPRrs {}
impl crate::Writable for EPRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0x8080;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x7070;
}
impl crate::Resettable for EPRrs {}