efm32gg12b110_pac/wdog1/
pch1_prsctrl.rs

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