stm32l4x2_pac/tim16/
ccer.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::CCER {
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 CC1NPR {
47    bits: bool,
48}
49impl CC1NPR {
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 CC1NER {
68    bits: bool,
69}
70impl CC1NER {
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 CC1PR {
89    bits: bool,
90}
91impl CC1PR {
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 CC1ER {
110    bits: bool,
111}
112impl CC1ER {
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" Proxy"]
130pub struct _CC1NPW<'a> {
131    w: &'a mut W,
132}
133impl<'a> _CC1NPW<'a> {
134    #[doc = r" Sets the field bit"]
135    pub fn set_bit(self) -> &'a mut W {
136        self.bit(true)
137    }
138    #[doc = r" Clears the field bit"]
139    pub fn clear_bit(self) -> &'a mut W {
140        self.bit(false)
141    }
142    #[doc = r" Writes raw bits to the field"]
143    #[inline]
144    pub fn bit(self, value: bool) -> &'a mut W {
145        const MASK: bool = true;
146        const OFFSET: u8 = 3;
147        self.w.bits &= !((MASK as u32) << OFFSET);
148        self.w.bits |= ((value & MASK) as u32) << OFFSET;
149        self.w
150    }
151}
152#[doc = r" Proxy"]
153pub struct _CC1NEW<'a> {
154    w: &'a mut W,
155}
156impl<'a> _CC1NEW<'a> {
157    #[doc = r" Sets the field bit"]
158    pub fn set_bit(self) -> &'a mut W {
159        self.bit(true)
160    }
161    #[doc = r" Clears the field bit"]
162    pub fn clear_bit(self) -> &'a mut W {
163        self.bit(false)
164    }
165    #[doc = r" Writes raw bits to the field"]
166    #[inline]
167    pub fn bit(self, value: bool) -> &'a mut W {
168        const MASK: bool = true;
169        const OFFSET: u8 = 2;
170        self.w.bits &= !((MASK as u32) << OFFSET);
171        self.w.bits |= ((value & MASK) as u32) << OFFSET;
172        self.w
173    }
174}
175#[doc = r" Proxy"]
176pub struct _CC1PW<'a> {
177    w: &'a mut W,
178}
179impl<'a> _CC1PW<'a> {
180    #[doc = r" Sets the field bit"]
181    pub fn set_bit(self) -> &'a mut W {
182        self.bit(true)
183    }
184    #[doc = r" Clears the field bit"]
185    pub fn clear_bit(self) -> &'a mut W {
186        self.bit(false)
187    }
188    #[doc = r" Writes raw bits to the field"]
189    #[inline]
190    pub fn bit(self, value: bool) -> &'a mut W {
191        const MASK: bool = true;
192        const OFFSET: u8 = 1;
193        self.w.bits &= !((MASK as u32) << OFFSET);
194        self.w.bits |= ((value & MASK) as u32) << OFFSET;
195        self.w
196    }
197}
198#[doc = r" Proxy"]
199pub struct _CC1EW<'a> {
200    w: &'a mut W,
201}
202impl<'a> _CC1EW<'a> {
203    #[doc = r" Sets the field bit"]
204    pub fn set_bit(self) -> &'a mut W {
205        self.bit(true)
206    }
207    #[doc = r" Clears the field bit"]
208    pub fn clear_bit(self) -> &'a mut W {
209        self.bit(false)
210    }
211    #[doc = r" Writes raw bits to the field"]
212    #[inline]
213    pub fn bit(self, value: bool) -> &'a mut W {
214        const MASK: bool = true;
215        const OFFSET: u8 = 0;
216        self.w.bits &= !((MASK as u32) << OFFSET);
217        self.w.bits |= ((value & MASK) as u32) << OFFSET;
218        self.w
219    }
220}
221impl R {
222    #[doc = r" Value of the register as raw bits"]
223    #[inline]
224    pub fn bits(&self) -> u32 {
225        self.bits
226    }
227    #[doc = "Bit 3 - Capture/Compare 1 output Polarity"]
228    #[inline]
229    pub fn cc1np(&self) -> CC1NPR {
230        let bits = {
231            const MASK: bool = true;
232            const OFFSET: u8 = 3;
233            ((self.bits >> OFFSET) & MASK as u32) != 0
234        };
235        CC1NPR { bits }
236    }
237    #[doc = "Bit 2 - Capture/Compare 1 complementary output enable"]
238    #[inline]
239    pub fn cc1ne(&self) -> CC1NER {
240        let bits = {
241            const MASK: bool = true;
242            const OFFSET: u8 = 2;
243            ((self.bits >> OFFSET) & MASK as u32) != 0
244        };
245        CC1NER { bits }
246    }
247    #[doc = "Bit 1 - Capture/Compare 1 output Polarity"]
248    #[inline]
249    pub fn cc1p(&self) -> CC1PR {
250        let bits = {
251            const MASK: bool = true;
252            const OFFSET: u8 = 1;
253            ((self.bits >> OFFSET) & MASK as u32) != 0
254        };
255        CC1PR { bits }
256    }
257    #[doc = "Bit 0 - Capture/Compare 1 output enable"]
258    #[inline]
259    pub fn cc1e(&self) -> CC1ER {
260        let bits = {
261            const MASK: bool = true;
262            const OFFSET: u8 = 0;
263            ((self.bits >> OFFSET) & MASK as u32) != 0
264        };
265        CC1ER { bits }
266    }
267}
268impl W {
269    #[doc = r" Reset value of the register"]
270    #[inline]
271    pub fn reset_value() -> W {
272        W { bits: 0 }
273    }
274    #[doc = r" Writes raw bits to the register"]
275    #[inline]
276    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
277        self.bits = bits;
278        self
279    }
280    #[doc = "Bit 3 - Capture/Compare 1 output Polarity"]
281    #[inline]
282    pub fn cc1np(&mut self) -> _CC1NPW {
283        _CC1NPW { w: self }
284    }
285    #[doc = "Bit 2 - Capture/Compare 1 complementary output enable"]
286    #[inline]
287    pub fn cc1ne(&mut self) -> _CC1NEW {
288        _CC1NEW { w: self }
289    }
290    #[doc = "Bit 1 - Capture/Compare 1 output Polarity"]
291    #[inline]
292    pub fn cc1p(&mut self) -> _CC1PW {
293        _CC1PW { w: self }
294    }
295    #[doc = "Bit 0 - Capture/Compare 1 output enable"]
296    #[inline]
297    pub fn cc1e(&mut self) -> _CC1EW {
298        _CC1EW { w: self }
299    }
300}