stm32l4x2_pac/lptim1/
icr.rs

1#[doc = r" Value to write to the register"]
2pub struct W {
3    bits: u32,
4}
5impl super::ICR {
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 _DOWNCFW<'a> {
19    w: &'a mut W,
20}
21impl<'a> _DOWNCFW<'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 = 6;
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 _UPCFW<'a> {
42    w: &'a mut W,
43}
44impl<'a> _UPCFW<'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 = 5;
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 _ARROKCFW<'a> {
65    w: &'a mut W,
66}
67impl<'a> _ARROKCFW<'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 = 4;
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 _CMPOKCFW<'a> {
88    w: &'a mut W,
89}
90impl<'a> _CMPOKCFW<'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 = 3;
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 _EXTTRIGCFW<'a> {
111    w: &'a mut W,
112}
113impl<'a> _EXTTRIGCFW<'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 = 2;
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 _ARRMCFW<'a> {
134    w: &'a mut W,
135}
136impl<'a> _ARRMCFW<'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 = 1;
150        self.w.bits &= !((MASK as u32) << OFFSET);
151        self.w.bits |= ((value & MASK) as u32) << OFFSET;
152        self.w
153    }
154}
155#[doc = r" Proxy"]
156pub struct _CMPMCFW<'a> {
157    w: &'a mut W,
158}
159impl<'a> _CMPMCFW<'a> {
160    #[doc = r" Sets the field bit"]
161    pub fn set_bit(self) -> &'a mut W {
162        self.bit(true)
163    }
164    #[doc = r" Clears the field bit"]
165    pub fn clear_bit(self) -> &'a mut W {
166        self.bit(false)
167    }
168    #[doc = r" Writes raw bits to the field"]
169    #[inline]
170    pub fn bit(self, value: bool) -> &'a mut W {
171        const MASK: bool = true;
172        const OFFSET: u8 = 0;
173        self.w.bits &= !((MASK as u32) << OFFSET);
174        self.w.bits |= ((value & MASK) as u32) << OFFSET;
175        self.w
176    }
177}
178impl W {
179    #[doc = r" Reset value of the register"]
180    #[inline]
181    pub fn reset_value() -> W {
182        W { bits: 0 }
183    }
184    #[doc = r" Writes raw bits to the register"]
185    #[inline]
186    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
187        self.bits = bits;
188        self
189    }
190    #[doc = "Bit 6 - Direction change to down Clear Flag"]
191    #[inline]
192    pub fn downcf(&mut self) -> _DOWNCFW {
193        _DOWNCFW { w: self }
194    }
195    #[doc = "Bit 5 - Direction change to UP Clear Flag"]
196    #[inline]
197    pub fn upcf(&mut self) -> _UPCFW {
198        _UPCFW { w: self }
199    }
200    #[doc = "Bit 4 - Autoreload register update OK Clear Flag"]
201    #[inline]
202    pub fn arrokcf(&mut self) -> _ARROKCFW {
203        _ARROKCFW { w: self }
204    }
205    #[doc = "Bit 3 - Compare register update OK Clear Flag"]
206    #[inline]
207    pub fn cmpokcf(&mut self) -> _CMPOKCFW {
208        _CMPOKCFW { w: self }
209    }
210    #[doc = "Bit 2 - External trigger valid edge Clear Flag"]
211    #[inline]
212    pub fn exttrigcf(&mut self) -> _EXTTRIGCFW {
213        _EXTTRIGCFW { w: self }
214    }
215    #[doc = "Bit 1 - Autoreload match Clear Flag"]
216    #[inline]
217    pub fn arrmcf(&mut self) -> _ARRMCFW {
218        _ARRMCFW { w: self }
219    }
220    #[doc = "Bit 0 - compare match Clear Flag"]
221    #[inline]
222    pub fn cmpmcf(&mut self) -> _CMPMCFW {
223        _CMPMCFW { w: self }
224    }
225}