Skip to main content

ke06z4_pac/pit/
tflg.rs

1#[doc = "Reader of register TFLG%s"]
2pub type R = crate::R<u32, super::TFLG>;
3#[doc = "Writer for register TFLG%s"]
4pub type W = crate::W<u32, super::TFLG>;
5#[doc = "Register TFLG%s `reset()`'s with value 0"]
6impl crate::ResetValue for super::TFLG {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Timer Interrupt Flag\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum TIF_A {
16    #[doc = "0: Timeout has not yet occurred."]
17    _0 = 0,
18    #[doc = "1: Timeout has occurred."]
19    _1 = 1,
20}
21impl From<TIF_A> for bool {
22    #[inline(always)]
23    fn from(variant: TIF_A) -> Self {
24        variant as u8 != 0
25    }
26}
27#[doc = "Reader of field `TIF`"]
28pub type TIF_R = crate::R<bool, TIF_A>;
29impl TIF_R {
30    #[doc = r"Get enumerated values variant"]
31    #[inline(always)]
32    pub fn variant(&self) -> TIF_A {
33        match self.bits {
34            false => TIF_A::_0,
35            true => TIF_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 == TIF_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 == TIF_A::_1
47    }
48}
49#[doc = "Write proxy for field `TIF`"]
50pub struct TIF_W<'a> {
51    w: &'a mut W,
52}
53impl<'a> TIF_W<'a> {
54    #[doc = r"Writes `variant` to the field"]
55    #[inline(always)]
56    pub fn variant(self, variant: TIF_A) -> &'a mut W {
57        {
58            self.bit(variant.into())
59        }
60    }
61    #[doc = "Timeout has not yet occurred."]
62    #[inline(always)]
63    pub fn _0(self) -> &'a mut W {
64        self.variant(TIF_A::_0)
65    }
66    #[doc = "Timeout has occurred."]
67    #[inline(always)]
68    pub fn _1(self) -> &'a mut W {
69        self.variant(TIF_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}
88impl R {
89    #[doc = "Bit 0 - Timer Interrupt Flag"]
90    #[inline(always)]
91    pub fn tif(&self) -> TIF_R {
92        TIF_R::new((self.bits & 0x01) != 0)
93    }
94}
95impl W {
96    #[doc = "Bit 0 - Timer Interrupt Flag"]
97    #[inline(always)]
98    pub fn tif(&mut self) -> TIF_W {
99        TIF_W { w: self }
100    }
101}