efm32pg12_pac/prs/
ctrl.rs1#[doc = "Reader of register CTRL"]
2pub type R = crate::R<u32, super::CTRL>;
3#[doc = "Writer for register CTRL"]
4pub type W = crate::W<u32, super::CTRL>;
5#[doc = "Register CTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::CTRL {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `SEVONPRS`"]
14pub type SEVONPRS_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `SEVONPRS`"]
16pub struct SEVONPRS_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> SEVONPRS_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
34 self.w
35 }
36}
37#[doc = "SEVONPRS PRS Channel Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum SEVONPRSSEL_A {
41 #[doc = "0: PRS Channel 0 selected"]
42 PRSCH0 = 0,
43 #[doc = "1: PRS Channel 1 selected"]
44 PRSCH1 = 1,
45 #[doc = "2: PRS Channel 2 selected"]
46 PRSCH2 = 2,
47 #[doc = "3: PRS Channel 3 selected"]
48 PRSCH3 = 3,
49 #[doc = "4: PRS Channel 4 selected"]
50 PRSCH4 = 4,
51 #[doc = "5: PRS Channel 5 selected"]
52 PRSCH5 = 5,
53 #[doc = "6: PRS Channel 6 selected"]
54 PRSCH6 = 6,
55 #[doc = "7: PRS Channel 7 selected"]
56 PRSCH7 = 7,
57 #[doc = "8: PRS Channel 8 selected"]
58 PRSCH8 = 8,
59 #[doc = "9: PRS Channel 9 selected"]
60 PRSCH9 = 9,
61 #[doc = "10: PRS Channel 10 selected"]
62 PRSCH10 = 10,
63 #[doc = "11: PRS Channel 11 selected"]
64 PRSCH11 = 11,
65}
66impl From<SEVONPRSSEL_A> for u8 {
67 #[inline(always)]
68 fn from(variant: SEVONPRSSEL_A) -> Self {
69 variant as _
70 }
71}
72#[doc = "Reader of field `SEVONPRSSEL`"]
73pub type SEVONPRSSEL_R = crate::R<u8, SEVONPRSSEL_A>;
74impl SEVONPRSSEL_R {
75 #[doc = r"Get enumerated values variant"]
76 #[inline(always)]
77 pub fn variant(&self) -> crate::Variant<u8, SEVONPRSSEL_A> {
78 use crate::Variant::*;
79 match self.bits {
80 0 => Val(SEVONPRSSEL_A::PRSCH0),
81 1 => Val(SEVONPRSSEL_A::PRSCH1),
82 2 => Val(SEVONPRSSEL_A::PRSCH2),
83 3 => Val(SEVONPRSSEL_A::PRSCH3),
84 4 => Val(SEVONPRSSEL_A::PRSCH4),
85 5 => Val(SEVONPRSSEL_A::PRSCH5),
86 6 => Val(SEVONPRSSEL_A::PRSCH6),
87 7 => Val(SEVONPRSSEL_A::PRSCH7),
88 8 => Val(SEVONPRSSEL_A::PRSCH8),
89 9 => Val(SEVONPRSSEL_A::PRSCH9),
90 10 => Val(SEVONPRSSEL_A::PRSCH10),
91 11 => Val(SEVONPRSSEL_A::PRSCH11),
92 i => Res(i),
93 }
94 }
95 #[doc = "Checks if the value of the field is `PRSCH0`"]
96 #[inline(always)]
97 pub fn is_prsch0(&self) -> bool {
98 *self == SEVONPRSSEL_A::PRSCH0
99 }
100 #[doc = "Checks if the value of the field is `PRSCH1`"]
101 #[inline(always)]
102 pub fn is_prsch1(&self) -> bool {
103 *self == SEVONPRSSEL_A::PRSCH1
104 }
105 #[doc = "Checks if the value of the field is `PRSCH2`"]
106 #[inline(always)]
107 pub fn is_prsch2(&self) -> bool {
108 *self == SEVONPRSSEL_A::PRSCH2
109 }
110 #[doc = "Checks if the value of the field is `PRSCH3`"]
111 #[inline(always)]
112 pub fn is_prsch3(&self) -> bool {
113 *self == SEVONPRSSEL_A::PRSCH3
114 }
115 #[doc = "Checks if the value of the field is `PRSCH4`"]
116 #[inline(always)]
117 pub fn is_prsch4(&self) -> bool {
118 *self == SEVONPRSSEL_A::PRSCH4
119 }
120 #[doc = "Checks if the value of the field is `PRSCH5`"]
121 #[inline(always)]
122 pub fn is_prsch5(&self) -> bool {
123 *self == SEVONPRSSEL_A::PRSCH5
124 }
125 #[doc = "Checks if the value of the field is `PRSCH6`"]
126 #[inline(always)]
127 pub fn is_prsch6(&self) -> bool {
128 *self == SEVONPRSSEL_A::PRSCH6
129 }
130 #[doc = "Checks if the value of the field is `PRSCH7`"]
131 #[inline(always)]
132 pub fn is_prsch7(&self) -> bool {
133 *self == SEVONPRSSEL_A::PRSCH7
134 }
135 #[doc = "Checks if the value of the field is `PRSCH8`"]
136 #[inline(always)]
137 pub fn is_prsch8(&self) -> bool {
138 *self == SEVONPRSSEL_A::PRSCH8
139 }
140 #[doc = "Checks if the value of the field is `PRSCH9`"]
141 #[inline(always)]
142 pub fn is_prsch9(&self) -> bool {
143 *self == SEVONPRSSEL_A::PRSCH9
144 }
145 #[doc = "Checks if the value of the field is `PRSCH10`"]
146 #[inline(always)]
147 pub fn is_prsch10(&self) -> bool {
148 *self == SEVONPRSSEL_A::PRSCH10
149 }
150 #[doc = "Checks if the value of the field is `PRSCH11`"]
151 #[inline(always)]
152 pub fn is_prsch11(&self) -> bool {
153 *self == SEVONPRSSEL_A::PRSCH11
154 }
155}
156#[doc = "Write proxy for field `SEVONPRSSEL`"]
157pub struct SEVONPRSSEL_W<'a> {
158 w: &'a mut W,
159}
160impl<'a> SEVONPRSSEL_W<'a> {
161 #[doc = r"Writes `variant` to the field"]
162 #[inline(always)]
163 pub fn variant(self, variant: SEVONPRSSEL_A) -> &'a mut W {
164 unsafe { self.bits(variant.into()) }
165 }
166 #[doc = "PRS Channel 0 selected"]
167 #[inline(always)]
168 pub fn prsch0(self) -> &'a mut W {
169 self.variant(SEVONPRSSEL_A::PRSCH0)
170 }
171 #[doc = "PRS Channel 1 selected"]
172 #[inline(always)]
173 pub fn prsch1(self) -> &'a mut W {
174 self.variant(SEVONPRSSEL_A::PRSCH1)
175 }
176 #[doc = "PRS Channel 2 selected"]
177 #[inline(always)]
178 pub fn prsch2(self) -> &'a mut W {
179 self.variant(SEVONPRSSEL_A::PRSCH2)
180 }
181 #[doc = "PRS Channel 3 selected"]
182 #[inline(always)]
183 pub fn prsch3(self) -> &'a mut W {
184 self.variant(SEVONPRSSEL_A::PRSCH3)
185 }
186 #[doc = "PRS Channel 4 selected"]
187 #[inline(always)]
188 pub fn prsch4(self) -> &'a mut W {
189 self.variant(SEVONPRSSEL_A::PRSCH4)
190 }
191 #[doc = "PRS Channel 5 selected"]
192 #[inline(always)]
193 pub fn prsch5(self) -> &'a mut W {
194 self.variant(SEVONPRSSEL_A::PRSCH5)
195 }
196 #[doc = "PRS Channel 6 selected"]
197 #[inline(always)]
198 pub fn prsch6(self) -> &'a mut W {
199 self.variant(SEVONPRSSEL_A::PRSCH6)
200 }
201 #[doc = "PRS Channel 7 selected"]
202 #[inline(always)]
203 pub fn prsch7(self) -> &'a mut W {
204 self.variant(SEVONPRSSEL_A::PRSCH7)
205 }
206 #[doc = "PRS Channel 8 selected"]
207 #[inline(always)]
208 pub fn prsch8(self) -> &'a mut W {
209 self.variant(SEVONPRSSEL_A::PRSCH8)
210 }
211 #[doc = "PRS Channel 9 selected"]
212 #[inline(always)]
213 pub fn prsch9(self) -> &'a mut W {
214 self.variant(SEVONPRSSEL_A::PRSCH9)
215 }
216 #[doc = "PRS Channel 10 selected"]
217 #[inline(always)]
218 pub fn prsch10(self) -> &'a mut W {
219 self.variant(SEVONPRSSEL_A::PRSCH10)
220 }
221 #[doc = "PRS Channel 11 selected"]
222 #[inline(always)]
223 pub fn prsch11(self) -> &'a mut W {
224 self.variant(SEVONPRSSEL_A::PRSCH11)
225 }
226 #[doc = r"Writes raw bits to the field"]
227 #[inline(always)]
228 pub unsafe fn bits(self, value: u8) -> &'a mut W {
229 self.w.bits = (self.w.bits & !(0x0f << 1)) | (((value as u32) & 0x0f) << 1);
230 self.w
231 }
232}
233impl R {
234 #[doc = "Bit 0 - Set Event on PRS"]
235 #[inline(always)]
236 pub fn sevonprs(&self) -> SEVONPRS_R {
237 SEVONPRS_R::new((self.bits & 0x01) != 0)
238 }
239 #[doc = "Bits 1:4 - SEVONPRS PRS Channel Select"]
240 #[inline(always)]
241 pub fn sevonprssel(&self) -> SEVONPRSSEL_R {
242 SEVONPRSSEL_R::new(((self.bits >> 1) & 0x0f) as u8)
243 }
244}
245impl W {
246 #[doc = "Bit 0 - Set Event on PRS"]
247 #[inline(always)]
248 pub fn sevonprs(&mut self) -> SEVONPRS_W {
249 SEVONPRS_W { w: self }
250 }
251 #[doc = "Bits 1:4 - SEVONPRS PRS Channel Select"]
252 #[inline(always)]
253 pub fn sevonprssel(&mut self) -> SEVONPRSSEL_W {
254 SEVONPRSSEL_W { w: self }
255 }
256}