nrf52840_pac/nfct/
fieldpresent.rs
1#[doc = "Register `FIELDPRESENT` reader"]
2pub struct R(crate::R<FIELDPRESENT_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<FIELDPRESENT_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<FIELDPRESENT_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<FIELDPRESENT_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `FIELDPRESENT` reader - Indicates if a valid field is present. Available only in the activated state."]
17pub type FIELDPRESENT_R = crate::BitReader<FIELDPRESENT_A>;
18#[doc = "Indicates if a valid field is present. Available only in the activated state.\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20pub enum FIELDPRESENT_A {
21 #[doc = "0: No valid field detected"]
22 NO_FIELD = 0,
23 #[doc = "1: Valid field detected"]
24 FIELD_PRESENT = 1,
25}
26impl From<FIELDPRESENT_A> for bool {
27 #[inline(always)]
28 fn from(variant: FIELDPRESENT_A) -> Self {
29 variant as u8 != 0
30 }
31}
32impl FIELDPRESENT_R {
33 #[doc = "Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> FIELDPRESENT_A {
36 match self.bits {
37 false => FIELDPRESENT_A::NO_FIELD,
38 true => FIELDPRESENT_A::FIELD_PRESENT,
39 }
40 }
41 #[doc = "Checks if the value of the field is `NO_FIELD`"]
42 #[inline(always)]
43 pub fn is_no_field(&self) -> bool {
44 *self == FIELDPRESENT_A::NO_FIELD
45 }
46 #[doc = "Checks if the value of the field is `FIELD_PRESENT`"]
47 #[inline(always)]
48 pub fn is_field_present(&self) -> bool {
49 *self == FIELDPRESENT_A::FIELD_PRESENT
50 }
51}
52#[doc = "Field `LOCKDETECT` reader - Indicates if the low level has locked to the field"]
53pub type LOCKDETECT_R = crate::BitReader<LOCKDETECT_A>;
54#[doc = "Indicates if the low level has locked to the field\n\nValue on reset: 0"]
55#[derive(Clone, Copy, Debug, PartialEq)]
56pub enum LOCKDETECT_A {
57 #[doc = "0: Not locked to field"]
58 NOT_LOCKED = 0,
59 #[doc = "1: Locked to field"]
60 LOCKED = 1,
61}
62impl From<LOCKDETECT_A> for bool {
63 #[inline(always)]
64 fn from(variant: LOCKDETECT_A) -> Self {
65 variant as u8 != 0
66 }
67}
68impl LOCKDETECT_R {
69 #[doc = "Get enumerated values variant"]
70 #[inline(always)]
71 pub fn variant(&self) -> LOCKDETECT_A {
72 match self.bits {
73 false => LOCKDETECT_A::NOT_LOCKED,
74 true => LOCKDETECT_A::LOCKED,
75 }
76 }
77 #[doc = "Checks if the value of the field is `NOT_LOCKED`"]
78 #[inline(always)]
79 pub fn is_not_locked(&self) -> bool {
80 *self == LOCKDETECT_A::NOT_LOCKED
81 }
82 #[doc = "Checks if the value of the field is `LOCKED`"]
83 #[inline(always)]
84 pub fn is_locked(&self) -> bool {
85 *self == LOCKDETECT_A::LOCKED
86 }
87}
88impl R {
89 #[doc = "Bit 0 - Indicates if a valid field is present. Available only in the activated state."]
90 #[inline(always)]
91 pub fn fieldpresent(&self) -> FIELDPRESENT_R {
92 FIELDPRESENT_R::new((self.bits & 1) != 0)
93 }
94 #[doc = "Bit 1 - Indicates if the low level has locked to the field"]
95 #[inline(always)]
96 pub fn lockdetect(&self) -> LOCKDETECT_R {
97 LOCKDETECT_R::new(((self.bits >> 1) & 1) != 0)
98 }
99}
100#[doc = "Indicates the presence or not of a valid field\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fieldpresent](index.html) module"]
101pub struct FIELDPRESENT_SPEC;
102impl crate::RegisterSpec for FIELDPRESENT_SPEC {
103 type Ux = u32;
104}
105#[doc = "`read()` method returns [fieldpresent::R](R) reader structure"]
106impl crate::Readable for FIELDPRESENT_SPEC {
107 type Reader = R;
108}
109#[doc = "`reset()` method sets FIELDPRESENT to value 0"]
110impl crate::Resettable for FIELDPRESENT_SPEC {
111 #[inline(always)]
112 fn reset_value() -> Self::Ux {
113 0
114 }
115}