mcxa_pac/inputmux0/
usbfs_trig.rs1#[doc = "Register `USBFS_TRIG` reader"]
2pub type R = crate::R<UsbfsTrigSpec>;
3#[doc = "Register `USBFS_TRIG` writer"]
4pub type W = crate::W<UsbfsTrigSpec>;
5#[doc = "USB-FS trigger input connections.\n\nValue on reset: 7"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Inp {
10 #[doc = "1: LPUART0 lpuart_trg_txdata input is selected"]
11 Val1 = 1,
12 #[doc = "2: LPUART1 lpuart_trg_txdata input is selected"]
13 Val2 = 2,
14 #[doc = "3: LPUART2 lpuart_trg_txdata input is selected"]
15 Val3 = 3,
16 #[doc = "4: LPUART3 lpuart_trg_txdata input is selected"]
17 Val4 = 4,
18 #[doc = "5: LPUART4 lpuart_trg_txdata input is selected"]
19 Val5 = 5,
20 #[doc = "6: LPUART5 lpuart_trg_txdata input is selected"]
21 Val6 = 6,
22}
23impl From<Inp> for u8 {
24 #[inline(always)]
25 fn from(variant: Inp) -> Self {
26 variant as _
27 }
28}
29impl crate::FieldSpec for Inp {
30 type Ux = u8;
31}
32impl crate::IsEnum for Inp {}
33#[doc = "Field `INP` reader - USB-FS trigger input connections."]
34pub type InpR = crate::FieldReader<Inp>;
35impl InpR {
36 #[doc = "Get enumerated values variant"]
37 #[inline(always)]
38 pub const fn variant(&self) -> Option<Inp> {
39 match self.bits {
40 1 => Some(Inp::Val1),
41 2 => Some(Inp::Val2),
42 3 => Some(Inp::Val3),
43 4 => Some(Inp::Val4),
44 5 => Some(Inp::Val5),
45 6 => Some(Inp::Val6),
46 _ => None,
47 }
48 }
49 #[doc = "LPUART0 lpuart_trg_txdata input is selected"]
50 #[inline(always)]
51 pub fn is_val1(&self) -> bool {
52 *self == Inp::Val1
53 }
54 #[doc = "LPUART1 lpuart_trg_txdata input is selected"]
55 #[inline(always)]
56 pub fn is_val2(&self) -> bool {
57 *self == Inp::Val2
58 }
59 #[doc = "LPUART2 lpuart_trg_txdata input is selected"]
60 #[inline(always)]
61 pub fn is_val3(&self) -> bool {
62 *self == Inp::Val3
63 }
64 #[doc = "LPUART3 lpuart_trg_txdata input is selected"]
65 #[inline(always)]
66 pub fn is_val4(&self) -> bool {
67 *self == Inp::Val4
68 }
69 #[doc = "LPUART4 lpuart_trg_txdata input is selected"]
70 #[inline(always)]
71 pub fn is_val5(&self) -> bool {
72 *self == Inp::Val5
73 }
74 #[doc = "LPUART5 lpuart_trg_txdata input is selected"]
75 #[inline(always)]
76 pub fn is_val6(&self) -> bool {
77 *self == Inp::Val6
78 }
79}
80#[doc = "Field `INP` writer - USB-FS trigger input connections."]
81pub type InpW<'a, REG> = crate::FieldWriter<'a, REG, 4, Inp>;
82impl<'a, REG> InpW<'a, REG>
83where
84 REG: crate::Writable + crate::RegisterSpec,
85 REG::Ux: From<u8>,
86{
87 #[doc = "LPUART0 lpuart_trg_txdata input is selected"]
88 #[inline(always)]
89 pub fn val1(self) -> &'a mut crate::W<REG> {
90 self.variant(Inp::Val1)
91 }
92 #[doc = "LPUART1 lpuart_trg_txdata input is selected"]
93 #[inline(always)]
94 pub fn val2(self) -> &'a mut crate::W<REG> {
95 self.variant(Inp::Val2)
96 }
97 #[doc = "LPUART2 lpuart_trg_txdata input is selected"]
98 #[inline(always)]
99 pub fn val3(self) -> &'a mut crate::W<REG> {
100 self.variant(Inp::Val3)
101 }
102 #[doc = "LPUART3 lpuart_trg_txdata input is selected"]
103 #[inline(always)]
104 pub fn val4(self) -> &'a mut crate::W<REG> {
105 self.variant(Inp::Val4)
106 }
107 #[doc = "LPUART4 lpuart_trg_txdata input is selected"]
108 #[inline(always)]
109 pub fn val5(self) -> &'a mut crate::W<REG> {
110 self.variant(Inp::Val5)
111 }
112 #[doc = "LPUART5 lpuart_trg_txdata input is selected"]
113 #[inline(always)]
114 pub fn val6(self) -> &'a mut crate::W<REG> {
115 self.variant(Inp::Val6)
116 }
117}
118impl R {
119 #[doc = "Bits 0:3 - USB-FS trigger input connections."]
120 #[inline(always)]
121 pub fn inp(&self) -> InpR {
122 InpR::new((self.bits & 0x0f) as u8)
123 }
124}
125#[cfg(feature = "debug")]
126impl core::fmt::Debug for R {
127 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
128 f.debug_struct("USBFS_TRIG").field("inp", &self.inp()).finish()
129 }
130}
131impl W {
132 #[doc = "Bits 0:3 - USB-FS trigger input connections."]
133 #[inline(always)]
134 pub fn inp(&mut self) -> InpW<'_, UsbfsTrigSpec> {
135 InpW::new(self, 0)
136 }
137}
138#[doc = "USB-FS trigger input connections\n\nYou can [`read`](crate::Reg::read) this register and get [`usbfs_trig::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`usbfs_trig::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
139pub struct UsbfsTrigSpec;
140impl crate::RegisterSpec for UsbfsTrigSpec {
141 type Ux = u32;
142}
143#[doc = "`read()` method returns [`usbfs_trig::R`](R) reader structure"]
144impl crate::Readable for UsbfsTrigSpec {}
145#[doc = "`write(|w| ..)` method takes [`usbfs_trig::W`](W) writer structure"]
146impl crate::Writable for UsbfsTrigSpec {
147 type Safety = crate::Unsafe;
148}
149#[doc = "`reset()` method sets USBFS_TRIG to value 0x07"]
150impl crate::Resettable for UsbfsTrigSpec {
151 const RESET_VALUE: u32 = 0x07;
152}