efm32pg22_pac/efm32pg22c200/euart0_ns/
irhfcfg.rs1#[doc = "Register `IRHFCFG` reader"]
2pub struct R(crate::R<IRHFCFG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<IRHFCFG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<IRHFCFG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<IRHFCFG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `IRHFCFG` writer"]
17pub struct W(crate::W<IRHFCFG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<IRHFCFG_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<IRHFCFG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<IRHFCFG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `IRHFEN` reader - Enable IrDA Module"]
38pub type IRHFEN_R = crate::BitReader<bool>;
39#[doc = "Field `IRHFEN` writer - Enable IrDA Module"]
40pub type IRHFEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, IRHFCFG_SPEC, bool, O>;
41#[doc = "Field `IRHFPW` reader - IrDA TX Pulse Width"]
42pub type IRHFPW_R = crate::FieldReader<u8, IRHFPW_A>;
43#[doc = "IrDA TX Pulse Width\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum IRHFPW_A {
47 #[doc = "0: IrDA pulse width is 1/16 for OVS=0 and 1/8 for OVS=1"]
48 ONE = 0,
49 #[doc = "1: IrDA pulse width is 2/16 for OVS=0 and 2/8 for OVS=1"]
50 TWO = 1,
51 #[doc = "2: IrDA pulse width is 3/16 for OVS=0 and 3/8 for OVS=1"]
52 THREE = 2,
53 #[doc = "3: IrDA pulse width is 4/16 for OVS=0 and 4/8 for OVS=1"]
54 FOUR = 3,
55}
56impl From<IRHFPW_A> for u8 {
57 #[inline(always)]
58 fn from(variant: IRHFPW_A) -> Self {
59 variant as _
60 }
61}
62impl IRHFPW_R {
63 #[doc = "Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> IRHFPW_A {
66 match self.bits {
67 0 => IRHFPW_A::ONE,
68 1 => IRHFPW_A::TWO,
69 2 => IRHFPW_A::THREE,
70 3 => IRHFPW_A::FOUR,
71 _ => unreachable!(),
72 }
73 }
74 #[doc = "Checks if the value of the field is `ONE`"]
75 #[inline(always)]
76 pub fn is_one(&self) -> bool {
77 *self == IRHFPW_A::ONE
78 }
79 #[doc = "Checks if the value of the field is `TWO`"]
80 #[inline(always)]
81 pub fn is_two(&self) -> bool {
82 *self == IRHFPW_A::TWO
83 }
84 #[doc = "Checks if the value of the field is `THREE`"]
85 #[inline(always)]
86 pub fn is_three(&self) -> bool {
87 *self == IRHFPW_A::THREE
88 }
89 #[doc = "Checks if the value of the field is `FOUR`"]
90 #[inline(always)]
91 pub fn is_four(&self) -> bool {
92 *self == IRHFPW_A::FOUR
93 }
94}
95#[doc = "Field `IRHFPW` writer - IrDA TX Pulse Width"]
96pub type IRHFPW_W<'a, const O: u8> =
97 crate::FieldWriterSafe<'a, u32, IRHFCFG_SPEC, u8, IRHFPW_A, 2, O>;
98impl<'a, const O: u8> IRHFPW_W<'a, O> {
99 #[doc = "IrDA pulse width is 1/16 for OVS=0 and 1/8 for OVS=1"]
100 #[inline(always)]
101 pub fn one(self) -> &'a mut W {
102 self.variant(IRHFPW_A::ONE)
103 }
104 #[doc = "IrDA pulse width is 2/16 for OVS=0 and 2/8 for OVS=1"]
105 #[inline(always)]
106 pub fn two(self) -> &'a mut W {
107 self.variant(IRHFPW_A::TWO)
108 }
109 #[doc = "IrDA pulse width is 3/16 for OVS=0 and 3/8 for OVS=1"]
110 #[inline(always)]
111 pub fn three(self) -> &'a mut W {
112 self.variant(IRHFPW_A::THREE)
113 }
114 #[doc = "IrDA pulse width is 4/16 for OVS=0 and 4/8 for OVS=1"]
115 #[inline(always)]
116 pub fn four(self) -> &'a mut W {
117 self.variant(IRHFPW_A::FOUR)
118 }
119}
120#[doc = "Field `IRHFFILT` reader - IrDA RX Filter"]
121pub type IRHFFILT_R = crate::BitReader<IRHFFILT_A>;
122#[doc = "IrDA RX Filter\n\nValue on reset: 0"]
123#[derive(Clone, Copy, Debug, PartialEq, Eq)]
124pub enum IRHFFILT_A {
125 #[doc = "0: No filter enabled"]
126 DISABLE = 0,
127 #[doc = "1: Filter enabled. IrDA pulse must be high for at least 4 consecutive clock cycles to be detected"]
128 ENABLE = 1,
129}
130impl From<IRHFFILT_A> for bool {
131 #[inline(always)]
132 fn from(variant: IRHFFILT_A) -> Self {
133 variant as u8 != 0
134 }
135}
136impl IRHFFILT_R {
137 #[doc = "Get enumerated values variant"]
138 #[inline(always)]
139 pub fn variant(&self) -> IRHFFILT_A {
140 match self.bits {
141 false => IRHFFILT_A::DISABLE,
142 true => IRHFFILT_A::ENABLE,
143 }
144 }
145 #[doc = "Checks if the value of the field is `DISABLE`"]
146 #[inline(always)]
147 pub fn is_disable(&self) -> bool {
148 *self == IRHFFILT_A::DISABLE
149 }
150 #[doc = "Checks if the value of the field is `ENABLE`"]
151 #[inline(always)]
152 pub fn is_enable(&self) -> bool {
153 *self == IRHFFILT_A::ENABLE
154 }
155}
156#[doc = "Field `IRHFFILT` writer - IrDA RX Filter"]
157pub type IRHFFILT_W<'a, const O: u8> = crate::BitWriter<'a, u32, IRHFCFG_SPEC, IRHFFILT_A, O>;
158impl<'a, const O: u8> IRHFFILT_W<'a, O> {
159 #[doc = "No filter enabled"]
160 #[inline(always)]
161 pub fn disable(self) -> &'a mut W {
162 self.variant(IRHFFILT_A::DISABLE)
163 }
164 #[doc = "Filter enabled. IrDA pulse must be high for at least 4 consecutive clock cycles to be detected"]
165 #[inline(always)]
166 pub fn enable(self) -> &'a mut W {
167 self.variant(IRHFFILT_A::ENABLE)
168 }
169}
170impl R {
171 #[doc = "Bit 0 - Enable IrDA Module"]
172 #[inline(always)]
173 pub fn irhfen(&self) -> IRHFEN_R {
174 IRHFEN_R::new((self.bits & 1) != 0)
175 }
176 #[doc = "Bits 1:2 - IrDA TX Pulse Width"]
177 #[inline(always)]
178 pub fn irhfpw(&self) -> IRHFPW_R {
179 IRHFPW_R::new(((self.bits >> 1) & 3) as u8)
180 }
181 #[doc = "Bit 3 - IrDA RX Filter"]
182 #[inline(always)]
183 pub fn irhffilt(&self) -> IRHFFILT_R {
184 IRHFFILT_R::new(((self.bits >> 3) & 1) != 0)
185 }
186}
187impl W {
188 #[doc = "Bit 0 - Enable IrDA Module"]
189 #[inline(always)]
190 #[must_use]
191 pub fn irhfen(&mut self) -> IRHFEN_W<0> {
192 IRHFEN_W::new(self)
193 }
194 #[doc = "Bits 1:2 - IrDA TX Pulse Width"]
195 #[inline(always)]
196 #[must_use]
197 pub fn irhfpw(&mut self) -> IRHFPW_W<1> {
198 IRHFPW_W::new(self)
199 }
200 #[doc = "Bit 3 - IrDA RX Filter"]
201 #[inline(always)]
202 #[must_use]
203 pub fn irhffilt(&mut self) -> IRHFFILT_W<3> {
204 IRHFFILT_W::new(self)
205 }
206 #[doc = "Writes raw bits to the register."]
207 #[inline(always)]
208 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
209 self.0.bits(bits);
210 self
211 }
212}
213#[doc = "No Description\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [irhfcfg](index.html) module"]
214pub struct IRHFCFG_SPEC;
215impl crate::RegisterSpec for IRHFCFG_SPEC {
216 type Ux = u32;
217}
218#[doc = "`read()` method returns [irhfcfg::R](R) reader structure"]
219impl crate::Readable for IRHFCFG_SPEC {
220 type Reader = R;
221}
222#[doc = "`write(|w| ..)` method takes [irhfcfg::W](W) writer structure"]
223impl crate::Writable for IRHFCFG_SPEC {
224 type Writer = W;
225 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
226 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
227}
228#[doc = "`reset()` method sets IRHFCFG to value 0"]
229impl crate::Resettable for IRHFCFG_SPEC {
230 const RESET_VALUE: Self::Ux = 0;
231}