stm32wb_pac/tim2/
ccmr2_input.rs

1#[doc = "Reader of register CCMR2_Input"]
2pub type R = crate::R<u32, super::CCMR2_INPUT>;
3#[doc = "Writer for register CCMR2_Input"]
4pub type W = crate::W<u32, super::CCMR2_INPUT>;
5#[doc = "Register CCMR2_Input `reset()`'s with value 0"]
6impl crate::ResetValue for super::CCMR2_INPUT {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `IC4F`"]
14pub type IC4F_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `IC4F`"]
16pub struct IC4F_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> IC4F_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 << 12)) | (((value as u32) & 0x0f) << 12);
24        self.w
25    }
26}
27#[doc = "Reader of field `IC4PSC`"]
28pub type IC4PSC_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `IC4PSC`"]
30pub struct IC4PSC_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> IC4PSC_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 & !(0x03 << 10)) | (((value as u32) & 0x03) << 10);
38        self.w
39    }
40}
41#[doc = "Reader of field `CC4S`"]
42pub type CC4S_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `CC4S`"]
44pub struct CC4S_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> CC4S_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 & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
52        self.w
53    }
54}
55#[doc = "Reader of field `IC3F`"]
56pub type IC3F_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `IC3F`"]
58pub struct IC3F_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> IC3F_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 << 4)) | (((value as u32) & 0x0f) << 4);
66        self.w
67    }
68}
69#[doc = "Reader of field `IC3PSC`"]
70pub type IC3PSC_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `IC3PSC`"]
72pub struct IC3PSC_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> IC3PSC_W<'a> {
76    #[doc = r"Writes raw bits to the field"]
77    #[inline(always)]
78    pub unsafe fn bits(self, value: u8) -> &'a mut W {
79        self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u32) & 0x03) << 2);
80        self.w
81    }
82}
83#[doc = "Reader of field `CC3S`"]
84pub type CC3S_R = crate::R<u8, u8>;
85#[doc = "Write proxy for field `CC3S`"]
86pub struct CC3S_W<'a> {
87    w: &'a mut W,
88}
89impl<'a> CC3S_W<'a> {
90    #[doc = r"Writes raw bits to the field"]
91    #[inline(always)]
92    pub unsafe fn bits(self, value: u8) -> &'a mut W {
93        self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
94        self.w
95    }
96}
97impl R {
98    #[doc = "Bits 12:15 - Input capture 4 filter"]
99    #[inline(always)]
100    pub fn ic4f(&self) -> IC4F_R {
101        IC4F_R::new(((self.bits >> 12) & 0x0f) as u8)
102    }
103    #[doc = "Bits 10:11 - Input capture 4 prescaler"]
104    #[inline(always)]
105    pub fn ic4psc(&self) -> IC4PSC_R {
106        IC4PSC_R::new(((self.bits >> 10) & 0x03) as u8)
107    }
108    #[doc = "Bits 8:9 - Capture/Compare 4 selection"]
109    #[inline(always)]
110    pub fn cc4s(&self) -> CC4S_R {
111        CC4S_R::new(((self.bits >> 8) & 0x03) as u8)
112    }
113    #[doc = "Bits 4:7 - Input capture 3 filter"]
114    #[inline(always)]
115    pub fn ic3f(&self) -> IC3F_R {
116        IC3F_R::new(((self.bits >> 4) & 0x0f) as u8)
117    }
118    #[doc = "Bits 2:3 - Input capture 3 prescaler"]
119    #[inline(always)]
120    pub fn ic3psc(&self) -> IC3PSC_R {
121        IC3PSC_R::new(((self.bits >> 2) & 0x03) as u8)
122    }
123    #[doc = "Bits 0:1 - Capture/Compare 3 selection"]
124    #[inline(always)]
125    pub fn cc3s(&self) -> CC3S_R {
126        CC3S_R::new((self.bits & 0x03) as u8)
127    }
128}
129impl W {
130    #[doc = "Bits 12:15 - Input capture 4 filter"]
131    #[inline(always)]
132    pub fn ic4f(&mut self) -> IC4F_W {
133        IC4F_W { w: self }
134    }
135    #[doc = "Bits 10:11 - Input capture 4 prescaler"]
136    #[inline(always)]
137    pub fn ic4psc(&mut self) -> IC4PSC_W {
138        IC4PSC_W { w: self }
139    }
140    #[doc = "Bits 8:9 - Capture/Compare 4 selection"]
141    #[inline(always)]
142    pub fn cc4s(&mut self) -> CC4S_W {
143        CC4S_W { w: self }
144    }
145    #[doc = "Bits 4:7 - Input capture 3 filter"]
146    #[inline(always)]
147    pub fn ic3f(&mut self) -> IC3F_W {
148        IC3F_W { w: self }
149    }
150    #[doc = "Bits 2:3 - Input capture 3 prescaler"]
151    #[inline(always)]
152    pub fn ic3psc(&mut self) -> IC3PSC_W {
153        IC3PSC_W { w: self }
154    }
155    #[doc = "Bits 0:1 - Capture/Compare 3 selection"]
156    #[inline(always)]
157    pub fn cc3s(&mut self) -> CC3S_W {
158        CC3S_W { w: self }
159    }
160}