lpc55s6x_pac/iocon/
pio0_14.rs

1#[doc = "Reader of register PIO0_14"]
2pub type R = crate::R<u32, super::PIO0_14>;
3#[doc = "Writer for register PIO0_14"]
4pub type W = crate::W<u32, super::PIO0_14>;
5#[doc = "Register PIO0_14 `reset()`'s with value 0x5000"]
6impl crate::ResetValue for super::PIO0_14 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x5000
11    }
12}
13#[doc = "Selects pin function.\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum FUNC_A {
17    #[doc = "0: Alternative connection 0."]
18    ALT0 = 0,
19    #[doc = "1: Alternative connection 1."]
20    ALT1 = 1,
21    #[doc = "2: Alternative connection 2."]
22    ALT2 = 2,
23    #[doc = "3: Alternative connection 3."]
24    ALT3 = 3,
25    #[doc = "4: Alternative connection 4."]
26    ALT4 = 4,
27    #[doc = "5: Alternative connection 5."]
28    ALT5 = 5,
29    #[doc = "6: Alternative connection 6."]
30    ALT6 = 6,
31    #[doc = "7: Alternative connection 7."]
32    ALT7 = 7,
33}
34impl From<FUNC_A> for u8 {
35    #[inline(always)]
36    fn from(variant: FUNC_A) -> Self {
37        variant as _
38    }
39}
40#[doc = "Reader of field `FUNC`"]
41pub type FUNC_R = crate::R<u8, FUNC_A>;
42impl FUNC_R {
43    #[doc = r"Get enumerated values variant"]
44    #[inline(always)]
45    pub fn variant(&self) -> crate::Variant<u8, FUNC_A> {
46        use crate::Variant::*;
47        match self.bits {
48            0 => Val(FUNC_A::ALT0),
49            1 => Val(FUNC_A::ALT1),
50            2 => Val(FUNC_A::ALT2),
51            3 => Val(FUNC_A::ALT3),
52            4 => Val(FUNC_A::ALT4),
53            5 => Val(FUNC_A::ALT5),
54            6 => Val(FUNC_A::ALT6),
55            7 => Val(FUNC_A::ALT7),
56            i => Res(i),
57        }
58    }
59    #[doc = "Checks if the value of the field is `ALT0`"]
60    #[inline(always)]
61    pub fn is_alt0(&self) -> bool {
62        *self == FUNC_A::ALT0
63    }
64    #[doc = "Checks if the value of the field is `ALT1`"]
65    #[inline(always)]
66    pub fn is_alt1(&self) -> bool {
67        *self == FUNC_A::ALT1
68    }
69    #[doc = "Checks if the value of the field is `ALT2`"]
70    #[inline(always)]
71    pub fn is_alt2(&self) -> bool {
72        *self == FUNC_A::ALT2
73    }
74    #[doc = "Checks if the value of the field is `ALT3`"]
75    #[inline(always)]
76    pub fn is_alt3(&self) -> bool {
77        *self == FUNC_A::ALT3
78    }
79    #[doc = "Checks if the value of the field is `ALT4`"]
80    #[inline(always)]
81    pub fn is_alt4(&self) -> bool {
82        *self == FUNC_A::ALT4
83    }
84    #[doc = "Checks if the value of the field is `ALT5`"]
85    #[inline(always)]
86    pub fn is_alt5(&self) -> bool {
87        *self == FUNC_A::ALT5
88    }
89    #[doc = "Checks if the value of the field is `ALT6`"]
90    #[inline(always)]
91    pub fn is_alt6(&self) -> bool {
92        *self == FUNC_A::ALT6
93    }
94    #[doc = "Checks if the value of the field is `ALT7`"]
95    #[inline(always)]
96    pub fn is_alt7(&self) -> bool {
97        *self == FUNC_A::ALT7
98    }
99}
100#[doc = "Write proxy for field `FUNC`"]
101pub struct FUNC_W<'a> {
102    w: &'a mut W,
103}
104impl<'a> FUNC_W<'a> {
105    #[doc = r"Writes `variant` to the field"]
106    #[inline(always)]
107    pub fn variant(self, variant: FUNC_A) -> &'a mut W {
108        unsafe { self.bits(variant.into()) }
109    }
110    #[doc = "Alternative connection 0."]
111    #[inline(always)]
112    pub fn alt0(self) -> &'a mut W {
113        self.variant(FUNC_A::ALT0)
114    }
115    #[doc = "Alternative connection 1."]
116    #[inline(always)]
117    pub fn alt1(self) -> &'a mut W {
118        self.variant(FUNC_A::ALT1)
119    }
120    #[doc = "Alternative connection 2."]
121    #[inline(always)]
122    pub fn alt2(self) -> &'a mut W {
123        self.variant(FUNC_A::ALT2)
124    }
125    #[doc = "Alternative connection 3."]
126    #[inline(always)]
127    pub fn alt3(self) -> &'a mut W {
128        self.variant(FUNC_A::ALT3)
129    }
130    #[doc = "Alternative connection 4."]
131    #[inline(always)]
132    pub fn alt4(self) -> &'a mut W {
133        self.variant(FUNC_A::ALT4)
134    }
135    #[doc = "Alternative connection 5."]
136    #[inline(always)]
137    pub fn alt5(self) -> &'a mut W {
138        self.variant(FUNC_A::ALT5)
139    }
140    #[doc = "Alternative connection 6."]
141    #[inline(always)]
142    pub fn alt6(self) -> &'a mut W {
143        self.variant(FUNC_A::ALT6)
144    }
145    #[doc = "Alternative connection 7."]
146    #[inline(always)]
147    pub fn alt7(self) -> &'a mut W {
148        self.variant(FUNC_A::ALT7)
149    }
150    #[doc = r"Writes raw bits to the field"]
151    #[inline(always)]
152    pub unsafe fn bits(self, value: u8) -> &'a mut W {
153        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
154        self.w
155    }
156}
157#[doc = "Selects function mode (on-chip pull-up/pull-down resistor control).\n\nValue on reset: 0"]
158#[derive(Clone, Copy, Debug, PartialEq)]
159#[repr(u8)]
160pub enum MODE_A {
161    #[doc = "0: Inactive. Inactive (no pull-down/pull-up resistor enabled)."]
162    INACTIVE = 0,
163    #[doc = "1: Pull-down. Pull-down resistor enabled."]
164    PULL_DOWN = 1,
165    #[doc = "2: Pull-up. Pull-up resistor enabled."]
166    PULL_UP = 2,
167    #[doc = "3: Repeater. Repeater mode."]
168    REPEATER = 3,
169}
170impl From<MODE_A> for u8 {
171    #[inline(always)]
172    fn from(variant: MODE_A) -> Self {
173        variant as _
174    }
175}
176#[doc = "Reader of field `MODE`"]
177pub type MODE_R = crate::R<u8, MODE_A>;
178impl MODE_R {
179    #[doc = r"Get enumerated values variant"]
180    #[inline(always)]
181    pub fn variant(&self) -> MODE_A {
182        match self.bits {
183            0 => MODE_A::INACTIVE,
184            1 => MODE_A::PULL_DOWN,
185            2 => MODE_A::PULL_UP,
186            3 => MODE_A::REPEATER,
187            _ => unreachable!(),
188        }
189    }
190    #[doc = "Checks if the value of the field is `INACTIVE`"]
191    #[inline(always)]
192    pub fn is_inactive(&self) -> bool {
193        *self == MODE_A::INACTIVE
194    }
195    #[doc = "Checks if the value of the field is `PULL_DOWN`"]
196    #[inline(always)]
197    pub fn is_pull_down(&self) -> bool {
198        *self == MODE_A::PULL_DOWN
199    }
200    #[doc = "Checks if the value of the field is `PULL_UP`"]
201    #[inline(always)]
202    pub fn is_pull_up(&self) -> bool {
203        *self == MODE_A::PULL_UP
204    }
205    #[doc = "Checks if the value of the field is `REPEATER`"]
206    #[inline(always)]
207    pub fn is_repeater(&self) -> bool {
208        *self == MODE_A::REPEATER
209    }
210}
211#[doc = "Write proxy for field `MODE`"]
212pub struct MODE_W<'a> {
213    w: &'a mut W,
214}
215impl<'a> MODE_W<'a> {
216    #[doc = r"Writes `variant` to the field"]
217    #[inline(always)]
218    pub fn variant(self, variant: MODE_A) -> &'a mut W {
219        {
220            self.bits(variant.into())
221        }
222    }
223    #[doc = "Inactive. Inactive (no pull-down/pull-up resistor enabled)."]
224    #[inline(always)]
225    pub fn inactive(self) -> &'a mut W {
226        self.variant(MODE_A::INACTIVE)
227    }
228    #[doc = "Pull-down. Pull-down resistor enabled."]
229    #[inline(always)]
230    pub fn pull_down(self) -> &'a mut W {
231        self.variant(MODE_A::PULL_DOWN)
232    }
233    #[doc = "Pull-up. Pull-up resistor enabled."]
234    #[inline(always)]
235    pub fn pull_up(self) -> &'a mut W {
236        self.variant(MODE_A::PULL_UP)
237    }
238    #[doc = "Repeater. Repeater mode."]
239    #[inline(always)]
240    pub fn repeater(self) -> &'a mut W {
241        self.variant(MODE_A::REPEATER)
242    }
243    #[doc = r"Writes raw bits to the field"]
244    #[inline(always)]
245    pub fn bits(self, value: u8) -> &'a mut W {
246        self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
247        self.w
248    }
249}
250#[doc = "Driver slew rate.\n\nValue on reset: 0"]
251#[derive(Clone, Copy, Debug, PartialEq)]
252pub enum SLEW_A {
253    #[doc = "0: Standard-mode, output slew rate is slower. More outputs can be switched simultaneously."]
254    STANDARD = 0,
255    #[doc = "1: Fast-mode, output slew rate is faster. Refer to the appropriate specific device data sheet for details."]
256    FAST = 1,
257}
258impl From<SLEW_A> for bool {
259    #[inline(always)]
260    fn from(variant: SLEW_A) -> Self {
261        variant as u8 != 0
262    }
263}
264#[doc = "Reader of field `SLEW`"]
265pub type SLEW_R = crate::R<bool, SLEW_A>;
266impl SLEW_R {
267    #[doc = r"Get enumerated values variant"]
268    #[inline(always)]
269    pub fn variant(&self) -> SLEW_A {
270        match self.bits {
271            false => SLEW_A::STANDARD,
272            true => SLEW_A::FAST,
273        }
274    }
275    #[doc = "Checks if the value of the field is `STANDARD`"]
276    #[inline(always)]
277    pub fn is_standard(&self) -> bool {
278        *self == SLEW_A::STANDARD
279    }
280    #[doc = "Checks if the value of the field is `FAST`"]
281    #[inline(always)]
282    pub fn is_fast(&self) -> bool {
283        *self == SLEW_A::FAST
284    }
285}
286#[doc = "Write proxy for field `SLEW`"]
287pub struct SLEW_W<'a> {
288    w: &'a mut W,
289}
290impl<'a> SLEW_W<'a> {
291    #[doc = r"Writes `variant` to the field"]
292    #[inline(always)]
293    pub fn variant(self, variant: SLEW_A) -> &'a mut W {
294        {
295            self.bit(variant.into())
296        }
297    }
298    #[doc = "Standard-mode, output slew rate is slower. More outputs can be switched simultaneously."]
299    #[inline(always)]
300    pub fn standard(self) -> &'a mut W {
301        self.variant(SLEW_A::STANDARD)
302    }
303    #[doc = "Fast-mode, output slew rate is faster. Refer to the appropriate specific device data sheet for details."]
304    #[inline(always)]
305    pub fn fast(self) -> &'a mut W {
306        self.variant(SLEW_A::FAST)
307    }
308    #[doc = r"Sets the field bit"]
309    #[inline(always)]
310    pub fn set_bit(self) -> &'a mut W {
311        self.bit(true)
312    }
313    #[doc = r"Clears the field bit"]
314    #[inline(always)]
315    pub fn clear_bit(self) -> &'a mut W {
316        self.bit(false)
317    }
318    #[doc = r"Writes raw bits to the field"]
319    #[inline(always)]
320    pub fn bit(self, value: bool) -> &'a mut W {
321        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
322        self.w
323    }
324}
325#[doc = "Input polarity.\n\nValue on reset: 0"]
326#[derive(Clone, Copy, Debug, PartialEq)]
327pub enum INVERT_A {
328    #[doc = "0: Disabled. Input function is not inverted."]
329    DISABLED = 0,
330    #[doc = "1: Enabled. Input is function inverted."]
331    ENABLED = 1,
332}
333impl From<INVERT_A> for bool {
334    #[inline(always)]
335    fn from(variant: INVERT_A) -> Self {
336        variant as u8 != 0
337    }
338}
339#[doc = "Reader of field `INVERT`"]
340pub type INVERT_R = crate::R<bool, INVERT_A>;
341impl INVERT_R {
342    #[doc = r"Get enumerated values variant"]
343    #[inline(always)]
344    pub fn variant(&self) -> INVERT_A {
345        match self.bits {
346            false => INVERT_A::DISABLED,
347            true => INVERT_A::ENABLED,
348        }
349    }
350    #[doc = "Checks if the value of the field is `DISABLED`"]
351    #[inline(always)]
352    pub fn is_disabled(&self) -> bool {
353        *self == INVERT_A::DISABLED
354    }
355    #[doc = "Checks if the value of the field is `ENABLED`"]
356    #[inline(always)]
357    pub fn is_enabled(&self) -> bool {
358        *self == INVERT_A::ENABLED
359    }
360}
361#[doc = "Write proxy for field `INVERT`"]
362pub struct INVERT_W<'a> {
363    w: &'a mut W,
364}
365impl<'a> INVERT_W<'a> {
366    #[doc = r"Writes `variant` to the field"]
367    #[inline(always)]
368    pub fn variant(self, variant: INVERT_A) -> &'a mut W {
369        {
370            self.bit(variant.into())
371        }
372    }
373    #[doc = "Disabled. Input function is not inverted."]
374    #[inline(always)]
375    pub fn disabled(self) -> &'a mut W {
376        self.variant(INVERT_A::DISABLED)
377    }
378    #[doc = "Enabled. Input is function inverted."]
379    #[inline(always)]
380    pub fn enabled(self) -> &'a mut W {
381        self.variant(INVERT_A::ENABLED)
382    }
383    #[doc = r"Sets the field bit"]
384    #[inline(always)]
385    pub fn set_bit(self) -> &'a mut W {
386        self.bit(true)
387    }
388    #[doc = r"Clears the field bit"]
389    #[inline(always)]
390    pub fn clear_bit(self) -> &'a mut W {
391        self.bit(false)
392    }
393    #[doc = r"Writes raw bits to the field"]
394    #[inline(always)]
395    pub fn bit(self, value: bool) -> &'a mut W {
396        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
397        self.w
398    }
399}
400#[doc = "Select Digital mode.\n\nValue on reset: 0"]
401#[derive(Clone, Copy, Debug, PartialEq)]
402pub enum DIGIMODE_A {
403    #[doc = "0: Disable digital mode. Digital input set to 0."]
404    ANALOG = 0,
405    #[doc = "1: Enable Digital mode. Digital input is enabled."]
406    DIGITAL = 1,
407}
408impl From<DIGIMODE_A> for bool {
409    #[inline(always)]
410    fn from(variant: DIGIMODE_A) -> Self {
411        variant as u8 != 0
412    }
413}
414#[doc = "Reader of field `DIGIMODE`"]
415pub type DIGIMODE_R = crate::R<bool, DIGIMODE_A>;
416impl DIGIMODE_R {
417    #[doc = r"Get enumerated values variant"]
418    #[inline(always)]
419    pub fn variant(&self) -> DIGIMODE_A {
420        match self.bits {
421            false => DIGIMODE_A::ANALOG,
422            true => DIGIMODE_A::DIGITAL,
423        }
424    }
425    #[doc = "Checks if the value of the field is `ANALOG`"]
426    #[inline(always)]
427    pub fn is_analog(&self) -> bool {
428        *self == DIGIMODE_A::ANALOG
429    }
430    #[doc = "Checks if the value of the field is `DIGITAL`"]
431    #[inline(always)]
432    pub fn is_digital(&self) -> bool {
433        *self == DIGIMODE_A::DIGITAL
434    }
435}
436#[doc = "Write proxy for field `DIGIMODE`"]
437pub struct DIGIMODE_W<'a> {
438    w: &'a mut W,
439}
440impl<'a> DIGIMODE_W<'a> {
441    #[doc = r"Writes `variant` to the field"]
442    #[inline(always)]
443    pub fn variant(self, variant: DIGIMODE_A) -> &'a mut W {
444        {
445            self.bit(variant.into())
446        }
447    }
448    #[doc = "Disable digital mode. Digital input set to 0."]
449    #[inline(always)]
450    pub fn analog(self) -> &'a mut W {
451        self.variant(DIGIMODE_A::ANALOG)
452    }
453    #[doc = "Enable Digital mode. Digital input is enabled."]
454    #[inline(always)]
455    pub fn digital(self) -> &'a mut W {
456        self.variant(DIGIMODE_A::DIGITAL)
457    }
458    #[doc = r"Sets the field bit"]
459    #[inline(always)]
460    pub fn set_bit(self) -> &'a mut W {
461        self.bit(true)
462    }
463    #[doc = r"Clears the field bit"]
464    #[inline(always)]
465    pub fn clear_bit(self) -> &'a mut W {
466        self.bit(false)
467    }
468    #[doc = r"Writes raw bits to the field"]
469    #[inline(always)]
470    pub fn bit(self, value: bool) -> &'a mut W {
471        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
472        self.w
473    }
474}
475#[doc = "Controls open-drain mode in standard GPIO mode (EGP = 1). This bit has no effect in I2C mode (EGP=0).\n\nValue on reset: 0"]
476#[derive(Clone, Copy, Debug, PartialEq)]
477pub enum OD_A {
478    #[doc = "0: Normal. Normal push-pull output"]
479    NORMAL = 0,
480    #[doc = "1: Open-drain. Simulated open-drain output (high drive disabled)."]
481    OPEN_DRAIN = 1,
482}
483impl From<OD_A> for bool {
484    #[inline(always)]
485    fn from(variant: OD_A) -> Self {
486        variant as u8 != 0
487    }
488}
489#[doc = "Reader of field `OD`"]
490pub type OD_R = crate::R<bool, OD_A>;
491impl OD_R {
492    #[doc = r"Get enumerated values variant"]
493    #[inline(always)]
494    pub fn variant(&self) -> OD_A {
495        match self.bits {
496            false => OD_A::NORMAL,
497            true => OD_A::OPEN_DRAIN,
498        }
499    }
500    #[doc = "Checks if the value of the field is `NORMAL`"]
501    #[inline(always)]
502    pub fn is_normal(&self) -> bool {
503        *self == OD_A::NORMAL
504    }
505    #[doc = "Checks if the value of the field is `OPEN_DRAIN`"]
506    #[inline(always)]
507    pub fn is_open_drain(&self) -> bool {
508        *self == OD_A::OPEN_DRAIN
509    }
510}
511#[doc = "Write proxy for field `OD`"]
512pub struct OD_W<'a> {
513    w: &'a mut W,
514}
515impl<'a> OD_W<'a> {
516    #[doc = r"Writes `variant` to the field"]
517    #[inline(always)]
518    pub fn variant(self, variant: OD_A) -> &'a mut W {
519        {
520            self.bit(variant.into())
521        }
522    }
523    #[doc = "Normal. Normal push-pull output"]
524    #[inline(always)]
525    pub fn normal(self) -> &'a mut W {
526        self.variant(OD_A::NORMAL)
527    }
528    #[doc = "Open-drain. Simulated open-drain output (high drive disabled)."]
529    #[inline(always)]
530    pub fn open_drain(self) -> &'a mut W {
531        self.variant(OD_A::OPEN_DRAIN)
532    }
533    #[doc = r"Sets the field bit"]
534    #[inline(always)]
535    pub fn set_bit(self) -> &'a mut W {
536        self.bit(true)
537    }
538    #[doc = r"Clears the field bit"]
539    #[inline(always)]
540    pub fn clear_bit(self) -> &'a mut W {
541        self.bit(false)
542    }
543    #[doc = r"Writes raw bits to the field"]
544    #[inline(always)]
545    pub fn bit(self, value: bool) -> &'a mut W {
546        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
547        self.w
548    }
549}
550#[doc = "Supply Selection bit.\n\nValue on reset: 0"]
551#[derive(Clone, Copy, Debug, PartialEq)]
552pub enum SSEL_A {
553    #[doc = "0: 3V3 Signaling in I2C Mode."]
554    SEL3V3 = 0,
555    #[doc = "1: 1V8 Signaling in I2C Mode."]
556    SEL1V8 = 1,
557}
558impl From<SSEL_A> for bool {
559    #[inline(always)]
560    fn from(variant: SSEL_A) -> Self {
561        variant as u8 != 0
562    }
563}
564#[doc = "Reader of field `SSEL`"]
565pub type SSEL_R = crate::R<bool, SSEL_A>;
566impl SSEL_R {
567    #[doc = r"Get enumerated values variant"]
568    #[inline(always)]
569    pub fn variant(&self) -> SSEL_A {
570        match self.bits {
571            false => SSEL_A::SEL3V3,
572            true => SSEL_A::SEL1V8,
573        }
574    }
575    #[doc = "Checks if the value of the field is `SEL3V3`"]
576    #[inline(always)]
577    pub fn is_sel3v3(&self) -> bool {
578        *self == SSEL_A::SEL3V3
579    }
580    #[doc = "Checks if the value of the field is `SEL1V8`"]
581    #[inline(always)]
582    pub fn is_sel1v8(&self) -> bool {
583        *self == SSEL_A::SEL1V8
584    }
585}
586#[doc = "Write proxy for field `SSEL`"]
587pub struct SSEL_W<'a> {
588    w: &'a mut W,
589}
590impl<'a> SSEL_W<'a> {
591    #[doc = r"Writes `variant` to the field"]
592    #[inline(always)]
593    pub fn variant(self, variant: SSEL_A) -> &'a mut W {
594        {
595            self.bit(variant.into())
596        }
597    }
598    #[doc = "3V3 Signaling in I2C Mode."]
599    #[inline(always)]
600    pub fn sel3v3(self) -> &'a mut W {
601        self.variant(SSEL_A::SEL3V3)
602    }
603    #[doc = "1V8 Signaling in I2C Mode."]
604    #[inline(always)]
605    pub fn sel1v8(self) -> &'a mut W {
606        self.variant(SSEL_A::SEL1V8)
607    }
608    #[doc = r"Sets the field bit"]
609    #[inline(always)]
610    pub fn set_bit(self) -> &'a mut W {
611        self.bit(true)
612    }
613    #[doc = r"Clears the field bit"]
614    #[inline(always)]
615    pub fn clear_bit(self) -> &'a mut W {
616        self.bit(false)
617    }
618    #[doc = r"Writes raw bits to the field"]
619    #[inline(always)]
620    pub fn bit(self, value: bool) -> &'a mut W {
621        self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
622        self.w
623    }
624}
625#[doc = "Controls input glitch filter.\n\nValue on reset: 1"]
626#[derive(Clone, Copy, Debug, PartialEq)]
627pub enum FILTEROFF_A {
628    #[doc = "0: Filter enabled."]
629    ENABLED = 0,
630    #[doc = "1: Filter disabled."]
631    DISABLED = 1,
632}
633impl From<FILTEROFF_A> for bool {
634    #[inline(always)]
635    fn from(variant: FILTEROFF_A) -> Self {
636        variant as u8 != 0
637    }
638}
639#[doc = "Reader of field `FILTEROFF`"]
640pub type FILTEROFF_R = crate::R<bool, FILTEROFF_A>;
641impl FILTEROFF_R {
642    #[doc = r"Get enumerated values variant"]
643    #[inline(always)]
644    pub fn variant(&self) -> FILTEROFF_A {
645        match self.bits {
646            false => FILTEROFF_A::ENABLED,
647            true => FILTEROFF_A::DISABLED,
648        }
649    }
650    #[doc = "Checks if the value of the field is `ENABLED`"]
651    #[inline(always)]
652    pub fn is_enabled(&self) -> bool {
653        *self == FILTEROFF_A::ENABLED
654    }
655    #[doc = "Checks if the value of the field is `DISABLED`"]
656    #[inline(always)]
657    pub fn is_disabled(&self) -> bool {
658        *self == FILTEROFF_A::DISABLED
659    }
660}
661#[doc = "Write proxy for field `FILTEROFF`"]
662pub struct FILTEROFF_W<'a> {
663    w: &'a mut W,
664}
665impl<'a> FILTEROFF_W<'a> {
666    #[doc = r"Writes `variant` to the field"]
667    #[inline(always)]
668    pub fn variant(self, variant: FILTEROFF_A) -> &'a mut W {
669        {
670            self.bit(variant.into())
671        }
672    }
673    #[doc = "Filter enabled."]
674    #[inline(always)]
675    pub fn enabled(self) -> &'a mut W {
676        self.variant(FILTEROFF_A::ENABLED)
677    }
678    #[doc = "Filter disabled."]
679    #[inline(always)]
680    pub fn disabled(self) -> &'a mut W {
681        self.variant(FILTEROFF_A::DISABLED)
682    }
683    #[doc = r"Sets the field bit"]
684    #[inline(always)]
685    pub fn set_bit(self) -> &'a mut W {
686        self.bit(true)
687    }
688    #[doc = r"Clears the field bit"]
689    #[inline(always)]
690    pub fn clear_bit(self) -> &'a mut W {
691        self.bit(false)
692    }
693    #[doc = r"Writes raw bits to the field"]
694    #[inline(always)]
695    pub fn bit(self, value: bool) -> &'a mut W {
696        self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
697        self.w
698    }
699}
700#[doc = "Pull-up current source enable in I2C mode.\n\nValue on reset: 0"]
701#[derive(Clone, Copy, Debug, PartialEq)]
702pub enum ECS_A {
703    #[doc = "0: Disabled. IO is in open drain cell."]
704    DISABLED = 0,
705    #[doc = "1: Enabled. Pull resistor is conencted."]
706    ENABLED = 1,
707}
708impl From<ECS_A> for bool {
709    #[inline(always)]
710    fn from(variant: ECS_A) -> Self {
711        variant as u8 != 0
712    }
713}
714#[doc = "Reader of field `ECS`"]
715pub type ECS_R = crate::R<bool, ECS_A>;
716impl ECS_R {
717    #[doc = r"Get enumerated values variant"]
718    #[inline(always)]
719    pub fn variant(&self) -> ECS_A {
720        match self.bits {
721            false => ECS_A::DISABLED,
722            true => ECS_A::ENABLED,
723        }
724    }
725    #[doc = "Checks if the value of the field is `DISABLED`"]
726    #[inline(always)]
727    pub fn is_disabled(&self) -> bool {
728        *self == ECS_A::DISABLED
729    }
730    #[doc = "Checks if the value of the field is `ENABLED`"]
731    #[inline(always)]
732    pub fn is_enabled(&self) -> bool {
733        *self == ECS_A::ENABLED
734    }
735}
736#[doc = "Write proxy for field `ECS`"]
737pub struct ECS_W<'a> {
738    w: &'a mut W,
739}
740impl<'a> ECS_W<'a> {
741    #[doc = r"Writes `variant` to the field"]
742    #[inline(always)]
743    pub fn variant(self, variant: ECS_A) -> &'a mut W {
744        {
745            self.bit(variant.into())
746        }
747    }
748    #[doc = "Disabled. IO is in open drain cell."]
749    #[inline(always)]
750    pub fn disabled(self) -> &'a mut W {
751        self.variant(ECS_A::DISABLED)
752    }
753    #[doc = "Enabled. Pull resistor is conencted."]
754    #[inline(always)]
755    pub fn enabled(self) -> &'a mut W {
756        self.variant(ECS_A::ENABLED)
757    }
758    #[doc = r"Sets the field bit"]
759    #[inline(always)]
760    pub fn set_bit(self) -> &'a mut W {
761        self.bit(true)
762    }
763    #[doc = r"Clears the field bit"]
764    #[inline(always)]
765    pub fn clear_bit(self) -> &'a mut W {
766        self.bit(false)
767    }
768    #[doc = r"Writes raw bits to the field"]
769    #[inline(always)]
770    pub fn bit(self, value: bool) -> &'a mut W {
771        self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
772        self.w
773    }
774}
775#[doc = "Switch between GPIO mode and I2C mode.\n\nValue on reset: 1"]
776#[derive(Clone, Copy, Debug, PartialEq)]
777pub enum EGP_A {
778    #[doc = "0: I2C mode."]
779    I2C_MODE = 0,
780    #[doc = "1: GPIO mode."]
781    GPIO_MODE = 1,
782}
783impl From<EGP_A> for bool {
784    #[inline(always)]
785    fn from(variant: EGP_A) -> Self {
786        variant as u8 != 0
787    }
788}
789#[doc = "Reader of field `EGP`"]
790pub type EGP_R = crate::R<bool, EGP_A>;
791impl EGP_R {
792    #[doc = r"Get enumerated values variant"]
793    #[inline(always)]
794    pub fn variant(&self) -> EGP_A {
795        match self.bits {
796            false => EGP_A::I2C_MODE,
797            true => EGP_A::GPIO_MODE,
798        }
799    }
800    #[doc = "Checks if the value of the field is `I2C_MODE`"]
801    #[inline(always)]
802    pub fn is_i2c_mode(&self) -> bool {
803        *self == EGP_A::I2C_MODE
804    }
805    #[doc = "Checks if the value of the field is `GPIO_MODE`"]
806    #[inline(always)]
807    pub fn is_gpio_mode(&self) -> bool {
808        *self == EGP_A::GPIO_MODE
809    }
810}
811#[doc = "Write proxy for field `EGP`"]
812pub struct EGP_W<'a> {
813    w: &'a mut W,
814}
815impl<'a> EGP_W<'a> {
816    #[doc = r"Writes `variant` to the field"]
817    #[inline(always)]
818    pub fn variant(self, variant: EGP_A) -> &'a mut W {
819        {
820            self.bit(variant.into())
821        }
822    }
823    #[doc = "I2C mode."]
824    #[inline(always)]
825    pub fn i2c_mode(self) -> &'a mut W {
826        self.variant(EGP_A::I2C_MODE)
827    }
828    #[doc = "GPIO mode."]
829    #[inline(always)]
830    pub fn gpio_mode(self) -> &'a mut W {
831        self.variant(EGP_A::GPIO_MODE)
832    }
833    #[doc = r"Sets the field bit"]
834    #[inline(always)]
835    pub fn set_bit(self) -> &'a mut W {
836        self.bit(true)
837    }
838    #[doc = r"Clears the field bit"]
839    #[inline(always)]
840    pub fn clear_bit(self) -> &'a mut W {
841        self.bit(false)
842    }
843    #[doc = r"Writes raw bits to the field"]
844    #[inline(always)]
845    pub fn bit(self, value: bool) -> &'a mut W {
846        self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
847        self.w
848    }
849}
850#[doc = "Configures I2C features for standard mode, fast mode, and Fast Mode Plus operation and High-Speed mode operation.\n\nValue on reset: 0"]
851#[derive(Clone, Copy, Debug, PartialEq)]
852pub enum I2CFILTER_A {
853    #[doc = "0: I2C 50 ns glitch filter enabled. Typically used for Standard-mode, Fast-mode and Fast-mode Plus I2C."]
854    FAST_MODE = 0,
855    #[doc = "1: I2C 10 ns glitch filter enabled. Typically used for High-speed mode I2C."]
856    STANDARD_MODE = 1,
857}
858impl From<I2CFILTER_A> for bool {
859    #[inline(always)]
860    fn from(variant: I2CFILTER_A) -> Self {
861        variant as u8 != 0
862    }
863}
864#[doc = "Reader of field `I2CFILTER`"]
865pub type I2CFILTER_R = crate::R<bool, I2CFILTER_A>;
866impl I2CFILTER_R {
867    #[doc = r"Get enumerated values variant"]
868    #[inline(always)]
869    pub fn variant(&self) -> I2CFILTER_A {
870        match self.bits {
871            false => I2CFILTER_A::FAST_MODE,
872            true => I2CFILTER_A::STANDARD_MODE,
873        }
874    }
875    #[doc = "Checks if the value of the field is `FAST_MODE`"]
876    #[inline(always)]
877    pub fn is_fast_mode(&self) -> bool {
878        *self == I2CFILTER_A::FAST_MODE
879    }
880    #[doc = "Checks if the value of the field is `STANDARD_MODE`"]
881    #[inline(always)]
882    pub fn is_standard_mode(&self) -> bool {
883        *self == I2CFILTER_A::STANDARD_MODE
884    }
885}
886#[doc = "Write proxy for field `I2CFILTER`"]
887pub struct I2CFILTER_W<'a> {
888    w: &'a mut W,
889}
890impl<'a> I2CFILTER_W<'a> {
891    #[doc = r"Writes `variant` to the field"]
892    #[inline(always)]
893    pub fn variant(self, variant: I2CFILTER_A) -> &'a mut W {
894        {
895            self.bit(variant.into())
896        }
897    }
898    #[doc = "I2C 50 ns glitch filter enabled. Typically used for Standard-mode, Fast-mode and Fast-mode Plus I2C."]
899    #[inline(always)]
900    pub fn fast_mode(self) -> &'a mut W {
901        self.variant(I2CFILTER_A::FAST_MODE)
902    }
903    #[doc = "I2C 10 ns glitch filter enabled. Typically used for High-speed mode I2C."]
904    #[inline(always)]
905    pub fn standard_mode(self) -> &'a mut W {
906        self.variant(I2CFILTER_A::STANDARD_MODE)
907    }
908    #[doc = r"Sets the field bit"]
909    #[inline(always)]
910    pub fn set_bit(self) -> &'a mut W {
911        self.bit(true)
912    }
913    #[doc = r"Clears the field bit"]
914    #[inline(always)]
915    pub fn clear_bit(self) -> &'a mut W {
916        self.bit(false)
917    }
918    #[doc = r"Writes raw bits to the field"]
919    #[inline(always)]
920    pub fn bit(self, value: bool) -> &'a mut W {
921        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
922        self.w
923    }
924}
925impl R {
926    #[doc = "Bits 0:3 - Selects pin function."]
927    #[inline(always)]
928    pub fn func(&self) -> FUNC_R {
929        FUNC_R::new((self.bits & 0x0f) as u8)
930    }
931    #[doc = "Bits 4:5 - Selects function mode (on-chip pull-up/pull-down resistor control)."]
932    #[inline(always)]
933    pub fn mode(&self) -> MODE_R {
934        MODE_R::new(((self.bits >> 4) & 0x03) as u8)
935    }
936    #[doc = "Bit 6 - Driver slew rate."]
937    #[inline(always)]
938    pub fn slew(&self) -> SLEW_R {
939        SLEW_R::new(((self.bits >> 6) & 0x01) != 0)
940    }
941    #[doc = "Bit 7 - Input polarity."]
942    #[inline(always)]
943    pub fn invert(&self) -> INVERT_R {
944        INVERT_R::new(((self.bits >> 7) & 0x01) != 0)
945    }
946    #[doc = "Bit 8 - Select Digital mode."]
947    #[inline(always)]
948    pub fn digimode(&self) -> DIGIMODE_R {
949        DIGIMODE_R::new(((self.bits >> 8) & 0x01) != 0)
950    }
951    #[doc = "Bit 9 - Controls open-drain mode in standard GPIO mode (EGP = 1). This bit has no effect in I2C mode (EGP=0)."]
952    #[inline(always)]
953    pub fn od(&self) -> OD_R {
954        OD_R::new(((self.bits >> 9) & 0x01) != 0)
955    }
956    #[doc = "Bit 11 - Supply Selection bit."]
957    #[inline(always)]
958    pub fn ssel(&self) -> SSEL_R {
959        SSEL_R::new(((self.bits >> 11) & 0x01) != 0)
960    }
961    #[doc = "Bit 12 - Controls input glitch filter."]
962    #[inline(always)]
963    pub fn filteroff(&self) -> FILTEROFF_R {
964        FILTEROFF_R::new(((self.bits >> 12) & 0x01) != 0)
965    }
966    #[doc = "Bit 13 - Pull-up current source enable in I2C mode."]
967    #[inline(always)]
968    pub fn ecs(&self) -> ECS_R {
969        ECS_R::new(((self.bits >> 13) & 0x01) != 0)
970    }
971    #[doc = "Bit 14 - Switch between GPIO mode and I2C mode."]
972    #[inline(always)]
973    pub fn egp(&self) -> EGP_R {
974        EGP_R::new(((self.bits >> 14) & 0x01) != 0)
975    }
976    #[doc = "Bit 15 - Configures I2C features for standard mode, fast mode, and Fast Mode Plus operation and High-Speed mode operation."]
977    #[inline(always)]
978    pub fn i2cfilter(&self) -> I2CFILTER_R {
979        I2CFILTER_R::new(((self.bits >> 15) & 0x01) != 0)
980    }
981}
982impl W {
983    #[doc = "Bits 0:3 - Selects pin function."]
984    #[inline(always)]
985    pub fn func(&mut self) -> FUNC_W {
986        FUNC_W { w: self }
987    }
988    #[doc = "Bits 4:5 - Selects function mode (on-chip pull-up/pull-down resistor control)."]
989    #[inline(always)]
990    pub fn mode(&mut self) -> MODE_W {
991        MODE_W { w: self }
992    }
993    #[doc = "Bit 6 - Driver slew rate."]
994    #[inline(always)]
995    pub fn slew(&mut self) -> SLEW_W {
996        SLEW_W { w: self }
997    }
998    #[doc = "Bit 7 - Input polarity."]
999    #[inline(always)]
1000    pub fn invert(&mut self) -> INVERT_W {
1001        INVERT_W { w: self }
1002    }
1003    #[doc = "Bit 8 - Select Digital mode."]
1004    #[inline(always)]
1005    pub fn digimode(&mut self) -> DIGIMODE_W {
1006        DIGIMODE_W { w: self }
1007    }
1008    #[doc = "Bit 9 - Controls open-drain mode in standard GPIO mode (EGP = 1). This bit has no effect in I2C mode (EGP=0)."]
1009    #[inline(always)]
1010    pub fn od(&mut self) -> OD_W {
1011        OD_W { w: self }
1012    }
1013    #[doc = "Bit 11 - Supply Selection bit."]
1014    #[inline(always)]
1015    pub fn ssel(&mut self) -> SSEL_W {
1016        SSEL_W { w: self }
1017    }
1018    #[doc = "Bit 12 - Controls input glitch filter."]
1019    #[inline(always)]
1020    pub fn filteroff(&mut self) -> FILTEROFF_W {
1021        FILTEROFF_W { w: self }
1022    }
1023    #[doc = "Bit 13 - Pull-up current source enable in I2C mode."]
1024    #[inline(always)]
1025    pub fn ecs(&mut self) -> ECS_W {
1026        ECS_W { w: self }
1027    }
1028    #[doc = "Bit 14 - Switch between GPIO mode and I2C mode."]
1029    #[inline(always)]
1030    pub fn egp(&mut self) -> EGP_W {
1031        EGP_W { w: self }
1032    }
1033    #[doc = "Bit 15 - Configures I2C features for standard mode, fast mode, and Fast Mode Plus operation and High-Speed mode operation."]
1034    #[inline(always)]
1035    pub fn i2cfilter(&mut self) -> I2CFILTER_W {
1036        I2CFILTER_W { w: self }
1037    }
1038}