stm32f1_staging/stm32f100/tim16/
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}
173#[cfg_attr(feature = "defmt", derive(defmt::Format))]
177#[derive(Clone, Copy, Debug, PartialEq, Eq)]
178pub enum OIS1 {
179 Reset = 0,
181 Set = 1,
183}
184impl From<OIS1> for bool {
185 #[inline(always)]
186 fn from(variant: OIS1) -> Self {
187 variant as u8 != 0
188 }
189}
190pub type OIS_R = crate::BitReader<OIS1>;
192impl OIS_R {
193 #[inline(always)]
195 pub const fn variant(&self) -> OIS1 {
196 match self.bits {
197 false => OIS1::Reset,
198 true => OIS1::Set,
199 }
200 }
201 #[inline(always)]
203 pub fn is_reset(&self) -> bool {
204 *self == OIS1::Reset
205 }
206 #[inline(always)]
208 pub fn is_set(&self) -> bool {
209 *self == OIS1::Set
210 }
211}
212pub type OIS_W<'a, REG> = crate::BitWriter<'a, REG, OIS1>;
214impl<'a, REG> OIS_W<'a, REG>
215where
216 REG: crate::Writable + crate::RegisterSpec,
217{
218 #[inline(always)]
220 pub fn reset(self) -> &'a mut crate::W<REG> {
221 self.variant(OIS1::Reset)
222 }
223 #[inline(always)]
225 pub fn set_(self) -> &'a mut crate::W<REG> {
226 self.variant(OIS1::Set)
227 }
228}
229#[cfg_attr(feature = "defmt", derive(defmt::Format))]
233#[derive(Clone, Copy, Debug, PartialEq, Eq)]
234pub enum OIS1N {
235 Reset = 0,
237 Set = 1,
239}
240impl From<OIS1N> for bool {
241 #[inline(always)]
242 fn from(variant: OIS1N) -> Self {
243 variant as u8 != 0
244 }
245}
246pub type OISN_R = crate::BitReader<OIS1N>;
248impl OISN_R {
249 #[inline(always)]
251 pub const fn variant(&self) -> OIS1N {
252 match self.bits {
253 false => OIS1N::Reset,
254 true => OIS1N::Set,
255 }
256 }
257 #[inline(always)]
259 pub fn is_reset(&self) -> bool {
260 *self == OIS1N::Reset
261 }
262 #[inline(always)]
264 pub fn is_set(&self) -> bool {
265 *self == OIS1N::Set
266 }
267}
268pub type OISN_W<'a, REG> = crate::BitWriter<'a, REG, OIS1N>;
270impl<'a, REG> OISN_W<'a, REG>
271where
272 REG: crate::Writable + crate::RegisterSpec,
273{
274 #[inline(always)]
276 pub fn reset(self) -> &'a mut crate::W<REG> {
277 self.variant(OIS1N::Reset)
278 }
279 #[inline(always)]
281 pub fn set_(self) -> &'a mut crate::W<REG> {
282 self.variant(OIS1N::Set)
283 }
284}
285impl R {
286 #[inline(always)]
288 pub fn ccpc(&self) -> CCPC_R {
289 CCPC_R::new((self.bits & 1) != 0)
290 }
291 #[inline(always)]
293 pub fn ccus(&self) -> CCUS_R {
294 CCUS_R::new(((self.bits >> 2) & 1) != 0)
295 }
296 #[inline(always)]
298 pub fn ccds(&self) -> CCDS_R {
299 CCDS_R::new(((self.bits >> 3) & 1) != 0)
300 }
301 #[inline(always)]
305 pub fn ois(&self, n: u8) -> OIS_R {
306 #[allow(clippy::no_effect)] [(); 1][n as usize];
307 OIS_R::new(((self.bits >> (n * 0 + 8)) & 1) != 0)
308 }
309 #[inline(always)]
312 pub fn ois_iter(&self) -> impl Iterator<Item = OIS_R> + '_ {
313 (0..1).map(move |n| OIS_R::new(((self.bits >> (n * 0 + 8)) & 1) != 0))
314 }
315 #[inline(always)]
317 pub fn ois1(&self) -> OIS_R {
318 OIS_R::new(((self.bits >> 8) & 1) != 0)
319 }
320 #[inline(always)]
324 pub fn oisn(&self, n: u8) -> OISN_R {
325 #[allow(clippy::no_effect)] [(); 1][n as usize];
326 OISN_R::new(((self.bits >> (n * 0 + 9)) & 1) != 0)
327 }
328 #[inline(always)]
331 pub fn oisn_iter(&self) -> impl Iterator<Item = OISN_R> + '_ {
332 (0..1).map(move |n| OISN_R::new(((self.bits >> (n * 0 + 9)) & 1) != 0))
333 }
334 #[inline(always)]
336 pub fn ois1n(&self) -> OISN_R {
337 OISN_R::new(((self.bits >> 9) & 1) != 0)
338 }
339}
340impl core::fmt::Debug for R {
341 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
342 f.debug_struct("CR2")
343 .field("ois1n", &self.ois1n())
344 .field("ois1", &self.ois1())
345 .field("ccds", &self.ccds())
346 .field("ccus", &self.ccus())
347 .field("ccpc", &self.ccpc())
348 .finish()
349 }
350}
351impl W {
352 #[inline(always)]
354 pub fn ccpc(&mut self) -> CCPC_W<CR2rs> {
355 CCPC_W::new(self, 0)
356 }
357 #[inline(always)]
359 pub fn ccus(&mut self) -> CCUS_W<CR2rs> {
360 CCUS_W::new(self, 2)
361 }
362 #[inline(always)]
364 pub fn ccds(&mut self) -> CCDS_W<CR2rs> {
365 CCDS_W::new(self, 3)
366 }
367 #[inline(always)]
371 pub fn ois(&mut self, n: u8) -> OIS_W<CR2rs> {
372 #[allow(clippy::no_effect)] [(); 1][n as usize];
373 OIS_W::new(self, n * 0 + 8)
374 }
375 #[inline(always)]
377 pub fn ois1(&mut self) -> OIS_W<CR2rs> {
378 OIS_W::new(self, 8)
379 }
380 #[inline(always)]
384 pub fn oisn(&mut self, n: u8) -> OISN_W<CR2rs> {
385 #[allow(clippy::no_effect)] [(); 1][n as usize];
386 OISN_W::new(self, n * 0 + 9)
387 }
388 #[inline(always)]
390 pub fn ois1n(&mut self) -> OISN_W<CR2rs> {
391 OISN_W::new(self, 9)
392 }
393}
394pub struct CR2rs;
400impl crate::RegisterSpec for CR2rs {
401 type Ux = u32;
402}
403impl crate::Readable for CR2rs {}
405impl crate::Writable for CR2rs {
407 type Safety = crate::Unsafe;
408}
409impl crate::Resettable for CR2rs {}