nrf52840_pac/nfct/
sleepstate.rs1#[doc = "Register `SLEEPSTATE` reader"]
2pub struct R(crate::R<SLEEPSTATE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SLEEPSTATE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SLEEPSTATE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SLEEPSTATE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `SLEEPSTATE` reader - Reflects the sleep state during automatic collision resolution. Set to IDLE by a GOIDLE task. Set to SLEEP_A when a valid SLEEP_REQ frame is received or by a GOSLEEP task."]
17pub type SLEEPSTATE_R = crate::BitReader<SLEEPSTATE_A>;
18#[doc = "Reflects the sleep state during automatic collision resolution. Set to IDLE by a GOIDLE task. Set to SLEEP_A when a valid SLEEP_REQ frame is received or by a GOSLEEP task.\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20pub enum SLEEPSTATE_A {
21 #[doc = "0: State is IDLE."]
22 IDLE = 0,
23 #[doc = "1: State is SLEEP_A."]
24 SLEEP_A = 1,
25}
26impl From<SLEEPSTATE_A> for bool {
27 #[inline(always)]
28 fn from(variant: SLEEPSTATE_A) -> Self {
29 variant as u8 != 0
30 }
31}
32impl SLEEPSTATE_R {
33 #[doc = "Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> SLEEPSTATE_A {
36 match self.bits {
37 false => SLEEPSTATE_A::IDLE,
38 true => SLEEPSTATE_A::SLEEP_A,
39 }
40 }
41 #[doc = "Checks if the value of the field is `IDLE`"]
42 #[inline(always)]
43 pub fn is_idle(&self) -> bool {
44 *self == SLEEPSTATE_A::IDLE
45 }
46 #[doc = "Checks if the value of the field is `SLEEP_A`"]
47 #[inline(always)]
48 pub fn is_sleep_a(&self) -> bool {
49 *self == SLEEPSTATE_A::SLEEP_A
50 }
51}
52impl R {
53 #[doc = "Bit 0 - Reflects the sleep state during automatic collision resolution. Set to IDLE by a GOIDLE task. Set to SLEEP_A when a valid SLEEP_REQ frame is received or by a GOSLEEP task."]
54 #[inline(always)]
55 pub fn sleepstate(&self) -> SLEEPSTATE_R {
56 SLEEPSTATE_R::new((self.bits & 1) != 0)
57 }
58}
59#[doc = "Sleep state during automatic collision resolution\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 [sleepstate](index.html) module"]
60pub struct SLEEPSTATE_SPEC;
61impl crate::RegisterSpec for SLEEPSTATE_SPEC {
62 type Ux = u32;
63}
64#[doc = "`read()` method returns [sleepstate::R](R) reader structure"]
65impl crate::Readable for SLEEPSTATE_SPEC {
66 type Reader = R;
67}
68#[doc = "`reset()` method sets SLEEPSTATE to value 0"]
69impl crate::Resettable for SLEEPSTATE_SPEC {
70 #[inline(always)]
71 fn reset_value() -> Self::Ux {
72 0
73 }
74}