py32f0/py32f030/led/
cr.rs1pub struct R(crate::R<CR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16pub struct W(crate::W<CR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CR_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<CR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37pub type LEDON_R = crate::BitReader<LEDON_A>;
39#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum LEDON_A {
44 Disabled = 0,
46 Enabled = 1,
48}
49impl From<LEDON_A> for bool {
50 #[inline(always)]
51 fn from(variant: LEDON_A) -> Self {
52 variant as u8 != 0
53 }
54}
55impl LEDON_R {
56 #[inline(always)]
58 pub fn variant(&self) -> LEDON_A {
59 match self.bits {
60 false => LEDON_A::Disabled,
61 true => LEDON_A::Enabled,
62 }
63 }
64 #[inline(always)]
66 pub fn is_disabled(&self) -> bool {
67 *self == LEDON_A::Disabled
68 }
69 #[inline(always)]
71 pub fn is_enabled(&self) -> bool {
72 *self == LEDON_A::Enabled
73 }
74}
75pub type LEDON_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, LEDON_A, O>;
77impl<'a, const O: u8> LEDON_W<'a, O> {
78 #[inline(always)]
80 pub fn disabled(self) -> &'a mut W {
81 self.variant(LEDON_A::Disabled)
82 }
83 #[inline(always)]
85 pub fn enabled(self) -> &'a mut W {
86 self.variant(LEDON_A::Enabled)
87 }
88}
89pub type LED_COM_SEL_R = crate::FieldReader<u8, LED_COM_SEL_A>;
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95#[repr(u8)]
96pub enum LED_COM_SEL_A {
97 OneDigit = 0,
99 TwoDigits = 1,
101 ThreeDigits = 2,
103 FourDigits = 3,
105}
106impl From<LED_COM_SEL_A> for u8 {
107 #[inline(always)]
108 fn from(variant: LED_COM_SEL_A) -> Self {
109 variant as _
110 }
111}
112impl LED_COM_SEL_R {
113 #[inline(always)]
115 pub fn variant(&self) -> LED_COM_SEL_A {
116 match self.bits {
117 0 => LED_COM_SEL_A::OneDigit,
118 1 => LED_COM_SEL_A::TwoDigits,
119 2 => LED_COM_SEL_A::ThreeDigits,
120 3 => LED_COM_SEL_A::FourDigits,
121 _ => unreachable!(),
122 }
123 }
124 #[inline(always)]
126 pub fn is_one_digit(&self) -> bool {
127 *self == LED_COM_SEL_A::OneDigit
128 }
129 #[inline(always)]
131 pub fn is_two_digits(&self) -> bool {
132 *self == LED_COM_SEL_A::TwoDigits
133 }
134 #[inline(always)]
136 pub fn is_three_digits(&self) -> bool {
137 *self == LED_COM_SEL_A::ThreeDigits
138 }
139 #[inline(always)]
141 pub fn is_four_digits(&self) -> bool {
142 *self == LED_COM_SEL_A::FourDigits
143 }
144}
145pub type LED_COM_SEL_W<'a, const O: u8> =
147 crate::FieldWriterSafe<'a, u32, CR_SPEC, u8, LED_COM_SEL_A, 2, O>;
148impl<'a, const O: u8> LED_COM_SEL_W<'a, O> {
149 #[inline(always)]
151 pub fn one_digit(self) -> &'a mut W {
152 self.variant(LED_COM_SEL_A::OneDigit)
153 }
154 #[inline(always)]
156 pub fn two_digits(self) -> &'a mut W {
157 self.variant(LED_COM_SEL_A::TwoDigits)
158 }
159 #[inline(always)]
161 pub fn three_digits(self) -> &'a mut W {
162 self.variant(LED_COM_SEL_A::ThreeDigits)
163 }
164 #[inline(always)]
166 pub fn four_digits(self) -> &'a mut W {
167 self.variant(LED_COM_SEL_A::FourDigits)
168 }
169}
170pub type IE_R = crate::BitReader<IE_A>;
172#[derive(Clone, Copy, Debug, PartialEq, Eq)]
176pub enum IE_A {
177 Disabled = 0,
179 Enabled = 1,
181}
182impl From<IE_A> for bool {
183 #[inline(always)]
184 fn from(variant: IE_A) -> Self {
185 variant as u8 != 0
186 }
187}
188impl IE_R {
189 #[inline(always)]
191 pub fn variant(&self) -> IE_A {
192 match self.bits {
193 false => IE_A::Disabled,
194 true => IE_A::Enabled,
195 }
196 }
197 #[inline(always)]
199 pub fn is_disabled(&self) -> bool {
200 *self == IE_A::Disabled
201 }
202 #[inline(always)]
204 pub fn is_enabled(&self) -> bool {
205 *self == IE_A::Enabled
206 }
207}
208pub type IE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, IE_A, O>;
210impl<'a, const O: u8> IE_W<'a, O> {
211 #[inline(always)]
213 pub fn disabled(self) -> &'a mut W {
214 self.variant(IE_A::Disabled)
215 }
216 #[inline(always)]
218 pub fn enabled(self) -> &'a mut W {
219 self.variant(IE_A::Enabled)
220 }
221}
222pub type EHS_R = crate::FieldReader<u8, EHS_A>;
224#[derive(Clone, Copy, Debug, PartialEq, Eq)]
228#[repr(u8)]
229pub enum EHS_A {
230 NoComOutput = 0,
232 HighSink = 1,
234}
235impl From<EHS_A> for u8 {
236 #[inline(always)]
237 fn from(variant: EHS_A) -> Self {
238 variant as _
239 }
240}
241impl EHS_R {
242 #[inline(always)]
244 pub fn variant(&self) -> Option<EHS_A> {
245 match self.bits {
246 0 => Some(EHS_A::NoComOutput),
247 1 => Some(EHS_A::HighSink),
248 _ => None,
249 }
250 }
251 #[inline(always)]
253 pub fn is_no_com_output(&self) -> bool {
254 *self == EHS_A::NoComOutput
255 }
256 #[inline(always)]
258 pub fn is_high_sink(&self) -> bool {
259 *self == EHS_A::HighSink
260 }
261}
262pub type EHS_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR_SPEC, u8, EHS_A, 2, O>;
264impl<'a, const O: u8> EHS_W<'a, O> {
265 #[inline(always)]
267 pub fn no_com_output(self) -> &'a mut W {
268 self.variant(EHS_A::NoComOutput)
269 }
270 #[inline(always)]
272 pub fn high_sink(self) -> &'a mut W {
273 self.variant(EHS_A::HighSink)
274 }
275}
276impl R {
277 #[inline(always)]
279 pub fn ledon(&self) -> LEDON_R {
280 LEDON_R::new((self.bits & 1) != 0)
281 }
282 #[inline(always)]
284 pub fn led_com_sel(&self) -> LED_COM_SEL_R {
285 LED_COM_SEL_R::new(((self.bits >> 1) & 3) as u8)
286 }
287 #[inline(always)]
289 pub fn ie(&self) -> IE_R {
290 IE_R::new(((self.bits >> 3) & 1) != 0)
291 }
292 #[inline(always)]
294 pub fn ehs(&self) -> EHS_R {
295 EHS_R::new(((self.bits >> 12) & 3) as u8)
296 }
297}
298impl W {
299 #[inline(always)]
301 #[must_use]
302 pub fn ledon(&mut self) -> LEDON_W<0> {
303 LEDON_W::new(self)
304 }
305 #[inline(always)]
307 #[must_use]
308 pub fn led_com_sel(&mut self) -> LED_COM_SEL_W<1> {
309 LED_COM_SEL_W::new(self)
310 }
311 #[inline(always)]
313 #[must_use]
314 pub fn ie(&mut self) -> IE_W<3> {
315 IE_W::new(self)
316 }
317 #[inline(always)]
319 #[must_use]
320 pub fn ehs(&mut self) -> EHS_W<12> {
321 EHS_W::new(self)
322 }
323 #[inline(always)]
325 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
326 self.0.bits(bits);
327 self
328 }
329}
330pub struct CR_SPEC;
336impl crate::RegisterSpec for CR_SPEC {
337 type Ux = u32;
338}
339impl crate::Readable for CR_SPEC {
341 type Reader = R;
342}
343impl crate::Writable for CR_SPEC {
345 type Writer = W;
346 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
347 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
348}
349impl crate::Resettable for CR_SPEC {
351 const RESET_VALUE: Self::Ux = 0;
352}