efm32jg12b_pac/efm32jg12b500/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, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
41#[doc = "Field `SEVONPRSSEL` reader - SEVONPRS PRS Channel Select"]
42pub type SEVONPRSSEL_R = crate::FieldReader<u8, SEVONPRSSEL_A>;
43#[doc = "SEVONPRS PRS Channel Select\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum SEVONPRSSEL_A {
47 #[doc = "0: PRS Channel 0 selected"]
48 PRSCH0 = 0,
49 #[doc = "1: PRS Channel 1 selected"]
50 PRSCH1 = 1,
51 #[doc = "2: PRS Channel 2 selected"]
52 PRSCH2 = 2,
53 #[doc = "3: PRS Channel 3 selected"]
54 PRSCH3 = 3,
55 #[doc = "4: PRS Channel 4 selected"]
56 PRSCH4 = 4,
57 #[doc = "5: PRS Channel 5 selected"]
58 PRSCH5 = 5,
59 #[doc = "6: PRS Channel 6 selected"]
60 PRSCH6 = 6,
61 #[doc = "7: PRS Channel 7 selected"]
62 PRSCH7 = 7,
63 #[doc = "8: PRS Channel 8 selected"]
64 PRSCH8 = 8,
65 #[doc = "9: PRS Channel 9 selected"]
66 PRSCH9 = 9,
67 #[doc = "10: PRS Channel 10 selected"]
68 PRSCH10 = 10,
69 #[doc = "11: PRS Channel 11 selected"]
70 PRSCH11 = 11,
71}
72impl From<SEVONPRSSEL_A> for u8 {
73 #[inline(always)]
74 fn from(variant: SEVONPRSSEL_A) -> Self {
75 variant as _
76 }
77}
78impl SEVONPRSSEL_R {
79 #[doc = "Get enumerated values variant"]
80 #[inline(always)]
81 pub fn variant(&self) -> Option<SEVONPRSSEL_A> {
82 match self.bits {
83 0 => Some(SEVONPRSSEL_A::PRSCH0),
84 1 => Some(SEVONPRSSEL_A::PRSCH1),
85 2 => Some(SEVONPRSSEL_A::PRSCH2),
86 3 => Some(SEVONPRSSEL_A::PRSCH3),
87 4 => Some(SEVONPRSSEL_A::PRSCH4),
88 5 => Some(SEVONPRSSEL_A::PRSCH5),
89 6 => Some(SEVONPRSSEL_A::PRSCH6),
90 7 => Some(SEVONPRSSEL_A::PRSCH7),
91 8 => Some(SEVONPRSSEL_A::PRSCH8),
92 9 => Some(SEVONPRSSEL_A::PRSCH9),
93 10 => Some(SEVONPRSSEL_A::PRSCH10),
94 11 => Some(SEVONPRSSEL_A::PRSCH11),
95 _ => None,
96 }
97 }
98 #[doc = "Checks if the value of the field is `PRSCH0`"]
99 #[inline(always)]
100 pub fn is_prsch0(&self) -> bool {
101 *self == SEVONPRSSEL_A::PRSCH0
102 }
103 #[doc = "Checks if the value of the field is `PRSCH1`"]
104 #[inline(always)]
105 pub fn is_prsch1(&self) -> bool {
106 *self == SEVONPRSSEL_A::PRSCH1
107 }
108 #[doc = "Checks if the value of the field is `PRSCH2`"]
109 #[inline(always)]
110 pub fn is_prsch2(&self) -> bool {
111 *self == SEVONPRSSEL_A::PRSCH2
112 }
113 #[doc = "Checks if the value of the field is `PRSCH3`"]
114 #[inline(always)]
115 pub fn is_prsch3(&self) -> bool {
116 *self == SEVONPRSSEL_A::PRSCH3
117 }
118 #[doc = "Checks if the value of the field is `PRSCH4`"]
119 #[inline(always)]
120 pub fn is_prsch4(&self) -> bool {
121 *self == SEVONPRSSEL_A::PRSCH4
122 }
123 #[doc = "Checks if the value of the field is `PRSCH5`"]
124 #[inline(always)]
125 pub fn is_prsch5(&self) -> bool {
126 *self == SEVONPRSSEL_A::PRSCH5
127 }
128 #[doc = "Checks if the value of the field is `PRSCH6`"]
129 #[inline(always)]
130 pub fn is_prsch6(&self) -> bool {
131 *self == SEVONPRSSEL_A::PRSCH6
132 }
133 #[doc = "Checks if the value of the field is `PRSCH7`"]
134 #[inline(always)]
135 pub fn is_prsch7(&self) -> bool {
136 *self == SEVONPRSSEL_A::PRSCH7
137 }
138 #[doc = "Checks if the value of the field is `PRSCH8`"]
139 #[inline(always)]
140 pub fn is_prsch8(&self) -> bool {
141 *self == SEVONPRSSEL_A::PRSCH8
142 }
143 #[doc = "Checks if the value of the field is `PRSCH9`"]
144 #[inline(always)]
145 pub fn is_prsch9(&self) -> bool {
146 *self == SEVONPRSSEL_A::PRSCH9
147 }
148 #[doc = "Checks if the value of the field is `PRSCH10`"]
149 #[inline(always)]
150 pub fn is_prsch10(&self) -> bool {
151 *self == SEVONPRSSEL_A::PRSCH10
152 }
153 #[doc = "Checks if the value of the field is `PRSCH11`"]
154 #[inline(always)]
155 pub fn is_prsch11(&self) -> bool {
156 *self == SEVONPRSSEL_A::PRSCH11
157 }
158}
159#[doc = "Field `SEVONPRSSEL` writer - SEVONPRS PRS Channel Select"]
160pub type SEVONPRSSEL_W<'a, const O: u8> =
161 crate::FieldWriter<'a, u32, CTRL_SPEC, u8, SEVONPRSSEL_A, 4, O>;
162impl<'a, const O: u8> SEVONPRSSEL_W<'a, O> {
163 #[doc = "PRS Channel 0 selected"]
164 #[inline(always)]
165 pub fn prsch0(self) -> &'a mut W {
166 self.variant(SEVONPRSSEL_A::PRSCH0)
167 }
168 #[doc = "PRS Channel 1 selected"]
169 #[inline(always)]
170 pub fn prsch1(self) -> &'a mut W {
171 self.variant(SEVONPRSSEL_A::PRSCH1)
172 }
173 #[doc = "PRS Channel 2 selected"]
174 #[inline(always)]
175 pub fn prsch2(self) -> &'a mut W {
176 self.variant(SEVONPRSSEL_A::PRSCH2)
177 }
178 #[doc = "PRS Channel 3 selected"]
179 #[inline(always)]
180 pub fn prsch3(self) -> &'a mut W {
181 self.variant(SEVONPRSSEL_A::PRSCH3)
182 }
183 #[doc = "PRS Channel 4 selected"]
184 #[inline(always)]
185 pub fn prsch4(self) -> &'a mut W {
186 self.variant(SEVONPRSSEL_A::PRSCH4)
187 }
188 #[doc = "PRS Channel 5 selected"]
189 #[inline(always)]
190 pub fn prsch5(self) -> &'a mut W {
191 self.variant(SEVONPRSSEL_A::PRSCH5)
192 }
193 #[doc = "PRS Channel 6 selected"]
194 #[inline(always)]
195 pub fn prsch6(self) -> &'a mut W {
196 self.variant(SEVONPRSSEL_A::PRSCH6)
197 }
198 #[doc = "PRS Channel 7 selected"]
199 #[inline(always)]
200 pub fn prsch7(self) -> &'a mut W {
201 self.variant(SEVONPRSSEL_A::PRSCH7)
202 }
203 #[doc = "PRS Channel 8 selected"]
204 #[inline(always)]
205 pub fn prsch8(self) -> &'a mut W {
206 self.variant(SEVONPRSSEL_A::PRSCH8)
207 }
208 #[doc = "PRS Channel 9 selected"]
209 #[inline(always)]
210 pub fn prsch9(self) -> &'a mut W {
211 self.variant(SEVONPRSSEL_A::PRSCH9)
212 }
213 #[doc = "PRS Channel 10 selected"]
214 #[inline(always)]
215 pub fn prsch10(self) -> &'a mut W {
216 self.variant(SEVONPRSSEL_A::PRSCH10)
217 }
218 #[doc = "PRS Channel 11 selected"]
219 #[inline(always)]
220 pub fn prsch11(self) -> &'a mut W {
221 self.variant(SEVONPRSSEL_A::PRSCH11)
222 }
223}
224impl R {
225 #[doc = "Bit 0 - Set Event on PRS"]
226 #[inline(always)]
227 pub fn sevonprs(&self) -> SEVONPRS_R {
228 SEVONPRS_R::new((self.bits & 1) != 0)
229 }
230 #[doc = "Bits 1:4 - SEVONPRS PRS Channel Select"]
231 #[inline(always)]
232 pub fn sevonprssel(&self) -> SEVONPRSSEL_R {
233 SEVONPRSSEL_R::new(((self.bits >> 1) & 0x0f) as u8)
234 }
235}
236impl W {
237 #[doc = "Bit 0 - Set Event on PRS"]
238 #[inline(always)]
239 #[must_use]
240 pub fn sevonprs(&mut self) -> SEVONPRS_W<0> {
241 SEVONPRS_W::new(self)
242 }
243 #[doc = "Bits 1:4 - SEVONPRS PRS Channel Select"]
244 #[inline(always)]
245 #[must_use]
246 pub fn sevonprssel(&mut self) -> SEVONPRSSEL_W<1> {
247 SEVONPRSSEL_W::new(self)
248 }
249 #[doc = "Writes raw bits to the register."]
250 #[inline(always)]
251 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
252 self.0.bits(bits);
253 self
254 }
255}
256#[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"]
257pub struct CTRL_SPEC;
258impl crate::RegisterSpec for CTRL_SPEC {
259 type Ux = u32;
260}
261#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
262impl crate::Readable for CTRL_SPEC {
263 type Reader = R;
264}
265#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
266impl crate::Writable for CTRL_SPEC {
267 type Writer = W;
268 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
269 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
270}
271#[doc = "`reset()` method sets CTRL to value 0"]
272impl crate::Resettable for CTRL_SPEC {
273 const RESET_VALUE: Self::Ux = 0;
274}