Skip to main content

atsamv71n21/usbhs/
usbhs_hsticr.rs

1#[doc = "Register `USBHS_HSTICR` writer"]
2pub struct W(crate::W<USBHS_HSTICR_SPEC>);
3impl core::ops::Deref for W {
4    type Target = crate::W<USBHS_HSTICR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl core::ops::DerefMut for W {
11    #[inline(always)]
12    fn deref_mut(&mut self) -> &mut Self::Target {
13        &mut self.0
14    }
15}
16impl From<crate::W<USBHS_HSTICR_SPEC>> for W {
17    #[inline(always)]
18    fn from(writer: crate::W<USBHS_HSTICR_SPEC>) -> Self {
19        W(writer)
20    }
21}
22#[doc = "Field `DCONNIC` writer - Device Connection Interrupt Clear"]
23pub struct DCONNIC_W<'a> {
24    w: &'a mut W,
25}
26impl<'a> DCONNIC_W<'a> {
27    #[doc = r"Sets the field bit"]
28    #[inline(always)]
29    pub fn set_bit(self) -> &'a mut W {
30        self.bit(true)
31    }
32    #[doc = r"Clears the field bit"]
33    #[inline(always)]
34    pub fn clear_bit(self) -> &'a mut W {
35        self.bit(false)
36    }
37    #[doc = r"Writes raw bits to the field"]
38    #[inline(always)]
39    pub fn bit(self, value: bool) -> &'a mut W {
40        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
41        self.w
42    }
43}
44#[doc = "Field `DDISCIC` writer - Device Disconnection Interrupt Clear"]
45pub struct DDISCIC_W<'a> {
46    w: &'a mut W,
47}
48impl<'a> DDISCIC_W<'a> {
49    #[doc = r"Sets the field bit"]
50    #[inline(always)]
51    pub fn set_bit(self) -> &'a mut W {
52        self.bit(true)
53    }
54    #[doc = r"Clears the field bit"]
55    #[inline(always)]
56    pub fn clear_bit(self) -> &'a mut W {
57        self.bit(false)
58    }
59    #[doc = r"Writes raw bits to the field"]
60    #[inline(always)]
61    pub fn bit(self, value: bool) -> &'a mut W {
62        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
63        self.w
64    }
65}
66#[doc = "Field `RSTIC` writer - USB Reset Sent Interrupt Clear"]
67pub struct RSTIC_W<'a> {
68    w: &'a mut W,
69}
70impl<'a> RSTIC_W<'a> {
71    #[doc = r"Sets the field bit"]
72    #[inline(always)]
73    pub fn set_bit(self) -> &'a mut W {
74        self.bit(true)
75    }
76    #[doc = r"Clears the field bit"]
77    #[inline(always)]
78    pub fn clear_bit(self) -> &'a mut W {
79        self.bit(false)
80    }
81    #[doc = r"Writes raw bits to the field"]
82    #[inline(always)]
83    pub fn bit(self, value: bool) -> &'a mut W {
84        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
85        self.w
86    }
87}
88#[doc = "Field `RSMEDIC` writer - Downstream Resume Sent Interrupt Clear"]
89pub struct RSMEDIC_W<'a> {
90    w: &'a mut W,
91}
92impl<'a> RSMEDIC_W<'a> {
93    #[doc = r"Sets the field bit"]
94    #[inline(always)]
95    pub fn set_bit(self) -> &'a mut W {
96        self.bit(true)
97    }
98    #[doc = r"Clears the field bit"]
99    #[inline(always)]
100    pub fn clear_bit(self) -> &'a mut W {
101        self.bit(false)
102    }
103    #[doc = r"Writes raw bits to the field"]
104    #[inline(always)]
105    pub fn bit(self, value: bool) -> &'a mut W {
106        self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
107        self.w
108    }
109}
110#[doc = "Field `RXRSMIC` writer - Upstream Resume Received Interrupt Clear"]
111pub struct RXRSMIC_W<'a> {
112    w: &'a mut W,
113}
114impl<'a> RXRSMIC_W<'a> {
115    #[doc = r"Sets the field bit"]
116    #[inline(always)]
117    pub fn set_bit(self) -> &'a mut W {
118        self.bit(true)
119    }
120    #[doc = r"Clears the field bit"]
121    #[inline(always)]
122    pub fn clear_bit(self) -> &'a mut W {
123        self.bit(false)
124    }
125    #[doc = r"Writes raw bits to the field"]
126    #[inline(always)]
127    pub fn bit(self, value: bool) -> &'a mut W {
128        self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
129        self.w
130    }
131}
132#[doc = "Field `HSOFIC` writer - Host Start of Frame Interrupt Clear"]
133pub struct HSOFIC_W<'a> {
134    w: &'a mut W,
135}
136impl<'a> HSOFIC_W<'a> {
137    #[doc = r"Sets the field bit"]
138    #[inline(always)]
139    pub fn set_bit(self) -> &'a mut W {
140        self.bit(true)
141    }
142    #[doc = r"Clears the field bit"]
143    #[inline(always)]
144    pub fn clear_bit(self) -> &'a mut W {
145        self.bit(false)
146    }
147    #[doc = r"Writes raw bits to the field"]
148    #[inline(always)]
149    pub fn bit(self, value: bool) -> &'a mut W {
150        self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
151        self.w
152    }
153}
154#[doc = "Field `HWUPIC` writer - Host Wake-Up Interrupt Clear"]
155pub struct HWUPIC_W<'a> {
156    w: &'a mut W,
157}
158impl<'a> HWUPIC_W<'a> {
159    #[doc = r"Sets the field bit"]
160    #[inline(always)]
161    pub fn set_bit(self) -> &'a mut W {
162        self.bit(true)
163    }
164    #[doc = r"Clears the field bit"]
165    #[inline(always)]
166    pub fn clear_bit(self) -> &'a mut W {
167        self.bit(false)
168    }
169    #[doc = r"Writes raw bits to the field"]
170    #[inline(always)]
171    pub fn bit(self, value: bool) -> &'a mut W {
172        self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
173        self.w
174    }
175}
176impl W {
177    #[doc = "Bit 0 - Device Connection Interrupt Clear"]
178    #[inline(always)]
179    pub fn dconnic(&mut self) -> DCONNIC_W {
180        DCONNIC_W { w: self }
181    }
182    #[doc = "Bit 1 - Device Disconnection Interrupt Clear"]
183    #[inline(always)]
184    pub fn ddiscic(&mut self) -> DDISCIC_W {
185        DDISCIC_W { w: self }
186    }
187    #[doc = "Bit 2 - USB Reset Sent Interrupt Clear"]
188    #[inline(always)]
189    pub fn rstic(&mut self) -> RSTIC_W {
190        RSTIC_W { w: self }
191    }
192    #[doc = "Bit 3 - Downstream Resume Sent Interrupt Clear"]
193    #[inline(always)]
194    pub fn rsmedic(&mut self) -> RSMEDIC_W {
195        RSMEDIC_W { w: self }
196    }
197    #[doc = "Bit 4 - Upstream Resume Received Interrupt Clear"]
198    #[inline(always)]
199    pub fn rxrsmic(&mut self) -> RXRSMIC_W {
200        RXRSMIC_W { w: self }
201    }
202    #[doc = "Bit 5 - Host Start of Frame Interrupt Clear"]
203    #[inline(always)]
204    pub fn hsofic(&mut self) -> HSOFIC_W {
205        HSOFIC_W { w: self }
206    }
207    #[doc = "Bit 6 - Host Wake-Up Interrupt Clear"]
208    #[inline(always)]
209    pub fn hwupic(&mut self) -> HWUPIC_W {
210        HWUPIC_W { w: self }
211    }
212    #[doc = "Writes raw bits to the register."]
213    #[inline(always)]
214    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
215        self.0.bits(bits);
216        self
217    }
218}
219#[doc = "Host Global Interrupt Clear Register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [usbhs_hsticr](index.html) module"]
220pub struct USBHS_HSTICR_SPEC;
221impl crate::RegisterSpec for USBHS_HSTICR_SPEC {
222    type Ux = u32;
223}
224#[doc = "`write(|w| ..)` method takes [usbhs_hsticr::W](W) writer structure"]
225impl crate::Writable for USBHS_HSTICR_SPEC {
226    type Writer = W;
227}
228#[doc = "`reset()` method sets USBHS_HSTICR to value 0"]
229impl crate::Resettable for USBHS_HSTICR_SPEC {
230    #[inline(always)]
231    fn reset_value() -> Self::Ux {
232        0
233    }
234}