nrf52840_pac/radio/
txpower.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
#[doc = "Register `TXPOWER` reader"]
pub struct R(crate::R<TXPOWER_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<TXPOWER_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<TXPOWER_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<TXPOWER_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `TXPOWER` writer"]
pub struct W(crate::W<TXPOWER_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<TXPOWER_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl From<crate::W<TXPOWER_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<TXPOWER_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `TXPOWER` reader - RADIO output power"]
pub type TXPOWER_R = crate::FieldReader<u8, TXPOWER_A>;
#[doc = "RADIO output power\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum TXPOWER_A {
    #[doc = "8: +8 dBm"]
    POS8D_BM = 8,
    #[doc = "7: +7 dBm"]
    POS7D_BM = 7,
    #[doc = "6: +6 dBm"]
    POS6D_BM = 6,
    #[doc = "5: +5 dBm"]
    POS5D_BM = 5,
    #[doc = "4: +4 dBm"]
    POS4D_BM = 4,
    #[doc = "3: +3 dBm"]
    POS3D_BM = 3,
    #[doc = "2: +2 dBm"]
    POS2D_BM = 2,
    #[doc = "0: 0 dBm"]
    _0D_BM = 0,
    #[doc = "252: -4 dBm"]
    NEG4D_BM = 252,
    #[doc = "248: -8 dBm"]
    NEG8D_BM = 248,
    #[doc = "244: -12 dBm"]
    NEG12D_BM = 244,
    #[doc = "240: -16 dBm"]
    NEG16D_BM = 240,
    #[doc = "236: -20 dBm"]
    NEG20D_BM = 236,
    #[doc = "255: Deprecated enumerator - -40 dBm"]
    NEG30D_BM = 255,
    #[doc = "216: -40 dBm"]
    NEG40D_BM = 216,
}
impl From<TXPOWER_A> for u8 {
    #[inline(always)]
    fn from(variant: TXPOWER_A) -> Self {
        variant as _
    }
}
impl TXPOWER_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<TXPOWER_A> {
        match self.bits {
            8 => Some(TXPOWER_A::POS8D_BM),
            7 => Some(TXPOWER_A::POS7D_BM),
            6 => Some(TXPOWER_A::POS6D_BM),
            5 => Some(TXPOWER_A::POS5D_BM),
            4 => Some(TXPOWER_A::POS4D_BM),
            3 => Some(TXPOWER_A::POS3D_BM),
            2 => Some(TXPOWER_A::POS2D_BM),
            0 => Some(TXPOWER_A::_0D_BM),
            252 => Some(TXPOWER_A::NEG4D_BM),
            248 => Some(TXPOWER_A::NEG8D_BM),
            244 => Some(TXPOWER_A::NEG12D_BM),
            240 => Some(TXPOWER_A::NEG16D_BM),
            236 => Some(TXPOWER_A::NEG20D_BM),
            255 => Some(TXPOWER_A::NEG30D_BM),
            216 => Some(TXPOWER_A::NEG40D_BM),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `POS8D_BM`"]
    #[inline(always)]
    pub fn is_pos8d_bm(&self) -> bool {
        *self == TXPOWER_A::POS8D_BM
    }
    #[doc = "Checks if the value of the field is `POS7D_BM`"]
    #[inline(always)]
    pub fn is_pos7d_bm(&self) -> bool {
        *self == TXPOWER_A::POS7D_BM
    }
    #[doc = "Checks if the value of the field is `POS6D_BM`"]
    #[inline(always)]
    pub fn is_pos6d_bm(&self) -> bool {
        *self == TXPOWER_A::POS6D_BM
    }
    #[doc = "Checks if the value of the field is `POS5D_BM`"]
    #[inline(always)]
    pub fn is_pos5d_bm(&self) -> bool {
        *self == TXPOWER_A::POS5D_BM
    }
    #[doc = "Checks if the value of the field is `POS4D_BM`"]
    #[inline(always)]
    pub fn is_pos4d_bm(&self) -> bool {
        *self == TXPOWER_A::POS4D_BM
    }
    #[doc = "Checks if the value of the field is `POS3D_BM`"]
    #[inline(always)]
    pub fn is_pos3d_bm(&self) -> bool {
        *self == TXPOWER_A::POS3D_BM
    }
    #[doc = "Checks if the value of the field is `POS2D_BM`"]
    #[inline(always)]
    pub fn is_pos2d_bm(&self) -> bool {
        *self == TXPOWER_A::POS2D_BM
    }
    #[doc = "Checks if the value of the field is `_0D_BM`"]
    #[inline(always)]
    pub fn is_0d_bm(&self) -> bool {
        *self == TXPOWER_A::_0D_BM
    }
    #[doc = "Checks if the value of the field is `NEG4D_BM`"]
    #[inline(always)]
    pub fn is_neg4d_bm(&self) -> bool {
        *self == TXPOWER_A::NEG4D_BM
    }
    #[doc = "Checks if the value of the field is `NEG8D_BM`"]
    #[inline(always)]
    pub fn is_neg8d_bm(&self) -> bool {
        *self == TXPOWER_A::NEG8D_BM
    }
    #[doc = "Checks if the value of the field is `NEG12D_BM`"]
    #[inline(always)]
    pub fn is_neg12d_bm(&self) -> bool {
        *self == TXPOWER_A::NEG12D_BM
    }
    #[doc = "Checks if the value of the field is `NEG16D_BM`"]
    #[inline(always)]
    pub fn is_neg16d_bm(&self) -> bool {
        *self == TXPOWER_A::NEG16D_BM
    }
    #[doc = "Checks if the value of the field is `NEG20D_BM`"]
    #[inline(always)]
    pub fn is_neg20d_bm(&self) -> bool {
        *self == TXPOWER_A::NEG20D_BM
    }
    #[doc = "Checks if the value of the field is `NEG30D_BM`"]
    #[inline(always)]
    pub fn is_neg30d_bm(&self) -> bool {
        *self == TXPOWER_A::NEG30D_BM
    }
    #[doc = "Checks if the value of the field is `NEG40D_BM`"]
    #[inline(always)]
    pub fn is_neg40d_bm(&self) -> bool {
        *self == TXPOWER_A::NEG40D_BM
    }
}
#[doc = "Field `TXPOWER` writer - RADIO output power"]
pub type TXPOWER_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, TXPOWER_SPEC, u8, TXPOWER_A, 8, O>;
impl<'a, const O: u8> TXPOWER_W<'a, O> {
    #[doc = "+8 dBm"]
    #[inline(always)]
    pub fn pos8d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::POS8D_BM)
    }
    #[doc = "+7 dBm"]
    #[inline(always)]
    pub fn pos7d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::POS7D_BM)
    }
    #[doc = "+6 dBm"]
    #[inline(always)]
    pub fn pos6d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::POS6D_BM)
    }
    #[doc = "+5 dBm"]
    #[inline(always)]
    pub fn pos5d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::POS5D_BM)
    }
    #[doc = "+4 dBm"]
    #[inline(always)]
    pub fn pos4d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::POS4D_BM)
    }
    #[doc = "+3 dBm"]
    #[inline(always)]
    pub fn pos3d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::POS3D_BM)
    }
    #[doc = "+2 dBm"]
    #[inline(always)]
    pub fn pos2d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::POS2D_BM)
    }
    #[doc = "0 dBm"]
    #[inline(always)]
    pub fn _0d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::_0D_BM)
    }
    #[doc = "-4 dBm"]
    #[inline(always)]
    pub fn neg4d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::NEG4D_BM)
    }
    #[doc = "-8 dBm"]
    #[inline(always)]
    pub fn neg8d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::NEG8D_BM)
    }
    #[doc = "-12 dBm"]
    #[inline(always)]
    pub fn neg12d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::NEG12D_BM)
    }
    #[doc = "-16 dBm"]
    #[inline(always)]
    pub fn neg16d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::NEG16D_BM)
    }
    #[doc = "-20 dBm"]
    #[inline(always)]
    pub fn neg20d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::NEG20D_BM)
    }
    #[doc = "Deprecated enumerator - -40 dBm"]
    #[inline(always)]
    pub fn neg30d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::NEG30D_BM)
    }
    #[doc = "-40 dBm"]
    #[inline(always)]
    pub fn neg40d_bm(self) -> &'a mut W {
        self.variant(TXPOWER_A::NEG40D_BM)
    }
}
impl R {
    #[doc = "Bits 0:7 - RADIO output power"]
    #[inline(always)]
    pub fn txpower(&self) -> TXPOWER_R {
        TXPOWER_R::new((self.bits & 0xff) as u8)
    }
}
impl W {
    #[doc = "Bits 0:7 - RADIO output power"]
    #[inline(always)]
    pub fn txpower(&mut self) -> TXPOWER_W<0> {
        TXPOWER_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Output power\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 [txpower](index.html) module"]
pub struct TXPOWER_SPEC;
impl crate::RegisterSpec for TXPOWER_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [txpower::R](R) reader structure"]
impl crate::Readable for TXPOWER_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [txpower::W](W) writer structure"]
impl crate::Writable for TXPOWER_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets TXPOWER to value 0"]
impl crate::Resettable for TXPOWER_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}