k22f/ftm1/
filter.rs

1#[doc = "Reader of register FILTER"]
2pub type R = crate::R<u32, super::FILTER>;
3#[doc = "Writer for register FILTER"]
4pub type W = crate::W<u32, super::FILTER>;
5#[doc = "Register FILTER `reset()`'s with value 0"]
6impl crate::ResetValue for super::FILTER {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `CH0FVAL`"]
14pub type CH0FVAL_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `CH0FVAL`"]
16pub struct CH0FVAL_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> CH0FVAL_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
24        self.w
25    }
26}
27#[doc = "Reader of field `CH1FVAL`"]
28pub type CH1FVAL_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `CH1FVAL`"]
30pub struct CH1FVAL_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> CH1FVAL_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x0f << 4)) | (((value as u32) & 0x0f) << 4);
38        self.w
39    }
40}
41#[doc = "Reader of field `CH2FVAL`"]
42pub type CH2FVAL_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `CH2FVAL`"]
44pub struct CH2FVAL_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> CH2FVAL_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
52        self.w
53    }
54}
55#[doc = "Reader of field `CH3FVAL`"]
56pub type CH3FVAL_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `CH3FVAL`"]
58pub struct CH3FVAL_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> CH3FVAL_W<'a> {
62    #[doc = r"Writes raw bits to the field"]
63    #[inline(always)]
64    pub unsafe fn bits(self, value: u8) -> &'a mut W {
65        self.w.bits = (self.w.bits & !(0x0f << 12)) | (((value as u32) & 0x0f) << 12);
66        self.w
67    }
68}
69impl R {
70    #[doc = "Bits 0:3 - Channel 0 Input Filter"]
71    #[inline(always)]
72    pub fn ch0fval(&self) -> CH0FVAL_R {
73        CH0FVAL_R::new((self.bits & 0x0f) as u8)
74    }
75    #[doc = "Bits 4:7 - Channel 1 Input Filter"]
76    #[inline(always)]
77    pub fn ch1fval(&self) -> CH1FVAL_R {
78        CH1FVAL_R::new(((self.bits >> 4) & 0x0f) as u8)
79    }
80    #[doc = "Bits 8:11 - Channel 2 Input Filter"]
81    #[inline(always)]
82    pub fn ch2fval(&self) -> CH2FVAL_R {
83        CH2FVAL_R::new(((self.bits >> 8) & 0x0f) as u8)
84    }
85    #[doc = "Bits 12:15 - Channel 3 Input Filter"]
86    #[inline(always)]
87    pub fn ch3fval(&self) -> CH3FVAL_R {
88        CH3FVAL_R::new(((self.bits >> 12) & 0x0f) as u8)
89    }
90}
91impl W {
92    #[doc = "Bits 0:3 - Channel 0 Input Filter"]
93    #[inline(always)]
94    pub fn ch0fval(&mut self) -> CH0FVAL_W {
95        CH0FVAL_W { w: self }
96    }
97    #[doc = "Bits 4:7 - Channel 1 Input Filter"]
98    #[inline(always)]
99    pub fn ch1fval(&mut self) -> CH1FVAL_W {
100        CH1FVAL_W { w: self }
101    }
102    #[doc = "Bits 8:11 - Channel 2 Input Filter"]
103    #[inline(always)]
104    pub fn ch2fval(&mut self) -> CH2FVAL_W {
105        CH2FVAL_W { w: self }
106    }
107    #[doc = "Bits 12:15 - Channel 3 Input Filter"]
108    #[inline(always)]
109    pub fn ch3fval(&mut self) -> CH3FVAL_W {
110        CH3FVAL_W { w: self }
111    }
112}