mk66f18/cmt/
oc.rs

1#[doc = "Reader of register OC"]
2pub type R = crate::R<u8, super::OC>;
3#[doc = "Writer for register OC"]
4pub type W = crate::W<u8, super::OC>;
5#[doc = "Register OC `reset()`'s with value 0"]
6impl crate::ResetValue for super::OC {
7    type Type = u8;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "IRO Pin Enable\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum IROPEN_A {
16    #[doc = "0: The IRO signal is disabled."]
17    _0,
18    #[doc = "1: The IRO signal is enabled as output."]
19    _1,
20}
21impl From<IROPEN_A> for bool {
22    #[inline(always)]
23    fn from(variant: IROPEN_A) -> Self {
24        match variant {
25            IROPEN_A::_0 => false,
26            IROPEN_A::_1 => true,
27        }
28    }
29}
30#[doc = "Reader of field `IROPEN`"]
31pub type IROPEN_R = crate::R<bool, IROPEN_A>;
32impl IROPEN_R {
33    #[doc = r"Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> IROPEN_A {
36        match self.bits {
37            false => IROPEN_A::_0,
38            true => IROPEN_A::_1,
39        }
40    }
41    #[doc = "Checks if the value of the field is `_0`"]
42    #[inline(always)]
43    pub fn is_0(&self) -> bool {
44        *self == IROPEN_A::_0
45    }
46    #[doc = "Checks if the value of the field is `_1`"]
47    #[inline(always)]
48    pub fn is_1(&self) -> bool {
49        *self == IROPEN_A::_1
50    }
51}
52#[doc = "Write proxy for field `IROPEN`"]
53pub struct IROPEN_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> IROPEN_W<'a> {
57    #[doc = r"Writes `variant` to the field"]
58    #[inline(always)]
59    pub fn variant(self, variant: IROPEN_A) -> &'a mut W {
60        {
61            self.bit(variant.into())
62        }
63    }
64    #[doc = "The IRO signal is disabled."]
65    #[inline(always)]
66    pub fn _0(self) -> &'a mut W {
67        self.variant(IROPEN_A::_0)
68    }
69    #[doc = "The IRO signal is enabled as output."]
70    #[inline(always)]
71    pub fn _1(self) -> &'a mut W {
72        self.variant(IROPEN_A::_1)
73    }
74    #[doc = r"Sets the field bit"]
75    #[inline(always)]
76    pub fn set_bit(self) -> &'a mut W {
77        self.bit(true)
78    }
79    #[doc = r"Clears the field bit"]
80    #[inline(always)]
81    pub fn clear_bit(self) -> &'a mut W {
82        self.bit(false)
83    }
84    #[doc = r"Writes raw bits to the field"]
85    #[inline(always)]
86    pub fn bit(self, value: bool) -> &'a mut W {
87        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u8) & 0x01) << 5);
88        self.w
89    }
90}
91#[doc = "CMT Output Polarity\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq)]
93pub enum CMTPOL_A {
94    #[doc = "0: The IRO signal is active-low."]
95    _0,
96    #[doc = "1: The IRO signal is active-high."]
97    _1,
98}
99impl From<CMTPOL_A> for bool {
100    #[inline(always)]
101    fn from(variant: CMTPOL_A) -> Self {
102        match variant {
103            CMTPOL_A::_0 => false,
104            CMTPOL_A::_1 => true,
105        }
106    }
107}
108#[doc = "Reader of field `CMTPOL`"]
109pub type CMTPOL_R = crate::R<bool, CMTPOL_A>;
110impl CMTPOL_R {
111    #[doc = r"Get enumerated values variant"]
112    #[inline(always)]
113    pub fn variant(&self) -> CMTPOL_A {
114        match self.bits {
115            false => CMTPOL_A::_0,
116            true => CMTPOL_A::_1,
117        }
118    }
119    #[doc = "Checks if the value of the field is `_0`"]
120    #[inline(always)]
121    pub fn is_0(&self) -> bool {
122        *self == CMTPOL_A::_0
123    }
124    #[doc = "Checks if the value of the field is `_1`"]
125    #[inline(always)]
126    pub fn is_1(&self) -> bool {
127        *self == CMTPOL_A::_1
128    }
129}
130#[doc = "Write proxy for field `CMTPOL`"]
131pub struct CMTPOL_W<'a> {
132    w: &'a mut W,
133}
134impl<'a> CMTPOL_W<'a> {
135    #[doc = r"Writes `variant` to the field"]
136    #[inline(always)]
137    pub fn variant(self, variant: CMTPOL_A) -> &'a mut W {
138        {
139            self.bit(variant.into())
140        }
141    }
142    #[doc = "The IRO signal is active-low."]
143    #[inline(always)]
144    pub fn _0(self) -> &'a mut W {
145        self.variant(CMTPOL_A::_0)
146    }
147    #[doc = "The IRO signal is active-high."]
148    #[inline(always)]
149    pub fn _1(self) -> &'a mut W {
150        self.variant(CMTPOL_A::_1)
151    }
152    #[doc = r"Sets the field bit"]
153    #[inline(always)]
154    pub fn set_bit(self) -> &'a mut W {
155        self.bit(true)
156    }
157    #[doc = r"Clears the field bit"]
158    #[inline(always)]
159    pub fn clear_bit(self) -> &'a mut W {
160        self.bit(false)
161    }
162    #[doc = r"Writes raw bits to the field"]
163    #[inline(always)]
164    pub fn bit(self, value: bool) -> &'a mut W {
165        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
166        self.w
167    }
168}
169#[doc = "Reader of field `IROL`"]
170pub type IROL_R = crate::R<bool, bool>;
171#[doc = "Write proxy for field `IROL`"]
172pub struct IROL_W<'a> {
173    w: &'a mut W,
174}
175impl<'a> IROL_W<'a> {
176    #[doc = r"Sets the field bit"]
177    #[inline(always)]
178    pub fn set_bit(self) -> &'a mut W {
179        self.bit(true)
180    }
181    #[doc = r"Clears the field bit"]
182    #[inline(always)]
183    pub fn clear_bit(self) -> &'a mut W {
184        self.bit(false)
185    }
186    #[doc = r"Writes raw bits to the field"]
187    #[inline(always)]
188    pub fn bit(self, value: bool) -> &'a mut W {
189        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
190        self.w
191    }
192}
193impl R {
194    #[doc = "Bit 5 - IRO Pin Enable"]
195    #[inline(always)]
196    pub fn iropen(&self) -> IROPEN_R {
197        IROPEN_R::new(((self.bits >> 5) & 0x01) != 0)
198    }
199    #[doc = "Bit 6 - CMT Output Polarity"]
200    #[inline(always)]
201    pub fn cmtpol(&self) -> CMTPOL_R {
202        CMTPOL_R::new(((self.bits >> 6) & 0x01) != 0)
203    }
204    #[doc = "Bit 7 - IRO Latch Control"]
205    #[inline(always)]
206    pub fn irol(&self) -> IROL_R {
207        IROL_R::new(((self.bits >> 7) & 0x01) != 0)
208    }
209}
210impl W {
211    #[doc = "Bit 5 - IRO Pin Enable"]
212    #[inline(always)]
213    pub fn iropen(&mut self) -> IROPEN_W {
214        IROPEN_W { w: self }
215    }
216    #[doc = "Bit 6 - CMT Output Polarity"]
217    #[inline(always)]
218    pub fn cmtpol(&mut self) -> CMTPOL_W {
219        CMTPOL_W { w: self }
220    }
221    #[doc = "Bit 7 - IRO Latch Control"]
222    #[inline(always)]
223    pub fn irol(&mut self) -> IROL_W {
224        IROL_W { w: self }
225    }
226}