stm32l4x2_pac/pwr/
scr.rs

1#[doc = r" Value to write to the register"]
2pub struct W {
3    bits: u32,
4}
5impl super::SCR {
6    #[doc = r" Writes to the register"]
7    #[inline]
8    pub fn write<F>(&self, f: F)
9    where
10        F: FnOnce(&mut W) -> &mut W,
11    {
12        let mut w = W::reset_value();
13        f(&mut w);
14        self.register.set(w.bits);
15    }
16}
17#[doc = r" Proxy"]
18pub struct _SBFW<'a> {
19    w: &'a mut W,
20}
21impl<'a> _SBFW<'a> {
22    #[doc = r" Sets the field bit"]
23    pub fn set_bit(self) -> &'a mut W {
24        self.bit(true)
25    }
26    #[doc = r" Clears the field bit"]
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]
32    pub fn bit(self, value: bool) -> &'a mut W {
33        const MASK: bool = true;
34        const OFFSET: u8 = 8;
35        self.w.bits &= !((MASK as u32) << OFFSET);
36        self.w.bits |= ((value & MASK) as u32) << OFFSET;
37        self.w
38    }
39}
40#[doc = r" Proxy"]
41pub struct _WUF5W<'a> {
42    w: &'a mut W,
43}
44impl<'a> _WUF5W<'a> {
45    #[doc = r" Sets the field bit"]
46    pub fn set_bit(self) -> &'a mut W {
47        self.bit(true)
48    }
49    #[doc = r" Clears the field bit"]
50    pub fn clear_bit(self) -> &'a mut W {
51        self.bit(false)
52    }
53    #[doc = r" Writes raw bits to the field"]
54    #[inline]
55    pub fn bit(self, value: bool) -> &'a mut W {
56        const MASK: bool = true;
57        const OFFSET: u8 = 4;
58        self.w.bits &= !((MASK as u32) << OFFSET);
59        self.w.bits |= ((value & MASK) as u32) << OFFSET;
60        self.w
61    }
62}
63#[doc = r" Proxy"]
64pub struct _WUF4W<'a> {
65    w: &'a mut W,
66}
67impl<'a> _WUF4W<'a> {
68    #[doc = r" Sets the field bit"]
69    pub fn set_bit(self) -> &'a mut W {
70        self.bit(true)
71    }
72    #[doc = r" Clears the field bit"]
73    pub fn clear_bit(self) -> &'a mut W {
74        self.bit(false)
75    }
76    #[doc = r" Writes raw bits to the field"]
77    #[inline]
78    pub fn bit(self, value: bool) -> &'a mut W {
79        const MASK: bool = true;
80        const OFFSET: u8 = 3;
81        self.w.bits &= !((MASK as u32) << OFFSET);
82        self.w.bits |= ((value & MASK) as u32) << OFFSET;
83        self.w
84    }
85}
86#[doc = r" Proxy"]
87pub struct _WUF3W<'a> {
88    w: &'a mut W,
89}
90impl<'a> _WUF3W<'a> {
91    #[doc = r" Sets the field bit"]
92    pub fn set_bit(self) -> &'a mut W {
93        self.bit(true)
94    }
95    #[doc = r" Clears the field bit"]
96    pub fn clear_bit(self) -> &'a mut W {
97        self.bit(false)
98    }
99    #[doc = r" Writes raw bits to the field"]
100    #[inline]
101    pub fn bit(self, value: bool) -> &'a mut W {
102        const MASK: bool = true;
103        const OFFSET: u8 = 2;
104        self.w.bits &= !((MASK as u32) << OFFSET);
105        self.w.bits |= ((value & MASK) as u32) << OFFSET;
106        self.w
107    }
108}
109#[doc = r" Proxy"]
110pub struct _WUF2W<'a> {
111    w: &'a mut W,
112}
113impl<'a> _WUF2W<'a> {
114    #[doc = r" Sets the field bit"]
115    pub fn set_bit(self) -> &'a mut W {
116        self.bit(true)
117    }
118    #[doc = r" Clears the field bit"]
119    pub fn clear_bit(self) -> &'a mut W {
120        self.bit(false)
121    }
122    #[doc = r" Writes raw bits to the field"]
123    #[inline]
124    pub fn bit(self, value: bool) -> &'a mut W {
125        const MASK: bool = true;
126        const OFFSET: u8 = 1;
127        self.w.bits &= !((MASK as u32) << OFFSET);
128        self.w.bits |= ((value & MASK) as u32) << OFFSET;
129        self.w
130    }
131}
132#[doc = r" Proxy"]
133pub struct _WUF1W<'a> {
134    w: &'a mut W,
135}
136impl<'a> _WUF1W<'a> {
137    #[doc = r" Sets the field bit"]
138    pub fn set_bit(self) -> &'a mut W {
139        self.bit(true)
140    }
141    #[doc = r" Clears the field bit"]
142    pub fn clear_bit(self) -> &'a mut W {
143        self.bit(false)
144    }
145    #[doc = r" Writes raw bits to the field"]
146    #[inline]
147    pub fn bit(self, value: bool) -> &'a mut W {
148        const MASK: bool = true;
149        const OFFSET: u8 = 0;
150        self.w.bits &= !((MASK as u32) << OFFSET);
151        self.w.bits |= ((value & MASK) as u32) << OFFSET;
152        self.w
153    }
154}
155impl W {
156    #[doc = r" Reset value of the register"]
157    #[inline]
158    pub fn reset_value() -> W {
159        W { bits: 0 }
160    }
161    #[doc = r" Writes raw bits to the register"]
162    #[inline]
163    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
164        self.bits = bits;
165        self
166    }
167    #[doc = "Bit 8 - Clear standby flag"]
168    #[inline]
169    pub fn sbf(&mut self) -> _SBFW {
170        _SBFW { w: self }
171    }
172    #[doc = "Bit 4 - Clear wakeup flag 5"]
173    #[inline]
174    pub fn wuf5(&mut self) -> _WUF5W {
175        _WUF5W { w: self }
176    }
177    #[doc = "Bit 3 - Clear wakeup flag 4"]
178    #[inline]
179    pub fn wuf4(&mut self) -> _WUF4W {
180        _WUF4W { w: self }
181    }
182    #[doc = "Bit 2 - Clear wakeup flag 3"]
183    #[inline]
184    pub fn wuf3(&mut self) -> _WUF3W {
185        _WUF3W { w: self }
186    }
187    #[doc = "Bit 1 - Clear wakeup flag 2"]
188    #[inline]
189    pub fn wuf2(&mut self) -> _WUF2W {
190        _WUF2W { w: self }
191    }
192    #[doc = "Bit 0 - Clear wakeup flag 1"]
193    #[inline]
194    pub fn wuf1(&mut self) -> _WUF1W {
195        _WUF1W { w: self }
196    }
197}