stm32f4_staging/stm32f413/lptim/
ier.rs

1///Register `IER` reader
2pub type R = crate::R<IERrs>;
3///Register `IER` writer
4pub type W = crate::W<IERrs>;
5/**Compare match Interrupt Enable
6
7Value on reset: 0*/
8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum CMPMIE {
11    ///0: CMPM interrupt disabled
12    Disabled = 0,
13    ///1: CMPM interrupt enabled
14    Enabled = 1,
15}
16impl From<CMPMIE> for bool {
17    #[inline(always)]
18    fn from(variant: CMPMIE) -> Self {
19        variant as u8 != 0
20    }
21}
22///Field `CMPMIE` reader - Compare match Interrupt Enable
23pub type CMPMIE_R = crate::BitReader<CMPMIE>;
24impl CMPMIE_R {
25    ///Get enumerated values variant
26    #[inline(always)]
27    pub const fn variant(&self) -> CMPMIE {
28        match self.bits {
29            false => CMPMIE::Disabled,
30            true => CMPMIE::Enabled,
31        }
32    }
33    ///CMPM interrupt disabled
34    #[inline(always)]
35    pub fn is_disabled(&self) -> bool {
36        *self == CMPMIE::Disabled
37    }
38    ///CMPM interrupt enabled
39    #[inline(always)]
40    pub fn is_enabled(&self) -> bool {
41        *self == CMPMIE::Enabled
42    }
43}
44///Field `CMPMIE` writer - Compare match Interrupt Enable
45pub type CMPMIE_W<'a, REG> = crate::BitWriter<'a, REG, CMPMIE>;
46impl<'a, REG> CMPMIE_W<'a, REG>
47where
48    REG: crate::Writable + crate::RegisterSpec,
49{
50    ///CMPM interrupt disabled
51    #[inline(always)]
52    pub fn disabled(self) -> &'a mut crate::W<REG> {
53        self.variant(CMPMIE::Disabled)
54    }
55    ///CMPM interrupt enabled
56    #[inline(always)]
57    pub fn enabled(self) -> &'a mut crate::W<REG> {
58        self.variant(CMPMIE::Enabled)
59    }
60}
61/**Autoreload match Interrupt Enable
62
63Value on reset: 0*/
64#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum ARRMIE {
67    ///0: ARRM interrupt disabled
68    Disabled = 0,
69    ///1: ARRM interrupt enabled
70    Enabled = 1,
71}
72impl From<ARRMIE> for bool {
73    #[inline(always)]
74    fn from(variant: ARRMIE) -> Self {
75        variant as u8 != 0
76    }
77}
78///Field `ARRMIE` reader - Autoreload match Interrupt Enable
79pub type ARRMIE_R = crate::BitReader<ARRMIE>;
80impl ARRMIE_R {
81    ///Get enumerated values variant
82    #[inline(always)]
83    pub const fn variant(&self) -> ARRMIE {
84        match self.bits {
85            false => ARRMIE::Disabled,
86            true => ARRMIE::Enabled,
87        }
88    }
89    ///ARRM interrupt disabled
90    #[inline(always)]
91    pub fn is_disabled(&self) -> bool {
92        *self == ARRMIE::Disabled
93    }
94    ///ARRM interrupt enabled
95    #[inline(always)]
96    pub fn is_enabled(&self) -> bool {
97        *self == ARRMIE::Enabled
98    }
99}
100///Field `ARRMIE` writer - Autoreload match Interrupt Enable
101pub type ARRMIE_W<'a, REG> = crate::BitWriter<'a, REG, ARRMIE>;
102impl<'a, REG> ARRMIE_W<'a, REG>
103where
104    REG: crate::Writable + crate::RegisterSpec,
105{
106    ///ARRM interrupt disabled
107    #[inline(always)]
108    pub fn disabled(self) -> &'a mut crate::W<REG> {
109        self.variant(ARRMIE::Disabled)
110    }
111    ///ARRM interrupt enabled
112    #[inline(always)]
113    pub fn enabled(self) -> &'a mut crate::W<REG> {
114        self.variant(ARRMIE::Enabled)
115    }
116}
117/**External trigger valid edge Interrupt Enable
118
119Value on reset: 0*/
120#[cfg_attr(feature = "defmt", derive(defmt::Format))]
121#[derive(Clone, Copy, Debug, PartialEq, Eq)]
122pub enum EXTTRIGIE {
123    ///0: EXTTRIG interrupt disabled
124    Disabled = 0,
125    ///1: EXTTRIG interrupt enabled
126    Enabled = 1,
127}
128impl From<EXTTRIGIE> for bool {
129    #[inline(always)]
130    fn from(variant: EXTTRIGIE) -> Self {
131        variant as u8 != 0
132    }
133}
134///Field `EXTTRIGIE` reader - External trigger valid edge Interrupt Enable
135pub type EXTTRIGIE_R = crate::BitReader<EXTTRIGIE>;
136impl EXTTRIGIE_R {
137    ///Get enumerated values variant
138    #[inline(always)]
139    pub const fn variant(&self) -> EXTTRIGIE {
140        match self.bits {
141            false => EXTTRIGIE::Disabled,
142            true => EXTTRIGIE::Enabled,
143        }
144    }
145    ///EXTTRIG interrupt disabled
146    #[inline(always)]
147    pub fn is_disabled(&self) -> bool {
148        *self == EXTTRIGIE::Disabled
149    }
150    ///EXTTRIG interrupt enabled
151    #[inline(always)]
152    pub fn is_enabled(&self) -> bool {
153        *self == EXTTRIGIE::Enabled
154    }
155}
156///Field `EXTTRIGIE` writer - External trigger valid edge Interrupt Enable
157pub type EXTTRIGIE_W<'a, REG> = crate::BitWriter<'a, REG, EXTTRIGIE>;
158impl<'a, REG> EXTTRIGIE_W<'a, REG>
159where
160    REG: crate::Writable + crate::RegisterSpec,
161{
162    ///EXTTRIG interrupt disabled
163    #[inline(always)]
164    pub fn disabled(self) -> &'a mut crate::W<REG> {
165        self.variant(EXTTRIGIE::Disabled)
166    }
167    ///EXTTRIG interrupt enabled
168    #[inline(always)]
169    pub fn enabled(self) -> &'a mut crate::W<REG> {
170        self.variant(EXTTRIGIE::Enabled)
171    }
172}
173/**Compare register update OK Interrupt Enable
174
175Value on reset: 0*/
176#[cfg_attr(feature = "defmt", derive(defmt::Format))]
177#[derive(Clone, Copy, Debug, PartialEq, Eq)]
178pub enum CMPOKIE {
179    ///0: CMPOK interrupt disabled
180    Disabled = 0,
181    ///1: CMPOK interrupt enabled
182    Enabled = 1,
183}
184impl From<CMPOKIE> for bool {
185    #[inline(always)]
186    fn from(variant: CMPOKIE) -> Self {
187        variant as u8 != 0
188    }
189}
190///Field `CMPOKIE` reader - Compare register update OK Interrupt Enable
191pub type CMPOKIE_R = crate::BitReader<CMPOKIE>;
192impl CMPOKIE_R {
193    ///Get enumerated values variant
194    #[inline(always)]
195    pub const fn variant(&self) -> CMPOKIE {
196        match self.bits {
197            false => CMPOKIE::Disabled,
198            true => CMPOKIE::Enabled,
199        }
200    }
201    ///CMPOK interrupt disabled
202    #[inline(always)]
203    pub fn is_disabled(&self) -> bool {
204        *self == CMPOKIE::Disabled
205    }
206    ///CMPOK interrupt enabled
207    #[inline(always)]
208    pub fn is_enabled(&self) -> bool {
209        *self == CMPOKIE::Enabled
210    }
211}
212///Field `CMPOKIE` writer - Compare register update OK Interrupt Enable
213pub type CMPOKIE_W<'a, REG> = crate::BitWriter<'a, REG, CMPOKIE>;
214impl<'a, REG> CMPOKIE_W<'a, REG>
215where
216    REG: crate::Writable + crate::RegisterSpec,
217{
218    ///CMPOK interrupt disabled
219    #[inline(always)]
220    pub fn disabled(self) -> &'a mut crate::W<REG> {
221        self.variant(CMPOKIE::Disabled)
222    }
223    ///CMPOK interrupt enabled
224    #[inline(always)]
225    pub fn enabled(self) -> &'a mut crate::W<REG> {
226        self.variant(CMPOKIE::Enabled)
227    }
228}
229/**Autoreload register update OK Interrupt Enable
230
231Value on reset: 0*/
232#[cfg_attr(feature = "defmt", derive(defmt::Format))]
233#[derive(Clone, Copy, Debug, PartialEq, Eq)]
234pub enum ARROKIE {
235    ///0: ARROK interrupt disabled
236    Disabled = 0,
237    ///1: ARROK interrupt enabled
238    Enabled = 1,
239}
240impl From<ARROKIE> for bool {
241    #[inline(always)]
242    fn from(variant: ARROKIE) -> Self {
243        variant as u8 != 0
244    }
245}
246///Field `ARROKIE` reader - Autoreload register update OK Interrupt Enable
247pub type ARROKIE_R = crate::BitReader<ARROKIE>;
248impl ARROKIE_R {
249    ///Get enumerated values variant
250    #[inline(always)]
251    pub const fn variant(&self) -> ARROKIE {
252        match self.bits {
253            false => ARROKIE::Disabled,
254            true => ARROKIE::Enabled,
255        }
256    }
257    ///ARROK interrupt disabled
258    #[inline(always)]
259    pub fn is_disabled(&self) -> bool {
260        *self == ARROKIE::Disabled
261    }
262    ///ARROK interrupt enabled
263    #[inline(always)]
264    pub fn is_enabled(&self) -> bool {
265        *self == ARROKIE::Enabled
266    }
267}
268///Field `ARROKIE` writer - Autoreload register update OK Interrupt Enable
269pub type ARROKIE_W<'a, REG> = crate::BitWriter<'a, REG, ARROKIE>;
270impl<'a, REG> ARROKIE_W<'a, REG>
271where
272    REG: crate::Writable + crate::RegisterSpec,
273{
274    ///ARROK interrupt disabled
275    #[inline(always)]
276    pub fn disabled(self) -> &'a mut crate::W<REG> {
277        self.variant(ARROKIE::Disabled)
278    }
279    ///ARROK interrupt enabled
280    #[inline(always)]
281    pub fn enabled(self) -> &'a mut crate::W<REG> {
282        self.variant(ARROKIE::Enabled)
283    }
284}
285/**Direction change to UP Interrupt Enable
286
287Value on reset: 0*/
288#[cfg_attr(feature = "defmt", derive(defmt::Format))]
289#[derive(Clone, Copy, Debug, PartialEq, Eq)]
290pub enum UPIE {
291    ///0: UP interrupt disabled
292    Disabled = 0,
293    ///1: UP interrupt enabled
294    Enabled = 1,
295}
296impl From<UPIE> for bool {
297    #[inline(always)]
298    fn from(variant: UPIE) -> Self {
299        variant as u8 != 0
300    }
301}
302///Field `UPIE` reader - Direction change to UP Interrupt Enable
303pub type UPIE_R = crate::BitReader<UPIE>;
304impl UPIE_R {
305    ///Get enumerated values variant
306    #[inline(always)]
307    pub const fn variant(&self) -> UPIE {
308        match self.bits {
309            false => UPIE::Disabled,
310            true => UPIE::Enabled,
311        }
312    }
313    ///UP interrupt disabled
314    #[inline(always)]
315    pub fn is_disabled(&self) -> bool {
316        *self == UPIE::Disabled
317    }
318    ///UP interrupt enabled
319    #[inline(always)]
320    pub fn is_enabled(&self) -> bool {
321        *self == UPIE::Enabled
322    }
323}
324///Field `UPIE` writer - Direction change to UP Interrupt Enable
325pub type UPIE_W<'a, REG> = crate::BitWriter<'a, REG, UPIE>;
326impl<'a, REG> UPIE_W<'a, REG>
327where
328    REG: crate::Writable + crate::RegisterSpec,
329{
330    ///UP interrupt disabled
331    #[inline(always)]
332    pub fn disabled(self) -> &'a mut crate::W<REG> {
333        self.variant(UPIE::Disabled)
334    }
335    ///UP interrupt enabled
336    #[inline(always)]
337    pub fn enabled(self) -> &'a mut crate::W<REG> {
338        self.variant(UPIE::Enabled)
339    }
340}
341/**Direction change to down Interrupt Enable
342
343Value on reset: 0*/
344#[cfg_attr(feature = "defmt", derive(defmt::Format))]
345#[derive(Clone, Copy, Debug, PartialEq, Eq)]
346pub enum DOWNIE {
347    ///0: DOWN interrupt disabled
348    Disabled = 0,
349    ///1: DOWN interrupt enabled
350    Enabled = 1,
351}
352impl From<DOWNIE> for bool {
353    #[inline(always)]
354    fn from(variant: DOWNIE) -> Self {
355        variant as u8 != 0
356    }
357}
358///Field `DOWNIE` reader - Direction change to down Interrupt Enable
359pub type DOWNIE_R = crate::BitReader<DOWNIE>;
360impl DOWNIE_R {
361    ///Get enumerated values variant
362    #[inline(always)]
363    pub const fn variant(&self) -> DOWNIE {
364        match self.bits {
365            false => DOWNIE::Disabled,
366            true => DOWNIE::Enabled,
367        }
368    }
369    ///DOWN interrupt disabled
370    #[inline(always)]
371    pub fn is_disabled(&self) -> bool {
372        *self == DOWNIE::Disabled
373    }
374    ///DOWN interrupt enabled
375    #[inline(always)]
376    pub fn is_enabled(&self) -> bool {
377        *self == DOWNIE::Enabled
378    }
379}
380///Field `DOWNIE` writer - Direction change to down Interrupt Enable
381pub type DOWNIE_W<'a, REG> = crate::BitWriter<'a, REG, DOWNIE>;
382impl<'a, REG> DOWNIE_W<'a, REG>
383where
384    REG: crate::Writable + crate::RegisterSpec,
385{
386    ///DOWN interrupt disabled
387    #[inline(always)]
388    pub fn disabled(self) -> &'a mut crate::W<REG> {
389        self.variant(DOWNIE::Disabled)
390    }
391    ///DOWN interrupt enabled
392    #[inline(always)]
393    pub fn enabled(self) -> &'a mut crate::W<REG> {
394        self.variant(DOWNIE::Enabled)
395    }
396}
397impl R {
398    ///Bit 0 - Compare match Interrupt Enable
399    #[inline(always)]
400    pub fn cmpmie(&self) -> CMPMIE_R {
401        CMPMIE_R::new((self.bits & 1) != 0)
402    }
403    ///Bit 1 - Autoreload match Interrupt Enable
404    #[inline(always)]
405    pub fn arrmie(&self) -> ARRMIE_R {
406        ARRMIE_R::new(((self.bits >> 1) & 1) != 0)
407    }
408    ///Bit 2 - External trigger valid edge Interrupt Enable
409    #[inline(always)]
410    pub fn exttrigie(&self) -> EXTTRIGIE_R {
411        EXTTRIGIE_R::new(((self.bits >> 2) & 1) != 0)
412    }
413    ///Bit 3 - Compare register update OK Interrupt Enable
414    #[inline(always)]
415    pub fn cmpokie(&self) -> CMPOKIE_R {
416        CMPOKIE_R::new(((self.bits >> 3) & 1) != 0)
417    }
418    ///Bit 4 - Autoreload register update OK Interrupt Enable
419    #[inline(always)]
420    pub fn arrokie(&self) -> ARROKIE_R {
421        ARROKIE_R::new(((self.bits >> 4) & 1) != 0)
422    }
423    ///Bit 5 - Direction change to UP Interrupt Enable
424    #[inline(always)]
425    pub fn upie(&self) -> UPIE_R {
426        UPIE_R::new(((self.bits >> 5) & 1) != 0)
427    }
428    ///Bit 6 - Direction change to down Interrupt Enable
429    #[inline(always)]
430    pub fn downie(&self) -> DOWNIE_R {
431        DOWNIE_R::new(((self.bits >> 6) & 1) != 0)
432    }
433}
434impl core::fmt::Debug for R {
435    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
436        f.debug_struct("IER")
437            .field("downie", &self.downie())
438            .field("upie", &self.upie())
439            .field("arrokie", &self.arrokie())
440            .field("cmpokie", &self.cmpokie())
441            .field("exttrigie", &self.exttrigie())
442            .field("arrmie", &self.arrmie())
443            .field("cmpmie", &self.cmpmie())
444            .finish()
445    }
446}
447impl W {
448    ///Bit 0 - Compare match Interrupt Enable
449    #[inline(always)]
450    pub fn cmpmie(&mut self) -> CMPMIE_W<IERrs> {
451        CMPMIE_W::new(self, 0)
452    }
453    ///Bit 1 - Autoreload match Interrupt Enable
454    #[inline(always)]
455    pub fn arrmie(&mut self) -> ARRMIE_W<IERrs> {
456        ARRMIE_W::new(self, 1)
457    }
458    ///Bit 2 - External trigger valid edge Interrupt Enable
459    #[inline(always)]
460    pub fn exttrigie(&mut self) -> EXTTRIGIE_W<IERrs> {
461        EXTTRIGIE_W::new(self, 2)
462    }
463    ///Bit 3 - Compare register update OK Interrupt Enable
464    #[inline(always)]
465    pub fn cmpokie(&mut self) -> CMPOKIE_W<IERrs> {
466        CMPOKIE_W::new(self, 3)
467    }
468    ///Bit 4 - Autoreload register update OK Interrupt Enable
469    #[inline(always)]
470    pub fn arrokie(&mut self) -> ARROKIE_W<IERrs> {
471        ARROKIE_W::new(self, 4)
472    }
473    ///Bit 5 - Direction change to UP Interrupt Enable
474    #[inline(always)]
475    pub fn upie(&mut self) -> UPIE_W<IERrs> {
476        UPIE_W::new(self, 5)
477    }
478    ///Bit 6 - Direction change to down Interrupt Enable
479    #[inline(always)]
480    pub fn downie(&mut self) -> DOWNIE_W<IERrs> {
481        DOWNIE_W::new(self, 6)
482    }
483}
484/**Interrupt Enable Register
485
486You can [`read`](crate::Reg::read) this register and get [`ier::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ier::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
487
488See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F413.html#LPTIM:IER)*/
489pub struct IERrs;
490impl crate::RegisterSpec for IERrs {
491    type Ux = u32;
492}
493///`read()` method returns [`ier::R`](R) reader structure
494impl crate::Readable for IERrs {}
495///`write(|w| ..)` method takes [`ier::W`](W) writer structure
496impl crate::Writable for IERrs {
497    type Safety = crate::Unsafe;
498}
499///`reset()` method sets IER to value 0
500impl crate::Resettable for IERrs {}