stm32f3_staging/stm32f373/comp/
csr.rs1pub type R = crate::R<CSRrs>;
3pub type W = crate::W<CSRrs>;
5pub type COMP1EN_R = crate::BitReader;
7pub type COMP1EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9pub type COMP1_INP_DAC_R = crate::BitReader;
11pub type COMP1_INP_DAC_W<'a, REG> = crate::BitWriter<'a, REG>;
13pub type COMP1MODE_R = crate::FieldReader;
15pub type COMP1MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17pub type COMP1INSEL_R = crate::FieldReader;
19pub type COMP1INSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
21pub type COMP1OUTSEL_R = crate::FieldReader;
23pub type COMP1OUTSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
25pub type COMP1POL_R = crate::BitReader;
27pub type COMP1POL_W<'a, REG> = crate::BitWriter<'a, REG>;
29pub type COMP1HYST_R = crate::FieldReader;
31pub type COMP1HYST_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
33pub type COMP1OUT_R = crate::BitReader;
35pub type COMP1LOCK_R = crate::BitReader;
37pub type COMP1LOCK_W<'a, REG> = crate::BitWriter<'a, REG>;
39pub type COMP2EN_R = crate::BitReader;
41pub type COMP2EN_W<'a, REG> = crate::BitWriter<'a, REG>;
43pub type COMP2MODE_R = crate::FieldReader;
45pub type COMP2MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
47pub type COMP2INSEL_R = crate::FieldReader;
49pub type COMP2INSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
51pub type WNDWEN_R = crate::BitReader;
53pub type WNDWEN_W<'a, REG> = crate::BitWriter<'a, REG>;
55pub type COMP2OUTSEL_R = crate::FieldReader;
57pub type COMP2OUTSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
59pub type COMP2POL_R = crate::BitReader;
61pub type COMP2POL_W<'a, REG> = crate::BitWriter<'a, REG>;
63pub type COMP2HYST_R = crate::FieldReader;
65pub type COMP2HYST_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
67pub type COMP2OUT_R = crate::BitReader;
69pub type COMP2LOCK_R = crate::BitReader;
71pub type COMP2LOCK_W<'a, REG> = crate::BitWriter<'a, REG>;
73impl R {
74 #[inline(always)]
76 pub fn comp1en(&self) -> COMP1EN_R {
77 COMP1EN_R::new((self.bits & 1) != 0)
78 }
79 #[inline(always)]
81 pub fn comp1_inp_dac(&self) -> COMP1_INP_DAC_R {
82 COMP1_INP_DAC_R::new(((self.bits >> 1) & 1) != 0)
83 }
84 #[inline(always)]
86 pub fn comp1mode(&self) -> COMP1MODE_R {
87 COMP1MODE_R::new(((self.bits >> 2) & 3) as u8)
88 }
89 #[inline(always)]
91 pub fn comp1insel(&self) -> COMP1INSEL_R {
92 COMP1INSEL_R::new(((self.bits >> 4) & 7) as u8)
93 }
94 #[inline(always)]
96 pub fn comp1outsel(&self) -> COMP1OUTSEL_R {
97 COMP1OUTSEL_R::new(((self.bits >> 8) & 7) as u8)
98 }
99 #[inline(always)]
101 pub fn comp1pol(&self) -> COMP1POL_R {
102 COMP1POL_R::new(((self.bits >> 11) & 1) != 0)
103 }
104 #[inline(always)]
106 pub fn comp1hyst(&self) -> COMP1HYST_R {
107 COMP1HYST_R::new(((self.bits >> 12) & 3) as u8)
108 }
109 #[inline(always)]
111 pub fn comp1out(&self) -> COMP1OUT_R {
112 COMP1OUT_R::new(((self.bits >> 14) & 1) != 0)
113 }
114 #[inline(always)]
116 pub fn comp1lock(&self) -> COMP1LOCK_R {
117 COMP1LOCK_R::new(((self.bits >> 15) & 1) != 0)
118 }
119 #[inline(always)]
121 pub fn comp2en(&self) -> COMP2EN_R {
122 COMP2EN_R::new(((self.bits >> 16) & 1) != 0)
123 }
124 #[inline(always)]
126 pub fn comp2mode(&self) -> COMP2MODE_R {
127 COMP2MODE_R::new(((self.bits >> 18) & 3) as u8)
128 }
129 #[inline(always)]
131 pub fn comp2insel(&self) -> COMP2INSEL_R {
132 COMP2INSEL_R::new(((self.bits >> 20) & 7) as u8)
133 }
134 #[inline(always)]
136 pub fn wndwen(&self) -> WNDWEN_R {
137 WNDWEN_R::new(((self.bits >> 23) & 1) != 0)
138 }
139 #[inline(always)]
141 pub fn comp2outsel(&self) -> COMP2OUTSEL_R {
142 COMP2OUTSEL_R::new(((self.bits >> 24) & 7) as u8)
143 }
144 #[inline(always)]
146 pub fn comp2pol(&self) -> COMP2POL_R {
147 COMP2POL_R::new(((self.bits >> 27) & 1) != 0)
148 }
149 #[inline(always)]
151 pub fn comp2hyst(&self) -> COMP2HYST_R {
152 COMP2HYST_R::new(((self.bits >> 28) & 3) as u8)
153 }
154 #[inline(always)]
156 pub fn comp2out(&self) -> COMP2OUT_R {
157 COMP2OUT_R::new(((self.bits >> 30) & 1) != 0)
158 }
159 #[inline(always)]
161 pub fn comp2lock(&self) -> COMP2LOCK_R {
162 COMP2LOCK_R::new(((self.bits >> 31) & 1) != 0)
163 }
164}
165impl core::fmt::Debug for R {
166 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
167 f.debug_struct("CSR")
168 .field("comp1en", &self.comp1en())
169 .field("comp1mode", &self.comp1mode())
170 .field("comp1insel", &self.comp1insel())
171 .field("comp1outsel", &self.comp1outsel())
172 .field("comp1pol", &self.comp1pol())
173 .field("comp1hyst", &self.comp1hyst())
174 .field("comp1out", &self.comp1out())
175 .field("comp1lock", &self.comp1lock())
176 .field("comp2en", &self.comp2en())
177 .field("comp2mode", &self.comp2mode())
178 .field("comp2insel", &self.comp2insel())
179 .field("wndwen", &self.wndwen())
180 .field("comp2outsel", &self.comp2outsel())
181 .field("comp2pol", &self.comp2pol())
182 .field("comp2hyst", &self.comp2hyst())
183 .field("comp2out", &self.comp2out())
184 .field("comp2lock", &self.comp2lock())
185 .field("comp1_inp_dac", &self.comp1_inp_dac())
186 .finish()
187 }
188}
189impl W {
190 #[inline(always)]
192 pub fn comp1en(&mut self) -> COMP1EN_W<CSRrs> {
193 COMP1EN_W::new(self, 0)
194 }
195 #[inline(always)]
197 pub fn comp1_inp_dac(&mut self) -> COMP1_INP_DAC_W<CSRrs> {
198 COMP1_INP_DAC_W::new(self, 1)
199 }
200 #[inline(always)]
202 pub fn comp1mode(&mut self) -> COMP1MODE_W<CSRrs> {
203 COMP1MODE_W::new(self, 2)
204 }
205 #[inline(always)]
207 pub fn comp1insel(&mut self) -> COMP1INSEL_W<CSRrs> {
208 COMP1INSEL_W::new(self, 4)
209 }
210 #[inline(always)]
212 pub fn comp1outsel(&mut self) -> COMP1OUTSEL_W<CSRrs> {
213 COMP1OUTSEL_W::new(self, 8)
214 }
215 #[inline(always)]
217 pub fn comp1pol(&mut self) -> COMP1POL_W<CSRrs> {
218 COMP1POL_W::new(self, 11)
219 }
220 #[inline(always)]
222 pub fn comp1hyst(&mut self) -> COMP1HYST_W<CSRrs> {
223 COMP1HYST_W::new(self, 12)
224 }
225 #[inline(always)]
227 pub fn comp1lock(&mut self) -> COMP1LOCK_W<CSRrs> {
228 COMP1LOCK_W::new(self, 15)
229 }
230 #[inline(always)]
232 pub fn comp2en(&mut self) -> COMP2EN_W<CSRrs> {
233 COMP2EN_W::new(self, 16)
234 }
235 #[inline(always)]
237 pub fn comp2mode(&mut self) -> COMP2MODE_W<CSRrs> {
238 COMP2MODE_W::new(self, 18)
239 }
240 #[inline(always)]
242 pub fn comp2insel(&mut self) -> COMP2INSEL_W<CSRrs> {
243 COMP2INSEL_W::new(self, 20)
244 }
245 #[inline(always)]
247 pub fn wndwen(&mut self) -> WNDWEN_W<CSRrs> {
248 WNDWEN_W::new(self, 23)
249 }
250 #[inline(always)]
252 pub fn comp2outsel(&mut self) -> COMP2OUTSEL_W<CSRrs> {
253 COMP2OUTSEL_W::new(self, 24)
254 }
255 #[inline(always)]
257 pub fn comp2pol(&mut self) -> COMP2POL_W<CSRrs> {
258 COMP2POL_W::new(self, 27)
259 }
260 #[inline(always)]
262 pub fn comp2hyst(&mut self) -> COMP2HYST_W<CSRrs> {
263 COMP2HYST_W::new(self, 28)
264 }
265 #[inline(always)]
267 pub fn comp2lock(&mut self) -> COMP2LOCK_W<CSRrs> {
268 COMP2LOCK_W::new(self, 31)
269 }
270}
271pub struct CSRrs;
277impl crate::RegisterSpec for CSRrs {
278 type Ux = u32;
279}
280impl crate::Readable for CSRrs {}
282impl crate::Writable for CSRrs {
284 type Safety = crate::Unsafe;
285 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
286 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
287}
288impl crate::Resettable for CSRrs {
290 const RESET_VALUE: u32 = 0;
291}