nrf52840_pac/radio/
state.rs1#[doc = "Register `STATE` reader"]
2pub struct R(crate::R<STATE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<STATE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<STATE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<STATE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `STATE` reader - Current radio state"]
17pub type STATE_R = crate::FieldReader<u8, STATE_A>;
18#[doc = "Current radio state\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20#[repr(u8)]
21pub enum STATE_A {
22 #[doc = "0: RADIO is in the Disabled state"]
23 DISABLED = 0,
24 #[doc = "1: RADIO is in the RXRU state"]
25 RX_RU = 1,
26 #[doc = "2: RADIO is in the RXIDLE state"]
27 RX_IDLE = 2,
28 #[doc = "3: RADIO is in the RX state"]
29 RX = 3,
30 #[doc = "4: RADIO is in the RXDISABLED state"]
31 RX_DISABLE = 4,
32 #[doc = "9: RADIO is in the TXRU state"]
33 TX_RU = 9,
34 #[doc = "10: RADIO is in the TXIDLE state"]
35 TX_IDLE = 10,
36 #[doc = "11: RADIO is in the TX state"]
37 TX = 11,
38 #[doc = "12: RADIO is in the TXDISABLED state"]
39 TX_DISABLE = 12,
40}
41impl From<STATE_A> for u8 {
42 #[inline(always)]
43 fn from(variant: STATE_A) -> Self {
44 variant as _
45 }
46}
47impl STATE_R {
48 #[doc = "Get enumerated values variant"]
49 #[inline(always)]
50 pub fn variant(&self) -> Option<STATE_A> {
51 match self.bits {
52 0 => Some(STATE_A::DISABLED),
53 1 => Some(STATE_A::RX_RU),
54 2 => Some(STATE_A::RX_IDLE),
55 3 => Some(STATE_A::RX),
56 4 => Some(STATE_A::RX_DISABLE),
57 9 => Some(STATE_A::TX_RU),
58 10 => Some(STATE_A::TX_IDLE),
59 11 => Some(STATE_A::TX),
60 12 => Some(STATE_A::TX_DISABLE),
61 _ => None,
62 }
63 }
64 #[doc = "Checks if the value of the field is `DISABLED`"]
65 #[inline(always)]
66 pub fn is_disabled(&self) -> bool {
67 *self == STATE_A::DISABLED
68 }
69 #[doc = "Checks if the value of the field is `RX_RU`"]
70 #[inline(always)]
71 pub fn is_rx_ru(&self) -> bool {
72 *self == STATE_A::RX_RU
73 }
74 #[doc = "Checks if the value of the field is `RX_IDLE`"]
75 #[inline(always)]
76 pub fn is_rx_idle(&self) -> bool {
77 *self == STATE_A::RX_IDLE
78 }
79 #[doc = "Checks if the value of the field is `RX`"]
80 #[inline(always)]
81 pub fn is_rx(&self) -> bool {
82 *self == STATE_A::RX
83 }
84 #[doc = "Checks if the value of the field is `RX_DISABLE`"]
85 #[inline(always)]
86 pub fn is_rx_disable(&self) -> bool {
87 *self == STATE_A::RX_DISABLE
88 }
89 #[doc = "Checks if the value of the field is `TX_RU`"]
90 #[inline(always)]
91 pub fn is_tx_ru(&self) -> bool {
92 *self == STATE_A::TX_RU
93 }
94 #[doc = "Checks if the value of the field is `TX_IDLE`"]
95 #[inline(always)]
96 pub fn is_tx_idle(&self) -> bool {
97 *self == STATE_A::TX_IDLE
98 }
99 #[doc = "Checks if the value of the field is `TX`"]
100 #[inline(always)]
101 pub fn is_tx(&self) -> bool {
102 *self == STATE_A::TX
103 }
104 #[doc = "Checks if the value of the field is `TX_DISABLE`"]
105 #[inline(always)]
106 pub fn is_tx_disable(&self) -> bool {
107 *self == STATE_A::TX_DISABLE
108 }
109}
110impl R {
111 #[doc = "Bits 0:3 - Current radio state"]
112 #[inline(always)]
113 pub fn state(&self) -> STATE_R {
114 STATE_R::new((self.bits & 0x0f) as u8)
115 }
116}
117#[doc = "Current radio state\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 [state](index.html) module"]
118pub struct STATE_SPEC;
119impl crate::RegisterSpec for STATE_SPEC {
120 type Ux = u32;
121}
122#[doc = "`read()` method returns [state::R](R) reader structure"]
123impl crate::Readable for STATE_SPEC {
124 type Reader = R;
125}
126#[doc = "`reset()` method sets STATE to value 0"]
127impl crate::Resettable for STATE_SPEC {
128 #[inline(always)]
129 fn reset_value() -> Self::Ux {
130 0
131 }
132}