lpc55_pac/anactrl/
usbhs_phy_ctrl.rs1#[doc = "Register `USBHS_PHY_CTRL` reader"]
2pub struct R(crate::R<USBHS_PHY_CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<USBHS_PHY_CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<USBHS_PHY_CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<USBHS_PHY_CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `USBHS_PHY_CTRL` writer"]
17pub struct W(crate::W<USBHS_PHY_CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<USBHS_PHY_CTRL_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<USBHS_PHY_CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<USBHS_PHY_CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `usb_vbusvalid_ext` reader - Override value for Vbus if using external detectors."]
38pub struct USB_VBUSVALID_EXT_R(crate::FieldReader<bool, bool>);
39impl USB_VBUSVALID_EXT_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: bool) -> Self {
42 USB_VBUSVALID_EXT_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for USB_VBUSVALID_EXT_R {
46 type Target = crate::FieldReader<bool, bool>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `usb_vbusvalid_ext` writer - Override value for Vbus if using external detectors."]
53pub struct USB_VBUSVALID_EXT_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> USB_VBUSVALID_EXT_W<'a> {
57 #[doc = r"Sets the field bit"]
58 #[inline(always)]
59 pub fn set_bit(self) -> &'a mut W {
60 self.bit(true)
61 }
62 #[doc = r"Clears the field bit"]
63 #[inline(always)]
64 pub fn clear_bit(self) -> &'a mut W {
65 self.bit(false)
66 }
67 #[doc = r"Writes raw bits to the field"]
68 #[inline(always)]
69 pub fn bit(self, value: bool) -> &'a mut W {
70 self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
71 self.w
72 }
73}
74#[doc = "Field `usb_id_ext` reader - Override value for ID if using external detectors."]
75pub struct USB_ID_EXT_R(crate::FieldReader<bool, bool>);
76impl USB_ID_EXT_R {
77 #[inline(always)]
78 pub(crate) fn new(bits: bool) -> Self {
79 USB_ID_EXT_R(crate::FieldReader::new(bits))
80 }
81}
82impl core::ops::Deref for USB_ID_EXT_R {
83 type Target = crate::FieldReader<bool, bool>;
84 #[inline(always)]
85 fn deref(&self) -> &Self::Target {
86 &self.0
87 }
88}
89#[doc = "Field `usb_id_ext` writer - Override value for ID if using external detectors."]
90pub struct USB_ID_EXT_W<'a> {
91 w: &'a mut W,
92}
93impl<'a> USB_ID_EXT_W<'a> {
94 #[doc = r"Sets the field bit"]
95 #[inline(always)]
96 pub fn set_bit(self) -> &'a mut W {
97 self.bit(true)
98 }
99 #[doc = r"Clears the field bit"]
100 #[inline(always)]
101 pub fn clear_bit(self) -> &'a mut W {
102 self.bit(false)
103 }
104 #[doc = r"Writes raw bits to the field"]
105 #[inline(always)]
106 pub fn bit(self, value: bool) -> &'a mut W {
107 self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
108 self.w
109 }
110}
111impl R {
112 #[doc = "Bit 0 - Override value for Vbus if using external detectors."]
113 #[inline(always)]
114 pub fn usb_vbusvalid_ext(&self) -> USB_VBUSVALID_EXT_R {
115 USB_VBUSVALID_EXT_R::new((self.bits & 0x01) != 0)
116 }
117 #[doc = "Bit 1 - Override value for ID if using external detectors."]
118 #[inline(always)]
119 pub fn usb_id_ext(&self) -> USB_ID_EXT_R {
120 USB_ID_EXT_R::new(((self.bits >> 1) & 0x01) != 0)
121 }
122}
123impl W {
124 #[doc = "Bit 0 - Override value for Vbus if using external detectors."]
125 #[inline(always)]
126 pub fn usb_vbusvalid_ext(&mut self) -> USB_VBUSVALID_EXT_W {
127 USB_VBUSVALID_EXT_W { w: self }
128 }
129 #[doc = "Bit 1 - Override value for ID if using external detectors."]
130 #[inline(always)]
131 pub fn usb_id_ext(&mut self) -> USB_ID_EXT_W {
132 USB_ID_EXT_W { w: self }
133 }
134 #[doc = "Writes raw bits to the register."]
135 #[inline(always)]
136 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
137 self.0.bits(bits);
138 self
139 }
140}
141#[doc = "USB High Speed Phy 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 [usbhs_phy_ctrl](index.html) module"]
142pub struct USBHS_PHY_CTRL_SPEC;
143impl crate::RegisterSpec for USBHS_PHY_CTRL_SPEC {
144 type Ux = u32;
145}
146#[doc = "`read()` method returns [usbhs_phy_ctrl::R](R) reader structure"]
147impl crate::Readable for USBHS_PHY_CTRL_SPEC {
148 type Reader = R;
149}
150#[doc = "`write(|w| ..)` method takes [usbhs_phy_ctrl::W](W) writer structure"]
151impl crate::Writable for USBHS_PHY_CTRL_SPEC {
152 type Writer = W;
153}
154#[doc = "`reset()` method sets USBHS_PHY_CTRL to value 0x08"]
155impl crate::Resettable for USBHS_PHY_CTRL_SPEC {
156 #[inline(always)]
157 fn reset_value() -> Self::Ux {
158 0x08
159 }
160}