1#[doc = "Register `BCCTRL` reader"]
2pub struct R(crate::R<BCCTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<BCCTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<BCCTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<BCCTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `BCCTRL` writer"]
17pub struct W(crate::W<BCCTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<BCCTRL_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<BCCTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<BCCTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `IDPSRCE` reader - IDPSRC Control"]
38pub type IDPSRCE_R = crate::BitReader<IDPSRCE_A>;
39#[doc = "IDPSRC Control\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum IDPSRCE_A {
42 #[doc = "0: The IDP_SRC circuit is disabled. (Initial value)"]
43 _0 = 0,
44 #[doc = "1: The IDP_SRC circuit is enabled."]
45 _1 = 1,
46}
47impl From<IDPSRCE_A> for bool {
48 #[inline(always)]
49 fn from(variant: IDPSRCE_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl IDPSRCE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> IDPSRCE_A {
57 match self.bits {
58 false => IDPSRCE_A::_0,
59 true => IDPSRCE_A::_1,
60 }
61 }
62 #[doc = "Checks if the value of the field is `_0`"]
63 #[inline(always)]
64 pub fn is_0(&self) -> bool {
65 *self == IDPSRCE_A::_0
66 }
67 #[doc = "Checks if the value of the field is `_1`"]
68 #[inline(always)]
69 pub fn is_1(&self) -> bool {
70 *self == IDPSRCE_A::_1
71 }
72}
73#[doc = "Field `IDPSRCE` writer - IDPSRC Control"]
74pub type IDPSRCE_W<'a, const O: u8> = crate::BitWriter<'a, u16, BCCTRL_SPEC, IDPSRCE_A, O>;
75impl<'a, const O: u8> IDPSRCE_W<'a, O> {
76 #[doc = "The IDP_SRC circuit is disabled. (Initial value)"]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(IDPSRCE_A::_0)
80 }
81 #[doc = "The IDP_SRC circuit is enabled."]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(IDPSRCE_A::_1)
85 }
86}
87#[doc = "Field `IDMSINKE` reader - IDMSINK Control"]
88pub type IDMSINKE_R = crate::BitReader<IDMSINKE_A>;
89#[doc = "IDMSINK Control\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum IDMSINKE_A {
92 #[doc = "0: The IDM_SINK circuit is disabled. (Initial value)"]
93 _0 = 0,
94 #[doc = "1: The IDM_SINK circuit is enabled."]
95 _1 = 1,
96}
97impl From<IDMSINKE_A> for bool {
98 #[inline(always)]
99 fn from(variant: IDMSINKE_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl IDMSINKE_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> IDMSINKE_A {
107 match self.bits {
108 false => IDMSINKE_A::_0,
109 true => IDMSINKE_A::_1,
110 }
111 }
112 #[doc = "Checks if the value of the field is `_0`"]
113 #[inline(always)]
114 pub fn is_0(&self) -> bool {
115 *self == IDMSINKE_A::_0
116 }
117 #[doc = "Checks if the value of the field is `_1`"]
118 #[inline(always)]
119 pub fn is_1(&self) -> bool {
120 *self == IDMSINKE_A::_1
121 }
122}
123#[doc = "Field `IDMSINKE` writer - IDMSINK Control"]
124pub type IDMSINKE_W<'a, const O: u8> = crate::BitWriter<'a, u16, BCCTRL_SPEC, IDMSINKE_A, O>;
125impl<'a, const O: u8> IDMSINKE_W<'a, O> {
126 #[doc = "The IDM_SINK circuit is disabled. (Initial value)"]
127 #[inline(always)]
128 pub fn _0(self) -> &'a mut W {
129 self.variant(IDMSINKE_A::_0)
130 }
131 #[doc = "The IDM_SINK circuit is enabled."]
132 #[inline(always)]
133 pub fn _1(self) -> &'a mut W {
134 self.variant(IDMSINKE_A::_1)
135 }
136}
137#[doc = "Field `VDPSRCE` reader - VDPSRC Control"]
138pub type VDPSRCE_R = crate::BitReader<VDPSRCE_A>;
139#[doc = "VDPSRC Control\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum VDPSRCE_A {
142 #[doc = "0: The VDP_SRC circuit is disabled. (Initial value)"]
143 _0 = 0,
144 #[doc = "1: The VDP_SRC circuit is enabled."]
145 _1 = 1,
146}
147impl From<VDPSRCE_A> for bool {
148 #[inline(always)]
149 fn from(variant: VDPSRCE_A) -> Self {
150 variant as u8 != 0
151 }
152}
153impl VDPSRCE_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> VDPSRCE_A {
157 match self.bits {
158 false => VDPSRCE_A::_0,
159 true => VDPSRCE_A::_1,
160 }
161 }
162 #[doc = "Checks if the value of the field is `_0`"]
163 #[inline(always)]
164 pub fn is_0(&self) -> bool {
165 *self == VDPSRCE_A::_0
166 }
167 #[doc = "Checks if the value of the field is `_1`"]
168 #[inline(always)]
169 pub fn is_1(&self) -> bool {
170 *self == VDPSRCE_A::_1
171 }
172}
173#[doc = "Field `VDPSRCE` writer - VDPSRC Control"]
174pub type VDPSRCE_W<'a, const O: u8> = crate::BitWriter<'a, u16, BCCTRL_SPEC, VDPSRCE_A, O>;
175impl<'a, const O: u8> VDPSRCE_W<'a, O> {
176 #[doc = "The VDP_SRC circuit is disabled. (Initial value)"]
177 #[inline(always)]
178 pub fn _0(self) -> &'a mut W {
179 self.variant(VDPSRCE_A::_0)
180 }
181 #[doc = "The VDP_SRC circuit is enabled."]
182 #[inline(always)]
183 pub fn _1(self) -> &'a mut W {
184 self.variant(VDPSRCE_A::_1)
185 }
186}
187#[doc = "Field `IDPSINKE` reader - IDPSINK Control"]
188pub type IDPSINKE_R = crate::BitReader<IDPSINKE_A>;
189#[doc = "IDPSINK Control\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum IDPSINKE_A {
192 #[doc = "0: The IDP_SINK circuit is disabled. (Initial value)"]
193 _0 = 0,
194 #[doc = "1: The IDP_SINK circuit is enabled."]
195 _1 = 1,
196}
197impl From<IDPSINKE_A> for bool {
198 #[inline(always)]
199 fn from(variant: IDPSINKE_A) -> Self {
200 variant as u8 != 0
201 }
202}
203impl IDPSINKE_R {
204 #[doc = "Get enumerated values variant"]
205 #[inline(always)]
206 pub fn variant(&self) -> IDPSINKE_A {
207 match self.bits {
208 false => IDPSINKE_A::_0,
209 true => IDPSINKE_A::_1,
210 }
211 }
212 #[doc = "Checks if the value of the field is `_0`"]
213 #[inline(always)]
214 pub fn is_0(&self) -> bool {
215 *self == IDPSINKE_A::_0
216 }
217 #[doc = "Checks if the value of the field is `_1`"]
218 #[inline(always)]
219 pub fn is_1(&self) -> bool {
220 *self == IDPSINKE_A::_1
221 }
222}
223#[doc = "Field `IDPSINKE` writer - IDPSINK Control"]
224pub type IDPSINKE_W<'a, const O: u8> = crate::BitWriter<'a, u16, BCCTRL_SPEC, IDPSINKE_A, O>;
225impl<'a, const O: u8> IDPSINKE_W<'a, O> {
226 #[doc = "The IDP_SINK circuit is disabled. (Initial value)"]
227 #[inline(always)]
228 pub fn _0(self) -> &'a mut W {
229 self.variant(IDPSINKE_A::_0)
230 }
231 #[doc = "The IDP_SINK circuit is enabled."]
232 #[inline(always)]
233 pub fn _1(self) -> &'a mut W {
234 self.variant(IDPSINKE_A::_1)
235 }
236}
237#[doc = "Field `VDMSRCE` reader - VDMSRC Control"]
238pub type VDMSRCE_R = crate::BitReader<VDMSRCE_A>;
239#[doc = "VDMSRC Control\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241pub enum VDMSRCE_A {
242 #[doc = "0: The VDM_SRC circuit is disabled. (Initial value)"]
243 _0 = 0,
244 #[doc = "1: The VDM_SRC circuit is enabled."]
245 _1 = 1,
246}
247impl From<VDMSRCE_A> for bool {
248 #[inline(always)]
249 fn from(variant: VDMSRCE_A) -> Self {
250 variant as u8 != 0
251 }
252}
253impl VDMSRCE_R {
254 #[doc = "Get enumerated values variant"]
255 #[inline(always)]
256 pub fn variant(&self) -> VDMSRCE_A {
257 match self.bits {
258 false => VDMSRCE_A::_0,
259 true => VDMSRCE_A::_1,
260 }
261 }
262 #[doc = "Checks if the value of the field is `_0`"]
263 #[inline(always)]
264 pub fn is_0(&self) -> bool {
265 *self == VDMSRCE_A::_0
266 }
267 #[doc = "Checks if the value of the field is `_1`"]
268 #[inline(always)]
269 pub fn is_1(&self) -> bool {
270 *self == VDMSRCE_A::_1
271 }
272}
273#[doc = "Field `VDMSRCE` writer - VDMSRC Control"]
274pub type VDMSRCE_W<'a, const O: u8> = crate::BitWriter<'a, u16, BCCTRL_SPEC, VDMSRCE_A, O>;
275impl<'a, const O: u8> VDMSRCE_W<'a, O> {
276 #[doc = "The VDM_SRC circuit is disabled. (Initial value)"]
277 #[inline(always)]
278 pub fn _0(self) -> &'a mut W {
279 self.variant(VDMSRCE_A::_0)
280 }
281 #[doc = "The VDM_SRC circuit is enabled."]
282 #[inline(always)]
283 pub fn _1(self) -> &'a mut W {
284 self.variant(VDMSRCE_A::_1)
285 }
286}
287#[doc = "Field `DCPMODE` reader - DCP Mode Control"]
288pub type DCPMODE_R = crate::BitReader<DCPMODE_A>;
289#[doc = "DCP Mode Control\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq, Eq)]
291pub enum DCPMODE_A {
292 #[doc = "0: The RDCP_DAT resistor is disabled"]
293 _0 = 0,
294 #[doc = "1: The RDCP_DAT resistor is enabled."]
295 _1 = 1,
296}
297impl From<DCPMODE_A> for bool {
298 #[inline(always)]
299 fn from(variant: DCPMODE_A) -> Self {
300 variant as u8 != 0
301 }
302}
303impl DCPMODE_R {
304 #[doc = "Get enumerated values variant"]
305 #[inline(always)]
306 pub fn variant(&self) -> DCPMODE_A {
307 match self.bits {
308 false => DCPMODE_A::_0,
309 true => DCPMODE_A::_1,
310 }
311 }
312 #[doc = "Checks if the value of the field is `_0`"]
313 #[inline(always)]
314 pub fn is_0(&self) -> bool {
315 *self == DCPMODE_A::_0
316 }
317 #[doc = "Checks if the value of the field is `_1`"]
318 #[inline(always)]
319 pub fn is_1(&self) -> bool {
320 *self == DCPMODE_A::_1
321 }
322}
323#[doc = "Field `DCPMODE` writer - DCP Mode Control"]
324pub type DCPMODE_W<'a, const O: u8> = crate::BitWriter<'a, u16, BCCTRL_SPEC, DCPMODE_A, O>;
325impl<'a, const O: u8> DCPMODE_W<'a, O> {
326 #[doc = "The RDCP_DAT resistor is disabled"]
327 #[inline(always)]
328 pub fn _0(self) -> &'a mut W {
329 self.variant(DCPMODE_A::_0)
330 }
331 #[doc = "The RDCP_DAT resistor is enabled."]
332 #[inline(always)]
333 pub fn _1(self) -> &'a mut W {
334 self.variant(DCPMODE_A::_1)
335 }
336}
337#[doc = "Field `CHGDETSTS` reader - CHGDET Status"]
338pub type CHGDETSTS_R = crate::BitReader<CHGDETSTS_A>;
339#[doc = "CHGDET Status\n\nValue on reset: 0"]
340#[derive(Clone, Copy, Debug, PartialEq, Eq)]
341pub enum CHGDETSTS_A {
342 #[doc = "0: The CHGDET pin is at low level."]
343 _0 = 0,
344 #[doc = "1: The CHGDET pin is at high level."]
345 _1 = 1,
346}
347impl From<CHGDETSTS_A> for bool {
348 #[inline(always)]
349 fn from(variant: CHGDETSTS_A) -> Self {
350 variant as u8 != 0
351 }
352}
353impl CHGDETSTS_R {
354 #[doc = "Get enumerated values variant"]
355 #[inline(always)]
356 pub fn variant(&self) -> CHGDETSTS_A {
357 match self.bits {
358 false => CHGDETSTS_A::_0,
359 true => CHGDETSTS_A::_1,
360 }
361 }
362 #[doc = "Checks if the value of the field is `_0`"]
363 #[inline(always)]
364 pub fn is_0(&self) -> bool {
365 *self == CHGDETSTS_A::_0
366 }
367 #[doc = "Checks if the value of the field is `_1`"]
368 #[inline(always)]
369 pub fn is_1(&self) -> bool {
370 *self == CHGDETSTS_A::_1
371 }
372}
373#[doc = "Field `PDDETSTS` reader - PDDET Status"]
374pub type PDDETSTS_R = crate::BitReader<PDDETSTS_A>;
375#[doc = "PDDET Status\n\nValue on reset: 0"]
376#[derive(Clone, Copy, Debug, PartialEq, Eq)]
377pub enum PDDETSTS_A {
378 #[doc = "0: The PDDET pin is at low level."]
379 _0 = 0,
380 #[doc = "1: The PDDET pin is at high level."]
381 _1 = 1,
382}
383impl From<PDDETSTS_A> for bool {
384 #[inline(always)]
385 fn from(variant: PDDETSTS_A) -> Self {
386 variant as u8 != 0
387 }
388}
389impl PDDETSTS_R {
390 #[doc = "Get enumerated values variant"]
391 #[inline(always)]
392 pub fn variant(&self) -> PDDETSTS_A {
393 match self.bits {
394 false => PDDETSTS_A::_0,
395 true => PDDETSTS_A::_1,
396 }
397 }
398 #[doc = "Checks if the value of the field is `_0`"]
399 #[inline(always)]
400 pub fn is_0(&self) -> bool {
401 *self == PDDETSTS_A::_0
402 }
403 #[doc = "Checks if the value of the field is `_1`"]
404 #[inline(always)]
405 pub fn is_1(&self) -> bool {
406 *self == PDDETSTS_A::_1
407 }
408}
409impl R {
410 #[doc = "Bit 0 - IDPSRC Control"]
411 #[inline(always)]
412 pub fn idpsrce(&self) -> IDPSRCE_R {
413 IDPSRCE_R::new((self.bits & 1) != 0)
414 }
415 #[doc = "Bit 1 - IDMSINK Control"]
416 #[inline(always)]
417 pub fn idmsinke(&self) -> IDMSINKE_R {
418 IDMSINKE_R::new(((self.bits >> 1) & 1) != 0)
419 }
420 #[doc = "Bit 2 - VDPSRC Control"]
421 #[inline(always)]
422 pub fn vdpsrce(&self) -> VDPSRCE_R {
423 VDPSRCE_R::new(((self.bits >> 2) & 1) != 0)
424 }
425 #[doc = "Bit 3 - IDPSINK Control"]
426 #[inline(always)]
427 pub fn idpsinke(&self) -> IDPSINKE_R {
428 IDPSINKE_R::new(((self.bits >> 3) & 1) != 0)
429 }
430 #[doc = "Bit 4 - VDMSRC Control"]
431 #[inline(always)]
432 pub fn vdmsrce(&self) -> VDMSRCE_R {
433 VDMSRCE_R::new(((self.bits >> 4) & 1) != 0)
434 }
435 #[doc = "Bit 5 - DCP Mode Control"]
436 #[inline(always)]
437 pub fn dcpmode(&self) -> DCPMODE_R {
438 DCPMODE_R::new(((self.bits >> 5) & 1) != 0)
439 }
440 #[doc = "Bit 8 - CHGDET Status"]
441 #[inline(always)]
442 pub fn chgdetsts(&self) -> CHGDETSTS_R {
443 CHGDETSTS_R::new(((self.bits >> 8) & 1) != 0)
444 }
445 #[doc = "Bit 9 - PDDET Status"]
446 #[inline(always)]
447 pub fn pddetsts(&self) -> PDDETSTS_R {
448 PDDETSTS_R::new(((self.bits >> 9) & 1) != 0)
449 }
450}
451impl W {
452 #[doc = "Bit 0 - IDPSRC Control"]
453 #[inline(always)]
454 #[must_use]
455 pub fn idpsrce(&mut self) -> IDPSRCE_W<0> {
456 IDPSRCE_W::new(self)
457 }
458 #[doc = "Bit 1 - IDMSINK Control"]
459 #[inline(always)]
460 #[must_use]
461 pub fn idmsinke(&mut self) -> IDMSINKE_W<1> {
462 IDMSINKE_W::new(self)
463 }
464 #[doc = "Bit 2 - VDPSRC Control"]
465 #[inline(always)]
466 #[must_use]
467 pub fn vdpsrce(&mut self) -> VDPSRCE_W<2> {
468 VDPSRCE_W::new(self)
469 }
470 #[doc = "Bit 3 - IDPSINK Control"]
471 #[inline(always)]
472 #[must_use]
473 pub fn idpsinke(&mut self) -> IDPSINKE_W<3> {
474 IDPSINKE_W::new(self)
475 }
476 #[doc = "Bit 4 - VDMSRC Control"]
477 #[inline(always)]
478 #[must_use]
479 pub fn vdmsrce(&mut self) -> VDMSRCE_W<4> {
480 VDMSRCE_W::new(self)
481 }
482 #[doc = "Bit 5 - DCP Mode Control"]
483 #[inline(always)]
484 #[must_use]
485 pub fn dcpmode(&mut self) -> DCPMODE_W<5> {
486 DCPMODE_W::new(self)
487 }
488 #[doc = "Writes raw bits to the register."]
489 #[inline(always)]
490 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
491 self.0.bits(bits);
492 self
493 }
494}
495#[doc = "Battery Charging Control Register\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 [bcctrl](index.html) module"]
496pub struct BCCTRL_SPEC;
497impl crate::RegisterSpec for BCCTRL_SPEC {
498 type Ux = u16;
499}
500#[doc = "`read()` method returns [bcctrl::R](R) reader structure"]
501impl crate::Readable for BCCTRL_SPEC {
502 type Reader = R;
503}
504#[doc = "`write(|w| ..)` method takes [bcctrl::W](W) writer structure"]
505impl crate::Writable for BCCTRL_SPEC {
506 type Writer = W;
507 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
508 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
509}
510#[doc = "`reset()` method sets BCCTRL to value 0"]
511impl crate::Resettable for BCCTRL_SPEC {
512 const RESET_VALUE: Self::Ux = 0;
513}