stm32f1_staging/stm32f100/tim15/
cr2.rs1pub type R = crate::R<CR2rs>;
3pub type W = crate::W<CR2rs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum CCPC {
11 NotPreloaded = 0,
13 Preloaded = 1,
15}
16impl From<CCPC> for bool {
17 #[inline(always)]
18 fn from(variant: CCPC) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type CCPC_R = crate::BitReader<CCPC>;
24impl CCPC_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> CCPC {
28 match self.bits {
29 false => CCPC::NotPreloaded,
30 true => CCPC::Preloaded,
31 }
32 }
33 #[inline(always)]
35 pub fn is_not_preloaded(&self) -> bool {
36 *self == CCPC::NotPreloaded
37 }
38 #[inline(always)]
40 pub fn is_preloaded(&self) -> bool {
41 *self == CCPC::Preloaded
42 }
43}
44pub type CCPC_W<'a, REG> = crate::BitWriter<'a, REG, CCPC>;
46impl<'a, REG> CCPC_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn not_preloaded(self) -> &'a mut crate::W<REG> {
53 self.variant(CCPC::NotPreloaded)
54 }
55 #[inline(always)]
57 pub fn preloaded(self) -> &'a mut crate::W<REG> {
58 self.variant(CCPC::Preloaded)
59 }
60}
61#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum CCUS {
67 Sw = 0,
69 SwOrEdge = 1,
71}
72impl From<CCUS> for bool {
73 #[inline(always)]
74 fn from(variant: CCUS) -> Self {
75 variant as u8 != 0
76 }
77}
78pub type CCUS_R = crate::BitReader<CCUS>;
80impl CCUS_R {
81 #[inline(always)]
83 pub const fn variant(&self) -> CCUS {
84 match self.bits {
85 false => CCUS::Sw,
86 true => CCUS::SwOrEdge,
87 }
88 }
89 #[inline(always)]
91 pub fn is_sw(&self) -> bool {
92 *self == CCUS::Sw
93 }
94 #[inline(always)]
96 pub fn is_sw_or_edge(&self) -> bool {
97 *self == CCUS::SwOrEdge
98 }
99}
100pub type CCUS_W<'a, REG> = crate::BitWriter<'a, REG, CCUS>;
102impl<'a, REG> CCUS_W<'a, REG>
103where
104 REG: crate::Writable + crate::RegisterSpec,
105{
106 #[inline(always)]
108 pub fn sw(self) -> &'a mut crate::W<REG> {
109 self.variant(CCUS::Sw)
110 }
111 #[inline(always)]
113 pub fn sw_or_edge(self) -> &'a mut crate::W<REG> {
114 self.variant(CCUS::SwOrEdge)
115 }
116}
117#[cfg_attr(feature = "defmt", derive(defmt::Format))]
121#[derive(Clone, Copy, Debug, PartialEq, Eq)]
122pub enum CCDS {
123 OnCompare = 0,
125 OnUpdate = 1,
127}
128impl From<CCDS> for bool {
129 #[inline(always)]
130 fn from(variant: CCDS) -> Self {
131 variant as u8 != 0
132 }
133}
134pub type CCDS_R = crate::BitReader<CCDS>;
136impl CCDS_R {
137 #[inline(always)]
139 pub const fn variant(&self) -> CCDS {
140 match self.bits {
141 false => CCDS::OnCompare,
142 true => CCDS::OnUpdate,
143 }
144 }
145 #[inline(always)]
147 pub fn is_on_compare(&self) -> bool {
148 *self == CCDS::OnCompare
149 }
150 #[inline(always)]
152 pub fn is_on_update(&self) -> bool {
153 *self == CCDS::OnUpdate
154 }
155}
156pub type CCDS_W<'a, REG> = crate::BitWriter<'a, REG, CCDS>;
158impl<'a, REG> CCDS_W<'a, REG>
159where
160 REG: crate::Writable + crate::RegisterSpec,
161{
162 #[inline(always)]
164 pub fn on_compare(self) -> &'a mut crate::W<REG> {
165 self.variant(CCDS::OnCompare)
166 }
167 #[inline(always)]
169 pub fn on_update(self) -> &'a mut crate::W<REG> {
170 self.variant(CCDS::OnUpdate)
171 }
172}
173pub type MMS_R = crate::FieldReader;
175pub type MMS_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
177#[cfg_attr(feature = "defmt", derive(defmt::Format))]
181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
182pub enum OIS1 {
183 Reset = 0,
185 Set = 1,
187}
188impl From<OIS1> for bool {
189 #[inline(always)]
190 fn from(variant: OIS1) -> Self {
191 variant as u8 != 0
192 }
193}
194pub type OIS_R = crate::BitReader<OIS1>;
196impl OIS_R {
197 #[inline(always)]
199 pub const fn variant(&self) -> OIS1 {
200 match self.bits {
201 false => OIS1::Reset,
202 true => OIS1::Set,
203 }
204 }
205 #[inline(always)]
207 pub fn is_reset(&self) -> bool {
208 *self == OIS1::Reset
209 }
210 #[inline(always)]
212 pub fn is_set(&self) -> bool {
213 *self == OIS1::Set
214 }
215}
216pub type OIS_W<'a, REG> = crate::BitWriter<'a, REG, OIS1>;
218impl<'a, REG> OIS_W<'a, REG>
219where
220 REG: crate::Writable + crate::RegisterSpec,
221{
222 #[inline(always)]
224 pub fn reset(self) -> &'a mut crate::W<REG> {
225 self.variant(OIS1::Reset)
226 }
227 #[inline(always)]
229 pub fn set_(self) -> &'a mut crate::W<REG> {
230 self.variant(OIS1::Set)
231 }
232}
233#[cfg_attr(feature = "defmt", derive(defmt::Format))]
237#[derive(Clone, Copy, Debug, PartialEq, Eq)]
238pub enum OIS1N {
239 Reset = 0,
241 Set = 1,
243}
244impl From<OIS1N> for bool {
245 #[inline(always)]
246 fn from(variant: OIS1N) -> Self {
247 variant as u8 != 0
248 }
249}
250pub type OISN_R = crate::BitReader<OIS1N>;
252impl OISN_R {
253 #[inline(always)]
255 pub const fn variant(&self) -> OIS1N {
256 match self.bits {
257 false => OIS1N::Reset,
258 true => OIS1N::Set,
259 }
260 }
261 #[inline(always)]
263 pub fn is_reset(&self) -> bool {
264 *self == OIS1N::Reset
265 }
266 #[inline(always)]
268 pub fn is_set(&self) -> bool {
269 *self == OIS1N::Set
270 }
271}
272pub type OISN_W<'a, REG> = crate::BitWriter<'a, REG, OIS1N>;
274impl<'a, REG> OISN_W<'a, REG>
275where
276 REG: crate::Writable + crate::RegisterSpec,
277{
278 #[inline(always)]
280 pub fn reset(self) -> &'a mut crate::W<REG> {
281 self.variant(OIS1N::Reset)
282 }
283 #[inline(always)]
285 pub fn set_(self) -> &'a mut crate::W<REG> {
286 self.variant(OIS1N::Set)
287 }
288}
289impl R {
290 #[inline(always)]
292 pub fn ccpc(&self) -> CCPC_R {
293 CCPC_R::new((self.bits & 1) != 0)
294 }
295 #[inline(always)]
297 pub fn ccus(&self) -> CCUS_R {
298 CCUS_R::new(((self.bits >> 2) & 1) != 0)
299 }
300 #[inline(always)]
302 pub fn ccds(&self) -> CCDS_R {
303 CCDS_R::new(((self.bits >> 3) & 1) != 0)
304 }
305 #[inline(always)]
307 pub fn mms(&self) -> MMS_R {
308 MMS_R::new(((self.bits >> 4) & 7) as u8)
309 }
310 #[inline(always)]
314 pub fn ois(&self, n: u8) -> OIS_R {
315 #[allow(clippy::no_effect)] [(); 2][n as usize];
316 OIS_R::new(((self.bits >> (n * 2 + 8)) & 1) != 0)
317 }
318 #[inline(always)]
321 pub fn ois_iter(&self) -> impl Iterator<Item = OIS_R> + '_ {
322 (0..2).map(move |n| OIS_R::new(((self.bits >> (n * 2 + 8)) & 1) != 0))
323 }
324 #[inline(always)]
326 pub fn ois1(&self) -> OIS_R {
327 OIS_R::new(((self.bits >> 8) & 1) != 0)
328 }
329 #[inline(always)]
331 pub fn ois2(&self) -> OIS_R {
332 OIS_R::new(((self.bits >> 10) & 1) != 0)
333 }
334 #[inline(always)]
338 pub fn oisn(&self, n: u8) -> OISN_R {
339 #[allow(clippy::no_effect)] [(); 1][n as usize];
340 OISN_R::new(((self.bits >> (n * 0 + 9)) & 1) != 0)
341 }
342 #[inline(always)]
345 pub fn oisn_iter(&self) -> impl Iterator<Item = OISN_R> + '_ {
346 (0..1).map(move |n| OISN_R::new(((self.bits >> (n * 0 + 9)) & 1) != 0))
347 }
348 #[inline(always)]
350 pub fn ois1n(&self) -> OISN_R {
351 OISN_R::new(((self.bits >> 9) & 1) != 0)
352 }
353}
354impl core::fmt::Debug for R {
355 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
356 f.debug_struct("CR2")
357 .field("ois1", &self.ois1())
358 .field("ois2", &self.ois2())
359 .field("ois1n", &self.ois1n())
360 .field("mms", &self.mms())
361 .field("ccds", &self.ccds())
362 .field("ccus", &self.ccus())
363 .field("ccpc", &self.ccpc())
364 .finish()
365 }
366}
367impl W {
368 #[inline(always)]
370 pub fn ccpc(&mut self) -> CCPC_W<CR2rs> {
371 CCPC_W::new(self, 0)
372 }
373 #[inline(always)]
375 pub fn ccus(&mut self) -> CCUS_W<CR2rs> {
376 CCUS_W::new(self, 2)
377 }
378 #[inline(always)]
380 pub fn ccds(&mut self) -> CCDS_W<CR2rs> {
381 CCDS_W::new(self, 3)
382 }
383 #[inline(always)]
385 pub fn mms(&mut self) -> MMS_W<CR2rs> {
386 MMS_W::new(self, 4)
387 }
388 #[inline(always)]
392 pub fn ois(&mut self, n: u8) -> OIS_W<CR2rs> {
393 #[allow(clippy::no_effect)] [(); 2][n as usize];
394 OIS_W::new(self, n * 2 + 8)
395 }
396 #[inline(always)]
398 pub fn ois1(&mut self) -> OIS_W<CR2rs> {
399 OIS_W::new(self, 8)
400 }
401 #[inline(always)]
403 pub fn ois2(&mut self) -> OIS_W<CR2rs> {
404 OIS_W::new(self, 10)
405 }
406 #[inline(always)]
410 pub fn oisn(&mut self, n: u8) -> OISN_W<CR2rs> {
411 #[allow(clippy::no_effect)] [(); 1][n as usize];
412 OISN_W::new(self, n * 0 + 9)
413 }
414 #[inline(always)]
416 pub fn ois1n(&mut self) -> OISN_W<CR2rs> {
417 OISN_W::new(self, 9)
418 }
419}
420pub struct CR2rs;
426impl crate::RegisterSpec for CR2rs {
427 type Ux = u32;
428}
429impl crate::Readable for CR2rs {}
431impl crate::Writable for CR2rs {
433 type Safety = crate::Unsafe;
434}
435impl crate::Resettable for CR2rs {}