1#[doc = "Reader of register BCDR"]
2pub type R = crate::R<u16, super::BCDR>;
3#[doc = "Writer for register BCDR"]
4pub type W = crate::W<u16, super::BCDR>;
5#[doc = "Register BCDR `reset()`'s with value 0"]
6impl crate::ResetValue for super::BCDR {
7 type Type = u16;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `BCDEN`"]
14pub type BCDEN_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `BCDEN`"]
16pub struct BCDEN_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> BCDEN_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !0x01) | ((value as u16) & 0x01);
34 self.w
35 }
36}
37#[doc = "Reader of field `DCDEN`"]
38pub type DCDEN_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `DCDEN`"]
40pub struct DCDEN_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> DCDEN_W<'a> {
44 #[doc = r"Sets the field bit"]
45 #[inline(always)]
46 pub fn set_bit(self) -> &'a mut W {
47 self.bit(true)
48 }
49 #[doc = r"Clears the field bit"]
50 #[inline(always)]
51 pub fn clear_bit(self) -> &'a mut W {
52 self.bit(false)
53 }
54 #[doc = r"Writes raw bits to the field"]
55 #[inline(always)]
56 pub fn bit(self, value: bool) -> &'a mut W {
57 self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u16) & 0x01) << 1);
58 self.w
59 }
60}
61#[doc = "Reader of field `PDEN`"]
62pub type PDEN_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `PDEN`"]
64pub struct PDEN_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> PDEN_W<'a> {
68 #[doc = r"Sets the field bit"]
69 #[inline(always)]
70 pub fn set_bit(self) -> &'a mut W {
71 self.bit(true)
72 }
73 #[doc = r"Clears the field bit"]
74 #[inline(always)]
75 pub fn clear_bit(self) -> &'a mut W {
76 self.bit(false)
77 }
78 #[doc = r"Writes raw bits to the field"]
79 #[inline(always)]
80 pub fn bit(self, value: bool) -> &'a mut W {
81 self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u16) & 0x01) << 2);
82 self.w
83 }
84}
85#[doc = "Reader of field `SDEN`"]
86pub type SDEN_R = crate::R<bool, bool>;
87#[doc = "Write proxy for field `SDEN`"]
88pub struct SDEN_W<'a> {
89 w: &'a mut W,
90}
91impl<'a> SDEN_W<'a> {
92 #[doc = r"Sets the field bit"]
93 #[inline(always)]
94 pub fn set_bit(self) -> &'a mut W {
95 self.bit(true)
96 }
97 #[doc = r"Clears the field bit"]
98 #[inline(always)]
99 pub fn clear_bit(self) -> &'a mut W {
100 self.bit(false)
101 }
102 #[doc = r"Writes raw bits to the field"]
103 #[inline(always)]
104 pub fn bit(self, value: bool) -> &'a mut W {
105 self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u16) & 0x01) << 3);
106 self.w
107 }
108}
109#[doc = "Reader of field `DCDET`"]
110pub type DCDET_R = crate::R<bool, bool>;
111#[doc = "Reader of field `PDET`"]
112pub type PDET_R = crate::R<bool, bool>;
113#[doc = "Reader of field `SDET`"]
114pub type SDET_R = crate::R<bool, bool>;
115#[doc = "Reader of field `PS2DET`"]
116pub type PS2DET_R = crate::R<bool, bool>;
117#[doc = "Reader of field `DPPU`"]
118pub type DPPU_R = crate::R<bool, bool>;
119#[doc = "Write proxy for field `DPPU`"]
120pub struct DPPU_W<'a> {
121 w: &'a mut W,
122}
123impl<'a> DPPU_W<'a> {
124 #[doc = r"Sets the field bit"]
125 #[inline(always)]
126 pub fn set_bit(self) -> &'a mut W {
127 self.bit(true)
128 }
129 #[doc = r"Clears the field bit"]
130 #[inline(always)]
131 pub fn clear_bit(self) -> &'a mut W {
132 self.bit(false)
133 }
134 #[doc = r"Writes raw bits to the field"]
135 #[inline(always)]
136 pub fn bit(self, value: bool) -> &'a mut W {
137 self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u16) & 0x01) << 15);
138 self.w
139 }
140}
141impl R {
142 #[doc = "Bit 0 - Battery charging detector (BCD) enable"]
143 #[inline(always)]
144 pub fn bcden(&self) -> BCDEN_R {
145 BCDEN_R::new((self.bits & 0x01) != 0)
146 }
147 #[doc = "Bit 1 - Data contact detection (DCD) mode enable"]
148 #[inline(always)]
149 pub fn dcden(&self) -> DCDEN_R {
150 DCDEN_R::new(((self.bits >> 1) & 0x01) != 0)
151 }
152 #[doc = "Bit 2 - Primary detection (PD) mode enable"]
153 #[inline(always)]
154 pub fn pden(&self) -> PDEN_R {
155 PDEN_R::new(((self.bits >> 2) & 0x01) != 0)
156 }
157 #[doc = "Bit 3 - Secondary detection (SD) mode enable"]
158 #[inline(always)]
159 pub fn sden(&self) -> SDEN_R {
160 SDEN_R::new(((self.bits >> 3) & 0x01) != 0)
161 }
162 #[doc = "Bit 4 - Data contact detection (DCD) status"]
163 #[inline(always)]
164 pub fn dcdet(&self) -> DCDET_R {
165 DCDET_R::new(((self.bits >> 4) & 0x01) != 0)
166 }
167 #[doc = "Bit 5 - Primary detection (PD) status"]
168 #[inline(always)]
169 pub fn pdet(&self) -> PDET_R {
170 PDET_R::new(((self.bits >> 5) & 0x01) != 0)
171 }
172 #[doc = "Bit 6 - Secondary detection (SD) status"]
173 #[inline(always)]
174 pub fn sdet(&self) -> SDET_R {
175 SDET_R::new(((self.bits >> 6) & 0x01) != 0)
176 }
177 #[doc = "Bit 7 - DM pull-up detection status"]
178 #[inline(always)]
179 pub fn ps2det(&self) -> PS2DET_R {
180 PS2DET_R::new(((self.bits >> 7) & 0x01) != 0)
181 }
182 #[doc = "Bit 15 - DP pull-up control"]
183 #[inline(always)]
184 pub fn dppu(&self) -> DPPU_R {
185 DPPU_R::new(((self.bits >> 15) & 0x01) != 0)
186 }
187}
188impl W {
189 #[doc = "Bit 0 - Battery charging detector (BCD) enable"]
190 #[inline(always)]
191 pub fn bcden(&mut self) -> BCDEN_W {
192 BCDEN_W { w: self }
193 }
194 #[doc = "Bit 1 - Data contact detection (DCD) mode enable"]
195 #[inline(always)]
196 pub fn dcden(&mut self) -> DCDEN_W {
197 DCDEN_W { w: self }
198 }
199 #[doc = "Bit 2 - Primary detection (PD) mode enable"]
200 #[inline(always)]
201 pub fn pden(&mut self) -> PDEN_W {
202 PDEN_W { w: self }
203 }
204 #[doc = "Bit 3 - Secondary detection (SD) mode enable"]
205 #[inline(always)]
206 pub fn sden(&mut self) -> SDEN_W {
207 SDEN_W { w: self }
208 }
209 #[doc = "Bit 15 - DP pull-up control"]
210 #[inline(always)]
211 pub fn dppu(&mut self) -> DPPU_W {
212 DPPU_W { w: self }
213 }
214}