#[doc = "Register `DOEP0CTL` reader"]
pub type R = crate::R<Doep0ctlSpec>;
#[doc = "Register `DOEP0CTL` writer"]
pub type W = crate::W<Doep0ctlSpec>;
#[doc = "Field `MPL` reader - Maximum packet length"]
pub type MplR = crate::FieldReader;
#[doc = "Field `EPACT` reader - Endpoint active"]
pub type EpactR = crate::BitReader;
#[doc = "Field `NAKS` reader - NAK status"]
pub type NaksR = crate::BitReader;
#[doc = "Field `EPTYPE` reader - Endpoint type"]
pub type EptypeR = crate::FieldReader;
#[doc = "Field `SNOOP` reader - Snoop mode"]
pub type SnoopR = crate::BitReader;
#[doc = "Field `SNOOP` writer - Snoop mode"]
pub type SnoopW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `STALL` reader - STALL handshake"]
pub type StallR = crate::BitReader;
#[doc = "Field `STALL` writer - STALL handshake"]
pub type StallW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `CNAK` writer - Clear NAK"]
pub type CnakW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `SNAK` writer - Set NAK"]
pub type SnakW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `EPD` reader - Endpoint disable"]
pub type EpdR = crate::BitReader;
#[doc = "Field `EPEN` writer - Endpoint enable"]
pub type EpenW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[doc = "Bits 0:1 - Maximum packet length"]
#[inline(always)]
pub fn mpl(&self) -> MplR {
MplR::new((self.bits & 3) as u8)
}
#[doc = "Bit 15 - Endpoint active"]
#[inline(always)]
pub fn epact(&self) -> EpactR {
EpactR::new(((self.bits >> 15) & 1) != 0)
}
#[doc = "Bit 17 - NAK status"]
#[inline(always)]
pub fn naks(&self) -> NaksR {
NaksR::new(((self.bits >> 17) & 1) != 0)
}
#[doc = "Bits 18:19 - Endpoint type"]
#[inline(always)]
pub fn eptype(&self) -> EptypeR {
EptypeR::new(((self.bits >> 18) & 3) as u8)
}
#[doc = "Bit 20 - Snoop mode"]
#[inline(always)]
pub fn snoop(&self) -> SnoopR {
SnoopR::new(((self.bits >> 20) & 1) != 0)
}
#[doc = "Bit 21 - STALL handshake"]
#[inline(always)]
pub fn stall(&self) -> StallR {
StallR::new(((self.bits >> 21) & 1) != 0)
}
#[doc = "Bit 30 - Endpoint disable"]
#[inline(always)]
pub fn epd(&self) -> EpdR {
EpdR::new(((self.bits >> 30) & 1) != 0)
}
}
impl W {
#[doc = "Bit 20 - Snoop mode"]
#[inline(always)]
#[must_use]
pub fn snoop(&mut self) -> SnoopW<Doep0ctlSpec> {
SnoopW::new(self, 20)
}
#[doc = "Bit 21 - STALL handshake"]
#[inline(always)]
#[must_use]
pub fn stall(&mut self) -> StallW<Doep0ctlSpec> {
StallW::new(self, 21)
}
#[doc = "Bit 26 - Clear NAK"]
#[inline(always)]
#[must_use]
pub fn cnak(&mut self) -> CnakW<Doep0ctlSpec> {
CnakW::new(self, 26)
}
#[doc = "Bit 27 - Set NAK"]
#[inline(always)]
#[must_use]
pub fn snak(&mut self) -> SnakW<Doep0ctlSpec> {
SnakW::new(self, 27)
}
#[doc = "Bit 31 - Endpoint enable"]
#[inline(always)]
#[must_use]
pub fn epen(&mut self) -> EpenW<Doep0ctlSpec> {
EpenW::new(self, 31)
}
}
#[doc = "device endpoint-0 control register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`doep0ctl::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`doep0ctl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Doep0ctlSpec;
impl crate::RegisterSpec for Doep0ctlSpec {
type Ux = u32;
}
#[doc = "`read()` method returns [`doep0ctl::R`](R) reader structure"]
impl crate::Readable for Doep0ctlSpec {}
#[doc = "`write(|w| ..)` method takes [`doep0ctl::W`](W) writer structure"]
impl crate::Writable for Doep0ctlSpec {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets DOEP0CTL to value 0x8000"]
impl crate::Resettable for Doep0ctlSpec {
const RESET_VALUE: u32 = 0x8000;
}