1#[doc = "Register `FILT` reader"]
2pub type R = crate::R<FiltSpec>;
3#[doc = "Register `FILT` writer"]
4pub type W = crate::W<FiltSpec>;
5#[doc = "Field `FILTSEL1` reader - Filter 1 Pin Select"]
6pub type Filtsel1R = crate::FieldReader;
7#[doc = "Field `FILTSEL1` writer - Filter 1 Pin Select"]
8pub type Filtsel1W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
9#[doc = "Filter 1 Enable\n\nValue on reset: 0"]
10#[cfg_attr(feature = "defmt", derive(defmt::Format))]
11#[derive(Clone, Copy, Debug, PartialEq, Eq)]
12#[repr(u8)]
13pub enum Filte1 {
14 #[doc = "0: Disable"]
15 Disable = 0,
16 #[doc = "1: Enable (Detect on rising edge or high level)"]
17 EnRiseHi = 1,
18 #[doc = "2: Enable (Detect on falling edge or low level)"]
19 EnFallLo = 2,
20 #[doc = "3: Enable (Detect on any edge)"]
21 EnAny = 3,
22}
23impl From<Filte1> for u8 {
24 #[inline(always)]
25 fn from(variant: Filte1) -> Self {
26 variant as _
27 }
28}
29impl crate::FieldSpec for Filte1 {
30 type Ux = u8;
31}
32impl crate::IsEnum for Filte1 {}
33#[doc = "Field `FILTE1` reader - Filter 1 Enable"]
34pub type Filte1R = crate::FieldReader<Filte1>;
35impl Filte1R {
36 #[doc = "Get enumerated values variant"]
37 #[inline(always)]
38 pub const fn variant(&self) -> Filte1 {
39 match self.bits {
40 0 => Filte1::Disable,
41 1 => Filte1::EnRiseHi,
42 2 => Filte1::EnFallLo,
43 3 => Filte1::EnAny,
44 _ => unreachable!(),
45 }
46 }
47 #[doc = "Disable"]
48 #[inline(always)]
49 pub fn is_disable(&self) -> bool {
50 *self == Filte1::Disable
51 }
52 #[doc = "Enable (Detect on rising edge or high level)"]
53 #[inline(always)]
54 pub fn is_en_rise_hi(&self) -> bool {
55 *self == Filte1::EnRiseHi
56 }
57 #[doc = "Enable (Detect on falling edge or low level)"]
58 #[inline(always)]
59 pub fn is_en_fall_lo(&self) -> bool {
60 *self == Filte1::EnFallLo
61 }
62 #[doc = "Enable (Detect on any edge)"]
63 #[inline(always)]
64 pub fn is_en_any(&self) -> bool {
65 *self == Filte1::EnAny
66 }
67}
68#[doc = "Field `FILTE1` writer - Filter 1 Enable"]
69pub type Filte1W<'a, REG> = crate::FieldWriter<'a, REG, 2, Filte1, crate::Safe>;
70impl<'a, REG> Filte1W<'a, REG>
71where
72 REG: crate::Writable + crate::RegisterSpec,
73 REG::Ux: From<u8>,
74{
75 #[doc = "Disable"]
76 #[inline(always)]
77 pub fn disable(self) -> &'a mut crate::W<REG> {
78 self.variant(Filte1::Disable)
79 }
80 #[doc = "Enable (Detect on rising edge or high level)"]
81 #[inline(always)]
82 pub fn en_rise_hi(self) -> &'a mut crate::W<REG> {
83 self.variant(Filte1::EnRiseHi)
84 }
85 #[doc = "Enable (Detect on falling edge or low level)"]
86 #[inline(always)]
87 pub fn en_fall_lo(self) -> &'a mut crate::W<REG> {
88 self.variant(Filte1::EnFallLo)
89 }
90 #[doc = "Enable (Detect on any edge)"]
91 #[inline(always)]
92 pub fn en_any(self) -> &'a mut crate::W<REG> {
93 self.variant(Filte1::EnAny)
94 }
95}
96#[doc = "Filter 1 Flag\n\nValue on reset: 0"]
97#[cfg_attr(feature = "defmt", derive(defmt::Format))]
98#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99pub enum Filtf1 {
100 #[doc = "0: No"]
101 NoFlag = 0,
102 #[doc = "1: Yes"]
103 Flag = 1,
104}
105impl From<Filtf1> for bool {
106 #[inline(always)]
107 fn from(variant: Filtf1) -> Self {
108 variant as u8 != 0
109 }
110}
111#[doc = "Field `FILTF1` reader - Filter 1 Flag"]
112pub type Filtf1R = crate::BitReader<Filtf1>;
113impl Filtf1R {
114 #[doc = "Get enumerated values variant"]
115 #[inline(always)]
116 pub const fn variant(&self) -> Filtf1 {
117 match self.bits {
118 false => Filtf1::NoFlag,
119 true => Filtf1::Flag,
120 }
121 }
122 #[doc = "No"]
123 #[inline(always)]
124 pub fn is_no_flag(&self) -> bool {
125 *self == Filtf1::NoFlag
126 }
127 #[doc = "Yes"]
128 #[inline(always)]
129 pub fn is_flag(&self) -> bool {
130 *self == Filtf1::Flag
131 }
132}
133#[doc = "Field `FILTF1` writer - Filter 1 Flag"]
134pub type Filtf1W<'a, REG> = crate::BitWriter1C<'a, REG, Filtf1>;
135impl<'a, REG> Filtf1W<'a, REG>
136where
137 REG: crate::Writable + crate::RegisterSpec,
138{
139 #[doc = "No"]
140 #[inline(always)]
141 pub fn no_flag(self) -> &'a mut crate::W<REG> {
142 self.variant(Filtf1::NoFlag)
143 }
144 #[doc = "Yes"]
145 #[inline(always)]
146 pub fn flag(self) -> &'a mut crate::W<REG> {
147 self.variant(Filtf1::Flag)
148 }
149}
150#[doc = "Field `FILTSEL2` reader - Filter 2 Pin Select"]
151pub type Filtsel2R = crate::FieldReader;
152#[doc = "Field `FILTSEL2` writer - Filter 2 Pin Select"]
153pub type Filtsel2W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
154#[doc = "Filter 2 Enable\n\nValue on reset: 0"]
155#[cfg_attr(feature = "defmt", derive(defmt::Format))]
156#[derive(Clone, Copy, Debug, PartialEq, Eq)]
157#[repr(u8)]
158pub enum Filte2 {
159 #[doc = "0: Disable"]
160 Disable = 0,
161 #[doc = "1: Enable (Detect on rising edge or high level)"]
162 EnRiseHi = 1,
163 #[doc = "2: Enable (Detect on falling edge or low level)"]
164 EnFallLo = 2,
165 #[doc = "3: Enable (Detect on any edge)"]
166 EnAny = 3,
167}
168impl From<Filte2> for u8 {
169 #[inline(always)]
170 fn from(variant: Filte2) -> Self {
171 variant as _
172 }
173}
174impl crate::FieldSpec for Filte2 {
175 type Ux = u8;
176}
177impl crate::IsEnum for Filte2 {}
178#[doc = "Field `FILTE2` reader - Filter 2 Enable"]
179pub type Filte2R = crate::FieldReader<Filte2>;
180impl Filte2R {
181 #[doc = "Get enumerated values variant"]
182 #[inline(always)]
183 pub const fn variant(&self) -> Filte2 {
184 match self.bits {
185 0 => Filte2::Disable,
186 1 => Filte2::EnRiseHi,
187 2 => Filte2::EnFallLo,
188 3 => Filte2::EnAny,
189 _ => unreachable!(),
190 }
191 }
192 #[doc = "Disable"]
193 #[inline(always)]
194 pub fn is_disable(&self) -> bool {
195 *self == Filte2::Disable
196 }
197 #[doc = "Enable (Detect on rising edge or high level)"]
198 #[inline(always)]
199 pub fn is_en_rise_hi(&self) -> bool {
200 *self == Filte2::EnRiseHi
201 }
202 #[doc = "Enable (Detect on falling edge or low level)"]
203 #[inline(always)]
204 pub fn is_en_fall_lo(&self) -> bool {
205 *self == Filte2::EnFallLo
206 }
207 #[doc = "Enable (Detect on any edge)"]
208 #[inline(always)]
209 pub fn is_en_any(&self) -> bool {
210 *self == Filte2::EnAny
211 }
212}
213#[doc = "Field `FILTE2` writer - Filter 2 Enable"]
214pub type Filte2W<'a, REG> = crate::FieldWriter<'a, REG, 2, Filte2, crate::Safe>;
215impl<'a, REG> Filte2W<'a, REG>
216where
217 REG: crate::Writable + crate::RegisterSpec,
218 REG::Ux: From<u8>,
219{
220 #[doc = "Disable"]
221 #[inline(always)]
222 pub fn disable(self) -> &'a mut crate::W<REG> {
223 self.variant(Filte2::Disable)
224 }
225 #[doc = "Enable (Detect on rising edge or high level)"]
226 #[inline(always)]
227 pub fn en_rise_hi(self) -> &'a mut crate::W<REG> {
228 self.variant(Filte2::EnRiseHi)
229 }
230 #[doc = "Enable (Detect on falling edge or low level)"]
231 #[inline(always)]
232 pub fn en_fall_lo(self) -> &'a mut crate::W<REG> {
233 self.variant(Filte2::EnFallLo)
234 }
235 #[doc = "Enable (Detect on any edge)"]
236 #[inline(always)]
237 pub fn en_any(self) -> &'a mut crate::W<REG> {
238 self.variant(Filte2::EnAny)
239 }
240}
241#[doc = "Filter 2 Flag\n\nValue on reset: 0"]
242#[cfg_attr(feature = "defmt", derive(defmt::Format))]
243#[derive(Clone, Copy, Debug, PartialEq, Eq)]
244pub enum Filtf2 {
245 #[doc = "0: No"]
246 NoFlag = 0,
247 #[doc = "1: Yes"]
248 Flag = 1,
249}
250impl From<Filtf2> for bool {
251 #[inline(always)]
252 fn from(variant: Filtf2) -> Self {
253 variant as u8 != 0
254 }
255}
256#[doc = "Field `FILTF2` reader - Filter 2 Flag"]
257pub type Filtf2R = crate::BitReader<Filtf2>;
258impl Filtf2R {
259 #[doc = "Get enumerated values variant"]
260 #[inline(always)]
261 pub const fn variant(&self) -> Filtf2 {
262 match self.bits {
263 false => Filtf2::NoFlag,
264 true => Filtf2::Flag,
265 }
266 }
267 #[doc = "No"]
268 #[inline(always)]
269 pub fn is_no_flag(&self) -> bool {
270 *self == Filtf2::NoFlag
271 }
272 #[doc = "Yes"]
273 #[inline(always)]
274 pub fn is_flag(&self) -> bool {
275 *self == Filtf2::Flag
276 }
277}
278#[doc = "Field `FILTF2` writer - Filter 2 Flag"]
279pub type Filtf2W<'a, REG> = crate::BitWriter1C<'a, REG, Filtf2>;
280impl<'a, REG> Filtf2W<'a, REG>
281where
282 REG: crate::Writable + crate::RegisterSpec,
283{
284 #[doc = "No"]
285 #[inline(always)]
286 pub fn no_flag(self) -> &'a mut crate::W<REG> {
287 self.variant(Filtf2::NoFlag)
288 }
289 #[doc = "Yes"]
290 #[inline(always)]
291 pub fn flag(self) -> &'a mut crate::W<REG> {
292 self.variant(Filtf2::Flag)
293 }
294}
295impl R {
296 #[doc = "Bits 0:4 - Filter 1 Pin Select"]
297 #[inline(always)]
298 pub fn filtsel1(&self) -> Filtsel1R {
299 Filtsel1R::new((self.bits & 0x1f) as u8)
300 }
301 #[doc = "Bits 5:6 - Filter 1 Enable"]
302 #[inline(always)]
303 pub fn filte1(&self) -> Filte1R {
304 Filte1R::new(((self.bits >> 5) & 3) as u8)
305 }
306 #[doc = "Bit 7 - Filter 1 Flag"]
307 #[inline(always)]
308 pub fn filtf1(&self) -> Filtf1R {
309 Filtf1R::new(((self.bits >> 7) & 1) != 0)
310 }
311 #[doc = "Bits 8:12 - Filter 2 Pin Select"]
312 #[inline(always)]
313 pub fn filtsel2(&self) -> Filtsel2R {
314 Filtsel2R::new(((self.bits >> 8) & 0x1f) as u8)
315 }
316 #[doc = "Bits 13:14 - Filter 2 Enable"]
317 #[inline(always)]
318 pub fn filte2(&self) -> Filte2R {
319 Filte2R::new(((self.bits >> 13) & 3) as u8)
320 }
321 #[doc = "Bit 15 - Filter 2 Flag"]
322 #[inline(always)]
323 pub fn filtf2(&self) -> Filtf2R {
324 Filtf2R::new(((self.bits >> 15) & 1) != 0)
325 }
326}
327#[cfg(feature = "debug")]
328impl core::fmt::Debug for R {
329 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
330 f.debug_struct("FILT")
331 .field("filtsel1", &self.filtsel1())
332 .field("filte1", &self.filte1())
333 .field("filtf1", &self.filtf1())
334 .field("filtsel2", &self.filtsel2())
335 .field("filte2", &self.filte2())
336 .field("filtf2", &self.filtf2())
337 .finish()
338 }
339}
340impl W {
341 #[doc = "Bits 0:4 - Filter 1 Pin Select"]
342 #[inline(always)]
343 pub fn filtsel1(&mut self) -> Filtsel1W<'_, FiltSpec> {
344 Filtsel1W::new(self, 0)
345 }
346 #[doc = "Bits 5:6 - Filter 1 Enable"]
347 #[inline(always)]
348 pub fn filte1(&mut self) -> Filte1W<'_, FiltSpec> {
349 Filte1W::new(self, 5)
350 }
351 #[doc = "Bit 7 - Filter 1 Flag"]
352 #[inline(always)]
353 pub fn filtf1(&mut self) -> Filtf1W<'_, FiltSpec> {
354 Filtf1W::new(self, 7)
355 }
356 #[doc = "Bits 8:12 - Filter 2 Pin Select"]
357 #[inline(always)]
358 pub fn filtsel2(&mut self) -> Filtsel2W<'_, FiltSpec> {
359 Filtsel2W::new(self, 8)
360 }
361 #[doc = "Bits 13:14 - Filter 2 Enable"]
362 #[inline(always)]
363 pub fn filte2(&mut self) -> Filte2W<'_, FiltSpec> {
364 Filte2W::new(self, 13)
365 }
366 #[doc = "Bit 15 - Filter 2 Flag"]
367 #[inline(always)]
368 pub fn filtf2(&mut self) -> Filtf2W<'_, FiltSpec> {
369 Filtf2W::new(self, 15)
370 }
371}
372#[doc = "Pin Filter\n\nYou can [`read`](crate::Reg::read) this register and get [`filt::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`filt::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
373pub struct FiltSpec;
374impl crate::RegisterSpec for FiltSpec {
375 type Ux = u32;
376}
377#[doc = "`read()` method returns [`filt::R`](R) reader structure"]
378impl crate::Readable for FiltSpec {}
379#[doc = "`write(|w| ..)` method takes [`filt::W`](W) writer structure"]
380impl crate::Writable for FiltSpec {
381 type Safety = crate::Unsafe;
382 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x8080;
383}
384#[doc = "`reset()` method sets FILT to value 0"]
385impl crate::Resettable for FiltSpec {}