esp32s3/usb_device/
test.rs

1#[doc = "Register `TEST` reader"]
2pub type R = crate::R<TEST_SPEC>;
3#[doc = "Register `TEST` writer"]
4pub type W = crate::W<TEST_SPEC>;
5#[doc = "Field `ENABLE` reader - Enable test of the USB pad"]
6pub type ENABLE_R = crate::BitReader;
7#[doc = "Field `ENABLE` writer - Enable test of the USB pad"]
8pub type ENABLE_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `USB_OE` reader - USB pad oen in test"]
10pub type USB_OE_R = crate::BitReader;
11#[doc = "Field `USB_OE` writer - USB pad oen in test"]
12pub type USB_OE_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `TX_DP` reader - USB D+ tx value in test"]
14pub type TX_DP_R = crate::BitReader;
15#[doc = "Field `TX_DP` writer - USB D+ tx value in test"]
16pub type TX_DP_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `TX_DM` reader - USB D- tx value in test"]
18pub type TX_DM_R = crate::BitReader;
19#[doc = "Field `TX_DM` writer - USB D- tx value in test"]
20pub type TX_DM_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `RX_RCV` reader - USB differential rx value in test"]
22pub type RX_RCV_R = crate::BitReader;
23#[doc = "Field `RX_DP` reader - USB D+ rx value in test"]
24pub type RX_DP_R = crate::BitReader;
25#[doc = "Field `RX_DM` reader - USB D- rx value in test"]
26pub type RX_DM_R = crate::BitReader;
27impl R {
28    #[doc = "Bit 0 - Enable test of the USB pad"]
29    #[inline(always)]
30    pub fn enable(&self) -> ENABLE_R {
31        ENABLE_R::new((self.bits & 1) != 0)
32    }
33    #[doc = "Bit 1 - USB pad oen in test"]
34    #[inline(always)]
35    pub fn usb_oe(&self) -> USB_OE_R {
36        USB_OE_R::new(((self.bits >> 1) & 1) != 0)
37    }
38    #[doc = "Bit 2 - USB D+ tx value in test"]
39    #[inline(always)]
40    pub fn tx_dp(&self) -> TX_DP_R {
41        TX_DP_R::new(((self.bits >> 2) & 1) != 0)
42    }
43    #[doc = "Bit 3 - USB D- tx value in test"]
44    #[inline(always)]
45    pub fn tx_dm(&self) -> TX_DM_R {
46        TX_DM_R::new(((self.bits >> 3) & 1) != 0)
47    }
48    #[doc = "Bit 4 - USB differential rx value in test"]
49    #[inline(always)]
50    pub fn rx_rcv(&self) -> RX_RCV_R {
51        RX_RCV_R::new(((self.bits >> 4) & 1) != 0)
52    }
53    #[doc = "Bit 5 - USB D+ rx value in test"]
54    #[inline(always)]
55    pub fn rx_dp(&self) -> RX_DP_R {
56        RX_DP_R::new(((self.bits >> 5) & 1) != 0)
57    }
58    #[doc = "Bit 6 - USB D- rx value in test"]
59    #[inline(always)]
60    pub fn rx_dm(&self) -> RX_DM_R {
61        RX_DM_R::new(((self.bits >> 6) & 1) != 0)
62    }
63}
64#[cfg(feature = "impl-register-debug")]
65impl core::fmt::Debug for R {
66    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
67        f.debug_struct("TEST")
68            .field("enable", &self.enable())
69            .field("usb_oe", &self.usb_oe())
70            .field("tx_dp", &self.tx_dp())
71            .field("tx_dm", &self.tx_dm())
72            .field("rx_rcv", &self.rx_rcv())
73            .field("rx_dp", &self.rx_dp())
74            .field("rx_dm", &self.rx_dm())
75            .finish()
76    }
77}
78impl W {
79    #[doc = "Bit 0 - Enable test of the USB pad"]
80    #[inline(always)]
81    pub fn enable(&mut self) -> ENABLE_W<TEST_SPEC> {
82        ENABLE_W::new(self, 0)
83    }
84    #[doc = "Bit 1 - USB pad oen in test"]
85    #[inline(always)]
86    pub fn usb_oe(&mut self) -> USB_OE_W<TEST_SPEC> {
87        USB_OE_W::new(self, 1)
88    }
89    #[doc = "Bit 2 - USB D+ tx value in test"]
90    #[inline(always)]
91    pub fn tx_dp(&mut self) -> TX_DP_W<TEST_SPEC> {
92        TX_DP_W::new(self, 2)
93    }
94    #[doc = "Bit 3 - USB D- tx value in test"]
95    #[inline(always)]
96    pub fn tx_dm(&mut self) -> TX_DM_W<TEST_SPEC> {
97        TX_DM_W::new(self, 3)
98    }
99}
100#[doc = "USB Internal PHY test register\n\nYou can [`read`](crate::Reg::read) this register and get [`test::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`test::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
101pub struct TEST_SPEC;
102impl crate::RegisterSpec for TEST_SPEC {
103    type Ux = u32;
104}
105#[doc = "`read()` method returns [`test::R`](R) reader structure"]
106impl crate::Readable for TEST_SPEC {}
107#[doc = "`write(|w| ..)` method takes [`test::W`](W) writer structure"]
108impl crate::Writable for TEST_SPEC {
109    type Safety = crate::Unsafe;
110    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
111    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
112}
113#[doc = "`reset()` method sets TEST to value 0"]
114impl crate::Resettable for TEST_SPEC {
115    const RESET_VALUE: u32 = 0;
116}