stm32f2 0.16.0

Device support crates for STM32F2 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
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
///Register `PCR%s` reader
pub type R = crate::R<PCRrs>;
///Register `PCR%s` writer
pub type W = crate::W<PCRrs>;
/**PWAITEN

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PWAITEN {
    ///0: Wait feature disabled
    Disabled = 0,
    ///1: Wait feature enabled
    Enabled = 1,
}
impl From<PWAITEN> for bool {
    #[inline(always)]
    fn from(variant: PWAITEN) -> Self {
        variant as u8 != 0
    }
}
///Field `PWAITEN` reader - PWAITEN
pub type PWAITEN_R = crate::BitReader<PWAITEN>;
impl PWAITEN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> PWAITEN {
        match self.bits {
            false => PWAITEN::Disabled,
            true => PWAITEN::Enabled,
        }
    }
    ///Wait feature disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == PWAITEN::Disabled
    }
    ///Wait feature enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == PWAITEN::Enabled
    }
}
///Field `PWAITEN` writer - PWAITEN
pub type PWAITEN_W<'a, REG> = crate::BitWriter<'a, REG, PWAITEN>;
impl<'a, REG> PWAITEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Wait feature disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(PWAITEN::Disabled)
    }
    ///Wait feature enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(PWAITEN::Enabled)
    }
}
/**PBKEN

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PBKEN {
    ///0: Corresponding memory bank is disabled
    Disabled = 0,
    ///1: Corresponding memory bank is enabled
    Enabled = 1,
}
impl From<PBKEN> for bool {
    #[inline(always)]
    fn from(variant: PBKEN) -> Self {
        variant as u8 != 0
    }
}
///Field `PBKEN` reader - PBKEN
pub type PBKEN_R = crate::BitReader<PBKEN>;
impl PBKEN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> PBKEN {
        match self.bits {
            false => PBKEN::Disabled,
            true => PBKEN::Enabled,
        }
    }
    ///Corresponding memory bank is disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == PBKEN::Disabled
    }
    ///Corresponding memory bank is enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == PBKEN::Enabled
    }
}
///Field `PBKEN` writer - PBKEN
pub type PBKEN_W<'a, REG> = crate::BitWriter<'a, REG, PBKEN>;
impl<'a, REG> PBKEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Corresponding memory bank is disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(PBKEN::Disabled)
    }
    ///Corresponding memory bank is enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(PBKEN::Enabled)
    }
}
/**PTYP

Value on reset: 1*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PTYP {
    ///1: NAND Flash
    Nandflash = 1,
}
impl From<PTYP> for bool {
    #[inline(always)]
    fn from(variant: PTYP) -> Self {
        variant as u8 != 0
    }
}
///Field `PTYP` reader - PTYP
pub type PTYP_R = crate::BitReader<PTYP>;
impl PTYP_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<PTYP> {
        match self.bits {
            true => Some(PTYP::Nandflash),
            _ => None,
        }
    }
    ///NAND Flash
    #[inline(always)]
    pub fn is_nandflash(&self) -> bool {
        *self == PTYP::Nandflash
    }
}
///Field `PTYP` writer - PTYP
pub type PTYP_W<'a, REG> = crate::BitWriter<'a, REG, PTYP>;
impl<'a, REG> PTYP_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///NAND Flash
    #[inline(always)]
    pub fn nandflash(self) -> &'a mut crate::W<REG> {
        self.variant(PTYP::Nandflash)
    }
}
/**PWID

Value on reset: 1*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PWID {
    ///0: External memory device width 8 bits
    Bits8 = 0,
    ///1: External memory device width 16 bits
    Bits16 = 1,
}
impl From<PWID> for u8 {
    #[inline(always)]
    fn from(variant: PWID) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for PWID {
    type Ux = u8;
}
impl crate::IsEnum for PWID {}
///Field `PWID` reader - PWID
pub type PWID_R = crate::FieldReader<PWID>;
impl PWID_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<PWID> {
        match self.bits {
            0 => Some(PWID::Bits8),
            1 => Some(PWID::Bits16),
            _ => None,
        }
    }
    ///External memory device width 8 bits
    #[inline(always)]
    pub fn is_bits8(&self) -> bool {
        *self == PWID::Bits8
    }
    ///External memory device width 16 bits
    #[inline(always)]
    pub fn is_bits16(&self) -> bool {
        *self == PWID::Bits16
    }
}
///Field `PWID` writer - PWID
pub type PWID_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PWID>;
impl<'a, REG> PWID_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///External memory device width 8 bits
    #[inline(always)]
    pub fn bits8(self) -> &'a mut crate::W<REG> {
        self.variant(PWID::Bits8)
    }
    ///External memory device width 16 bits
    #[inline(always)]
    pub fn bits16(self) -> &'a mut crate::W<REG> {
        self.variant(PWID::Bits16)
    }
}
/**ECCEN

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ECCEN {
    ///0: ECC logic is disabled and reset
    Disabled = 0,
    ///1: ECC logic is enabled
    Enabled = 1,
}
impl From<ECCEN> for bool {
    #[inline(always)]
    fn from(variant: ECCEN) -> Self {
        variant as u8 != 0
    }
}
///Field `ECCEN` reader - ECCEN
pub type ECCEN_R = crate::BitReader<ECCEN>;
impl ECCEN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> ECCEN {
        match self.bits {
            false => ECCEN::Disabled,
            true => ECCEN::Enabled,
        }
    }
    ///ECC logic is disabled and reset
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == ECCEN::Disabled
    }
    ///ECC logic is enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == ECCEN::Enabled
    }
}
///Field `ECCEN` writer - ECCEN
pub type ECCEN_W<'a, REG> = crate::BitWriter<'a, REG, ECCEN>;
impl<'a, REG> ECCEN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///ECC logic is disabled and reset
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(ECCEN::Disabled)
    }
    ///ECC logic is enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(ECCEN::Enabled)
    }
}
///Field `TCLR` reader - TCLR
pub type TCLR_R = crate::FieldReader;
///Field `TCLR` writer - TCLR
pub type TCLR_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
///Field `TAR` reader - TAR
pub type TAR_R = crate::FieldReader;
///Field `TAR` writer - TAR
pub type TAR_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
/**ECCPS

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ECCPS {
    ///0: ECC page size 256 bytes
    Bytes256 = 0,
    ///1: ECC page size 512 bytes
    Bytes512 = 1,
    ///2: ECC page size 1024 bytes
    Bytes1024 = 2,
    ///3: ECC page size 2048 bytes
    Bytes2048 = 3,
    ///4: ECC page size 4096 bytes
    Bytes4096 = 4,
    ///5: ECC page size 8192 bytes
    Bytes8192 = 5,
}
impl From<ECCPS> for u8 {
    #[inline(always)]
    fn from(variant: ECCPS) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for ECCPS {
    type Ux = u8;
}
impl crate::IsEnum for ECCPS {}
///Field `ECCPS` reader - ECCPS
pub type ECCPS_R = crate::FieldReader<ECCPS>;
impl ECCPS_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<ECCPS> {
        match self.bits {
            0 => Some(ECCPS::Bytes256),
            1 => Some(ECCPS::Bytes512),
            2 => Some(ECCPS::Bytes1024),
            3 => Some(ECCPS::Bytes2048),
            4 => Some(ECCPS::Bytes4096),
            5 => Some(ECCPS::Bytes8192),
            _ => None,
        }
    }
    ///ECC page size 256 bytes
    #[inline(always)]
    pub fn is_bytes256(&self) -> bool {
        *self == ECCPS::Bytes256
    }
    ///ECC page size 512 bytes
    #[inline(always)]
    pub fn is_bytes512(&self) -> bool {
        *self == ECCPS::Bytes512
    }
    ///ECC page size 1024 bytes
    #[inline(always)]
    pub fn is_bytes1024(&self) -> bool {
        *self == ECCPS::Bytes1024
    }
    ///ECC page size 2048 bytes
    #[inline(always)]
    pub fn is_bytes2048(&self) -> bool {
        *self == ECCPS::Bytes2048
    }
    ///ECC page size 4096 bytes
    #[inline(always)]
    pub fn is_bytes4096(&self) -> bool {
        *self == ECCPS::Bytes4096
    }
    ///ECC page size 8192 bytes
    #[inline(always)]
    pub fn is_bytes8192(&self) -> bool {
        *self == ECCPS::Bytes8192
    }
}
///Field `ECCPS` writer - ECCPS
pub type ECCPS_W<'a, REG> = crate::FieldWriter<'a, REG, 3, ECCPS>;
impl<'a, REG> ECCPS_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///ECC page size 256 bytes
    #[inline(always)]
    pub fn bytes256(self) -> &'a mut crate::W<REG> {
        self.variant(ECCPS::Bytes256)
    }
    ///ECC page size 512 bytes
    #[inline(always)]
    pub fn bytes512(self) -> &'a mut crate::W<REG> {
        self.variant(ECCPS::Bytes512)
    }
    ///ECC page size 1024 bytes
    #[inline(always)]
    pub fn bytes1024(self) -> &'a mut crate::W<REG> {
        self.variant(ECCPS::Bytes1024)
    }
    ///ECC page size 2048 bytes
    #[inline(always)]
    pub fn bytes2048(self) -> &'a mut crate::W<REG> {
        self.variant(ECCPS::Bytes2048)
    }
    ///ECC page size 4096 bytes
    #[inline(always)]
    pub fn bytes4096(self) -> &'a mut crate::W<REG> {
        self.variant(ECCPS::Bytes4096)
    }
    ///ECC page size 8192 bytes
    #[inline(always)]
    pub fn bytes8192(self) -> &'a mut crate::W<REG> {
        self.variant(ECCPS::Bytes8192)
    }
}
impl R {
    ///Bit 1 - PWAITEN
    #[inline(always)]
    pub fn pwaiten(&self) -> PWAITEN_R {
        PWAITEN_R::new(((self.bits >> 1) & 1) != 0)
    }
    ///Bit 2 - PBKEN
    #[inline(always)]
    pub fn pbken(&self) -> PBKEN_R {
        PBKEN_R::new(((self.bits >> 2) & 1) != 0)
    }
    ///Bit 3 - PTYP
    #[inline(always)]
    pub fn ptyp(&self) -> PTYP_R {
        PTYP_R::new(((self.bits >> 3) & 1) != 0)
    }
    ///Bits 4:5 - PWID
    #[inline(always)]
    pub fn pwid(&self) -> PWID_R {
        PWID_R::new(((self.bits >> 4) & 3) as u8)
    }
    ///Bit 6 - ECCEN
    #[inline(always)]
    pub fn eccen(&self) -> ECCEN_R {
        ECCEN_R::new(((self.bits >> 6) & 1) != 0)
    }
    ///Bits 9:12 - TCLR
    #[inline(always)]
    pub fn tclr(&self) -> TCLR_R {
        TCLR_R::new(((self.bits >> 9) & 0x0f) as u8)
    }
    ///Bits 13:16 - TAR
    #[inline(always)]
    pub fn tar(&self) -> TAR_R {
        TAR_R::new(((self.bits >> 13) & 0x0f) as u8)
    }
    ///Bits 17:19 - ECCPS
    #[inline(always)]
    pub fn eccps(&self) -> ECCPS_R {
        ECCPS_R::new(((self.bits >> 17) & 7) as u8)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("PCR")
            .field("eccps", &self.eccps())
            .field("tar", &self.tar())
            .field("tclr", &self.tclr())
            .field("eccen", &self.eccen())
            .field("pwid", &self.pwid())
            .field("ptyp", &self.ptyp())
            .field("pbken", &self.pbken())
            .field("pwaiten", &self.pwaiten())
            .finish()
    }
}
impl W {
    ///Bit 1 - PWAITEN
    #[inline(always)]
    pub fn pwaiten(&mut self) -> PWAITEN_W<PCRrs> {
        PWAITEN_W::new(self, 1)
    }
    ///Bit 2 - PBKEN
    #[inline(always)]
    pub fn pbken(&mut self) -> PBKEN_W<PCRrs> {
        PBKEN_W::new(self, 2)
    }
    ///Bit 3 - PTYP
    #[inline(always)]
    pub fn ptyp(&mut self) -> PTYP_W<PCRrs> {
        PTYP_W::new(self, 3)
    }
    ///Bits 4:5 - PWID
    #[inline(always)]
    pub fn pwid(&mut self) -> PWID_W<PCRrs> {
        PWID_W::new(self, 4)
    }
    ///Bit 6 - ECCEN
    #[inline(always)]
    pub fn eccen(&mut self) -> ECCEN_W<PCRrs> {
        ECCEN_W::new(self, 6)
    }
    ///Bits 9:12 - TCLR
    #[inline(always)]
    pub fn tclr(&mut self) -> TCLR_W<PCRrs> {
        TCLR_W::new(self, 9)
    }
    ///Bits 13:16 - TAR
    #[inline(always)]
    pub fn tar(&mut self) -> TAR_W<PCRrs> {
        TAR_W::new(self, 13)
    }
    ///Bits 17:19 - ECCPS
    #[inline(always)]
    pub fn eccps(&mut self) -> ECCPS_W<PCRrs> {
        ECCPS_W::new(self, 17)
    }
}
/**PC Card/NAND Flash control register %s

You can [`read`](crate::Reg::read) this register and get [`pcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).

See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F215.html#FSMC:PCR[2])*/
pub struct PCRrs;
impl crate::RegisterSpec for PCRrs {
    type Ux = u32;
}
///`read()` method returns [`pcr::R`](R) reader structure
impl crate::Readable for PCRrs {}
///`write(|w| ..)` method takes [`pcr::W`](W) writer structure
impl crate::Writable for PCRrs {
    type Safety = crate::Unsafe;
}
///`reset()` method sets PCR%s to value 0x18
impl crate::Resettable for PCRrs {
    const RESET_VALUE: u32 = 0x18;
}