#[doc = "Register `DIEP0CTL` reader"]
pub type R = crate::R<Diep0ctlSpec>;
#[doc = "Register `DIEP0CTL` writer"]
pub type W = crate::W<Diep0ctlSpec>;
#[doc = "Field `MPL` reader - Maximum packet length"]
pub type MplR = crate::FieldReader;
#[doc = "Field `MPL` writer - Maximum packet length"]
pub type MplW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
#[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 `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 `TXFNUM` reader - TxFIFO number"]
pub type TxfnumR = crate::FieldReader;
#[doc = "Field `TXFNUM` writer - TxFIFO number"]
pub type TxfnumW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
#[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 `EPD` writer - Endpoint disable"]
pub type EpdW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `EPEN` reader - Endpoint enable"]
pub type EpenR = 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 21 - STALL handshake"]
#[inline(always)]
pub fn stall(&self) -> StallR {
StallR::new(((self.bits >> 21) & 1) != 0)
}
#[doc = "Bits 22:25 - TxFIFO number"]
#[inline(always)]
pub fn txfnum(&self) -> TxfnumR {
TxfnumR::new(((self.bits >> 22) & 0x0f) as u8)
}
#[doc = "Bit 30 - Endpoint disable"]
#[inline(always)]
pub fn epd(&self) -> EpdR {
EpdR::new(((self.bits >> 30) & 1) != 0)
}
#[doc = "Bit 31 - Endpoint enable"]
#[inline(always)]
pub fn epen(&self) -> EpenR {
EpenR::new(((self.bits >> 31) & 1) != 0)
}
}
impl W {
#[doc = "Bits 0:1 - Maximum packet length"]
#[inline(always)]
#[must_use]
pub fn mpl(&mut self) -> MplW<Diep0ctlSpec> {
MplW::new(self, 0)
}
#[doc = "Bit 21 - STALL handshake"]
#[inline(always)]
#[must_use]
pub fn stall(&mut self) -> StallW<Diep0ctlSpec> {
StallW::new(self, 21)
}
#[doc = "Bits 22:25 - TxFIFO number"]
#[inline(always)]
#[must_use]
pub fn txfnum(&mut self) -> TxfnumW<Diep0ctlSpec> {
TxfnumW::new(self, 22)
}
#[doc = "Bit 26 - Clear NAK"]
#[inline(always)]
#[must_use]
pub fn cnak(&mut self) -> CnakW<Diep0ctlSpec> {
CnakW::new(self, 26)
}
#[doc = "Bit 27 - Set NAK"]
#[inline(always)]
#[must_use]
pub fn snak(&mut self) -> SnakW<Diep0ctlSpec> {
SnakW::new(self, 27)
}
#[doc = "Bit 30 - Endpoint disable"]
#[inline(always)]
#[must_use]
pub fn epd(&mut self) -> EpdW<Diep0ctlSpec> {
EpdW::new(self, 30)
}
#[doc = "Bit 31 - Endpoint enable"]
#[inline(always)]
#[must_use]
pub fn epen(&mut self) -> EpenW<Diep0ctlSpec> {
EpenW::new(self, 31)
}
}
#[doc = "device IN endpoint 0 control register (DIEP0CTL)\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`diep0ctl::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 [`diep0ctl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Diep0ctlSpec;
impl crate::RegisterSpec for Diep0ctlSpec {
type Ux = u32;
}
#[doc = "`read()` method returns [`diep0ctl::R`](R) reader structure"]
impl crate::Readable for Diep0ctlSpec {}
#[doc = "`write(|w| ..)` method takes [`diep0ctl::W`](W) writer structure"]
impl crate::Writable for Diep0ctlSpec {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets DIEP0CTL to value 0x8000"]
impl crate::Resettable for Diep0ctlSpec {
const RESET_VALUE: u32 = 0x8000;
}