efm32tg11b540_pac/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> = 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}
62impl From<SEVONPRSSEL_A> for u8 {
63 #[inline(always)]
64 fn from(variant: SEVONPRSSEL_A) -> Self {
65 variant as _
66 }
67}
68#[doc = "Field `SEVONPRSSEL` reader - SEVONPRS PRS Channel Select"]
69pub type SEVONPRSSEL_R = crate::FieldReader<u8, SEVONPRSSEL_A>;
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> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, SEVONPRSSEL_A, 3, 1>;
129impl<'a> SEVONPRSSEL_W<'a> {
130 #[doc = "PRS Channel 0 selected"]
131 #[inline(always)]
132 pub fn prsch0(self) -> &'a mut W {
133 self.variant(SEVONPRSSEL_A::PRSCH0)
134 }
135 #[doc = "PRS Channel 1 selected"]
136 #[inline(always)]
137 pub fn prsch1(self) -> &'a mut W {
138 self.variant(SEVONPRSSEL_A::PRSCH1)
139 }
140 #[doc = "PRS Channel 2 selected"]
141 #[inline(always)]
142 pub fn prsch2(self) -> &'a mut W {
143 self.variant(SEVONPRSSEL_A::PRSCH2)
144 }
145 #[doc = "PRS Channel 3 selected"]
146 #[inline(always)]
147 pub fn prsch3(self) -> &'a mut W {
148 self.variant(SEVONPRSSEL_A::PRSCH3)
149 }
150 #[doc = "PRS Channel 4 selected"]
151 #[inline(always)]
152 pub fn prsch4(self) -> &'a mut W {
153 self.variant(SEVONPRSSEL_A::PRSCH4)
154 }
155 #[doc = "PRS Channel 5 selected"]
156 #[inline(always)]
157 pub fn prsch5(self) -> &'a mut W {
158 self.variant(SEVONPRSSEL_A::PRSCH5)
159 }
160 #[doc = "PRS Channel 6 selected"]
161 #[inline(always)]
162 pub fn prsch6(self) -> &'a mut W {
163 self.variant(SEVONPRSSEL_A::PRSCH6)
164 }
165 #[doc = "PRS Channel 7 selected"]
166 #[inline(always)]
167 pub fn prsch7(self) -> &'a mut W {
168 self.variant(SEVONPRSSEL_A::PRSCH7)
169 }
170}
171impl R {
172 #[doc = "Bit 0 - Set Event on PRS"]
173 #[inline(always)]
174 pub fn sevonprs(&self) -> SEVONPRS_R {
175 SEVONPRS_R::new((self.bits & 1) != 0)
176 }
177 #[doc = "Bits 1:3 - SEVONPRS PRS Channel Select"]
178 #[inline(always)]
179 pub fn sevonprssel(&self) -> SEVONPRSSEL_R {
180 SEVONPRSSEL_R::new(((self.bits >> 1) & 7) as u8)
181 }
182}
183impl W {
184 #[doc = "Bit 0 - Set Event on PRS"]
185 #[inline(always)]
186 pub fn sevonprs(&mut self) -> SEVONPRS_W {
187 SEVONPRS_W::new(self)
188 }
189 #[doc = "Bits 1:3 - SEVONPRS PRS Channel Select"]
190 #[inline(always)]
191 pub fn sevonprssel(&mut self) -> SEVONPRSSEL_W {
192 SEVONPRSSEL_W::new(self)
193 }
194 #[doc = "Writes raw bits to the register."]
195 #[inline(always)]
196 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
197 self.0.bits(bits);
198 self
199 }
200}
201#[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"]
202pub struct CTRL_SPEC;
203impl crate::RegisterSpec for CTRL_SPEC {
204 type Ux = u32;
205}
206#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
207impl crate::Readable for CTRL_SPEC {
208 type Reader = R;
209}
210#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
211impl crate::Writable for CTRL_SPEC {
212 type Writer = W;
213}
214#[doc = "`reset()` method sets CTRL to value 0"]
215impl crate::Resettable for CTRL_SPEC {
216 #[inline(always)]
217 fn reset_value() -> Self::Ux {
218 0
219 }
220}