efm32pg1b200_pac/prs/
ctrl.rs

1#[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}
70impl From<SEVONPRSSEL_A> for u8 {
71    #[inline(always)]
72    fn from(variant: SEVONPRSSEL_A) -> Self {
73        variant as _
74    }
75}
76#[doc = "Field `SEVONPRSSEL` reader - SEVONPRS PRS Channel Select"]
77pub type SEVONPRSSEL_R = crate::FieldReader<u8, SEVONPRSSEL_A>;
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> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, SEVONPRSSEL_A, 4, 1>;
161impl<'a> SEVONPRSSEL_W<'a> {
162    #[doc = "PRS Channel 0 selected"]
163    #[inline(always)]
164    pub fn prsch0(self) -> &'a mut W {
165        self.variant(SEVONPRSSEL_A::PRSCH0)
166    }
167    #[doc = "PRS Channel 1 selected"]
168    #[inline(always)]
169    pub fn prsch1(self) -> &'a mut W {
170        self.variant(SEVONPRSSEL_A::PRSCH1)
171    }
172    #[doc = "PRS Channel 2 selected"]
173    #[inline(always)]
174    pub fn prsch2(self) -> &'a mut W {
175        self.variant(SEVONPRSSEL_A::PRSCH2)
176    }
177    #[doc = "PRS Channel 3 selected"]
178    #[inline(always)]
179    pub fn prsch3(self) -> &'a mut W {
180        self.variant(SEVONPRSSEL_A::PRSCH3)
181    }
182    #[doc = "PRS Channel 4 selected"]
183    #[inline(always)]
184    pub fn prsch4(self) -> &'a mut W {
185        self.variant(SEVONPRSSEL_A::PRSCH4)
186    }
187    #[doc = "PRS Channel 5 selected"]
188    #[inline(always)]
189    pub fn prsch5(self) -> &'a mut W {
190        self.variant(SEVONPRSSEL_A::PRSCH5)
191    }
192    #[doc = "PRS Channel 6 selected"]
193    #[inline(always)]
194    pub fn prsch6(self) -> &'a mut W {
195        self.variant(SEVONPRSSEL_A::PRSCH6)
196    }
197    #[doc = "PRS Channel 7 selected"]
198    #[inline(always)]
199    pub fn prsch7(self) -> &'a mut W {
200        self.variant(SEVONPRSSEL_A::PRSCH7)
201    }
202    #[doc = "PRS Channel 8 selected"]
203    #[inline(always)]
204    pub fn prsch8(self) -> &'a mut W {
205        self.variant(SEVONPRSSEL_A::PRSCH8)
206    }
207    #[doc = "PRS Channel 9 selected"]
208    #[inline(always)]
209    pub fn prsch9(self) -> &'a mut W {
210        self.variant(SEVONPRSSEL_A::PRSCH9)
211    }
212    #[doc = "PRS Channel 10 selected"]
213    #[inline(always)]
214    pub fn prsch10(self) -> &'a mut W {
215        self.variant(SEVONPRSSEL_A::PRSCH10)
216    }
217    #[doc = "PRS Channel 11 selected"]
218    #[inline(always)]
219    pub fn prsch11(self) -> &'a mut W {
220        self.variant(SEVONPRSSEL_A::PRSCH11)
221    }
222}
223impl R {
224    #[doc = "Bit 0 - Set Event on PRS"]
225    #[inline(always)]
226    pub fn sevonprs(&self) -> SEVONPRS_R {
227        SEVONPRS_R::new((self.bits & 1) != 0)
228    }
229    #[doc = "Bits 1:4 - SEVONPRS PRS Channel Select"]
230    #[inline(always)]
231    pub fn sevonprssel(&self) -> SEVONPRSSEL_R {
232        SEVONPRSSEL_R::new(((self.bits >> 1) & 0x0f) as u8)
233    }
234}
235impl W {
236    #[doc = "Bit 0 - Set Event on PRS"]
237    #[inline(always)]
238    pub fn sevonprs(&mut self) -> SEVONPRS_W {
239        SEVONPRS_W::new(self)
240    }
241    #[doc = "Bits 1:4 - SEVONPRS PRS Channel Select"]
242    #[inline(always)]
243    pub fn sevonprssel(&mut self) -> SEVONPRSSEL_W {
244        SEVONPRSSEL_W::new(self)
245    }
246    #[doc = "Writes raw bits to the register."]
247    #[inline(always)]
248    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
249        self.0.bits(bits);
250        self
251    }
252}
253#[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"]
254pub struct CTRL_SPEC;
255impl crate::RegisterSpec for CTRL_SPEC {
256    type Ux = u32;
257}
258#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
259impl crate::Readable for CTRL_SPEC {
260    type Reader = R;
261}
262#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
263impl crate::Writable for CTRL_SPEC {
264    type Writer = W;
265}
266#[doc = "`reset()` method sets CTRL to value 0"]
267impl crate::Resettable for CTRL_SPEC {
268    #[inline(always)]
269    fn reset_value() -> Self::Ux {
270        0
271    }
272}