stm32l0/stm32l0x3/tsc/
iogcsr.rs1pub type R = crate::R<IOGCSRrs>;
3pub type W = crate::W<IOGCSRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum G1E {
11    Disabled = 0,
13    Enabled = 1,
15}
16impl From<G1E> for bool {
17    #[inline(always)]
18    fn from(variant: G1E) -> Self {
19        variant as u8 != 0
20    }
21}
22pub type GE_R = crate::BitReader<G1E>;
24impl GE_R {
25    #[inline(always)]
27    pub const fn variant(&self) -> G1E {
28        match self.bits {
29            false => G1E::Disabled,
30            true => G1E::Enabled,
31        }
32    }
33    #[inline(always)]
35    pub fn is_disabled(&self) -> bool {
36        *self == G1E::Disabled
37    }
38    #[inline(always)]
40    pub fn is_enabled(&self) -> bool {
41        *self == G1E::Enabled
42    }
43}
44pub type GE_W<'a, REG> = crate::BitWriter<'a, REG, G1E>;
46impl<'a, REG> GE_W<'a, REG>
47where
48    REG: crate::Writable + crate::RegisterSpec,
49{
50    #[inline(always)]
52    pub fn disabled(self) -> &'a mut crate::W<REG> {
53        self.variant(G1E::Disabled)
54    }
55    #[inline(always)]
57    pub fn enabled(self) -> &'a mut crate::W<REG> {
58        self.variant(G1E::Enabled)
59    }
60}
61#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum G1S {
67    Ongoing = 0,
69    Complete = 1,
71}
72impl From<G1S> for bool {
73    #[inline(always)]
74    fn from(variant: G1S) -> Self {
75        variant as u8 != 0
76    }
77}
78pub type GS_R = crate::BitReader<G1S>;
80impl GS_R {
81    #[inline(always)]
83    pub const fn variant(&self) -> G1S {
84        match self.bits {
85            false => G1S::Ongoing,
86            true => G1S::Complete,
87        }
88    }
89    #[inline(always)]
91    pub fn is_ongoing(&self) -> bool {
92        *self == G1S::Ongoing
93    }
94    #[inline(always)]
96    pub fn is_complete(&self) -> bool {
97        *self == G1S::Complete
98    }
99}
100impl R {
101    #[inline(always)]
105    pub fn ge(&self, n: u8) -> GE_R {
106        #[allow(clippy::no_effect)]
107        [(); 8][n as usize];
108        GE_R::new(((self.bits >> n) & 1) != 0)
109    }
110    #[inline(always)]
113    pub fn ge_iter(&self) -> impl Iterator<Item = GE_R> + '_ {
114        (0..8).map(move |n| GE_R::new(((self.bits >> n) & 1) != 0))
115    }
116    #[inline(always)]
118    pub fn g1e(&self) -> GE_R {
119        GE_R::new((self.bits & 1) != 0)
120    }
121    #[inline(always)]
123    pub fn g2e(&self) -> GE_R {
124        GE_R::new(((self.bits >> 1) & 1) != 0)
125    }
126    #[inline(always)]
128    pub fn g3e(&self) -> GE_R {
129        GE_R::new(((self.bits >> 2) & 1) != 0)
130    }
131    #[inline(always)]
133    pub fn g4e(&self) -> GE_R {
134        GE_R::new(((self.bits >> 3) & 1) != 0)
135    }
136    #[inline(always)]
138    pub fn g5e(&self) -> GE_R {
139        GE_R::new(((self.bits >> 4) & 1) != 0)
140    }
141    #[inline(always)]
143    pub fn g6e(&self) -> GE_R {
144        GE_R::new(((self.bits >> 5) & 1) != 0)
145    }
146    #[inline(always)]
148    pub fn g7e(&self) -> GE_R {
149        GE_R::new(((self.bits >> 6) & 1) != 0)
150    }
151    #[inline(always)]
153    pub fn g8e(&self) -> GE_R {
154        GE_R::new(((self.bits >> 7) & 1) != 0)
155    }
156    #[inline(always)]
160    pub fn gs(&self, n: u8) -> GS_R {
161        #[allow(clippy::no_effect)]
162        [(); 8][n as usize];
163        GS_R::new(((self.bits >> (n + 16)) & 1) != 0)
164    }
165    #[inline(always)]
168    pub fn gs_iter(&self) -> impl Iterator<Item = GS_R> + '_ {
169        (0..8).map(move |n| GS_R::new(((self.bits >> (n + 16)) & 1) != 0))
170    }
171    #[inline(always)]
173    pub fn g1s(&self) -> GS_R {
174        GS_R::new(((self.bits >> 16) & 1) != 0)
175    }
176    #[inline(always)]
178    pub fn g2s(&self) -> GS_R {
179        GS_R::new(((self.bits >> 17) & 1) != 0)
180    }
181    #[inline(always)]
183    pub fn g3s(&self) -> GS_R {
184        GS_R::new(((self.bits >> 18) & 1) != 0)
185    }
186    #[inline(always)]
188    pub fn g4s(&self) -> GS_R {
189        GS_R::new(((self.bits >> 19) & 1) != 0)
190    }
191    #[inline(always)]
193    pub fn g5s(&self) -> GS_R {
194        GS_R::new(((self.bits >> 20) & 1) != 0)
195    }
196    #[inline(always)]
198    pub fn g6s(&self) -> GS_R {
199        GS_R::new(((self.bits >> 21) & 1) != 0)
200    }
201    #[inline(always)]
203    pub fn g7s(&self) -> GS_R {
204        GS_R::new(((self.bits >> 22) & 1) != 0)
205    }
206    #[inline(always)]
208    pub fn g8s(&self) -> GS_R {
209        GS_R::new(((self.bits >> 23) & 1) != 0)
210    }
211}
212impl core::fmt::Debug for R {
213    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
214        f.debug_struct("IOGCSR")
215            .field("g1s", &self.g1s())
216            .field("g2s", &self.g2s())
217            .field("g3s", &self.g3s())
218            .field("g4s", &self.g4s())
219            .field("g5s", &self.g5s())
220            .field("g6s", &self.g6s())
221            .field("g7s", &self.g7s())
222            .field("g8s", &self.g8s())
223            .field("g1e", &self.g1e())
224            .field("g2e", &self.g2e())
225            .field("g3e", &self.g3e())
226            .field("g4e", &self.g4e())
227            .field("g5e", &self.g5e())
228            .field("g6e", &self.g6e())
229            .field("g7e", &self.g7e())
230            .field("g8e", &self.g8e())
231            .finish()
232    }
233}
234impl W {
235    #[inline(always)]
239    pub fn ge(&mut self, n: u8) -> GE_W<IOGCSRrs> {
240        #[allow(clippy::no_effect)]
241        [(); 8][n as usize];
242        GE_W::new(self, n)
243    }
244    #[inline(always)]
246    pub fn g1e(&mut self) -> GE_W<IOGCSRrs> {
247        GE_W::new(self, 0)
248    }
249    #[inline(always)]
251    pub fn g2e(&mut self) -> GE_W<IOGCSRrs> {
252        GE_W::new(self, 1)
253    }
254    #[inline(always)]
256    pub fn g3e(&mut self) -> GE_W<IOGCSRrs> {
257        GE_W::new(self, 2)
258    }
259    #[inline(always)]
261    pub fn g4e(&mut self) -> GE_W<IOGCSRrs> {
262        GE_W::new(self, 3)
263    }
264    #[inline(always)]
266    pub fn g5e(&mut self) -> GE_W<IOGCSRrs> {
267        GE_W::new(self, 4)
268    }
269    #[inline(always)]
271    pub fn g6e(&mut self) -> GE_W<IOGCSRrs> {
272        GE_W::new(self, 5)
273    }
274    #[inline(always)]
276    pub fn g7e(&mut self) -> GE_W<IOGCSRrs> {
277        GE_W::new(self, 6)
278    }
279    #[inline(always)]
281    pub fn g8e(&mut self) -> GE_W<IOGCSRrs> {
282        GE_W::new(self, 7)
283    }
284}
285pub struct IOGCSRrs;
291impl crate::RegisterSpec for IOGCSRrs {
292    type Ux = u32;
293}
294impl crate::Readable for IOGCSRrs {}
296impl crate::Writable for IOGCSRrs {
298    type Safety = crate::Unsafe;
299}
300impl crate::Resettable for IOGCSRrs {}