stm32l4x2_pac/tim6/
dier.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::DIER {
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 = "Possible values of the field `UDE`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum UDER {
48    #[doc = "Update DMA request disabled"]
49    DISABLED,
50    #[doc = "Update DMA request enabled"]
51    ENABLED,
52}
53impl UDER {
54    #[doc = r" Returns `true` if the bit is clear (0)"]
55    #[inline]
56    pub fn bit_is_clear(&self) -> bool {
57        !self.bit()
58    }
59    #[doc = r" Returns `true` if the bit is set (1)"]
60    #[inline]
61    pub fn bit_is_set(&self) -> bool {
62        self.bit()
63    }
64    #[doc = r" Value of the field as raw bits"]
65    #[inline]
66    pub fn bit(&self) -> bool {
67        match *self {
68            UDER::DISABLED => false,
69            UDER::ENABLED => true,
70        }
71    }
72    #[allow(missing_docs)]
73    #[doc(hidden)]
74    #[inline]
75    pub fn _from(value: bool) -> UDER {
76        match value {
77            false => UDER::DISABLED,
78            true => UDER::ENABLED,
79        }
80    }
81    #[doc = "Checks if the value of the field is `DISABLED`"]
82    #[inline]
83    pub fn is_disabled(&self) -> bool {
84        *self == UDER::DISABLED
85    }
86    #[doc = "Checks if the value of the field is `ENABLED`"]
87    #[inline]
88    pub fn is_enabled(&self) -> bool {
89        *self == UDER::ENABLED
90    }
91}
92#[doc = "Possible values of the field `UIE`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum UIER {
95    #[doc = "Update interrupt disabled"]
96    DISABLED,
97    #[doc = "Update interrupt enabled"]
98    ENABLED,
99}
100impl UIER {
101    #[doc = r" Returns `true` if the bit is clear (0)"]
102    #[inline]
103    pub fn bit_is_clear(&self) -> bool {
104        !self.bit()
105    }
106    #[doc = r" Returns `true` if the bit is set (1)"]
107    #[inline]
108    pub fn bit_is_set(&self) -> bool {
109        self.bit()
110    }
111    #[doc = r" Value of the field as raw bits"]
112    #[inline]
113    pub fn bit(&self) -> bool {
114        match *self {
115            UIER::DISABLED => false,
116            UIER::ENABLED => true,
117        }
118    }
119    #[allow(missing_docs)]
120    #[doc(hidden)]
121    #[inline]
122    pub fn _from(value: bool) -> UIER {
123        match value {
124            false => UIER::DISABLED,
125            true => UIER::ENABLED,
126        }
127    }
128    #[doc = "Checks if the value of the field is `DISABLED`"]
129    #[inline]
130    pub fn is_disabled(&self) -> bool {
131        *self == UIER::DISABLED
132    }
133    #[doc = "Checks if the value of the field is `ENABLED`"]
134    #[inline]
135    pub fn is_enabled(&self) -> bool {
136        *self == UIER::ENABLED
137    }
138}
139#[doc = "Values that can be written to the field `UDE`"]
140pub enum UDEW {
141    #[doc = "Update DMA request disabled"]
142    DISABLED,
143    #[doc = "Update DMA request enabled"]
144    ENABLED,
145}
146impl UDEW {
147    #[allow(missing_docs)]
148    #[doc(hidden)]
149    #[inline]
150    pub fn _bits(&self) -> bool {
151        match *self {
152            UDEW::DISABLED => false,
153            UDEW::ENABLED => true,
154        }
155    }
156}
157#[doc = r" Proxy"]
158pub struct _UDEW<'a> {
159    w: &'a mut W,
160}
161impl<'a> _UDEW<'a> {
162    #[doc = r" Writes `variant` to the field"]
163    #[inline]
164    pub fn variant(self, variant: UDEW) -> &'a mut W {
165        {
166            self.bit(variant._bits())
167        }
168    }
169    #[doc = "Update DMA request disabled"]
170    #[inline]
171    pub fn disabled(self) -> &'a mut W {
172        self.variant(UDEW::DISABLED)
173    }
174    #[doc = "Update DMA request enabled"]
175    #[inline]
176    pub fn enabled(self) -> &'a mut W {
177        self.variant(UDEW::ENABLED)
178    }
179    #[doc = r" Sets the field bit"]
180    pub fn set_bit(self) -> &'a mut W {
181        self.bit(true)
182    }
183    #[doc = r" Clears the field bit"]
184    pub fn clear_bit(self) -> &'a mut W {
185        self.bit(false)
186    }
187    #[doc = r" Writes raw bits to the field"]
188    #[inline]
189    pub fn bit(self, value: bool) -> &'a mut W {
190        const MASK: bool = true;
191        const OFFSET: u8 = 8;
192        self.w.bits &= !((MASK as u32) << OFFSET);
193        self.w.bits |= ((value & MASK) as u32) << OFFSET;
194        self.w
195    }
196}
197#[doc = "Values that can be written to the field `UIE`"]
198pub enum UIEW {
199    #[doc = "Update interrupt disabled"]
200    DISABLED,
201    #[doc = "Update interrupt enabled"]
202    ENABLED,
203}
204impl UIEW {
205    #[allow(missing_docs)]
206    #[doc(hidden)]
207    #[inline]
208    pub fn _bits(&self) -> bool {
209        match *self {
210            UIEW::DISABLED => false,
211            UIEW::ENABLED => true,
212        }
213    }
214}
215#[doc = r" Proxy"]
216pub struct _UIEW<'a> {
217    w: &'a mut W,
218}
219impl<'a> _UIEW<'a> {
220    #[doc = r" Writes `variant` to the field"]
221    #[inline]
222    pub fn variant(self, variant: UIEW) -> &'a mut W {
223        {
224            self.bit(variant._bits())
225        }
226    }
227    #[doc = "Update interrupt disabled"]
228    #[inline]
229    pub fn disabled(self) -> &'a mut W {
230        self.variant(UIEW::DISABLED)
231    }
232    #[doc = "Update interrupt enabled"]
233    #[inline]
234    pub fn enabled(self) -> &'a mut W {
235        self.variant(UIEW::ENABLED)
236    }
237    #[doc = r" Sets the field bit"]
238    pub fn set_bit(self) -> &'a mut W {
239        self.bit(true)
240    }
241    #[doc = r" Clears the field bit"]
242    pub fn clear_bit(self) -> &'a mut W {
243        self.bit(false)
244    }
245    #[doc = r" Writes raw bits to the field"]
246    #[inline]
247    pub fn bit(self, value: bool) -> &'a mut W {
248        const MASK: bool = true;
249        const OFFSET: u8 = 0;
250        self.w.bits &= !((MASK as u32) << OFFSET);
251        self.w.bits |= ((value & MASK) as u32) << OFFSET;
252        self.w
253    }
254}
255impl R {
256    #[doc = r" Value of the register as raw bits"]
257    #[inline]
258    pub fn bits(&self) -> u32 {
259        self.bits
260    }
261    #[doc = "Bit 8 - Update DMA request enable"]
262    #[inline]
263    pub fn ude(&self) -> UDER {
264        UDER::_from({
265            const MASK: bool = true;
266            const OFFSET: u8 = 8;
267            ((self.bits >> OFFSET) & MASK as u32) != 0
268        })
269    }
270    #[doc = "Bit 0 - Update interrupt enable"]
271    #[inline]
272    pub fn uie(&self) -> UIER {
273        UIER::_from({
274            const MASK: bool = true;
275            const OFFSET: u8 = 0;
276            ((self.bits >> OFFSET) & MASK as u32) != 0
277        })
278    }
279}
280impl W {
281    #[doc = r" Reset value of the register"]
282    #[inline]
283    pub fn reset_value() -> W {
284        W { bits: 0 }
285    }
286    #[doc = r" Writes raw bits to the register"]
287    #[inline]
288    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
289        self.bits = bits;
290        self
291    }
292    #[doc = "Bit 8 - Update DMA request enable"]
293    #[inline]
294    pub fn ude(&mut self) -> _UDEW {
295        _UDEW { w: self }
296    }
297    #[doc = "Bit 0 - Update interrupt enable"]
298    #[inline]
299    pub fn uie(&mut self) -> _UIEW {
300        _UIEW { w: self }
301    }
302}