esp32c3/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>;
21impl R {
22    #[doc = "Bit 0 - Enable test of the USB pad"]
23    #[inline(always)]
24    pub fn enable(&self) -> ENABLE_R {
25        ENABLE_R::new((self.bits & 1) != 0)
26    }
27    #[doc = "Bit 1 - USB pad oen in test"]
28    #[inline(always)]
29    pub fn usb_oe(&self) -> USB_OE_R {
30        USB_OE_R::new(((self.bits >> 1) & 1) != 0)
31    }
32    #[doc = "Bit 2 - USB D+ tx value in test"]
33    #[inline(always)]
34    pub fn tx_dp(&self) -> TX_DP_R {
35        TX_DP_R::new(((self.bits >> 2) & 1) != 0)
36    }
37    #[doc = "Bit 3 - USB D- tx value in test"]
38    #[inline(always)]
39    pub fn tx_dm(&self) -> TX_DM_R {
40        TX_DM_R::new(((self.bits >> 3) & 1) != 0)
41    }
42}
43#[cfg(feature = "impl-register-debug")]
44impl core::fmt::Debug for R {
45    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
46        f.debug_struct("TEST")
47            .field("enable", &self.enable())
48            .field("usb_oe", &self.usb_oe())
49            .field("tx_dp", &self.tx_dp())
50            .field("tx_dm", &self.tx_dm())
51            .finish()
52    }
53}
54impl W {
55    #[doc = "Bit 0 - Enable test of the USB pad"]
56    #[inline(always)]
57    pub fn enable(&mut self) -> ENABLE_W<TEST_SPEC> {
58        ENABLE_W::new(self, 0)
59    }
60    #[doc = "Bit 1 - USB pad oen in test"]
61    #[inline(always)]
62    pub fn usb_oe(&mut self) -> USB_OE_W<TEST_SPEC> {
63        USB_OE_W::new(self, 1)
64    }
65    #[doc = "Bit 2 - USB D+ tx value in test"]
66    #[inline(always)]
67    pub fn tx_dp(&mut self) -> TX_DP_W<TEST_SPEC> {
68        TX_DP_W::new(self, 2)
69    }
70    #[doc = "Bit 3 - USB D- tx value in test"]
71    #[inline(always)]
72    pub fn tx_dm(&mut self) -> TX_DM_W<TEST_SPEC> {
73        TX_DM_W::new(self, 3)
74    }
75}
76#[doc = "USB_DEVICE_TEST_REG.\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)."]
77pub struct TEST_SPEC;
78impl crate::RegisterSpec for TEST_SPEC {
79    type Ux = u32;
80}
81#[doc = "`read()` method returns [`test::R`](R) reader structure"]
82impl crate::Readable for TEST_SPEC {}
83#[doc = "`write(|w| ..)` method takes [`test::W`](W) writer structure"]
84impl crate::Writable for TEST_SPEC {
85    type Safety = crate::Unsafe;
86    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
87    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
88}
89#[doc = "`reset()` method sets TEST to value 0"]
90impl crate::Resettable for TEST_SPEC {
91    const RESET_VALUE: u32 = 0;
92}