1#[doc = "Reader of register CR2"]
2pub type R = crate::R<u32, super::CR2>;
3#[doc = "Writer for register CR2"]
4pub type W = crate::W<u32, super::CR2>;
5#[doc = "Register CR2 `reset()`'s with value 0"]
6impl crate::ResetValue for super::CR2 {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `USV`"]
14pub type USV_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `USV`"]
16pub struct USV_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> USV_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 << 10)) | (((value as u32) & 0x01) << 10);
34 self.w
35 }
36}
37#[doc = "Reader of field `PVME3`"]
38pub type PVME3_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `PVME3`"]
40pub struct PVME3_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> PVME3_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 << 6)) | (((value as u32) & 0x01) << 6);
58 self.w
59 }
60}
61#[doc = "Reader of field `PVME1`"]
62pub type PVME1_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `PVME1`"]
64pub struct PVME1_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> PVME1_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 << 4)) | (((value as u32) & 0x01) << 4);
82 self.w
83 }
84}
85#[doc = "Reader of field `PLS`"]
86pub type PLS_R = crate::R<u8, u8>;
87#[doc = "Write proxy for field `PLS`"]
88pub struct PLS_W<'a> {
89 w: &'a mut W,
90}
91impl<'a> PLS_W<'a> {
92 #[doc = r"Writes raw bits to the field"]
93 #[inline(always)]
94 pub unsafe fn bits(self, value: u8) -> &'a mut W {
95 self.w.bits = (self.w.bits & !(0x07 << 1)) | (((value as u32) & 0x07) << 1);
96 self.w
97 }
98}
99#[doc = "Reader of field `PVDE`"]
100pub type PVDE_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `PVDE`"]
102pub struct PVDE_W<'a> {
103 w: &'a mut W,
104}
105impl<'a> PVDE_W<'a> {
106 #[doc = r"Sets the field bit"]
107 #[inline(always)]
108 pub fn set_bit(self) -> &'a mut W {
109 self.bit(true)
110 }
111 #[doc = r"Clears the field bit"]
112 #[inline(always)]
113 pub fn clear_bit(self) -> &'a mut W {
114 self.bit(false)
115 }
116 #[doc = r"Writes raw bits to the field"]
117 #[inline(always)]
118 pub fn bit(self, value: bool) -> &'a mut W {
119 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
120 self.w
121 }
122}
123impl R {
124 #[doc = "Bit 10 - VDDUSB USB supply valid"]
125 #[inline(always)]
126 pub fn usv(&self) -> USV_R {
127 USV_R::new(((self.bits >> 10) & 0x01) != 0)
128 }
129 #[doc = "Bit 6 - Peripheral voltage monitoring 3 enable: VDDA vs. 1.62V"]
130 #[inline(always)]
131 pub fn pvme3(&self) -> PVME3_R {
132 PVME3_R::new(((self.bits >> 6) & 0x01) != 0)
133 }
134 #[doc = "Bit 4 - Peripheral voltage monitoring 1 enable: VDDUSB vs. 1.2V"]
135 #[inline(always)]
136 pub fn pvme1(&self) -> PVME1_R {
137 PVME1_R::new(((self.bits >> 4) & 0x01) != 0)
138 }
139 #[doc = "Bits 1:3 - Power voltage detector level selection"]
140 #[inline(always)]
141 pub fn pls(&self) -> PLS_R {
142 PLS_R::new(((self.bits >> 1) & 0x07) as u8)
143 }
144 #[doc = "Bit 0 - Power voltage detector enable"]
145 #[inline(always)]
146 pub fn pvde(&self) -> PVDE_R {
147 PVDE_R::new((self.bits & 0x01) != 0)
148 }
149}
150impl W {
151 #[doc = "Bit 10 - VDDUSB USB supply valid"]
152 #[inline(always)]
153 pub fn usv(&mut self) -> USV_W {
154 USV_W { w: self }
155 }
156 #[doc = "Bit 6 - Peripheral voltage monitoring 3 enable: VDDA vs. 1.62V"]
157 #[inline(always)]
158 pub fn pvme3(&mut self) -> PVME3_W {
159 PVME3_W { w: self }
160 }
161 #[doc = "Bit 4 - Peripheral voltage monitoring 1 enable: VDDUSB vs. 1.2V"]
162 #[inline(always)]
163 pub fn pvme1(&mut self) -> PVME1_W {
164 PVME1_W { w: self }
165 }
166 #[doc = "Bits 1:3 - Power voltage detector level selection"]
167 #[inline(always)]
168 pub fn pls(&mut self) -> PLS_W {
169 PLS_W { w: self }
170 }
171 #[doc = "Bit 0 - Power voltage detector enable"]
172 #[inline(always)]
173 pub fn pvde(&mut self) -> PVDE_W {
174 PVDE_W { w: self }
175 }
176}