mimxrt595s/usbphy/
rx.rs

1#[doc = "Register `RX` reader"]
2pub struct R(crate::R<RX_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RX_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RX_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RX_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `RX` writer"]
17pub struct W(crate::W<RX_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RX_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<RX_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RX_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `ENVADJ` reader - Envelope detector trip point."]
38pub type ENVADJ_R = crate::FieldReader<u8, ENVADJ_A>;
39#[doc = "Envelope detector trip point.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum ENVADJ_A {
43    #[doc = "0: Trip-Level Voltage is 0.1000 V"]
44    ENVADJ_0 = 0,
45    #[doc = "1: Trip-Level Voltage is 0.1125 V"]
46    ENVADJ_1 = 1,
47    #[doc = "2: Trip-Level Voltage is 0.1250 V"]
48    ENVADJ_2 = 2,
49    #[doc = "3: Trip-Level Voltage is 0.0875 V"]
50    ENVADJ_3 = 3,
51}
52impl From<ENVADJ_A> for u8 {
53    #[inline(always)]
54    fn from(variant: ENVADJ_A) -> Self {
55        variant as _
56    }
57}
58impl ENVADJ_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> Option<ENVADJ_A> {
62        match self.bits {
63            0 => Some(ENVADJ_A::ENVADJ_0),
64            1 => Some(ENVADJ_A::ENVADJ_1),
65            2 => Some(ENVADJ_A::ENVADJ_2),
66            3 => Some(ENVADJ_A::ENVADJ_3),
67            _ => None,
68        }
69    }
70    #[doc = "Checks if the value of the field is `ENVADJ_0`"]
71    #[inline(always)]
72    pub fn is_envadj_0(&self) -> bool {
73        *self == ENVADJ_A::ENVADJ_0
74    }
75    #[doc = "Checks if the value of the field is `ENVADJ_1`"]
76    #[inline(always)]
77    pub fn is_envadj_1(&self) -> bool {
78        *self == ENVADJ_A::ENVADJ_1
79    }
80    #[doc = "Checks if the value of the field is `ENVADJ_2`"]
81    #[inline(always)]
82    pub fn is_envadj_2(&self) -> bool {
83        *self == ENVADJ_A::ENVADJ_2
84    }
85    #[doc = "Checks if the value of the field is `ENVADJ_3`"]
86    #[inline(always)]
87    pub fn is_envadj_3(&self) -> bool {
88        *self == ENVADJ_A::ENVADJ_3
89    }
90}
91#[doc = "Field `ENVADJ` writer - Envelope detector trip point."]
92pub type ENVADJ_W<'a, const O: u8> = crate::FieldWriter<'a, u32, RX_SPEC, u8, ENVADJ_A, 3, O>;
93impl<'a, const O: u8> ENVADJ_W<'a, O> {
94    #[doc = "Trip-Level Voltage is 0.1000 V"]
95    #[inline(always)]
96    pub fn envadj_0(self) -> &'a mut W {
97        self.variant(ENVADJ_A::ENVADJ_0)
98    }
99    #[doc = "Trip-Level Voltage is 0.1125 V"]
100    #[inline(always)]
101    pub fn envadj_1(self) -> &'a mut W {
102        self.variant(ENVADJ_A::ENVADJ_1)
103    }
104    #[doc = "Trip-Level Voltage is 0.1250 V"]
105    #[inline(always)]
106    pub fn envadj_2(self) -> &'a mut W {
107        self.variant(ENVADJ_A::ENVADJ_2)
108    }
109    #[doc = "Trip-Level Voltage is 0.0875 V"]
110    #[inline(always)]
111    pub fn envadj_3(self) -> &'a mut W {
112        self.variant(ENVADJ_A::ENVADJ_3)
113    }
114}
115#[doc = "Field `DISCONADJ` reader - Disconnect detector trip point."]
116pub type DISCONADJ_R = crate::FieldReader<u8, DISCONADJ_A>;
117#[doc = "Disconnect detector trip point.\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119#[repr(u8)]
120pub enum DISCONADJ_A {
121    #[doc = "0: Trip-Level Voltage is 0.56875 V"]
122    DISCONADJ_1 = 0,
123    #[doc = "1: Trip-Level Voltage is 0.55000 V"]
124    DISCONADJ_2 = 1,
125    #[doc = "2: Trip-Level Voltage is 0.58125 V"]
126    DISCONADJ_3 = 2,
127    #[doc = "3: Trip-Level Voltage is 0.60000 V"]
128    DISCONADJ_4 = 3,
129}
130impl From<DISCONADJ_A> for u8 {
131    #[inline(always)]
132    fn from(variant: DISCONADJ_A) -> Self {
133        variant as _
134    }
135}
136impl DISCONADJ_R {
137    #[doc = "Get enumerated values variant"]
138    #[inline(always)]
139    pub fn variant(&self) -> Option<DISCONADJ_A> {
140        match self.bits {
141            0 => Some(DISCONADJ_A::DISCONADJ_1),
142            1 => Some(DISCONADJ_A::DISCONADJ_2),
143            2 => Some(DISCONADJ_A::DISCONADJ_3),
144            3 => Some(DISCONADJ_A::DISCONADJ_4),
145            _ => None,
146        }
147    }
148    #[doc = "Checks if the value of the field is `DISCONADJ_1`"]
149    #[inline(always)]
150    pub fn is_disconadj_1(&self) -> bool {
151        *self == DISCONADJ_A::DISCONADJ_1
152    }
153    #[doc = "Checks if the value of the field is `DISCONADJ_2`"]
154    #[inline(always)]
155    pub fn is_disconadj_2(&self) -> bool {
156        *self == DISCONADJ_A::DISCONADJ_2
157    }
158    #[doc = "Checks if the value of the field is `DISCONADJ_3`"]
159    #[inline(always)]
160    pub fn is_disconadj_3(&self) -> bool {
161        *self == DISCONADJ_A::DISCONADJ_3
162    }
163    #[doc = "Checks if the value of the field is `DISCONADJ_4`"]
164    #[inline(always)]
165    pub fn is_disconadj_4(&self) -> bool {
166        *self == DISCONADJ_A::DISCONADJ_4
167    }
168}
169#[doc = "Field `DISCONADJ` writer - Disconnect detector trip point."]
170pub type DISCONADJ_W<'a, const O: u8> = crate::FieldWriter<'a, u32, RX_SPEC, u8, DISCONADJ_A, 3, O>;
171impl<'a, const O: u8> DISCONADJ_W<'a, O> {
172    #[doc = "Trip-Level Voltage is 0.56875 V"]
173    #[inline(always)]
174    pub fn disconadj_1(self) -> &'a mut W {
175        self.variant(DISCONADJ_A::DISCONADJ_1)
176    }
177    #[doc = "Trip-Level Voltage is 0.55000 V"]
178    #[inline(always)]
179    pub fn disconadj_2(self) -> &'a mut W {
180        self.variant(DISCONADJ_A::DISCONADJ_2)
181    }
182    #[doc = "Trip-Level Voltage is 0.58125 V"]
183    #[inline(always)]
184    pub fn disconadj_3(self) -> &'a mut W {
185        self.variant(DISCONADJ_A::DISCONADJ_3)
186    }
187    #[doc = "Trip-Level Voltage is 0.60000 V"]
188    #[inline(always)]
189    pub fn disconadj_4(self) -> &'a mut W {
190        self.variant(DISCONADJ_A::DISCONADJ_4)
191    }
192}
193#[doc = "Field `RXDBYPASS` reader - DM bypass"]
194pub type RXDBYPASS_R = crate::BitReader<RXDBYPASS_A>;
195#[doc = "DM bypass\n\nValue on reset: 0"]
196#[derive(Clone, Copy, Debug, PartialEq, Eq)]
197pub enum RXDBYPASS_A {
198    #[doc = "0: Normal operation"]
199    RXDBYPASS_0 = 0,
200    #[doc = "1: Use the output of the USB_DP single-ended receiver in place of the full-speed differential receiver"]
201    RXDBYPASS_1 = 1,
202}
203impl From<RXDBYPASS_A> for bool {
204    #[inline(always)]
205    fn from(variant: RXDBYPASS_A) -> Self {
206        variant as u8 != 0
207    }
208}
209impl RXDBYPASS_R {
210    #[doc = "Get enumerated values variant"]
211    #[inline(always)]
212    pub fn variant(&self) -> RXDBYPASS_A {
213        match self.bits {
214            false => RXDBYPASS_A::RXDBYPASS_0,
215            true => RXDBYPASS_A::RXDBYPASS_1,
216        }
217    }
218    #[doc = "Checks if the value of the field is `RXDBYPASS_0`"]
219    #[inline(always)]
220    pub fn is_rxdbypass_0(&self) -> bool {
221        *self == RXDBYPASS_A::RXDBYPASS_0
222    }
223    #[doc = "Checks if the value of the field is `RXDBYPASS_1`"]
224    #[inline(always)]
225    pub fn is_rxdbypass_1(&self) -> bool {
226        *self == RXDBYPASS_A::RXDBYPASS_1
227    }
228}
229#[doc = "Field `RXDBYPASS` writer - DM bypass"]
230pub type RXDBYPASS_W<'a, const O: u8> = crate::BitWriter<'a, u32, RX_SPEC, RXDBYPASS_A, O>;
231impl<'a, const O: u8> RXDBYPASS_W<'a, O> {
232    #[doc = "Normal operation"]
233    #[inline(always)]
234    pub fn rxdbypass_0(self) -> &'a mut W {
235        self.variant(RXDBYPASS_A::RXDBYPASS_0)
236    }
237    #[doc = "Use the output of the USB_DP single-ended receiver in place of the full-speed differential receiver"]
238    #[inline(always)]
239    pub fn rxdbypass_1(self) -> &'a mut W {
240        self.variant(RXDBYPASS_A::RXDBYPASS_1)
241    }
242}
243impl R {
244    #[doc = "Bits 0:2 - Envelope detector trip point."]
245    #[inline(always)]
246    pub fn envadj(&self) -> ENVADJ_R {
247        ENVADJ_R::new((self.bits & 7) as u8)
248    }
249    #[doc = "Bits 4:6 - Disconnect detector trip point."]
250    #[inline(always)]
251    pub fn disconadj(&self) -> DISCONADJ_R {
252        DISCONADJ_R::new(((self.bits >> 4) & 7) as u8)
253    }
254    #[doc = "Bit 22 - DM bypass"]
255    #[inline(always)]
256    pub fn rxdbypass(&self) -> RXDBYPASS_R {
257        RXDBYPASS_R::new(((self.bits >> 22) & 1) != 0)
258    }
259}
260impl W {
261    #[doc = "Bits 0:2 - Envelope detector trip point."]
262    #[inline(always)]
263    #[must_use]
264    pub fn envadj(&mut self) -> ENVADJ_W<0> {
265        ENVADJ_W::new(self)
266    }
267    #[doc = "Bits 4:6 - Disconnect detector trip point."]
268    #[inline(always)]
269    #[must_use]
270    pub fn disconadj(&mut self) -> DISCONADJ_W<4> {
271        DISCONADJ_W::new(self)
272    }
273    #[doc = "Bit 22 - DM bypass"]
274    #[inline(always)]
275    #[must_use]
276    pub fn rxdbypass(&mut self) -> RXDBYPASS_W<22> {
277        RXDBYPASS_W::new(self)
278    }
279    #[doc = "Writes raw bits to the register."]
280    #[inline(always)]
281    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
282        self.0.bits(bits);
283        self
284    }
285}
286#[doc = "RX Control\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 [rx](index.html) module"]
287pub struct RX_SPEC;
288impl crate::RegisterSpec for RX_SPEC {
289    type Ux = u32;
290}
291#[doc = "`read()` method returns [rx::R](R) reader structure"]
292impl crate::Readable for RX_SPEC {
293    type Reader = R;
294}
295#[doc = "`write(|w| ..)` method takes [rx::W](W) writer structure"]
296impl crate::Writable for RX_SPEC {
297    type Writer = W;
298    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
299    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
300}
301#[doc = "`reset()` method sets RX to value 0"]
302impl crate::Resettable for RX_SPEC {
303    const RESET_VALUE: Self::Ux = 0;
304}