wip_s32k144/rtc/
ier.rs

1#[doc = "Reader of register IER"]
2pub type R = crate::R<u32, super::IER>;
3#[doc = "Writer for register IER"]
4pub type W = crate::W<u32, super::IER>;
5#[doc = "Register IER `reset()`'s with value 0x07"]
6impl crate::ResetValue for super::IER {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x07
11    }
12}
13#[doc = "Time Invalid Interrupt Enable\n\nValue on reset: 1"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum TIIE_A {
16    #[doc = "0: Time invalid flag does not generate an interrupt."]
17    _0 = 0,
18    #[doc = "1: Time invalid flag does generate an interrupt."]
19    _1 = 1,
20}
21impl From<TIIE_A> for bool {
22    #[inline(always)]
23    fn from(variant: TIIE_A) -> Self {
24        variant as u8 != 0
25    }
26}
27#[doc = "Reader of field `TIIE`"]
28pub type TIIE_R = crate::R<bool, TIIE_A>;
29impl TIIE_R {
30    #[doc = r"Get enumerated values variant"]
31    #[inline(always)]
32    pub fn variant(&self) -> TIIE_A {
33        match self.bits {
34            false => TIIE_A::_0,
35            true => TIIE_A::_1,
36        }
37    }
38    #[doc = "Checks if the value of the field is `_0`"]
39    #[inline(always)]
40    pub fn is_0(&self) -> bool {
41        *self == TIIE_A::_0
42    }
43    #[doc = "Checks if the value of the field is `_1`"]
44    #[inline(always)]
45    pub fn is_1(&self) -> bool {
46        *self == TIIE_A::_1
47    }
48}
49#[doc = "Write proxy for field `TIIE`"]
50pub struct TIIE_W<'a> {
51    w: &'a mut W,
52}
53impl<'a> TIIE_W<'a> {
54    #[doc = r"Writes `variant` to the field"]
55    #[inline(always)]
56    pub fn variant(self, variant: TIIE_A) -> &'a mut W {
57        {
58            self.bit(variant.into())
59        }
60    }
61    #[doc = "Time invalid flag does not generate an interrupt."]
62    #[inline(always)]
63    pub fn _0(self) -> &'a mut W {
64        self.variant(TIIE_A::_0)
65    }
66    #[doc = "Time invalid flag does generate an interrupt."]
67    #[inline(always)]
68    pub fn _1(self) -> &'a mut W {
69        self.variant(TIIE_A::_1)
70    }
71    #[doc = r"Sets the field bit"]
72    #[inline(always)]
73    pub fn set_bit(self) -> &'a mut W {
74        self.bit(true)
75    }
76    #[doc = r"Clears the field bit"]
77    #[inline(always)]
78    pub fn clear_bit(self) -> &'a mut W {
79        self.bit(false)
80    }
81    #[doc = r"Writes raw bits to the field"]
82    #[inline(always)]
83    pub fn bit(self, value: bool) -> &'a mut W {
84        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
85        self.w
86    }
87}
88#[doc = "Time Overflow Interrupt Enable\n\nValue on reset: 1"]
89#[derive(Clone, Copy, Debug, PartialEq)]
90pub enum TOIE_A {
91    #[doc = "0: Time overflow flag does not generate an interrupt."]
92    _0 = 0,
93    #[doc = "1: Time overflow flag does generate an interrupt."]
94    _1 = 1,
95}
96impl From<TOIE_A> for bool {
97    #[inline(always)]
98    fn from(variant: TOIE_A) -> Self {
99        variant as u8 != 0
100    }
101}
102#[doc = "Reader of field `TOIE`"]
103pub type TOIE_R = crate::R<bool, TOIE_A>;
104impl TOIE_R {
105    #[doc = r"Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> TOIE_A {
108        match self.bits {
109            false => TOIE_A::_0,
110            true => TOIE_A::_1,
111        }
112    }
113    #[doc = "Checks if the value of the field is `_0`"]
114    #[inline(always)]
115    pub fn is_0(&self) -> bool {
116        *self == TOIE_A::_0
117    }
118    #[doc = "Checks if the value of the field is `_1`"]
119    #[inline(always)]
120    pub fn is_1(&self) -> bool {
121        *self == TOIE_A::_1
122    }
123}
124#[doc = "Write proxy for field `TOIE`"]
125pub struct TOIE_W<'a> {
126    w: &'a mut W,
127}
128impl<'a> TOIE_W<'a> {
129    #[doc = r"Writes `variant` to the field"]
130    #[inline(always)]
131    pub fn variant(self, variant: TOIE_A) -> &'a mut W {
132        {
133            self.bit(variant.into())
134        }
135    }
136    #[doc = "Time overflow flag does not generate an interrupt."]
137    #[inline(always)]
138    pub fn _0(self) -> &'a mut W {
139        self.variant(TOIE_A::_0)
140    }
141    #[doc = "Time overflow flag does generate an interrupt."]
142    #[inline(always)]
143    pub fn _1(self) -> &'a mut W {
144        self.variant(TOIE_A::_1)
145    }
146    #[doc = r"Sets the field bit"]
147    #[inline(always)]
148    pub fn set_bit(self) -> &'a mut W {
149        self.bit(true)
150    }
151    #[doc = r"Clears the field bit"]
152    #[inline(always)]
153    pub fn clear_bit(self) -> &'a mut W {
154        self.bit(false)
155    }
156    #[doc = r"Writes raw bits to the field"]
157    #[inline(always)]
158    pub fn bit(self, value: bool) -> &'a mut W {
159        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
160        self.w
161    }
162}
163#[doc = "Time Alarm Interrupt Enable\n\nValue on reset: 1"]
164#[derive(Clone, Copy, Debug, PartialEq)]
165pub enum TAIE_A {
166    #[doc = "0: Time alarm flag does not generate an interrupt."]
167    _0 = 0,
168    #[doc = "1: Time alarm flag does generate an interrupt."]
169    _1 = 1,
170}
171impl From<TAIE_A> for bool {
172    #[inline(always)]
173    fn from(variant: TAIE_A) -> Self {
174        variant as u8 != 0
175    }
176}
177#[doc = "Reader of field `TAIE`"]
178pub type TAIE_R = crate::R<bool, TAIE_A>;
179impl TAIE_R {
180    #[doc = r"Get enumerated values variant"]
181    #[inline(always)]
182    pub fn variant(&self) -> TAIE_A {
183        match self.bits {
184            false => TAIE_A::_0,
185            true => TAIE_A::_1,
186        }
187    }
188    #[doc = "Checks if the value of the field is `_0`"]
189    #[inline(always)]
190    pub fn is_0(&self) -> bool {
191        *self == TAIE_A::_0
192    }
193    #[doc = "Checks if the value of the field is `_1`"]
194    #[inline(always)]
195    pub fn is_1(&self) -> bool {
196        *self == TAIE_A::_1
197    }
198}
199#[doc = "Write proxy for field `TAIE`"]
200pub struct TAIE_W<'a> {
201    w: &'a mut W,
202}
203impl<'a> TAIE_W<'a> {
204    #[doc = r"Writes `variant` to the field"]
205    #[inline(always)]
206    pub fn variant(self, variant: TAIE_A) -> &'a mut W {
207        {
208            self.bit(variant.into())
209        }
210    }
211    #[doc = "Time alarm flag does not generate an interrupt."]
212    #[inline(always)]
213    pub fn _0(self) -> &'a mut W {
214        self.variant(TAIE_A::_0)
215    }
216    #[doc = "Time alarm flag does generate an interrupt."]
217    #[inline(always)]
218    pub fn _1(self) -> &'a mut W {
219        self.variant(TAIE_A::_1)
220    }
221    #[doc = r"Sets the field bit"]
222    #[inline(always)]
223    pub fn set_bit(self) -> &'a mut W {
224        self.bit(true)
225    }
226    #[doc = r"Clears the field bit"]
227    #[inline(always)]
228    pub fn clear_bit(self) -> &'a mut W {
229        self.bit(false)
230    }
231    #[doc = r"Writes raw bits to the field"]
232    #[inline(always)]
233    pub fn bit(self, value: bool) -> &'a mut W {
234        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
235        self.w
236    }
237}
238#[doc = "Time Seconds Interrupt Enable\n\nValue on reset: 0"]
239#[derive(Clone, Copy, Debug, PartialEq)]
240pub enum TSIE_A {
241    #[doc = "0: Seconds interrupt is disabled."]
242    _0 = 0,
243    #[doc = "1: Seconds interrupt is enabled."]
244    _1 = 1,
245}
246impl From<TSIE_A> for bool {
247    #[inline(always)]
248    fn from(variant: TSIE_A) -> Self {
249        variant as u8 != 0
250    }
251}
252#[doc = "Reader of field `TSIE`"]
253pub type TSIE_R = crate::R<bool, TSIE_A>;
254impl TSIE_R {
255    #[doc = r"Get enumerated values variant"]
256    #[inline(always)]
257    pub fn variant(&self) -> TSIE_A {
258        match self.bits {
259            false => TSIE_A::_0,
260            true => TSIE_A::_1,
261        }
262    }
263    #[doc = "Checks if the value of the field is `_0`"]
264    #[inline(always)]
265    pub fn is_0(&self) -> bool {
266        *self == TSIE_A::_0
267    }
268    #[doc = "Checks if the value of the field is `_1`"]
269    #[inline(always)]
270    pub fn is_1(&self) -> bool {
271        *self == TSIE_A::_1
272    }
273}
274#[doc = "Write proxy for field `TSIE`"]
275pub struct TSIE_W<'a> {
276    w: &'a mut W,
277}
278impl<'a> TSIE_W<'a> {
279    #[doc = r"Writes `variant` to the field"]
280    #[inline(always)]
281    pub fn variant(self, variant: TSIE_A) -> &'a mut W {
282        {
283            self.bit(variant.into())
284        }
285    }
286    #[doc = "Seconds interrupt is disabled."]
287    #[inline(always)]
288    pub fn _0(self) -> &'a mut W {
289        self.variant(TSIE_A::_0)
290    }
291    #[doc = "Seconds interrupt is enabled."]
292    #[inline(always)]
293    pub fn _1(self) -> &'a mut W {
294        self.variant(TSIE_A::_1)
295    }
296    #[doc = r"Sets the field bit"]
297    #[inline(always)]
298    pub fn set_bit(self) -> &'a mut W {
299        self.bit(true)
300    }
301    #[doc = r"Clears the field bit"]
302    #[inline(always)]
303    pub fn clear_bit(self) -> &'a mut W {
304        self.bit(false)
305    }
306    #[doc = r"Writes raw bits to the field"]
307    #[inline(always)]
308    pub fn bit(self, value: bool) -> &'a mut W {
309        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
310        self.w
311    }
312}
313#[doc = "Timer Seconds Interrupt Configuration\n\nValue on reset: 0"]
314#[derive(Clone, Copy, Debug, PartialEq)]
315#[repr(u8)]
316pub enum TSIC_A {
317    #[doc = "0: 1 Hz."]
318    _000 = 0,
319    #[doc = "1: 2 Hz."]
320    _001 = 1,
321    #[doc = "2: 4 Hz."]
322    _010 = 2,
323    #[doc = "3: 8 Hz."]
324    _011 = 3,
325    #[doc = "4: 16 Hz."]
326    _100 = 4,
327    #[doc = "5: 32 Hz."]
328    _101 = 5,
329    #[doc = "6: 64 Hz."]
330    _110 = 6,
331    #[doc = "7: 128 Hz."]
332    _111 = 7,
333}
334impl From<TSIC_A> for u8 {
335    #[inline(always)]
336    fn from(variant: TSIC_A) -> Self {
337        variant as _
338    }
339}
340#[doc = "Reader of field `TSIC`"]
341pub type TSIC_R = crate::R<u8, TSIC_A>;
342impl TSIC_R {
343    #[doc = r"Get enumerated values variant"]
344    #[inline(always)]
345    pub fn variant(&self) -> TSIC_A {
346        match self.bits {
347            0 => TSIC_A::_000,
348            1 => TSIC_A::_001,
349            2 => TSIC_A::_010,
350            3 => TSIC_A::_011,
351            4 => TSIC_A::_100,
352            5 => TSIC_A::_101,
353            6 => TSIC_A::_110,
354            7 => TSIC_A::_111,
355            _ => unreachable!(),
356        }
357    }
358    #[doc = "Checks if the value of the field is `_000`"]
359    #[inline(always)]
360    pub fn is_000(&self) -> bool {
361        *self == TSIC_A::_000
362    }
363    #[doc = "Checks if the value of the field is `_001`"]
364    #[inline(always)]
365    pub fn is_001(&self) -> bool {
366        *self == TSIC_A::_001
367    }
368    #[doc = "Checks if the value of the field is `_010`"]
369    #[inline(always)]
370    pub fn is_010(&self) -> bool {
371        *self == TSIC_A::_010
372    }
373    #[doc = "Checks if the value of the field is `_011`"]
374    #[inline(always)]
375    pub fn is_011(&self) -> bool {
376        *self == TSIC_A::_011
377    }
378    #[doc = "Checks if the value of the field is `_100`"]
379    #[inline(always)]
380    pub fn is_100(&self) -> bool {
381        *self == TSIC_A::_100
382    }
383    #[doc = "Checks if the value of the field is `_101`"]
384    #[inline(always)]
385    pub fn is_101(&self) -> bool {
386        *self == TSIC_A::_101
387    }
388    #[doc = "Checks if the value of the field is `_110`"]
389    #[inline(always)]
390    pub fn is_110(&self) -> bool {
391        *self == TSIC_A::_110
392    }
393    #[doc = "Checks if the value of the field is `_111`"]
394    #[inline(always)]
395    pub fn is_111(&self) -> bool {
396        *self == TSIC_A::_111
397    }
398}
399#[doc = "Write proxy for field `TSIC`"]
400pub struct TSIC_W<'a> {
401    w: &'a mut W,
402}
403impl<'a> TSIC_W<'a> {
404    #[doc = r"Writes `variant` to the field"]
405    #[inline(always)]
406    pub fn variant(self, variant: TSIC_A) -> &'a mut W {
407        {
408            self.bits(variant.into())
409        }
410    }
411    #[doc = "1 Hz."]
412    #[inline(always)]
413    pub fn _000(self) -> &'a mut W {
414        self.variant(TSIC_A::_000)
415    }
416    #[doc = "2 Hz."]
417    #[inline(always)]
418    pub fn _001(self) -> &'a mut W {
419        self.variant(TSIC_A::_001)
420    }
421    #[doc = "4 Hz."]
422    #[inline(always)]
423    pub fn _010(self) -> &'a mut W {
424        self.variant(TSIC_A::_010)
425    }
426    #[doc = "8 Hz."]
427    #[inline(always)]
428    pub fn _011(self) -> &'a mut W {
429        self.variant(TSIC_A::_011)
430    }
431    #[doc = "16 Hz."]
432    #[inline(always)]
433    pub fn _100(self) -> &'a mut W {
434        self.variant(TSIC_A::_100)
435    }
436    #[doc = "32 Hz."]
437    #[inline(always)]
438    pub fn _101(self) -> &'a mut W {
439        self.variant(TSIC_A::_101)
440    }
441    #[doc = "64 Hz."]
442    #[inline(always)]
443    pub fn _110(self) -> &'a mut W {
444        self.variant(TSIC_A::_110)
445    }
446    #[doc = "128 Hz."]
447    #[inline(always)]
448    pub fn _111(self) -> &'a mut W {
449        self.variant(TSIC_A::_111)
450    }
451    #[doc = r"Writes raw bits to the field"]
452    #[inline(always)]
453    pub fn bits(self, value: u8) -> &'a mut W {
454        self.w.bits = (self.w.bits & !(0x07 << 16)) | (((value as u32) & 0x07) << 16);
455        self.w
456    }
457}
458impl R {
459    #[doc = "Bit 0 - Time Invalid Interrupt Enable"]
460    #[inline(always)]
461    pub fn tiie(&self) -> TIIE_R {
462        TIIE_R::new((self.bits & 0x01) != 0)
463    }
464    #[doc = "Bit 1 - Time Overflow Interrupt Enable"]
465    #[inline(always)]
466    pub fn toie(&self) -> TOIE_R {
467        TOIE_R::new(((self.bits >> 1) & 0x01) != 0)
468    }
469    #[doc = "Bit 2 - Time Alarm Interrupt Enable"]
470    #[inline(always)]
471    pub fn taie(&self) -> TAIE_R {
472        TAIE_R::new(((self.bits >> 2) & 0x01) != 0)
473    }
474    #[doc = "Bit 4 - Time Seconds Interrupt Enable"]
475    #[inline(always)]
476    pub fn tsie(&self) -> TSIE_R {
477        TSIE_R::new(((self.bits >> 4) & 0x01) != 0)
478    }
479    #[doc = "Bits 16:18 - Timer Seconds Interrupt Configuration"]
480    #[inline(always)]
481    pub fn tsic(&self) -> TSIC_R {
482        TSIC_R::new(((self.bits >> 16) & 0x07) as u8)
483    }
484}
485impl W {
486    #[doc = "Bit 0 - Time Invalid Interrupt Enable"]
487    #[inline(always)]
488    pub fn tiie(&mut self) -> TIIE_W {
489        TIIE_W { w: self }
490    }
491    #[doc = "Bit 1 - Time Overflow Interrupt Enable"]
492    #[inline(always)]
493    pub fn toie(&mut self) -> TOIE_W {
494        TOIE_W { w: self }
495    }
496    #[doc = "Bit 2 - Time Alarm Interrupt Enable"]
497    #[inline(always)]
498    pub fn taie(&mut self) -> TAIE_W {
499        TAIE_W { w: self }
500    }
501    #[doc = "Bit 4 - Time Seconds Interrupt Enable"]
502    #[inline(always)]
503    pub fn tsie(&mut self) -> TSIE_W {
504        TSIE_W { w: self }
505    }
506    #[doc = "Bits 16:18 - Timer Seconds Interrupt Configuration"]
507    #[inline(always)]
508    pub fn tsic(&mut self) -> TSIC_W {
509        TSIC_W { w: self }
510    }
511}