stm32l4x6/tim8/
ccr5.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::CCR5 {
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 CCR5R {
47    bits: u16,
48}
49impl CCR5R {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bits(&self) -> u16 {
53        self.bits
54    }
55}
56#[doc = r" Value of the field"]
57pub struct GC5C1R {
58    bits: bool,
59}
60impl GC5C1R {
61    #[doc = r" Value of the field as raw bits"]
62    #[inline]
63    pub fn bit(&self) -> bool {
64        self.bits
65    }
66    #[doc = r" Returns `true` if the bit is clear (0)"]
67    #[inline]
68    pub fn bit_is_clear(&self) -> bool {
69        !self.bit()
70    }
71    #[doc = r" Returns `true` if the bit is set (1)"]
72    #[inline]
73    pub fn bit_is_set(&self) -> bool {
74        self.bit()
75    }
76}
77#[doc = r" Value of the field"]
78pub struct GC5C2R {
79    bits: bool,
80}
81impl GC5C2R {
82    #[doc = r" Value of the field as raw bits"]
83    #[inline]
84    pub fn bit(&self) -> bool {
85        self.bits
86    }
87    #[doc = r" Returns `true` if the bit is clear (0)"]
88    #[inline]
89    pub fn bit_is_clear(&self) -> bool {
90        !self.bit()
91    }
92    #[doc = r" Returns `true` if the bit is set (1)"]
93    #[inline]
94    pub fn bit_is_set(&self) -> bool {
95        self.bit()
96    }
97}
98#[doc = r" Value of the field"]
99pub struct GC5C3R {
100    bits: bool,
101}
102impl GC5C3R {
103    #[doc = r" Value of the field as raw bits"]
104    #[inline]
105    pub fn bit(&self) -> bool {
106        self.bits
107    }
108    #[doc = r" Returns `true` if the bit is clear (0)"]
109    #[inline]
110    pub fn bit_is_clear(&self) -> bool {
111        !self.bit()
112    }
113    #[doc = r" Returns `true` if the bit is set (1)"]
114    #[inline]
115    pub fn bit_is_set(&self) -> bool {
116        self.bit()
117    }
118}
119#[doc = r" Proxy"]
120pub struct _CCR5W<'a> {
121    w: &'a mut W,
122}
123impl<'a> _CCR5W<'a> {
124    #[doc = r" Writes raw bits to the field"]
125    #[inline]
126    pub unsafe fn bits(self, value: u16) -> &'a mut W {
127        const MASK: u16 = 65535;
128        const OFFSET: u8 = 0;
129        self.w.bits &= !((MASK as u32) << OFFSET);
130        self.w.bits |= ((value & MASK) as u32) << OFFSET;
131        self.w
132    }
133}
134#[doc = r" Proxy"]
135pub struct _GC5C1W<'a> {
136    w: &'a mut W,
137}
138impl<'a> _GC5C1W<'a> {
139    #[doc = r" Sets the field bit"]
140    pub fn set_bit(self) -> &'a mut W {
141        self.bit(true)
142    }
143    #[doc = r" Clears the field bit"]
144    pub fn clear_bit(self) -> &'a mut W {
145        self.bit(false)
146    }
147    #[doc = r" Writes raw bits to the field"]
148    #[inline]
149    pub fn bit(self, value: bool) -> &'a mut W {
150        const MASK: bool = true;
151        const OFFSET: u8 = 29;
152        self.w.bits &= !((MASK as u32) << OFFSET);
153        self.w.bits |= ((value & MASK) as u32) << OFFSET;
154        self.w
155    }
156}
157#[doc = r" Proxy"]
158pub struct _GC5C2W<'a> {
159    w: &'a mut W,
160}
161impl<'a> _GC5C2W<'a> {
162    #[doc = r" Sets the field bit"]
163    pub fn set_bit(self) -> &'a mut W {
164        self.bit(true)
165    }
166    #[doc = r" Clears the field bit"]
167    pub fn clear_bit(self) -> &'a mut W {
168        self.bit(false)
169    }
170    #[doc = r" Writes raw bits to the field"]
171    #[inline]
172    pub fn bit(self, value: bool) -> &'a mut W {
173        const MASK: bool = true;
174        const OFFSET: u8 = 30;
175        self.w.bits &= !((MASK as u32) << OFFSET);
176        self.w.bits |= ((value & MASK) as u32) << OFFSET;
177        self.w
178    }
179}
180#[doc = r" Proxy"]
181pub struct _GC5C3W<'a> {
182    w: &'a mut W,
183}
184impl<'a> _GC5C3W<'a> {
185    #[doc = r" Sets the field bit"]
186    pub fn set_bit(self) -> &'a mut W {
187        self.bit(true)
188    }
189    #[doc = r" Clears the field bit"]
190    pub fn clear_bit(self) -> &'a mut W {
191        self.bit(false)
192    }
193    #[doc = r" Writes raw bits to the field"]
194    #[inline]
195    pub fn bit(self, value: bool) -> &'a mut W {
196        const MASK: bool = true;
197        const OFFSET: u8 = 31;
198        self.w.bits &= !((MASK as u32) << OFFSET);
199        self.w.bits |= ((value & MASK) as u32) << OFFSET;
200        self.w
201    }
202}
203impl R {
204    #[doc = r" Value of the register as raw bits"]
205    #[inline]
206    pub fn bits(&self) -> u32 {
207        self.bits
208    }
209    #[doc = "Bits 0:15 - Capture/Compare value"]
210    #[inline]
211    pub fn ccr5(&self) -> CCR5R {
212        let bits = {
213            const MASK: u16 = 65535;
214            const OFFSET: u8 = 0;
215            ((self.bits >> OFFSET) & MASK as u32) as u16
216        };
217        CCR5R { bits }
218    }
219    #[doc = "Bit 29 - Group Channel 5 and Channel 1"]
220    #[inline]
221    pub fn gc5c1(&self) -> GC5C1R {
222        let bits = {
223            const MASK: bool = true;
224            const OFFSET: u8 = 29;
225            ((self.bits >> OFFSET) & MASK as u32) != 0
226        };
227        GC5C1R { bits }
228    }
229    #[doc = "Bit 30 - Group Channel 5 and Channel 2"]
230    #[inline]
231    pub fn gc5c2(&self) -> GC5C2R {
232        let bits = {
233            const MASK: bool = true;
234            const OFFSET: u8 = 30;
235            ((self.bits >> OFFSET) & MASK as u32) != 0
236        };
237        GC5C2R { bits }
238    }
239    #[doc = "Bit 31 - Group Channel 5 and Channel 3"]
240    #[inline]
241    pub fn gc5c3(&self) -> GC5C3R {
242        let bits = {
243            const MASK: bool = true;
244            const OFFSET: u8 = 31;
245            ((self.bits >> OFFSET) & MASK as u32) != 0
246        };
247        GC5C3R { bits }
248    }
249}
250impl W {
251    #[doc = r" Reset value of the register"]
252    #[inline]
253    pub fn reset_value() -> W {
254        W { bits: 0 }
255    }
256    #[doc = r" Writes raw bits to the register"]
257    #[inline]
258    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
259        self.bits = bits;
260        self
261    }
262    #[doc = "Bits 0:15 - Capture/Compare value"]
263    #[inline]
264    pub fn ccr5(&mut self) -> _CCR5W {
265        _CCR5W { w: self }
266    }
267    #[doc = "Bit 29 - Group Channel 5 and Channel 1"]
268    #[inline]
269    pub fn gc5c1(&mut self) -> _GC5C1W {
270        _GC5C1W { w: self }
271    }
272    #[doc = "Bit 30 - Group Channel 5 and Channel 2"]
273    #[inline]
274    pub fn gc5c2(&mut self) -> _GC5C2W {
275        _GC5C2W { w: self }
276    }
277    #[doc = "Bit 31 - Group Channel 5 and Channel 3"]
278    #[inline]
279    pub fn gc5c3(&mut self) -> _GC5C3W {
280        _GC5C3W { w: self }
281    }
282}