stm32l4x2_pac/dac1/
sr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::SR {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = r" Value of the field"]
46pub struct DMAUDR1R {
47    bits: bool,
48}
49impl DMAUDR1R {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bit(&self) -> bool {
53        self.bits
54    }
55    #[doc = r" Returns `true` if the bit is clear (0)"]
56    #[inline]
57    pub fn bit_is_clear(&self) -> bool {
58        !self.bit()
59    }
60    #[doc = r" Returns `true` if the bit is set (1)"]
61    #[inline]
62    pub fn bit_is_set(&self) -> bool {
63        self.bit()
64    }
65}
66#[doc = r" Value of the field"]
67pub struct CAL_FLAG1R {
68    bits: bool,
69}
70impl CAL_FLAG1R {
71    #[doc = r" Value of the field as raw bits"]
72    #[inline]
73    pub fn bit(&self) -> bool {
74        self.bits
75    }
76    #[doc = r" Returns `true` if the bit is clear (0)"]
77    #[inline]
78    pub fn bit_is_clear(&self) -> bool {
79        !self.bit()
80    }
81    #[doc = r" Returns `true` if the bit is set (1)"]
82    #[inline]
83    pub fn bit_is_set(&self) -> bool {
84        self.bit()
85    }
86}
87#[doc = r" Value of the field"]
88pub struct BWST1R {
89    bits: bool,
90}
91impl BWST1R {
92    #[doc = r" Value of the field as raw bits"]
93    #[inline]
94    pub fn bit(&self) -> bool {
95        self.bits
96    }
97    #[doc = r" Returns `true` if the bit is clear (0)"]
98    #[inline]
99    pub fn bit_is_clear(&self) -> bool {
100        !self.bit()
101    }
102    #[doc = r" Returns `true` if the bit is set (1)"]
103    #[inline]
104    pub fn bit_is_set(&self) -> bool {
105        self.bit()
106    }
107}
108#[doc = r" Value of the field"]
109pub struct DMAUDR2R {
110    bits: bool,
111}
112impl DMAUDR2R {
113    #[doc = r" Value of the field as raw bits"]
114    #[inline]
115    pub fn bit(&self) -> bool {
116        self.bits
117    }
118    #[doc = r" Returns `true` if the bit is clear (0)"]
119    #[inline]
120    pub fn bit_is_clear(&self) -> bool {
121        !self.bit()
122    }
123    #[doc = r" Returns `true` if the bit is set (1)"]
124    #[inline]
125    pub fn bit_is_set(&self) -> bool {
126        self.bit()
127    }
128}
129#[doc = r" Value of the field"]
130pub struct CAL_FLAG2R {
131    bits: bool,
132}
133impl CAL_FLAG2R {
134    #[doc = r" Value of the field as raw bits"]
135    #[inline]
136    pub fn bit(&self) -> bool {
137        self.bits
138    }
139    #[doc = r" Returns `true` if the bit is clear (0)"]
140    #[inline]
141    pub fn bit_is_clear(&self) -> bool {
142        !self.bit()
143    }
144    #[doc = r" Returns `true` if the bit is set (1)"]
145    #[inline]
146    pub fn bit_is_set(&self) -> bool {
147        self.bit()
148    }
149}
150#[doc = r" Value of the field"]
151pub struct BWST2R {
152    bits: bool,
153}
154impl BWST2R {
155    #[doc = r" Value of the field as raw bits"]
156    #[inline]
157    pub fn bit(&self) -> bool {
158        self.bits
159    }
160    #[doc = r" Returns `true` if the bit is clear (0)"]
161    #[inline]
162    pub fn bit_is_clear(&self) -> bool {
163        !self.bit()
164    }
165    #[doc = r" Returns `true` if the bit is set (1)"]
166    #[inline]
167    pub fn bit_is_set(&self) -> bool {
168        self.bit()
169    }
170}
171#[doc = r" Proxy"]
172pub struct _DMAUDR1W<'a> {
173    w: &'a mut W,
174}
175impl<'a> _DMAUDR1W<'a> {
176    #[doc = r" Sets the field bit"]
177    pub fn set_bit(self) -> &'a mut W {
178        self.bit(true)
179    }
180    #[doc = r" Clears the field bit"]
181    pub fn clear_bit(self) -> &'a mut W {
182        self.bit(false)
183    }
184    #[doc = r" Writes raw bits to the field"]
185    #[inline]
186    pub fn bit(self, value: bool) -> &'a mut W {
187        const MASK: bool = true;
188        const OFFSET: u8 = 13;
189        self.w.bits &= !((MASK as u32) << OFFSET);
190        self.w.bits |= ((value & MASK) as u32) << OFFSET;
191        self.w
192    }
193}
194#[doc = r" Proxy"]
195pub struct _DMAUDR2W<'a> {
196    w: &'a mut W,
197}
198impl<'a> _DMAUDR2W<'a> {
199    #[doc = r" Sets the field bit"]
200    pub fn set_bit(self) -> &'a mut W {
201        self.bit(true)
202    }
203    #[doc = r" Clears the field bit"]
204    pub fn clear_bit(self) -> &'a mut W {
205        self.bit(false)
206    }
207    #[doc = r" Writes raw bits to the field"]
208    #[inline]
209    pub fn bit(self, value: bool) -> &'a mut W {
210        const MASK: bool = true;
211        const OFFSET: u8 = 29;
212        self.w.bits &= !((MASK as u32) << OFFSET);
213        self.w.bits |= ((value & MASK) as u32) << OFFSET;
214        self.w
215    }
216}
217impl R {
218    #[doc = r" Value of the register as raw bits"]
219    #[inline]
220    pub fn bits(&self) -> u32 {
221        self.bits
222    }
223    #[doc = "Bit 13 - DAC channel1 DMA underrun flag"]
224    #[inline]
225    pub fn dmaudr1(&self) -> DMAUDR1R {
226        let bits = {
227            const MASK: bool = true;
228            const OFFSET: u8 = 13;
229            ((self.bits >> OFFSET) & MASK as u32) != 0
230        };
231        DMAUDR1R { bits }
232    }
233    #[doc = "Bit 14 - DAC Channel 1 calibration offset status"]
234    #[inline]
235    pub fn cal_flag1(&self) -> CAL_FLAG1R {
236        let bits = {
237            const MASK: bool = true;
238            const OFFSET: u8 = 14;
239            ((self.bits >> OFFSET) & MASK as u32) != 0
240        };
241        CAL_FLAG1R { bits }
242    }
243    #[doc = "Bit 15 - DAC Channel 1 busy writing sample time flag"]
244    #[inline]
245    pub fn bwst1(&self) -> BWST1R {
246        let bits = {
247            const MASK: bool = true;
248            const OFFSET: u8 = 15;
249            ((self.bits >> OFFSET) & MASK as u32) != 0
250        };
251        BWST1R { bits }
252    }
253    #[doc = "Bit 29 - DAC channel2 DMA underrun flag"]
254    #[inline]
255    pub fn dmaudr2(&self) -> DMAUDR2R {
256        let bits = {
257            const MASK: bool = true;
258            const OFFSET: u8 = 29;
259            ((self.bits >> OFFSET) & MASK as u32) != 0
260        };
261        DMAUDR2R { bits }
262    }
263    #[doc = "Bit 30 - DAC Channel 2 calibration offset status"]
264    #[inline]
265    pub fn cal_flag2(&self) -> CAL_FLAG2R {
266        let bits = {
267            const MASK: bool = true;
268            const OFFSET: u8 = 30;
269            ((self.bits >> OFFSET) & MASK as u32) != 0
270        };
271        CAL_FLAG2R { bits }
272    }
273    #[doc = "Bit 31 - DAC Channel 2 busy writing sample time flag"]
274    #[inline]
275    pub fn bwst2(&self) -> BWST2R {
276        let bits = {
277            const MASK: bool = true;
278            const OFFSET: u8 = 31;
279            ((self.bits >> OFFSET) & MASK as u32) != 0
280        };
281        BWST2R { bits }
282    }
283}
284impl W {
285    #[doc = r" Reset value of the register"]
286    #[inline]
287    pub fn reset_value() -> W {
288        W { bits: 0 }
289    }
290    #[doc = r" Writes raw bits to the register"]
291    #[inline]
292    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
293        self.bits = bits;
294        self
295    }
296    #[doc = "Bit 13 - DAC channel1 DMA underrun flag"]
297    #[inline]
298    pub fn dmaudr1(&mut self) -> _DMAUDR1W {
299        _DMAUDR1W { w: self }
300    }
301    #[doc = "Bit 29 - DAC channel2 DMA underrun flag"]
302    #[inline]
303    pub fn dmaudr2(&mut self) -> _DMAUDR2W {
304        _DMAUDR2W { w: self }
305    }
306}