Skip to main content

lpc_usbd/pac/usb/
intsetstat.rs

1#[doc = "Register `INTSETSTAT` reader"]
2pub struct R(crate::pac::generic::R<INTSETSTAT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::pac::generic::R<INTSETSTAT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::pac::generic::R<INTSETSTAT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::pac::generic::R<INTSETSTAT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `INTSETSTAT` writer"]
17pub struct W(crate::pac::generic::W<INTSETSTAT_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::pac::generic::W<INTSETSTAT_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::pac::generic::W<INTSETSTAT_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::pac::generic::W<INTSETSTAT_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EP_SET_INT` reader - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
38pub struct EP_SET_INT_R(crate::pac::generic::FieldReader<u16, u16>);
39impl EP_SET_INT_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u16) -> Self {
42        EP_SET_INT_R(crate::pac::generic::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for EP_SET_INT_R {
46    type Target = crate::pac::generic::FieldReader<u16, u16>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `EP_SET_INT` writer - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
53pub struct EP_SET_INT_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> EP_SET_INT_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u16) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0x03ff) | (value as u32 & 0x03ff);
61        self.w
62    }
63}
64#[doc = "Field `FRAME_SET_INT` reader - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
65pub struct FRAME_SET_INT_R(crate::pac::generic::FieldReader<bool, bool>);
66impl FRAME_SET_INT_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: bool) -> Self {
69        FRAME_SET_INT_R(crate::pac::generic::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for FRAME_SET_INT_R {
73    type Target = crate::pac::generic::FieldReader<bool, bool>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `FRAME_SET_INT` writer - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
80pub struct FRAME_SET_INT_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> FRAME_SET_INT_W<'a> {
84    #[doc = r"Sets the field bit"]
85    #[inline(always)]
86    pub fn set_bit(self) -> &'a mut W {
87        self.bit(true)
88    }
89    #[doc = r"Clears the field bit"]
90    #[inline(always)]
91    pub fn clear_bit(self) -> &'a mut W {
92        self.bit(false)
93    }
94    #[doc = r"Writes raw bits to the field"]
95    #[inline(always)]
96    pub fn bit(self, value: bool) -> &'a mut W {
97        self.w.bits = (self.w.bits & !(0x01 << 30)) | ((value as u32 & 0x01) << 30);
98        self.w
99    }
100}
101#[doc = "Field `DEV_SET_INT` reader - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
102pub struct DEV_SET_INT_R(crate::pac::generic::FieldReader<bool, bool>);
103impl DEV_SET_INT_R {
104    #[inline(always)]
105    pub(crate) fn new(bits: bool) -> Self {
106        DEV_SET_INT_R(crate::pac::generic::FieldReader::new(bits))
107    }
108}
109impl core::ops::Deref for DEV_SET_INT_R {
110    type Target = crate::pac::generic::FieldReader<bool, bool>;
111    #[inline(always)]
112    fn deref(&self) -> &Self::Target {
113        &self.0
114    }
115}
116#[doc = "Field `DEV_SET_INT` writer - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
117pub struct DEV_SET_INT_W<'a> {
118    w: &'a mut W,
119}
120impl<'a> DEV_SET_INT_W<'a> {
121    #[doc = r"Sets the field bit"]
122    #[inline(always)]
123    pub fn set_bit(self) -> &'a mut W {
124        self.bit(true)
125    }
126    #[doc = r"Clears the field bit"]
127    #[inline(always)]
128    pub fn clear_bit(self) -> &'a mut W {
129        self.bit(false)
130    }
131    #[doc = r"Writes raw bits to the field"]
132    #[inline(always)]
133    pub fn bit(self, value: bool) -> &'a mut W {
134        self.w.bits = (self.w.bits & !(0x01 << 31)) | ((value as u32 & 0x01) << 31);
135        self.w
136    }
137}
138impl R {
139    #[doc = "Bits 0:9 - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
140    #[inline(always)]
141    pub fn ep_set_int(&self) -> EP_SET_INT_R {
142        EP_SET_INT_R::new((self.bits & 0x03ff) as u16)
143    }
144    #[doc = "Bit 30 - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
145    #[inline(always)]
146    pub fn frame_set_int(&self) -> FRAME_SET_INT_R {
147        FRAME_SET_INT_R::new(((self.bits >> 30) & 0x01) != 0)
148    }
149    #[doc = "Bit 31 - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
150    #[inline(always)]
151    pub fn dev_set_int(&self) -> DEV_SET_INT_R {
152        DEV_SET_INT_R::new(((self.bits >> 31) & 0x01) != 0)
153    }
154}
155impl W {
156    #[doc = "Bits 0:9 - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
157    #[inline(always)]
158    pub fn ep_set_int(&mut self) -> EP_SET_INT_W {
159        EP_SET_INT_W { w: self }
160    }
161    #[doc = "Bit 30 - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
162    #[inline(always)]
163    pub fn frame_set_int(&mut self) -> FRAME_SET_INT_W {
164        FRAME_SET_INT_W { w: self }
165    }
166    #[doc = "Bit 31 - If software writes a one to one of these bits, the corresponding USB interrupt status bit is set. When this register is read, the same value as the USB interrupt status register is returned."]
167    #[inline(always)]
168    pub fn dev_set_int(&mut self) -> DEV_SET_INT_W {
169        DEV_SET_INT_W { w: self }
170    }
171    #[doc = "Writes raw bits to the register."]
172    #[inline(always)]
173    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
174        self.0.bits(bits);
175        self
176    }
177}
178#[doc = "USB set interrupt status register\n\nThis register you can [`read`](crate::pac::generic::generic::Reg::read), [`write_with_zero`](crate::pac::generic::generic::Reg::write_with_zero), [`reset`](crate::pac::generic::generic::Reg::reset), [`write`](crate::pac::generic::generic::Reg::write), [`modify`](crate::pac::generic::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [intsetstat](index.html) module"]
179pub struct INTSETSTAT_SPEC;
180impl crate::pac::generic::RegisterSpec for INTSETSTAT_SPEC {
181    type Ux = u32;
182}
183#[doc = "`read()` method returns [intsetstat::R](R) reader structure"]
184impl crate::pac::generic::Readable for INTSETSTAT_SPEC {
185    type Reader = R;
186}
187#[doc = "`write(|w| ..)` method takes [intsetstat::W](W) writer structure"]
188impl crate::pac::generic::Writable for INTSETSTAT_SPEC {
189    type Writer = W;
190}
191#[doc = "`reset()` method sets INTSETSTAT to value 0"]
192impl crate::pac::generic::Resettable for INTSETSTAT_SPEC {
193    #[inline(always)]
194    fn reset_value() -> Self::Ux {
195        0
196    }
197}