stm32h7 0.16.0

Device support crates for STM32H7 devices
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
///Register `EECR2` reader
pub type R = crate::R<EECR2rs>;
///Register `EECR2` writer
pub type W = crate::W<EECR2rs>;
/**External Event %s Source

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum EE6SRC {
    ///0: Source 1
    Src1 = 0,
    ///1: Source 2
    Src2 = 1,
    ///2: Source 3
    Src3 = 2,
    ///3: Source 4
    Src4 = 3,
}
impl From<EE6SRC> for u8 {
    #[inline(always)]
    fn from(variant: EE6SRC) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for EE6SRC {
    type Ux = u8;
}
impl crate::IsEnum for EE6SRC {}
///Field `EESRC(6-10)` reader - External Event %s Source
pub type EESRC_R = crate::FieldReader<EE6SRC>;
impl EESRC_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> EE6SRC {
        match self.bits {
            0 => EE6SRC::Src1,
            1 => EE6SRC::Src2,
            2 => EE6SRC::Src3,
            3 => EE6SRC::Src4,
            _ => unreachable!(),
        }
    }
    ///Source 1
    #[inline(always)]
    pub fn is_src1(&self) -> bool {
        *self == EE6SRC::Src1
    }
    ///Source 2
    #[inline(always)]
    pub fn is_src2(&self) -> bool {
        *self == EE6SRC::Src2
    }
    ///Source 3
    #[inline(always)]
    pub fn is_src3(&self) -> bool {
        *self == EE6SRC::Src3
    }
    ///Source 4
    #[inline(always)]
    pub fn is_src4(&self) -> bool {
        *self == EE6SRC::Src4
    }
}
///Field `EESRC(6-10)` writer - External Event %s Source
pub type EESRC_W<'a, REG> = crate::FieldWriter<'a, REG, 2, EE6SRC, crate::Safe>;
impl<'a, REG> EESRC_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///Source 1
    #[inline(always)]
    pub fn src1(self) -> &'a mut crate::W<REG> {
        self.variant(EE6SRC::Src1)
    }
    ///Source 2
    #[inline(always)]
    pub fn src2(self) -> &'a mut crate::W<REG> {
        self.variant(EE6SRC::Src2)
    }
    ///Source 3
    #[inline(always)]
    pub fn src3(self) -> &'a mut crate::W<REG> {
        self.variant(EE6SRC::Src3)
    }
    ///Source 4
    #[inline(always)]
    pub fn src4(self) -> &'a mut crate::W<REG> {
        self.variant(EE6SRC::Src4)
    }
}
/**External Event %s Polarity

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EE6POL {
    ///0: External event is active high
    ActiveHigh = 0,
    ///1: External event is active low
    ActiveLow = 1,
}
impl From<EE6POL> for bool {
    #[inline(always)]
    fn from(variant: EE6POL) -> Self {
        variant as u8 != 0
    }
}
///Field `EEPOL(6-10)` reader - External Event %s Polarity
pub type EEPOL_R = crate::BitReader<EE6POL>;
impl EEPOL_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> EE6POL {
        match self.bits {
            false => EE6POL::ActiveHigh,
            true => EE6POL::ActiveLow,
        }
    }
    ///External event is active high
    #[inline(always)]
    pub fn is_active_high(&self) -> bool {
        *self == EE6POL::ActiveHigh
    }
    ///External event is active low
    #[inline(always)]
    pub fn is_active_low(&self) -> bool {
        *self == EE6POL::ActiveLow
    }
}
///Field `EEPOL(6-10)` writer - External Event %s Polarity
pub type EEPOL_W<'a, REG> = crate::BitWriter<'a, REG, EE6POL>;
impl<'a, REG> EEPOL_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///External event is active high
    #[inline(always)]
    pub fn active_high(self) -> &'a mut crate::W<REG> {
        self.variant(EE6POL::ActiveHigh)
    }
    ///External event is active low
    #[inline(always)]
    pub fn active_low(self) -> &'a mut crate::W<REG> {
        self.variant(EE6POL::ActiveLow)
    }
}
/**External Event %s Sensitivity

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum EE6SNS {
    ///0: On active level defined by EExPOL bit
    Active = 0,
    ///1: Rising edge
    Rising = 1,
    ///2: Falling edge
    Falling = 2,
    ///3: Both edges
    Both = 3,
}
impl From<EE6SNS> for u8 {
    #[inline(always)]
    fn from(variant: EE6SNS) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for EE6SNS {
    type Ux = u8;
}
impl crate::IsEnum for EE6SNS {}
///Field `EESNS(6-10)` reader - External Event %s Sensitivity
pub type EESNS_R = crate::FieldReader<EE6SNS>;
impl EESNS_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> EE6SNS {
        match self.bits {
            0 => EE6SNS::Active,
            1 => EE6SNS::Rising,
            2 => EE6SNS::Falling,
            3 => EE6SNS::Both,
            _ => unreachable!(),
        }
    }
    ///On active level defined by EExPOL bit
    #[inline(always)]
    pub fn is_active(&self) -> bool {
        *self == EE6SNS::Active
    }
    ///Rising edge
    #[inline(always)]
    pub fn is_rising(&self) -> bool {
        *self == EE6SNS::Rising
    }
    ///Falling edge
    #[inline(always)]
    pub fn is_falling(&self) -> bool {
        *self == EE6SNS::Falling
    }
    ///Both edges
    #[inline(always)]
    pub fn is_both(&self) -> bool {
        *self == EE6SNS::Both
    }
}
///Field `EESNS(6-10)` writer - External Event %s Sensitivity
pub type EESNS_W<'a, REG> = crate::FieldWriter<'a, REG, 2, EE6SNS, crate::Safe>;
impl<'a, REG> EESNS_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///On active level defined by EExPOL bit
    #[inline(always)]
    pub fn active(self) -> &'a mut crate::W<REG> {
        self.variant(EE6SNS::Active)
    }
    ///Rising edge
    #[inline(always)]
    pub fn rising(self) -> &'a mut crate::W<REG> {
        self.variant(EE6SNS::Rising)
    }
    ///Falling edge
    #[inline(always)]
    pub fn falling(self) -> &'a mut crate::W<REG> {
        self.variant(EE6SNS::Falling)
    }
    ///Both edges
    #[inline(always)]
    pub fn both(self) -> &'a mut crate::W<REG> {
        self.variant(EE6SNS::Both)
    }
}
impl R {
    ///External Event (6-10) Source
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EE6SRC` field.</div>
    #[inline(always)]
    pub fn eesrc(&self, n: u8) -> EESRC_R {
        #[allow(clippy::no_effect)] [(); 5][n as usize];
        EESRC_R::new(((self.bits >> (n * 6)) & 3) as u8)
    }
    ///Iterator for array of:
    ///External Event (6-10) Source
    #[inline(always)]
    pub fn eesrc_iter(&self) -> impl Iterator<Item = EESRC_R> + '_ {
        (0..5).map(move |n| EESRC_R::new(((self.bits >> (n * 6)) & 3) as u8))
    }
    ///Bits 0:1 - External Event 6 Source
    #[inline(always)]
    pub fn ee6src(&self) -> EESRC_R {
        EESRC_R::new((self.bits & 3) as u8)
    }
    ///Bits 6:7 - External Event 7 Source
    #[inline(always)]
    pub fn ee7src(&self) -> EESRC_R {
        EESRC_R::new(((self.bits >> 6) & 3) as u8)
    }
    ///Bits 12:13 - External Event 8 Source
    #[inline(always)]
    pub fn ee8src(&self) -> EESRC_R {
        EESRC_R::new(((self.bits >> 12) & 3) as u8)
    }
    ///Bits 18:19 - External Event 9 Source
    #[inline(always)]
    pub fn ee9src(&self) -> EESRC_R {
        EESRC_R::new(((self.bits >> 18) & 3) as u8)
    }
    ///Bits 24:25 - External Event 10 Source
    #[inline(always)]
    pub fn ee10src(&self) -> EESRC_R {
        EESRC_R::new(((self.bits >> 24) & 3) as u8)
    }
    ///External Event (6-10) Polarity
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EE6POL` field.</div>
    #[inline(always)]
    pub fn eepol(&self, n: u8) -> EEPOL_R {
        #[allow(clippy::no_effect)] [(); 5][n as usize];
        EEPOL_R::new(((self.bits >> (n * 6 + 2)) & 1) != 0)
    }
    ///Iterator for array of:
    ///External Event (6-10) Polarity
    #[inline(always)]
    pub fn eepol_iter(&self) -> impl Iterator<Item = EEPOL_R> + '_ {
        (0..5).map(move |n| EEPOL_R::new(((self.bits >> (n * 6 + 2)) & 1) != 0))
    }
    ///Bit 2 - External Event 6 Polarity
    #[inline(always)]
    pub fn ee6pol(&self) -> EEPOL_R {
        EEPOL_R::new(((self.bits >> 2) & 1) != 0)
    }
    ///Bit 8 - External Event 7 Polarity
    #[inline(always)]
    pub fn ee7pol(&self) -> EEPOL_R {
        EEPOL_R::new(((self.bits >> 8) & 1) != 0)
    }
    ///Bit 14 - External Event 8 Polarity
    #[inline(always)]
    pub fn ee8pol(&self) -> EEPOL_R {
        EEPOL_R::new(((self.bits >> 14) & 1) != 0)
    }
    ///Bit 20 - External Event 9 Polarity
    #[inline(always)]
    pub fn ee9pol(&self) -> EEPOL_R {
        EEPOL_R::new(((self.bits >> 20) & 1) != 0)
    }
    ///Bit 26 - External Event 10 Polarity
    #[inline(always)]
    pub fn ee10pol(&self) -> EEPOL_R {
        EEPOL_R::new(((self.bits >> 26) & 1) != 0)
    }
    ///External Event (6-10) Sensitivity
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EE6SNS` field.</div>
    #[inline(always)]
    pub fn eesns(&self, n: u8) -> EESNS_R {
        #[allow(clippy::no_effect)] [(); 5][n as usize];
        EESNS_R::new(((self.bits >> (n * 6 + 3)) & 3) as u8)
    }
    ///Iterator for array of:
    ///External Event (6-10) Sensitivity
    #[inline(always)]
    pub fn eesns_iter(&self) -> impl Iterator<Item = EESNS_R> + '_ {
        (0..5).map(move |n| EESNS_R::new(((self.bits >> (n * 6 + 3)) & 3) as u8))
    }
    ///Bits 3:4 - External Event 6 Sensitivity
    #[inline(always)]
    pub fn ee6sns(&self) -> EESNS_R {
        EESNS_R::new(((self.bits >> 3) & 3) as u8)
    }
    ///Bits 9:10 - External Event 7 Sensitivity
    #[inline(always)]
    pub fn ee7sns(&self) -> EESNS_R {
        EESNS_R::new(((self.bits >> 9) & 3) as u8)
    }
    ///Bits 15:16 - External Event 8 Sensitivity
    #[inline(always)]
    pub fn ee8sns(&self) -> EESNS_R {
        EESNS_R::new(((self.bits >> 15) & 3) as u8)
    }
    ///Bits 21:22 - External Event 9 Sensitivity
    #[inline(always)]
    pub fn ee9sns(&self) -> EESNS_R {
        EESNS_R::new(((self.bits >> 21) & 3) as u8)
    }
    ///Bits 27:28 - External Event 10 Sensitivity
    #[inline(always)]
    pub fn ee10sns(&self) -> EESNS_R {
        EESNS_R::new(((self.bits >> 27) & 3) as u8)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("EECR2")
            .field("ee6sns", &self.ee6sns())
            .field("ee7sns", &self.ee7sns())
            .field("ee8sns", &self.ee8sns())
            .field("ee9sns", &self.ee9sns())
            .field("ee10sns", &self.ee10sns())
            .field("ee6pol", &self.ee6pol())
            .field("ee7pol", &self.ee7pol())
            .field("ee8pol", &self.ee8pol())
            .field("ee9pol", &self.ee9pol())
            .field("ee10pol", &self.ee10pol())
            .field("ee6src", &self.ee6src())
            .field("ee7src", &self.ee7src())
            .field("ee8src", &self.ee8src())
            .field("ee9src", &self.ee9src())
            .field("ee10src", &self.ee10src())
            .finish()
    }
}
impl W {
    ///External Event (6-10) Source
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EE6SRC` field.</div>
    #[inline(always)]
    pub fn eesrc(&mut self, n: u8) -> EESRC_W<EECR2rs> {
        #[allow(clippy::no_effect)] [(); 5][n as usize];
        EESRC_W::new(self, n * 6)
    }
    ///Bits 0:1 - External Event 6 Source
    #[inline(always)]
    pub fn ee6src(&mut self) -> EESRC_W<EECR2rs> {
        EESRC_W::new(self, 0)
    }
    ///Bits 6:7 - External Event 7 Source
    #[inline(always)]
    pub fn ee7src(&mut self) -> EESRC_W<EECR2rs> {
        EESRC_W::new(self, 6)
    }
    ///Bits 12:13 - External Event 8 Source
    #[inline(always)]
    pub fn ee8src(&mut self) -> EESRC_W<EECR2rs> {
        EESRC_W::new(self, 12)
    }
    ///Bits 18:19 - External Event 9 Source
    #[inline(always)]
    pub fn ee9src(&mut self) -> EESRC_W<EECR2rs> {
        EESRC_W::new(self, 18)
    }
    ///Bits 24:25 - External Event 10 Source
    #[inline(always)]
    pub fn ee10src(&mut self) -> EESRC_W<EECR2rs> {
        EESRC_W::new(self, 24)
    }
    ///External Event (6-10) Polarity
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EE6POL` field.</div>
    #[inline(always)]
    pub fn eepol(&mut self, n: u8) -> EEPOL_W<EECR2rs> {
        #[allow(clippy::no_effect)] [(); 5][n as usize];
        EEPOL_W::new(self, n * 6 + 2)
    }
    ///Bit 2 - External Event 6 Polarity
    #[inline(always)]
    pub fn ee6pol(&mut self) -> EEPOL_W<EECR2rs> {
        EEPOL_W::new(self, 2)
    }
    ///Bit 8 - External Event 7 Polarity
    #[inline(always)]
    pub fn ee7pol(&mut self) -> EEPOL_W<EECR2rs> {
        EEPOL_W::new(self, 8)
    }
    ///Bit 14 - External Event 8 Polarity
    #[inline(always)]
    pub fn ee8pol(&mut self) -> EEPOL_W<EECR2rs> {
        EEPOL_W::new(self, 14)
    }
    ///Bit 20 - External Event 9 Polarity
    #[inline(always)]
    pub fn ee9pol(&mut self) -> EEPOL_W<EECR2rs> {
        EEPOL_W::new(self, 20)
    }
    ///Bit 26 - External Event 10 Polarity
    #[inline(always)]
    pub fn ee10pol(&mut self) -> EEPOL_W<EECR2rs> {
        EEPOL_W::new(self, 26)
    }
    ///External Event (6-10) Sensitivity
    ///
    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `EE6SNS` field.</div>
    #[inline(always)]
    pub fn eesns(&mut self, n: u8) -> EESNS_W<EECR2rs> {
        #[allow(clippy::no_effect)] [(); 5][n as usize];
        EESNS_W::new(self, n * 6 + 3)
    }
    ///Bits 3:4 - External Event 6 Sensitivity
    #[inline(always)]
    pub fn ee6sns(&mut self) -> EESNS_W<EECR2rs> {
        EESNS_W::new(self, 3)
    }
    ///Bits 9:10 - External Event 7 Sensitivity
    #[inline(always)]
    pub fn ee7sns(&mut self) -> EESNS_W<EECR2rs> {
        EESNS_W::new(self, 9)
    }
    ///Bits 15:16 - External Event 8 Sensitivity
    #[inline(always)]
    pub fn ee8sns(&mut self) -> EESNS_W<EECR2rs> {
        EESNS_W::new(self, 15)
    }
    ///Bits 21:22 - External Event 9 Sensitivity
    #[inline(always)]
    pub fn ee9sns(&mut self) -> EESNS_W<EECR2rs> {
        EESNS_W::new(self, 21)
    }
    ///Bits 27:28 - External Event 10 Sensitivity
    #[inline(always)]
    pub fn ee10sns(&mut self) -> EESNS_W<EECR2rs> {
        EESNS_W::new(self, 27)
    }
}
/**Timer External Event Control Register 2

You can [`read`](crate::Reg::read) this register and get [`eecr2::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`eecr2::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).*/
pub struct EECR2rs;
impl crate::RegisterSpec for EECR2rs {
    type Ux = u32;
}
///`read()` method returns [`eecr2::R`](R) reader structure
impl crate::Readable for EECR2rs {}
///`write(|w| ..)` method takes [`eecr2::W`](W) writer structure
impl crate::Writable for EECR2rs {
    type Safety = crate::Unsafe;
}
///`reset()` method sets EECR2 to value 0
impl crate::Resettable for EECR2rs {}