nrf52/lpcomp/intenclr/
mod.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::INTENCLR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = "Possible values of the field `READY`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum READYR {
48 #[doc = "Read: Disabled"]
49 DISABLED,
50 #[doc = "Read: Enabled"]
51 ENABLED,
52}
53impl READYR {
54 #[doc = r" Returns `true` if the bit is clear (0)"]
55 #[inline]
56 pub fn bit_is_clear(&self) -> bool {
57 !self.bit()
58 }
59 #[doc = r" Returns `true` if the bit is set (1)"]
60 #[inline]
61 pub fn bit_is_set(&self) -> bool {
62 self.bit()
63 }
64 #[doc = r" Value of the field as raw bits"]
65 #[inline]
66 pub fn bit(&self) -> bool {
67 match *self {
68 READYR::DISABLED => false,
69 READYR::ENABLED => true,
70 }
71 }
72 #[allow(missing_docs)]
73 #[doc(hidden)]
74 #[inline]
75 pub fn _from(value: bool) -> READYR {
76 match value {
77 false => READYR::DISABLED,
78 true => READYR::ENABLED,
79 }
80 }
81 #[doc = "Checks if the value of the field is `DISABLED`"]
82 #[inline]
83 pub fn is_disabled(&self) -> bool {
84 *self == READYR::DISABLED
85 }
86 #[doc = "Checks if the value of the field is `ENABLED`"]
87 #[inline]
88 pub fn is_enabled(&self) -> bool {
89 *self == READYR::ENABLED
90 }
91}
92#[doc = "Possible values of the field `DOWN`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum DOWNR {
95 #[doc = "Read: Disabled"]
96 DISABLED,
97 #[doc = "Read: Enabled"]
98 ENABLED,
99}
100impl DOWNR {
101 #[doc = r" Returns `true` if the bit is clear (0)"]
102 #[inline]
103 pub fn bit_is_clear(&self) -> bool {
104 !self.bit()
105 }
106 #[doc = r" Returns `true` if the bit is set (1)"]
107 #[inline]
108 pub fn bit_is_set(&self) -> bool {
109 self.bit()
110 }
111 #[doc = r" Value of the field as raw bits"]
112 #[inline]
113 pub fn bit(&self) -> bool {
114 match *self {
115 DOWNR::DISABLED => false,
116 DOWNR::ENABLED => true,
117 }
118 }
119 #[allow(missing_docs)]
120 #[doc(hidden)]
121 #[inline]
122 pub fn _from(value: bool) -> DOWNR {
123 match value {
124 false => DOWNR::DISABLED,
125 true => DOWNR::ENABLED,
126 }
127 }
128 #[doc = "Checks if the value of the field is `DISABLED`"]
129 #[inline]
130 pub fn is_disabled(&self) -> bool {
131 *self == DOWNR::DISABLED
132 }
133 #[doc = "Checks if the value of the field is `ENABLED`"]
134 #[inline]
135 pub fn is_enabled(&self) -> bool {
136 *self == DOWNR::ENABLED
137 }
138}
139#[doc = "Possible values of the field `UP`"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum UPR {
142 #[doc = "Read: Disabled"]
143 DISABLED,
144 #[doc = "Read: Enabled"]
145 ENABLED,
146}
147impl UPR {
148 #[doc = r" Returns `true` if the bit is clear (0)"]
149 #[inline]
150 pub fn bit_is_clear(&self) -> bool {
151 !self.bit()
152 }
153 #[doc = r" Returns `true` if the bit is set (1)"]
154 #[inline]
155 pub fn bit_is_set(&self) -> bool {
156 self.bit()
157 }
158 #[doc = r" Value of the field as raw bits"]
159 #[inline]
160 pub fn bit(&self) -> bool {
161 match *self {
162 UPR::DISABLED => false,
163 UPR::ENABLED => true,
164 }
165 }
166 #[allow(missing_docs)]
167 #[doc(hidden)]
168 #[inline]
169 pub fn _from(value: bool) -> UPR {
170 match value {
171 false => UPR::DISABLED,
172 true => UPR::ENABLED,
173 }
174 }
175 #[doc = "Checks if the value of the field is `DISABLED`"]
176 #[inline]
177 pub fn is_disabled(&self) -> bool {
178 *self == UPR::DISABLED
179 }
180 #[doc = "Checks if the value of the field is `ENABLED`"]
181 #[inline]
182 pub fn is_enabled(&self) -> bool {
183 *self == UPR::ENABLED
184 }
185}
186#[doc = "Possible values of the field `CROSS`"]
187#[derive(Clone, Copy, Debug, PartialEq)]
188pub enum CROSSR {
189 #[doc = "Read: Disabled"]
190 DISABLED,
191 #[doc = "Read: Enabled"]
192 ENABLED,
193}
194impl CROSSR {
195 #[doc = r" Returns `true` if the bit is clear (0)"]
196 #[inline]
197 pub fn bit_is_clear(&self) -> bool {
198 !self.bit()
199 }
200 #[doc = r" Returns `true` if the bit is set (1)"]
201 #[inline]
202 pub fn bit_is_set(&self) -> bool {
203 self.bit()
204 }
205 #[doc = r" Value of the field as raw bits"]
206 #[inline]
207 pub fn bit(&self) -> bool {
208 match *self {
209 CROSSR::DISABLED => false,
210 CROSSR::ENABLED => true,
211 }
212 }
213 #[allow(missing_docs)]
214 #[doc(hidden)]
215 #[inline]
216 pub fn _from(value: bool) -> CROSSR {
217 match value {
218 false => CROSSR::DISABLED,
219 true => CROSSR::ENABLED,
220 }
221 }
222 #[doc = "Checks if the value of the field is `DISABLED`"]
223 #[inline]
224 pub fn is_disabled(&self) -> bool {
225 *self == CROSSR::DISABLED
226 }
227 #[doc = "Checks if the value of the field is `ENABLED`"]
228 #[inline]
229 pub fn is_enabled(&self) -> bool {
230 *self == CROSSR::ENABLED
231 }
232}
233#[doc = "Values that can be written to the field `READY`"]
234pub enum READYW {
235 #[doc = "Disable"]
236 CLEAR,
237}
238impl READYW {
239 #[allow(missing_docs)]
240 #[doc(hidden)]
241 #[inline]
242 pub fn _bits(&self) -> bool {
243 match *self {
244 READYW::CLEAR => true,
245 }
246 }
247}
248#[doc = r" Proxy"]
249pub struct _READYW<'a> {
250 w: &'a mut W,
251}
252impl<'a> _READYW<'a> {
253 #[doc = r" Writes `variant` to the field"]
254 #[inline]
255 pub fn variant(self, variant: READYW) -> &'a mut W {
256 {
257 self.bit(variant._bits())
258 }
259 }
260 #[doc = "Disable"]
261 #[inline]
262 pub fn clear(self) -> &'a mut W {
263 self.variant(READYW::CLEAR)
264 }
265 #[doc = r" Sets the field bit"]
266 pub fn set_bit(self) -> &'a mut W {
267 self.bit(true)
268 }
269 #[doc = r" Clears the field bit"]
270 pub fn clear_bit(self) -> &'a mut W {
271 self.bit(false)
272 }
273 #[doc = r" Writes raw bits to the field"]
274 #[inline]
275 pub fn bit(self, value: bool) -> &'a mut W {
276 const MASK: bool = true;
277 const OFFSET: u8 = 0;
278 self.w.bits &= !((MASK as u32) << OFFSET);
279 self.w.bits |= ((value & MASK) as u32) << OFFSET;
280 self.w
281 }
282}
283#[doc = "Values that can be written to the field `DOWN`"]
284pub enum DOWNW {
285 #[doc = "Disable"]
286 CLEAR,
287}
288impl DOWNW {
289 #[allow(missing_docs)]
290 #[doc(hidden)]
291 #[inline]
292 pub fn _bits(&self) -> bool {
293 match *self {
294 DOWNW::CLEAR => true,
295 }
296 }
297}
298#[doc = r" Proxy"]
299pub struct _DOWNW<'a> {
300 w: &'a mut W,
301}
302impl<'a> _DOWNW<'a> {
303 #[doc = r" Writes `variant` to the field"]
304 #[inline]
305 pub fn variant(self, variant: DOWNW) -> &'a mut W {
306 {
307 self.bit(variant._bits())
308 }
309 }
310 #[doc = "Disable"]
311 #[inline]
312 pub fn clear(self) -> &'a mut W {
313 self.variant(DOWNW::CLEAR)
314 }
315 #[doc = r" Sets the field bit"]
316 pub fn set_bit(self) -> &'a mut W {
317 self.bit(true)
318 }
319 #[doc = r" Clears the field bit"]
320 pub fn clear_bit(self) -> &'a mut W {
321 self.bit(false)
322 }
323 #[doc = r" Writes raw bits to the field"]
324 #[inline]
325 pub fn bit(self, value: bool) -> &'a mut W {
326 const MASK: bool = true;
327 const OFFSET: u8 = 1;
328 self.w.bits &= !((MASK as u32) << OFFSET);
329 self.w.bits |= ((value & MASK) as u32) << OFFSET;
330 self.w
331 }
332}
333#[doc = "Values that can be written to the field `UP`"]
334pub enum UPW {
335 #[doc = "Disable"]
336 CLEAR,
337}
338impl UPW {
339 #[allow(missing_docs)]
340 #[doc(hidden)]
341 #[inline]
342 pub fn _bits(&self) -> bool {
343 match *self {
344 UPW::CLEAR => true,
345 }
346 }
347}
348#[doc = r" Proxy"]
349pub struct _UPW<'a> {
350 w: &'a mut W,
351}
352impl<'a> _UPW<'a> {
353 #[doc = r" Writes `variant` to the field"]
354 #[inline]
355 pub fn variant(self, variant: UPW) -> &'a mut W {
356 {
357 self.bit(variant._bits())
358 }
359 }
360 #[doc = "Disable"]
361 #[inline]
362 pub fn clear(self) -> &'a mut W {
363 self.variant(UPW::CLEAR)
364 }
365 #[doc = r" Sets the field bit"]
366 pub fn set_bit(self) -> &'a mut W {
367 self.bit(true)
368 }
369 #[doc = r" Clears the field bit"]
370 pub fn clear_bit(self) -> &'a mut W {
371 self.bit(false)
372 }
373 #[doc = r" Writes raw bits to the field"]
374 #[inline]
375 pub fn bit(self, value: bool) -> &'a mut W {
376 const MASK: bool = true;
377 const OFFSET: u8 = 2;
378 self.w.bits &= !((MASK as u32) << OFFSET);
379 self.w.bits |= ((value & MASK) as u32) << OFFSET;
380 self.w
381 }
382}
383#[doc = "Values that can be written to the field `CROSS`"]
384pub enum CROSSW {
385 #[doc = "Disable"]
386 CLEAR,
387}
388impl CROSSW {
389 #[allow(missing_docs)]
390 #[doc(hidden)]
391 #[inline]
392 pub fn _bits(&self) -> bool {
393 match *self {
394 CROSSW::CLEAR => true,
395 }
396 }
397}
398#[doc = r" Proxy"]
399pub struct _CROSSW<'a> {
400 w: &'a mut W,
401}
402impl<'a> _CROSSW<'a> {
403 #[doc = r" Writes `variant` to the field"]
404 #[inline]
405 pub fn variant(self, variant: CROSSW) -> &'a mut W {
406 {
407 self.bit(variant._bits())
408 }
409 }
410 #[doc = "Disable"]
411 #[inline]
412 pub fn clear(self) -> &'a mut W {
413 self.variant(CROSSW::CLEAR)
414 }
415 #[doc = r" Sets the field bit"]
416 pub fn set_bit(self) -> &'a mut W {
417 self.bit(true)
418 }
419 #[doc = r" Clears the field bit"]
420 pub fn clear_bit(self) -> &'a mut W {
421 self.bit(false)
422 }
423 #[doc = r" Writes raw bits to the field"]
424 #[inline]
425 pub fn bit(self, value: bool) -> &'a mut W {
426 const MASK: bool = true;
427 const OFFSET: u8 = 3;
428 self.w.bits &= !((MASK as u32) << OFFSET);
429 self.w.bits |= ((value & MASK) as u32) << OFFSET;
430 self.w
431 }
432}
433impl R {
434 #[doc = r" Value of the register as raw bits"]
435 #[inline]
436 pub fn bits(&self) -> u32 {
437 self.bits
438 }
439 #[doc = "Bit 0 - Write '1' to Disable interrupt for READY event"]
440 #[inline]
441 pub fn ready(&self) -> READYR {
442 READYR::_from({
443 const MASK: bool = true;
444 const OFFSET: u8 = 0;
445 ((self.bits >> OFFSET) & MASK as u32) != 0
446 })
447 }
448 #[doc = "Bit 1 - Write '1' to Disable interrupt for DOWN event"]
449 #[inline]
450 pub fn down(&self) -> DOWNR {
451 DOWNR::_from({
452 const MASK: bool = true;
453 const OFFSET: u8 = 1;
454 ((self.bits >> OFFSET) & MASK as u32) != 0
455 })
456 }
457 #[doc = "Bit 2 - Write '1' to Disable interrupt for UP event"]
458 #[inline]
459 pub fn up(&self) -> UPR {
460 UPR::_from({
461 const MASK: bool = true;
462 const OFFSET: u8 = 2;
463 ((self.bits >> OFFSET) & MASK as u32) != 0
464 })
465 }
466 #[doc = "Bit 3 - Write '1' to Disable interrupt for CROSS event"]
467 #[inline]
468 pub fn cross(&self) -> CROSSR {
469 CROSSR::_from({
470 const MASK: bool = true;
471 const OFFSET: u8 = 3;
472 ((self.bits >> OFFSET) & MASK as u32) != 0
473 })
474 }
475}
476impl W {
477 #[doc = r" Reset value of the register"]
478 #[inline]
479 pub fn reset_value() -> W {
480 W { bits: 0 }
481 }
482 #[doc = r" Writes raw bits to the register"]
483 #[inline]
484 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
485 self.bits = bits;
486 self
487 }
488 #[doc = "Bit 0 - Write '1' to Disable interrupt for READY event"]
489 #[inline]
490 pub fn ready(&mut self) -> _READYW {
491 _READYW { w: self }
492 }
493 #[doc = "Bit 1 - Write '1' to Disable interrupt for DOWN event"]
494 #[inline]
495 pub fn down(&mut self) -> _DOWNW {
496 _DOWNW { w: self }
497 }
498 #[doc = "Bit 2 - Write '1' to Disable interrupt for UP event"]
499 #[inline]
500 pub fn up(&mut self) -> _UPW {
501 _UPW { w: self }
502 }
503 #[doc = "Bit 3 - Write '1' to Disable interrupt for CROSS event"]
504 #[inline]
505 pub fn cross(&mut self) -> _CROSSW {
506 _CROSSW { w: self }
507 }
508}