nrf52832_pac/radio/
mode.rs1#[doc = "Register `MODE` reader"]
2pub struct R(crate::R<MODE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<MODE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<MODE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<MODE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `MODE` writer"]
17pub struct W(crate::W<MODE_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<MODE_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<MODE_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<MODE_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `MODE` reader - Radio data rate and modulation setting. The radio supports Frequency-shift Keying (FSK) modulation."]
38pub type MODE_R = crate::FieldReader<u8, MODE_A>;
39#[doc = "Radio data rate and modulation setting. The radio supports Frequency-shift Keying (FSK) modulation.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u8)]
42pub enum MODE_A {
43 #[doc = "0: 1 Mbit/s Nordic proprietary radio mode"]
44 NRF_1MBIT = 0,
45 #[doc = "1: 2 Mbit/s Nordic proprietary radio mode"]
46 NRF_2MBIT = 1,
47 #[doc = "2: Deprecated enumerator - 250 kbit/s Nordic proprietary radio mode"]
48 NRF_250KBIT = 2,
49 #[doc = "3: 1 Mbit/s Bluetooth Low Energy"]
50 BLE_1MBIT = 3,
51 #[doc = "4: 2 Mbit/s Bluetooth Low Energy"]
52 BLE_2MBIT = 4,
53}
54impl From<MODE_A> for u8 {
55 #[inline(always)]
56 fn from(variant: MODE_A) -> Self {
57 variant as _
58 }
59}
60impl MODE_R {
61 #[doc = "Get enumerated values variant"]
62 #[inline(always)]
63 pub fn variant(&self) -> Option<MODE_A> {
64 match self.bits {
65 0 => Some(MODE_A::NRF_1MBIT),
66 1 => Some(MODE_A::NRF_2MBIT),
67 2 => Some(MODE_A::NRF_250KBIT),
68 3 => Some(MODE_A::BLE_1MBIT),
69 4 => Some(MODE_A::BLE_2MBIT),
70 _ => None,
71 }
72 }
73 #[doc = "Checks if the value of the field is `NRF_1MBIT`"]
74 #[inline(always)]
75 pub fn is_nrf_1mbit(&self) -> bool {
76 *self == MODE_A::NRF_1MBIT
77 }
78 #[doc = "Checks if the value of the field is `NRF_2MBIT`"]
79 #[inline(always)]
80 pub fn is_nrf_2mbit(&self) -> bool {
81 *self == MODE_A::NRF_2MBIT
82 }
83 #[doc = "Checks if the value of the field is `NRF_250KBIT`"]
84 #[inline(always)]
85 pub fn is_nrf_250kbit(&self) -> bool {
86 *self == MODE_A::NRF_250KBIT
87 }
88 #[doc = "Checks if the value of the field is `BLE_1MBIT`"]
89 #[inline(always)]
90 pub fn is_ble_1mbit(&self) -> bool {
91 *self == MODE_A::BLE_1MBIT
92 }
93 #[doc = "Checks if the value of the field is `BLE_2MBIT`"]
94 #[inline(always)]
95 pub fn is_ble_2mbit(&self) -> bool {
96 *self == MODE_A::BLE_2MBIT
97 }
98}
99#[doc = "Field `MODE` writer - Radio data rate and modulation setting. The radio supports Frequency-shift Keying (FSK) modulation."]
100pub type MODE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, MODE_SPEC, u8, MODE_A, 4, O>;
101impl<'a, const O: u8> MODE_W<'a, O> {
102 #[doc = "1 Mbit/s Nordic proprietary radio mode"]
103 #[inline(always)]
104 pub fn nrf_1mbit(self) -> &'a mut W {
105 self.variant(MODE_A::NRF_1MBIT)
106 }
107 #[doc = "2 Mbit/s Nordic proprietary radio mode"]
108 #[inline(always)]
109 pub fn nrf_2mbit(self) -> &'a mut W {
110 self.variant(MODE_A::NRF_2MBIT)
111 }
112 #[doc = "Deprecated enumerator - 250 kbit/s Nordic proprietary radio mode"]
113 #[inline(always)]
114 pub fn nrf_250kbit(self) -> &'a mut W {
115 self.variant(MODE_A::NRF_250KBIT)
116 }
117 #[doc = "1 Mbit/s Bluetooth Low Energy"]
118 #[inline(always)]
119 pub fn ble_1mbit(self) -> &'a mut W {
120 self.variant(MODE_A::BLE_1MBIT)
121 }
122 #[doc = "2 Mbit/s Bluetooth Low Energy"]
123 #[inline(always)]
124 pub fn ble_2mbit(self) -> &'a mut W {
125 self.variant(MODE_A::BLE_2MBIT)
126 }
127}
128impl R {
129 #[doc = "Bits 0:3 - Radio data rate and modulation setting. The radio supports Frequency-shift Keying (FSK) modulation."]
130 #[inline(always)]
131 pub fn mode(&self) -> MODE_R {
132 MODE_R::new((self.bits & 0x0f) as u8)
133 }
134}
135impl W {
136 #[doc = "Bits 0:3 - Radio data rate and modulation setting. The radio supports Frequency-shift Keying (FSK) modulation."]
137 #[inline(always)]
138 pub fn mode(&mut self) -> MODE_W<0> {
139 MODE_W::new(self)
140 }
141 #[doc = "Writes raw bits to the register."]
142 #[inline(always)]
143 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
144 self.0.bits(bits);
145 self
146 }
147}
148#[doc = "Data rate and modulation\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [mode](index.html) module"]
149pub struct MODE_SPEC;
150impl crate::RegisterSpec for MODE_SPEC {
151 type Ux = u32;
152}
153#[doc = "`read()` method returns [mode::R](R) reader structure"]
154impl crate::Readable for MODE_SPEC {
155 type Reader = R;
156}
157#[doc = "`write(|w| ..)` method takes [mode::W](W) writer structure"]
158impl crate::Writable for MODE_SPEC {
159 type Writer = W;
160}
161#[doc = "`reset()` method sets MODE to value 0"]
162impl crate::Resettable for MODE_SPEC {
163 #[inline(always)]
164 fn reset_value() -> Self::Ux {
165 0
166 }
167}