nrf52833_pac/nfct/
nfctagstate.rs

1#[doc = "Register `NFCTAGSTATE` reader"]
2pub struct R(crate::R<NFCTAGSTATE_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<NFCTAGSTATE_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<NFCTAGSTATE_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<NFCTAGSTATE_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `NFCTAGSTATE` reader - NfcTag state"]
17pub type NFCTAGSTATE_R = crate::FieldReader<u8, NFCTAGSTATE_A>;
18#[doc = "NfcTag state\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20#[repr(u8)]
21pub enum NFCTAGSTATE_A {
22    #[doc = "0: Disabled or sense"]
23    DISABLED = 0,
24    #[doc = "2: RampUp"]
25    RAMP_UP = 2,
26    #[doc = "3: Idle"]
27    IDLE = 3,
28    #[doc = "4: Receive"]
29    RECEIVE = 4,
30    #[doc = "5: FrameDelay"]
31    FRAME_DELAY = 5,
32    #[doc = "6: Transmit"]
33    TRANSMIT = 6,
34}
35impl From<NFCTAGSTATE_A> for u8 {
36    #[inline(always)]
37    fn from(variant: NFCTAGSTATE_A) -> Self {
38        variant as _
39    }
40}
41impl NFCTAGSTATE_R {
42    #[doc = "Get enumerated values variant"]
43    #[inline(always)]
44    pub fn variant(&self) -> Option<NFCTAGSTATE_A> {
45        match self.bits {
46            0 => Some(NFCTAGSTATE_A::DISABLED),
47            2 => Some(NFCTAGSTATE_A::RAMP_UP),
48            3 => Some(NFCTAGSTATE_A::IDLE),
49            4 => Some(NFCTAGSTATE_A::RECEIVE),
50            5 => Some(NFCTAGSTATE_A::FRAME_DELAY),
51            6 => Some(NFCTAGSTATE_A::TRANSMIT),
52            _ => None,
53        }
54    }
55    #[doc = "Checks if the value of the field is `DISABLED`"]
56    #[inline(always)]
57    pub fn is_disabled(&self) -> bool {
58        *self == NFCTAGSTATE_A::DISABLED
59    }
60    #[doc = "Checks if the value of the field is `RAMP_UP`"]
61    #[inline(always)]
62    pub fn is_ramp_up(&self) -> bool {
63        *self == NFCTAGSTATE_A::RAMP_UP
64    }
65    #[doc = "Checks if the value of the field is `IDLE`"]
66    #[inline(always)]
67    pub fn is_idle(&self) -> bool {
68        *self == NFCTAGSTATE_A::IDLE
69    }
70    #[doc = "Checks if the value of the field is `RECEIVE`"]
71    #[inline(always)]
72    pub fn is_receive(&self) -> bool {
73        *self == NFCTAGSTATE_A::RECEIVE
74    }
75    #[doc = "Checks if the value of the field is `FRAME_DELAY`"]
76    #[inline(always)]
77    pub fn is_frame_delay(&self) -> bool {
78        *self == NFCTAGSTATE_A::FRAME_DELAY
79    }
80    #[doc = "Checks if the value of the field is `TRANSMIT`"]
81    #[inline(always)]
82    pub fn is_transmit(&self) -> bool {
83        *self == NFCTAGSTATE_A::TRANSMIT
84    }
85}
86impl R {
87    #[doc = "Bits 0:2 - NfcTag state"]
88    #[inline(always)]
89    pub fn nfctagstate(&self) -> NFCTAGSTATE_R {
90        NFCTAGSTATE_R::new((self.bits & 7) as u8)
91    }
92}
93#[doc = "NfcTag state register\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 [nfctagstate](index.html) module"]
94pub struct NFCTAGSTATE_SPEC;
95impl crate::RegisterSpec for NFCTAGSTATE_SPEC {
96    type Ux = u32;
97}
98#[doc = "`read()` method returns [nfctagstate::R](R) reader structure"]
99impl crate::Readable for NFCTAGSTATE_SPEC {
100    type Reader = R;
101}
102#[doc = "`reset()` method sets NFCTAGSTATE to value 0"]
103impl crate::Resettable for NFCTAGSTATE_SPEC {
104    #[inline(always)]
105    fn reset_value() -> Self::Ux {
106        0
107    }
108}