efm32gg12b510_pac/prs/
ctrl.rs1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `SEVONPRS` reader - Set Event on PRS"]
38pub type SEVONPRS_R = crate::BitReader<bool>;
39#[doc = "Field `SEVONPRS` writer - Set Event on PRS"]
40pub type SEVONPRS_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 0>;
41#[doc = "SEVONPRS PRS Channel Select\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43#[repr(u8)]
44pub enum SEVONPRSSEL_A {
45 #[doc = "0: PRS Channel 0 selected"]
46 PRSCH0 = 0,
47 #[doc = "1: PRS Channel 1 selected"]
48 PRSCH1 = 1,
49 #[doc = "2: PRS Channel 2 selected"]
50 PRSCH2 = 2,
51 #[doc = "3: PRS Channel 3 selected"]
52 PRSCH3 = 3,
53 #[doc = "4: PRS Channel 4 selected"]
54 PRSCH4 = 4,
55 #[doc = "5: PRS Channel 5 selected"]
56 PRSCH5 = 5,
57 #[doc = "6: PRS Channel 6 selected"]
58 PRSCH6 = 6,
59 #[doc = "7: PRS Channel 7 selected"]
60 PRSCH7 = 7,
61 #[doc = "8: PRS Channel 8 selected"]
62 PRSCH8 = 8,
63 #[doc = "9: PRS Channel 9 selected"]
64 PRSCH9 = 9,
65 #[doc = "10: PRS Channel 10 selected"]
66 PRSCH10 = 10,
67 #[doc = "11: PRS Channel 11 selected"]
68 PRSCH11 = 11,
69 #[doc = "12: PRS Channel 12 selected"]
70 PRSCH12 = 12,
71 #[doc = "13: PRS Channel 13 selected"]
72 PRSCH13 = 13,
73 #[doc = "14: PRS Channel 14 selected"]
74 PRSCH14 = 14,
75 #[doc = "15: PRS Channel 15 selected"]
76 PRSCH15 = 15,
77}
78impl From<SEVONPRSSEL_A> for u8 {
79 #[inline(always)]
80 fn from(variant: SEVONPRSSEL_A) -> Self {
81 variant as _
82 }
83}
84#[doc = "Field `SEVONPRSSEL` reader - SEVONPRS PRS Channel Select"]
85pub type SEVONPRSSEL_R = crate::FieldReader<u8, SEVONPRSSEL_A>;
86impl SEVONPRSSEL_R {
87 #[doc = "Get enumerated values variant"]
88 #[inline(always)]
89 pub fn variant(&self) -> SEVONPRSSEL_A {
90 match self.bits {
91 0 => SEVONPRSSEL_A::PRSCH0,
92 1 => SEVONPRSSEL_A::PRSCH1,
93 2 => SEVONPRSSEL_A::PRSCH2,
94 3 => SEVONPRSSEL_A::PRSCH3,
95 4 => SEVONPRSSEL_A::PRSCH4,
96 5 => SEVONPRSSEL_A::PRSCH5,
97 6 => SEVONPRSSEL_A::PRSCH6,
98 7 => SEVONPRSSEL_A::PRSCH7,
99 8 => SEVONPRSSEL_A::PRSCH8,
100 9 => SEVONPRSSEL_A::PRSCH9,
101 10 => SEVONPRSSEL_A::PRSCH10,
102 11 => SEVONPRSSEL_A::PRSCH11,
103 12 => SEVONPRSSEL_A::PRSCH12,
104 13 => SEVONPRSSEL_A::PRSCH13,
105 14 => SEVONPRSSEL_A::PRSCH14,
106 15 => SEVONPRSSEL_A::PRSCH15,
107 _ => unreachable!(),
108 }
109 }
110 #[doc = "Checks if the value of the field is `PRSCH0`"]
111 #[inline(always)]
112 pub fn is_prsch0(&self) -> bool {
113 *self == SEVONPRSSEL_A::PRSCH0
114 }
115 #[doc = "Checks if the value of the field is `PRSCH1`"]
116 #[inline(always)]
117 pub fn is_prsch1(&self) -> bool {
118 *self == SEVONPRSSEL_A::PRSCH1
119 }
120 #[doc = "Checks if the value of the field is `PRSCH2`"]
121 #[inline(always)]
122 pub fn is_prsch2(&self) -> bool {
123 *self == SEVONPRSSEL_A::PRSCH2
124 }
125 #[doc = "Checks if the value of the field is `PRSCH3`"]
126 #[inline(always)]
127 pub fn is_prsch3(&self) -> bool {
128 *self == SEVONPRSSEL_A::PRSCH3
129 }
130 #[doc = "Checks if the value of the field is `PRSCH4`"]
131 #[inline(always)]
132 pub fn is_prsch4(&self) -> bool {
133 *self == SEVONPRSSEL_A::PRSCH4
134 }
135 #[doc = "Checks if the value of the field is `PRSCH5`"]
136 #[inline(always)]
137 pub fn is_prsch5(&self) -> bool {
138 *self == SEVONPRSSEL_A::PRSCH5
139 }
140 #[doc = "Checks if the value of the field is `PRSCH6`"]
141 #[inline(always)]
142 pub fn is_prsch6(&self) -> bool {
143 *self == SEVONPRSSEL_A::PRSCH6
144 }
145 #[doc = "Checks if the value of the field is `PRSCH7`"]
146 #[inline(always)]
147 pub fn is_prsch7(&self) -> bool {
148 *self == SEVONPRSSEL_A::PRSCH7
149 }
150 #[doc = "Checks if the value of the field is `PRSCH8`"]
151 #[inline(always)]
152 pub fn is_prsch8(&self) -> bool {
153 *self == SEVONPRSSEL_A::PRSCH8
154 }
155 #[doc = "Checks if the value of the field is `PRSCH9`"]
156 #[inline(always)]
157 pub fn is_prsch9(&self) -> bool {
158 *self == SEVONPRSSEL_A::PRSCH9
159 }
160 #[doc = "Checks if the value of the field is `PRSCH10`"]
161 #[inline(always)]
162 pub fn is_prsch10(&self) -> bool {
163 *self == SEVONPRSSEL_A::PRSCH10
164 }
165 #[doc = "Checks if the value of the field is `PRSCH11`"]
166 #[inline(always)]
167 pub fn is_prsch11(&self) -> bool {
168 *self == SEVONPRSSEL_A::PRSCH11
169 }
170 #[doc = "Checks if the value of the field is `PRSCH12`"]
171 #[inline(always)]
172 pub fn is_prsch12(&self) -> bool {
173 *self == SEVONPRSSEL_A::PRSCH12
174 }
175 #[doc = "Checks if the value of the field is `PRSCH13`"]
176 #[inline(always)]
177 pub fn is_prsch13(&self) -> bool {
178 *self == SEVONPRSSEL_A::PRSCH13
179 }
180 #[doc = "Checks if the value of the field is `PRSCH14`"]
181 #[inline(always)]
182 pub fn is_prsch14(&self) -> bool {
183 *self == SEVONPRSSEL_A::PRSCH14
184 }
185 #[doc = "Checks if the value of the field is `PRSCH15`"]
186 #[inline(always)]
187 pub fn is_prsch15(&self) -> bool {
188 *self == SEVONPRSSEL_A::PRSCH15
189 }
190}
191#[doc = "Field `SEVONPRSSEL` writer - SEVONPRS PRS Channel Select"]
192pub type SEVONPRSSEL_W<'a> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, SEVONPRSSEL_A, 4, 1>;
193impl<'a> SEVONPRSSEL_W<'a> {
194 #[doc = "PRS Channel 0 selected"]
195 #[inline(always)]
196 pub fn prsch0(self) -> &'a mut W {
197 self.variant(SEVONPRSSEL_A::PRSCH0)
198 }
199 #[doc = "PRS Channel 1 selected"]
200 #[inline(always)]
201 pub fn prsch1(self) -> &'a mut W {
202 self.variant(SEVONPRSSEL_A::PRSCH1)
203 }
204 #[doc = "PRS Channel 2 selected"]
205 #[inline(always)]
206 pub fn prsch2(self) -> &'a mut W {
207 self.variant(SEVONPRSSEL_A::PRSCH2)
208 }
209 #[doc = "PRS Channel 3 selected"]
210 #[inline(always)]
211 pub fn prsch3(self) -> &'a mut W {
212 self.variant(SEVONPRSSEL_A::PRSCH3)
213 }
214 #[doc = "PRS Channel 4 selected"]
215 #[inline(always)]
216 pub fn prsch4(self) -> &'a mut W {
217 self.variant(SEVONPRSSEL_A::PRSCH4)
218 }
219 #[doc = "PRS Channel 5 selected"]
220 #[inline(always)]
221 pub fn prsch5(self) -> &'a mut W {
222 self.variant(SEVONPRSSEL_A::PRSCH5)
223 }
224 #[doc = "PRS Channel 6 selected"]
225 #[inline(always)]
226 pub fn prsch6(self) -> &'a mut W {
227 self.variant(SEVONPRSSEL_A::PRSCH6)
228 }
229 #[doc = "PRS Channel 7 selected"]
230 #[inline(always)]
231 pub fn prsch7(self) -> &'a mut W {
232 self.variant(SEVONPRSSEL_A::PRSCH7)
233 }
234 #[doc = "PRS Channel 8 selected"]
235 #[inline(always)]
236 pub fn prsch8(self) -> &'a mut W {
237 self.variant(SEVONPRSSEL_A::PRSCH8)
238 }
239 #[doc = "PRS Channel 9 selected"]
240 #[inline(always)]
241 pub fn prsch9(self) -> &'a mut W {
242 self.variant(SEVONPRSSEL_A::PRSCH9)
243 }
244 #[doc = "PRS Channel 10 selected"]
245 #[inline(always)]
246 pub fn prsch10(self) -> &'a mut W {
247 self.variant(SEVONPRSSEL_A::PRSCH10)
248 }
249 #[doc = "PRS Channel 11 selected"]
250 #[inline(always)]
251 pub fn prsch11(self) -> &'a mut W {
252 self.variant(SEVONPRSSEL_A::PRSCH11)
253 }
254 #[doc = "PRS Channel 12 selected"]
255 #[inline(always)]
256 pub fn prsch12(self) -> &'a mut W {
257 self.variant(SEVONPRSSEL_A::PRSCH12)
258 }
259 #[doc = "PRS Channel 13 selected"]
260 #[inline(always)]
261 pub fn prsch13(self) -> &'a mut W {
262 self.variant(SEVONPRSSEL_A::PRSCH13)
263 }
264 #[doc = "PRS Channel 14 selected"]
265 #[inline(always)]
266 pub fn prsch14(self) -> &'a mut W {
267 self.variant(SEVONPRSSEL_A::PRSCH14)
268 }
269 #[doc = "PRS Channel 15 selected"]
270 #[inline(always)]
271 pub fn prsch15(self) -> &'a mut W {
272 self.variant(SEVONPRSSEL_A::PRSCH15)
273 }
274}
275impl R {
276 #[doc = "Bit 0 - Set Event on PRS"]
277 #[inline(always)]
278 pub fn sevonprs(&self) -> SEVONPRS_R {
279 SEVONPRS_R::new((self.bits & 1) != 0)
280 }
281 #[doc = "Bits 1:4 - SEVONPRS PRS Channel Select"]
282 #[inline(always)]
283 pub fn sevonprssel(&self) -> SEVONPRSSEL_R {
284 SEVONPRSSEL_R::new(((self.bits >> 1) & 0x0f) as u8)
285 }
286}
287impl W {
288 #[doc = "Bit 0 - Set Event on PRS"]
289 #[inline(always)]
290 pub fn sevonprs(&mut self) -> SEVONPRS_W {
291 SEVONPRS_W::new(self)
292 }
293 #[doc = "Bits 1:4 - SEVONPRS PRS Channel Select"]
294 #[inline(always)]
295 pub fn sevonprssel(&mut self) -> SEVONPRSSEL_W {
296 SEVONPRSSEL_W::new(self)
297 }
298 #[doc = "Writes raw bits to the register."]
299 #[inline(always)]
300 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
301 self.0.bits(bits);
302 self
303 }
304}
305#[doc = "Control Register\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 [ctrl](index.html) module"]
306pub struct CTRL_SPEC;
307impl crate::RegisterSpec for CTRL_SPEC {
308 type Ux = u32;
309}
310#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
311impl crate::Readable for CTRL_SPEC {
312 type Reader = R;
313}
314#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
315impl crate::Writable for CTRL_SPEC {
316 type Writer = W;
317}
318#[doc = "`reset()` method sets CTRL to value 0"]
319impl crate::Resettable for CTRL_SPEC {
320 #[inline(always)]
321 fn reset_value() -> Self::Ux {
322 0
323 }
324}