mimxrt685s_pac/usbphy/
rx_tog.rs

1#[doc = "Register `RX_TOG` reader"]
2pub type R = crate::R<RxTogSpec>;
3#[doc = "Register `RX_TOG` writer"]
4pub type W = crate::W<RxTogSpec>;
5#[doc = "The ENVADJ field adjusts the trip point for the envelope detector\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Envadj {
10    #[doc = "0: Trip-Level Voltage is 0.1000 V"]
11    Envadj0 = 0,
12    #[doc = "1: Trip-Level Voltage is 0.1125 V"]
13    Envadj1 = 1,
14    #[doc = "2: Trip-Level Voltage is 0.1250 V"]
15    Envadj2 = 2,
16    #[doc = "3: Trip-Level Voltage is 0.0875 V"]
17    Envadj3 = 3,
18}
19impl From<Envadj> for u8 {
20    #[inline(always)]
21    fn from(variant: Envadj) -> Self {
22        variant as _
23    }
24}
25impl crate::FieldSpec for Envadj {
26    type Ux = u8;
27}
28impl crate::IsEnum for Envadj {}
29#[doc = "Field `ENVADJ` reader - The ENVADJ field adjusts the trip point for the envelope detector"]
30pub type EnvadjR = crate::FieldReader<Envadj>;
31impl EnvadjR {
32    #[doc = "Get enumerated values variant"]
33    #[inline(always)]
34    pub const fn variant(&self) -> Option<Envadj> {
35        match self.bits {
36            0 => Some(Envadj::Envadj0),
37            1 => Some(Envadj::Envadj1),
38            2 => Some(Envadj::Envadj2),
39            3 => Some(Envadj::Envadj3),
40            _ => None,
41        }
42    }
43    #[doc = "Trip-Level Voltage is 0.1000 V"]
44    #[inline(always)]
45    pub fn is_envadj_0(&self) -> bool {
46        *self == Envadj::Envadj0
47    }
48    #[doc = "Trip-Level Voltage is 0.1125 V"]
49    #[inline(always)]
50    pub fn is_envadj_1(&self) -> bool {
51        *self == Envadj::Envadj1
52    }
53    #[doc = "Trip-Level Voltage is 0.1250 V"]
54    #[inline(always)]
55    pub fn is_envadj_2(&self) -> bool {
56        *self == Envadj::Envadj2
57    }
58    #[doc = "Trip-Level Voltage is 0.0875 V"]
59    #[inline(always)]
60    pub fn is_envadj_3(&self) -> bool {
61        *self == Envadj::Envadj3
62    }
63}
64#[doc = "Field `ENVADJ` writer - The ENVADJ field adjusts the trip point for the envelope detector"]
65pub type EnvadjW<'a, REG> = crate::FieldWriter<'a, REG, 3, Envadj>;
66impl<'a, REG> EnvadjW<'a, REG>
67where
68    REG: crate::Writable + crate::RegisterSpec,
69    REG::Ux: From<u8>,
70{
71    #[doc = "Trip-Level Voltage is 0.1000 V"]
72    #[inline(always)]
73    pub fn envadj_0(self) -> &'a mut crate::W<REG> {
74        self.variant(Envadj::Envadj0)
75    }
76    #[doc = "Trip-Level Voltage is 0.1125 V"]
77    #[inline(always)]
78    pub fn envadj_1(self) -> &'a mut crate::W<REG> {
79        self.variant(Envadj::Envadj1)
80    }
81    #[doc = "Trip-Level Voltage is 0.1250 V"]
82    #[inline(always)]
83    pub fn envadj_2(self) -> &'a mut crate::W<REG> {
84        self.variant(Envadj::Envadj2)
85    }
86    #[doc = "Trip-Level Voltage is 0.0875 V"]
87    #[inline(always)]
88    pub fn envadj_3(self) -> &'a mut crate::W<REG> {
89        self.variant(Envadj::Envadj3)
90    }
91}
92#[doc = "The DISCONADJ field adjusts the trip point for the disconnect detector.\n\nValue on reset: 0"]
93#[cfg_attr(feature = "defmt", derive(defmt::Format))]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95#[repr(u8)]
96pub enum Disconadj {
97    #[doc = "0: Trip-Level Voltage is 0.56875 V"]
98    Disconadj0 = 0,
99    #[doc = "1: Trip-Level Voltage is 0.55000 V"]
100    Disconadj1 = 1,
101    #[doc = "2: Trip-Level Voltage is 0.58125 V"]
102    Disconadj2 = 2,
103    #[doc = "3: Trip-Level Voltage is 0.60000 V"]
104    Disconadj3 = 3,
105}
106impl From<Disconadj> for u8 {
107    #[inline(always)]
108    fn from(variant: Disconadj) -> Self {
109        variant as _
110    }
111}
112impl crate::FieldSpec for Disconadj {
113    type Ux = u8;
114}
115impl crate::IsEnum for Disconadj {}
116#[doc = "Field `DISCONADJ` reader - The DISCONADJ field adjusts the trip point for the disconnect detector."]
117pub type DisconadjR = crate::FieldReader<Disconadj>;
118impl DisconadjR {
119    #[doc = "Get enumerated values variant"]
120    #[inline(always)]
121    pub const fn variant(&self) -> Option<Disconadj> {
122        match self.bits {
123            0 => Some(Disconadj::Disconadj0),
124            1 => Some(Disconadj::Disconadj1),
125            2 => Some(Disconadj::Disconadj2),
126            3 => Some(Disconadj::Disconadj3),
127            _ => None,
128        }
129    }
130    #[doc = "Trip-Level Voltage is 0.56875 V"]
131    #[inline(always)]
132    pub fn is_disconadj_0(&self) -> bool {
133        *self == Disconadj::Disconadj0
134    }
135    #[doc = "Trip-Level Voltage is 0.55000 V"]
136    #[inline(always)]
137    pub fn is_disconadj_1(&self) -> bool {
138        *self == Disconadj::Disconadj1
139    }
140    #[doc = "Trip-Level Voltage is 0.58125 V"]
141    #[inline(always)]
142    pub fn is_disconadj_2(&self) -> bool {
143        *self == Disconadj::Disconadj2
144    }
145    #[doc = "Trip-Level Voltage is 0.60000 V"]
146    #[inline(always)]
147    pub fn is_disconadj_3(&self) -> bool {
148        *self == Disconadj::Disconadj3
149    }
150}
151#[doc = "Field `DISCONADJ` writer - The DISCONADJ field adjusts the trip point for the disconnect detector."]
152pub type DisconadjW<'a, REG> = crate::FieldWriter<'a, REG, 3, Disconadj>;
153impl<'a, REG> DisconadjW<'a, REG>
154where
155    REG: crate::Writable + crate::RegisterSpec,
156    REG::Ux: From<u8>,
157{
158    #[doc = "Trip-Level Voltage is 0.56875 V"]
159    #[inline(always)]
160    pub fn disconadj_0(self) -> &'a mut crate::W<REG> {
161        self.variant(Disconadj::Disconadj0)
162    }
163    #[doc = "Trip-Level Voltage is 0.55000 V"]
164    #[inline(always)]
165    pub fn disconadj_1(self) -> &'a mut crate::W<REG> {
166        self.variant(Disconadj::Disconadj1)
167    }
168    #[doc = "Trip-Level Voltage is 0.58125 V"]
169    #[inline(always)]
170    pub fn disconadj_2(self) -> &'a mut crate::W<REG> {
171        self.variant(Disconadj::Disconadj2)
172    }
173    #[doc = "Trip-Level Voltage is 0.60000 V"]
174    #[inline(always)]
175    pub fn disconadj_3(self) -> &'a mut crate::W<REG> {
176        self.variant(Disconadj::Disconadj3)
177    }
178}
179#[doc = "This test mode is intended for lab use only, replace FS differential receiver with DP single ended receiver\n\nValue on reset: 0"]
180#[cfg_attr(feature = "defmt", derive(defmt::Format))]
181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
182pub enum Rxdbypass {
183    #[doc = "0: Normal operation."]
184    Rxdbypass0 = 0,
185    #[doc = "1: Use the output of the USB_DP single-ended receiver in place of the full-speed differential receiver"]
186    Rxdbypass1 = 1,
187}
188impl From<Rxdbypass> for bool {
189    #[inline(always)]
190    fn from(variant: Rxdbypass) -> Self {
191        variant as u8 != 0
192    }
193}
194#[doc = "Field `RXDBYPASS` reader - This test mode is intended for lab use only, replace FS differential receiver with DP single ended receiver"]
195pub type RxdbypassR = crate::BitReader<Rxdbypass>;
196impl RxdbypassR {
197    #[doc = "Get enumerated values variant"]
198    #[inline(always)]
199    pub const fn variant(&self) -> Rxdbypass {
200        match self.bits {
201            false => Rxdbypass::Rxdbypass0,
202            true => Rxdbypass::Rxdbypass1,
203        }
204    }
205    #[doc = "Normal operation."]
206    #[inline(always)]
207    pub fn is_rxdbypass_0(&self) -> bool {
208        *self == Rxdbypass::Rxdbypass0
209    }
210    #[doc = "Use the output of the USB_DP single-ended receiver in place of the full-speed differential receiver"]
211    #[inline(always)]
212    pub fn is_rxdbypass_1(&self) -> bool {
213        *self == Rxdbypass::Rxdbypass1
214    }
215}
216#[doc = "Field `RXDBYPASS` writer - This test mode is intended for lab use only, replace FS differential receiver with DP single ended receiver"]
217pub type RxdbypassW<'a, REG> = crate::BitWriter<'a, REG, Rxdbypass>;
218impl<'a, REG> RxdbypassW<'a, REG>
219where
220    REG: crate::Writable + crate::RegisterSpec,
221{
222    #[doc = "Normal operation."]
223    #[inline(always)]
224    pub fn rxdbypass_0(self) -> &'a mut crate::W<REG> {
225        self.variant(Rxdbypass::Rxdbypass0)
226    }
227    #[doc = "Use the output of the USB_DP single-ended receiver in place of the full-speed differential receiver"]
228    #[inline(always)]
229    pub fn rxdbypass_1(self) -> &'a mut crate::W<REG> {
230        self.variant(Rxdbypass::Rxdbypass1)
231    }
232}
233impl R {
234    #[doc = "Bits 0:2 - The ENVADJ field adjusts the trip point for the envelope detector"]
235    #[inline(always)]
236    pub fn envadj(&self) -> EnvadjR {
237        EnvadjR::new((self.bits & 7) as u8)
238    }
239    #[doc = "Bits 4:6 - The DISCONADJ field adjusts the trip point for the disconnect detector."]
240    #[inline(always)]
241    pub fn disconadj(&self) -> DisconadjR {
242        DisconadjR::new(((self.bits >> 4) & 7) as u8)
243    }
244    #[doc = "Bit 22 - This test mode is intended for lab use only, replace FS differential receiver with DP single ended receiver"]
245    #[inline(always)]
246    pub fn rxdbypass(&self) -> RxdbypassR {
247        RxdbypassR::new(((self.bits >> 22) & 1) != 0)
248    }
249}
250#[cfg(feature = "debug")]
251impl core::fmt::Debug for R {
252    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
253        f.debug_struct("RX_TOG")
254            .field("envadj", &self.envadj())
255            .field("disconadj", &self.disconadj())
256            .field("rxdbypass", &self.rxdbypass())
257            .finish()
258    }
259}
260impl W {
261    #[doc = "Bits 0:2 - The ENVADJ field adjusts the trip point for the envelope detector"]
262    #[inline(always)]
263    pub fn envadj(&mut self) -> EnvadjW<RxTogSpec> {
264        EnvadjW::new(self, 0)
265    }
266    #[doc = "Bits 4:6 - The DISCONADJ field adjusts the trip point for the disconnect detector."]
267    #[inline(always)]
268    pub fn disconadj(&mut self) -> DisconadjW<RxTogSpec> {
269        DisconadjW::new(self, 4)
270    }
271    #[doc = "Bit 22 - This test mode is intended for lab use only, replace FS differential receiver with DP single ended receiver"]
272    #[inline(always)]
273    pub fn rxdbypass(&mut self) -> RxdbypassW<RxTogSpec> {
274        RxdbypassW::new(self, 22)
275    }
276}
277#[doc = "USB PHY Receiver Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`rx_tog::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`rx_tog::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
278pub struct RxTogSpec;
279impl crate::RegisterSpec for RxTogSpec {
280    type Ux = u32;
281}
282#[doc = "`read()` method returns [`rx_tog::R`](R) reader structure"]
283impl crate::Readable for RxTogSpec {}
284#[doc = "`write(|w| ..)` method takes [`rx_tog::W`](W) writer structure"]
285impl crate::Writable for RxTogSpec {
286    type Safety = crate::Unsafe;
287    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
288    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
289}
290#[doc = "`reset()` method sets RX_TOG to value 0"]
291impl crate::Resettable for RxTogSpec {
292    const RESET_VALUE: u32 = 0;
293}