nrf5340_app_pac/usbregulator_ns/
intenset.rs1#[doc = "Register `INTENSET` reader"]
2pub struct R(crate::R<INTENSET_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<INTENSET_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<INTENSET_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<INTENSET_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `INTENSET` writer"]
17pub struct W(crate::W<INTENSET_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<INTENSET_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::W<INTENSET_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<INTENSET_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `USBDETECTED` reader - Write '1' to enable interrupt for event USBDETECTED"]
38pub type USBDETECTED_R = crate::BitReader<USBDETECTED_A>;
39#[doc = "Write '1' to enable interrupt for event USBDETECTED\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum USBDETECTED_A {
42 #[doc = "0: Read: Disabled"]
43 DISABLED = 0,
44 #[doc = "1: Read: Enabled"]
45 ENABLED = 1,
46}
47impl From<USBDETECTED_A> for bool {
48 #[inline(always)]
49 fn from(variant: USBDETECTED_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl USBDETECTED_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> USBDETECTED_A {
57 match self.bits {
58 false => USBDETECTED_A::DISABLED,
59 true => USBDETECTED_A::ENABLED,
60 }
61 }
62 #[doc = "Checks if the value of the field is `DISABLED`"]
63 #[inline(always)]
64 pub fn is_disabled(&self) -> bool {
65 *self == USBDETECTED_A::DISABLED
66 }
67 #[doc = "Checks if the value of the field is `ENABLED`"]
68 #[inline(always)]
69 pub fn is_enabled(&self) -> bool {
70 *self == USBDETECTED_A::ENABLED
71 }
72}
73#[doc = "Write '1' to enable interrupt for event USBDETECTED\n\nValue on reset: 0"]
74#[derive(Clone, Copy, Debug, PartialEq)]
75pub enum USBDETECTED_AW {
76 #[doc = "1: Enable"]
77 SET = 1,
78}
79impl From<USBDETECTED_AW> for bool {
80 #[inline(always)]
81 fn from(variant: USBDETECTED_AW) -> Self {
82 variant as u8 != 0
83 }
84}
85#[doc = "Field `USBDETECTED` writer - Write '1' to enable interrupt for event USBDETECTED"]
86pub type USBDETECTED_W<'a, const O: u8> =
87 crate::BitWriter<'a, u32, INTENSET_SPEC, USBDETECTED_AW, O>;
88impl<'a, const O: u8> USBDETECTED_W<'a, O> {
89 #[doc = "Enable"]
90 #[inline(always)]
91 pub fn set(self) -> &'a mut W {
92 self.variant(USBDETECTED_AW::SET)
93 }
94}
95#[doc = "Field `USBREMOVED` reader - Write '1' to enable interrupt for event USBREMOVED"]
96pub type USBREMOVED_R = crate::BitReader<USBREMOVED_A>;
97#[doc = "Write '1' to enable interrupt for event USBREMOVED\n\nValue on reset: 0"]
98#[derive(Clone, Copy, Debug, PartialEq)]
99pub enum USBREMOVED_A {
100 #[doc = "0: Read: Disabled"]
101 DISABLED = 0,
102 #[doc = "1: Read: Enabled"]
103 ENABLED = 1,
104}
105impl From<USBREMOVED_A> for bool {
106 #[inline(always)]
107 fn from(variant: USBREMOVED_A) -> Self {
108 variant as u8 != 0
109 }
110}
111impl USBREMOVED_R {
112 #[doc = "Get enumerated values variant"]
113 #[inline(always)]
114 pub fn variant(&self) -> USBREMOVED_A {
115 match self.bits {
116 false => USBREMOVED_A::DISABLED,
117 true => USBREMOVED_A::ENABLED,
118 }
119 }
120 #[doc = "Checks if the value of the field is `DISABLED`"]
121 #[inline(always)]
122 pub fn is_disabled(&self) -> bool {
123 *self == USBREMOVED_A::DISABLED
124 }
125 #[doc = "Checks if the value of the field is `ENABLED`"]
126 #[inline(always)]
127 pub fn is_enabled(&self) -> bool {
128 *self == USBREMOVED_A::ENABLED
129 }
130}
131#[doc = "Write '1' to enable interrupt for event USBREMOVED\n\nValue on reset: 0"]
132#[derive(Clone, Copy, Debug, PartialEq)]
133pub enum USBREMOVED_AW {
134 #[doc = "1: Enable"]
135 SET = 1,
136}
137impl From<USBREMOVED_AW> for bool {
138 #[inline(always)]
139 fn from(variant: USBREMOVED_AW) -> Self {
140 variant as u8 != 0
141 }
142}
143#[doc = "Field `USBREMOVED` writer - Write '1' to enable interrupt for event USBREMOVED"]
144pub type USBREMOVED_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTENSET_SPEC, USBREMOVED_AW, O>;
145impl<'a, const O: u8> USBREMOVED_W<'a, O> {
146 #[doc = "Enable"]
147 #[inline(always)]
148 pub fn set(self) -> &'a mut W {
149 self.variant(USBREMOVED_AW::SET)
150 }
151}
152#[doc = "Field `USBPWRRDY` reader - Write '1' to enable interrupt for event USBPWRRDY"]
153pub type USBPWRRDY_R = crate::BitReader<USBPWRRDY_A>;
154#[doc = "Write '1' to enable interrupt for event USBPWRRDY\n\nValue on reset: 0"]
155#[derive(Clone, Copy, Debug, PartialEq)]
156pub enum USBPWRRDY_A {
157 #[doc = "0: Read: Disabled"]
158 DISABLED = 0,
159 #[doc = "1: Read: Enabled"]
160 ENABLED = 1,
161}
162impl From<USBPWRRDY_A> for bool {
163 #[inline(always)]
164 fn from(variant: USBPWRRDY_A) -> Self {
165 variant as u8 != 0
166 }
167}
168impl USBPWRRDY_R {
169 #[doc = "Get enumerated values variant"]
170 #[inline(always)]
171 pub fn variant(&self) -> USBPWRRDY_A {
172 match self.bits {
173 false => USBPWRRDY_A::DISABLED,
174 true => USBPWRRDY_A::ENABLED,
175 }
176 }
177 #[doc = "Checks if the value of the field is `DISABLED`"]
178 #[inline(always)]
179 pub fn is_disabled(&self) -> bool {
180 *self == USBPWRRDY_A::DISABLED
181 }
182 #[doc = "Checks if the value of the field is `ENABLED`"]
183 #[inline(always)]
184 pub fn is_enabled(&self) -> bool {
185 *self == USBPWRRDY_A::ENABLED
186 }
187}
188#[doc = "Write '1' to enable interrupt for event USBPWRRDY\n\nValue on reset: 0"]
189#[derive(Clone, Copy, Debug, PartialEq)]
190pub enum USBPWRRDY_AW {
191 #[doc = "1: Enable"]
192 SET = 1,
193}
194impl From<USBPWRRDY_AW> for bool {
195 #[inline(always)]
196 fn from(variant: USBPWRRDY_AW) -> Self {
197 variant as u8 != 0
198 }
199}
200#[doc = "Field `USBPWRRDY` writer - Write '1' to enable interrupt for event USBPWRRDY"]
201pub type USBPWRRDY_W<'a, const O: u8> = crate::BitWriter<'a, u32, INTENSET_SPEC, USBPWRRDY_AW, O>;
202impl<'a, const O: u8> USBPWRRDY_W<'a, O> {
203 #[doc = "Enable"]
204 #[inline(always)]
205 pub fn set(self) -> &'a mut W {
206 self.variant(USBPWRRDY_AW::SET)
207 }
208}
209impl R {
210 #[doc = "Bit 0 - Write '1' to enable interrupt for event USBDETECTED"]
211 #[inline(always)]
212 pub fn usbdetected(&self) -> USBDETECTED_R {
213 USBDETECTED_R::new((self.bits & 1) != 0)
214 }
215 #[doc = "Bit 1 - Write '1' to enable interrupt for event USBREMOVED"]
216 #[inline(always)]
217 pub fn usbremoved(&self) -> USBREMOVED_R {
218 USBREMOVED_R::new(((self.bits >> 1) & 1) != 0)
219 }
220 #[doc = "Bit 2 - Write '1' to enable interrupt for event USBPWRRDY"]
221 #[inline(always)]
222 pub fn usbpwrrdy(&self) -> USBPWRRDY_R {
223 USBPWRRDY_R::new(((self.bits >> 2) & 1) != 0)
224 }
225}
226impl W {
227 #[doc = "Bit 0 - Write '1' to enable interrupt for event USBDETECTED"]
228 #[inline(always)]
229 pub fn usbdetected(&mut self) -> USBDETECTED_W<0> {
230 USBDETECTED_W::new(self)
231 }
232 #[doc = "Bit 1 - Write '1' to enable interrupt for event USBREMOVED"]
233 #[inline(always)]
234 pub fn usbremoved(&mut self) -> USBREMOVED_W<1> {
235 USBREMOVED_W::new(self)
236 }
237 #[doc = "Bit 2 - Write '1' to enable interrupt for event USBPWRRDY"]
238 #[inline(always)]
239 pub fn usbpwrrdy(&mut self) -> USBPWRRDY_W<2> {
240 USBPWRRDY_W::new(self)
241 }
242 #[doc = "Writes raw bits to the register."]
243 #[inline(always)]
244 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
245 self.0.bits(bits);
246 self
247 }
248}
249#[doc = "Enable interrupt\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [intenset](index.html) module"]
250pub struct INTENSET_SPEC;
251impl crate::RegisterSpec for INTENSET_SPEC {
252 type Ux = u32;
253}
254#[doc = "`read()` method returns [intenset::R](R) reader structure"]
255impl crate::Readable for INTENSET_SPEC {
256 type Reader = R;
257}
258#[doc = "`write(|w| ..)` method takes [intenset::W](W) writer structure"]
259impl crate::Writable for INTENSET_SPEC {
260 type Writer = W;
261}
262#[doc = "`reset()` method sets INTENSET to value 0"]
263impl crate::Resettable for INTENSET_SPEC {
264 #[inline(always)]
265 fn reset_value() -> Self::Ux {
266 0
267 }
268}