rp2040_pac/usbctrl_regs/
usbphy_trim.rs

1#[doc = "Register `USBPHY_TRIM` reader"]
2pub type R = crate::R<USBPHY_TRIM_SPEC>;
3#[doc = "Register `USBPHY_TRIM` writer"]
4pub type W = crate::W<USBPHY_TRIM_SPEC>;
5#[doc = "Field `DP_PULLDN_TRIM` reader - Value to drive to USB PHY  
6 DP pulldown resistor trim control  
7 Experimental data suggests that the reset value will work, but this register allows adjustment if required"]
8pub type DP_PULLDN_TRIM_R = crate::FieldReader;
9#[doc = "Field `DP_PULLDN_TRIM` writer - Value to drive to USB PHY  
10 DP pulldown resistor trim control  
11 Experimental data suggests that the reset value will work, but this register allows adjustment if required"]
12pub type DP_PULLDN_TRIM_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
13#[doc = "Field `DM_PULLDN_TRIM` reader - Value to drive to USB PHY  
14 DM pulldown resistor trim control  
15 Experimental data suggests that the reset value will work, but this register allows adjustment if required"]
16pub type DM_PULLDN_TRIM_R = crate::FieldReader;
17#[doc = "Field `DM_PULLDN_TRIM` writer - Value to drive to USB PHY  
18 DM pulldown resistor trim control  
19 Experimental data suggests that the reset value will work, but this register allows adjustment if required"]
20pub type DM_PULLDN_TRIM_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
21impl R {
22    #[doc = "Bits 0:4 - Value to drive to USB PHY  
23 DP pulldown resistor trim control  
24 Experimental data suggests that the reset value will work, but this register allows adjustment if required"]
25    #[inline(always)]
26    pub fn dp_pulldn_trim(&self) -> DP_PULLDN_TRIM_R {
27        DP_PULLDN_TRIM_R::new((self.bits & 0x1f) as u8)
28    }
29    #[doc = "Bits 8:12 - Value to drive to USB PHY  
30 DM pulldown resistor trim control  
31 Experimental data suggests that the reset value will work, but this register allows adjustment if required"]
32    #[inline(always)]
33    pub fn dm_pulldn_trim(&self) -> DM_PULLDN_TRIM_R {
34        DM_PULLDN_TRIM_R::new(((self.bits >> 8) & 0x1f) as u8)
35    }
36}
37impl W {
38    #[doc = "Bits 0:4 - Value to drive to USB PHY  
39 DP pulldown resistor trim control  
40 Experimental data suggests that the reset value will work, but this register allows adjustment if required"]
41    #[inline(always)]
42    #[must_use]
43    pub fn dp_pulldn_trim(&mut self) -> DP_PULLDN_TRIM_W<USBPHY_TRIM_SPEC> {
44        DP_PULLDN_TRIM_W::new(self, 0)
45    }
46    #[doc = "Bits 8:12 - Value to drive to USB PHY  
47 DM pulldown resistor trim control  
48 Experimental data suggests that the reset value will work, but this register allows adjustment if required"]
49    #[inline(always)]
50    #[must_use]
51    pub fn dm_pulldn_trim(&mut self) -> DM_PULLDN_TRIM_W<USBPHY_TRIM_SPEC> {
52        DM_PULLDN_TRIM_W::new(self, 8)
53    }
54    #[doc = r" Writes raw bits to the register."]
55    #[doc = r""]
56    #[doc = r" # Safety"]
57    #[doc = r""]
58    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
59    #[inline(always)]
60    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
61        self.bits = bits;
62        self
63    }
64}
65#[doc = "Used to adjust trim values of USB phy pull down resistors.  
66
67You can [`read`](crate::generic::Reg::read) this register and get [`usbphy_trim::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`usbphy_trim::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
68pub struct USBPHY_TRIM_SPEC;
69impl crate::RegisterSpec for USBPHY_TRIM_SPEC {
70    type Ux = u32;
71}
72#[doc = "`read()` method returns [`usbphy_trim::R`](R) reader structure"]
73impl crate::Readable for USBPHY_TRIM_SPEC {}
74#[doc = "`write(|w| ..)` method takes [`usbphy_trim::W`](W) writer structure"]
75impl crate::Writable for USBPHY_TRIM_SPEC {
76    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
77    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
78}
79#[doc = "`reset()` method sets USBPHY_TRIM to value 0x1f1f"]
80impl crate::Resettable for USBPHY_TRIM_SPEC {
81    const RESET_VALUE: u32 = 0x1f1f;
82}