efm32tg11b_pac/efm32tg11b540/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}
64impl From<SEVONPRSSEL_A> for u8 {
65 #[inline(always)]
66 fn from(variant: SEVONPRSSEL_A) -> Self {
67 variant as _
68 }
69}
70impl SEVONPRSSEL_R {
71 #[doc = "Get enumerated values variant"]
72 #[inline(always)]
73 pub fn variant(&self) -> SEVONPRSSEL_A {
74 match self.bits {
75 0 => SEVONPRSSEL_A::PRSCH0,
76 1 => SEVONPRSSEL_A::PRSCH1,
77 2 => SEVONPRSSEL_A::PRSCH2,
78 3 => SEVONPRSSEL_A::PRSCH3,
79 4 => SEVONPRSSEL_A::PRSCH4,
80 5 => SEVONPRSSEL_A::PRSCH5,
81 6 => SEVONPRSSEL_A::PRSCH6,
82 7 => SEVONPRSSEL_A::PRSCH7,
83 _ => unreachable!(),
84 }
85 }
86 #[doc = "Checks if the value of the field is `PRSCH0`"]
87 #[inline(always)]
88 pub fn is_prsch0(&self) -> bool {
89 *self == SEVONPRSSEL_A::PRSCH0
90 }
91 #[doc = "Checks if the value of the field is `PRSCH1`"]
92 #[inline(always)]
93 pub fn is_prsch1(&self) -> bool {
94 *self == SEVONPRSSEL_A::PRSCH1
95 }
96 #[doc = "Checks if the value of the field is `PRSCH2`"]
97 #[inline(always)]
98 pub fn is_prsch2(&self) -> bool {
99 *self == SEVONPRSSEL_A::PRSCH2
100 }
101 #[doc = "Checks if the value of the field is `PRSCH3`"]
102 #[inline(always)]
103 pub fn is_prsch3(&self) -> bool {
104 *self == SEVONPRSSEL_A::PRSCH3
105 }
106 #[doc = "Checks if the value of the field is `PRSCH4`"]
107 #[inline(always)]
108 pub fn is_prsch4(&self) -> bool {
109 *self == SEVONPRSSEL_A::PRSCH4
110 }
111 #[doc = "Checks if the value of the field is `PRSCH5`"]
112 #[inline(always)]
113 pub fn is_prsch5(&self) -> bool {
114 *self == SEVONPRSSEL_A::PRSCH5
115 }
116 #[doc = "Checks if the value of the field is `PRSCH6`"]
117 #[inline(always)]
118 pub fn is_prsch6(&self) -> bool {
119 *self == SEVONPRSSEL_A::PRSCH6
120 }
121 #[doc = "Checks if the value of the field is `PRSCH7`"]
122 #[inline(always)]
123 pub fn is_prsch7(&self) -> bool {
124 *self == SEVONPRSSEL_A::PRSCH7
125 }
126}
127#[doc = "Field `SEVONPRSSEL` writer - SEVONPRS PRS Channel Select"]
128pub type SEVONPRSSEL_W<'a, const O: u8> =
129 crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, SEVONPRSSEL_A, 3, O>;
130impl<'a, const O: u8> SEVONPRSSEL_W<'a, O> {
131 #[doc = "PRS Channel 0 selected"]
132 #[inline(always)]
133 pub fn prsch0(self) -> &'a mut W {
134 self.variant(SEVONPRSSEL_A::PRSCH0)
135 }
136 #[doc = "PRS Channel 1 selected"]
137 #[inline(always)]
138 pub fn prsch1(self) -> &'a mut W {
139 self.variant(SEVONPRSSEL_A::PRSCH1)
140 }
141 #[doc = "PRS Channel 2 selected"]
142 #[inline(always)]
143 pub fn prsch2(self) -> &'a mut W {
144 self.variant(SEVONPRSSEL_A::PRSCH2)
145 }
146 #[doc = "PRS Channel 3 selected"]
147 #[inline(always)]
148 pub fn prsch3(self) -> &'a mut W {
149 self.variant(SEVONPRSSEL_A::PRSCH3)
150 }
151 #[doc = "PRS Channel 4 selected"]
152 #[inline(always)]
153 pub fn prsch4(self) -> &'a mut W {
154 self.variant(SEVONPRSSEL_A::PRSCH4)
155 }
156 #[doc = "PRS Channel 5 selected"]
157 #[inline(always)]
158 pub fn prsch5(self) -> &'a mut W {
159 self.variant(SEVONPRSSEL_A::PRSCH5)
160 }
161 #[doc = "PRS Channel 6 selected"]
162 #[inline(always)]
163 pub fn prsch6(self) -> &'a mut W {
164 self.variant(SEVONPRSSEL_A::PRSCH6)
165 }
166 #[doc = "PRS Channel 7 selected"]
167 #[inline(always)]
168 pub fn prsch7(self) -> &'a mut W {
169 self.variant(SEVONPRSSEL_A::PRSCH7)
170 }
171}
172impl R {
173 #[doc = "Bit 0 - Set Event on PRS"]
174 #[inline(always)]
175 pub fn sevonprs(&self) -> SEVONPRS_R {
176 SEVONPRS_R::new((self.bits & 1) != 0)
177 }
178 #[doc = "Bits 1:3 - SEVONPRS PRS Channel Select"]
179 #[inline(always)]
180 pub fn sevonprssel(&self) -> SEVONPRSSEL_R {
181 SEVONPRSSEL_R::new(((self.bits >> 1) & 7) as u8)
182 }
183}
184impl W {
185 #[doc = "Bit 0 - Set Event on PRS"]
186 #[inline(always)]
187 #[must_use]
188 pub fn sevonprs(&mut self) -> SEVONPRS_W<0> {
189 SEVONPRS_W::new(self)
190 }
191 #[doc = "Bits 1:3 - SEVONPRS PRS Channel Select"]
192 #[inline(always)]
193 #[must_use]
194 pub fn sevonprssel(&mut self) -> SEVONPRSSEL_W<1> {
195 SEVONPRSSEL_W::new(self)
196 }
197 #[doc = "Writes raw bits to the register."]
198 #[inline(always)]
199 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
200 self.0.bits(bits);
201 self
202 }
203}
204#[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"]
205pub struct CTRL_SPEC;
206impl crate::RegisterSpec for CTRL_SPEC {
207 type Ux = u32;
208}
209#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
210impl crate::Readable for CTRL_SPEC {
211 type Reader = R;
212}
213#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
214impl crate::Writable for CTRL_SPEC {
215 type Writer = W;
216 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
217 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
218}
219#[doc = "`reset()` method sets CTRL to value 0"]
220impl crate::Resettable for CTRL_SPEC {
221 const RESET_VALUE: Self::Ux = 0;
222}