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
#[doc = "Register `CR2` reader"]
pub struct R(crate::R<CR2_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CR2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<CR2_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<CR2_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CR2` writer"]
pub struct W(crate::W<CR2_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CR2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl From<crate::W<CR2_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<CR2_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "TAMP1NOER\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP1NOER_A {
    #[doc = "0: Tamper x event erases the backup registers"]
    Erase = 0,
    #[doc = "1: Tamper x event does not erase the backup registers"]
    NotErase = 1,
}
impl From<TAMP1NOER_A> for bool {
    #[inline(always)]
    fn from(variant: TAMP1NOER_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TAMP1NOER` reader - TAMP1NOER"]
pub type TAMP1NOER_R = crate::BitReader<TAMP1NOER_A>;
impl TAMP1NOER_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> TAMP1NOER_A {
        match self.bits {
            false => TAMP1NOER_A::Erase,
            true => TAMP1NOER_A::NotErase,
        }
    }
    #[doc = "Checks if the value of the field is `Erase`"]
    #[inline(always)]
    pub fn is_erase(&self) -> bool {
        *self == TAMP1NOER_A::Erase
    }
    #[doc = "Checks if the value of the field is `NotErase`"]
    #[inline(always)]
    pub fn is_not_erase(&self) -> bool {
        *self == TAMP1NOER_A::NotErase
    }
}
#[doc = "Field `TAMP1NOER` writer - TAMP1NOER"]
pub type TAMP1NOER_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, TAMP1NOER_A, O>;
impl<'a, const O: u8> TAMP1NOER_W<'a, O> {
    #[doc = "Tamper x event erases the backup registers"]
    #[inline(always)]
    pub fn erase(self) -> &'a mut W {
        self.variant(TAMP1NOER_A::Erase)
    }
    #[doc = "Tamper x event does not erase the backup registers"]
    #[inline(always)]
    pub fn not_erase(self) -> &'a mut W {
        self.variant(TAMP1NOER_A::NotErase)
    }
}
#[doc = "TAMP2NOER"]
pub use TAMP1NOER_A as TAMP2NOER_A;
#[doc = "TAMP3NOER"]
pub use TAMP1NOER_A as TAMP3NOER_A;
#[doc = "Field `TAMP2NOER` reader - TAMP2NOER"]
pub use TAMP1NOER_R as TAMP2NOER_R;
#[doc = "Field `TAMP3NOER` reader - TAMP3NOER"]
pub use TAMP1NOER_R as TAMP3NOER_R;
#[doc = "Field `TAMP2NOER` writer - TAMP2NOER"]
pub use TAMP1NOER_W as TAMP2NOER_W;
#[doc = "Field `TAMP3NOER` writer - TAMP3NOER"]
pub use TAMP1NOER_W as TAMP3NOER_W;
#[doc = "TAMP1MSK\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP1MSK_A {
    #[doc = "0: Tamper x event generates a trigger event and TAMPxF must be cleared by software to allow next tamper event detection"]
    ResetBySoftware = 0,
    #[doc = "1: Tamper x event generates a trigger event. TAMPxF is masked and internally cleared by hardware. The backup registers are not erased. The tamper x interrupt must not be enabled when TAMP3MSK is set"]
    ResetByHardware = 1,
}
impl From<TAMP1MSK_A> for bool {
    #[inline(always)]
    fn from(variant: TAMP1MSK_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TAMP1MSK` reader - TAMP1MSK"]
pub type TAMP1MSK_R = crate::BitReader<TAMP1MSK_A>;
impl TAMP1MSK_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> TAMP1MSK_A {
        match self.bits {
            false => TAMP1MSK_A::ResetBySoftware,
            true => TAMP1MSK_A::ResetByHardware,
        }
    }
    #[doc = "Checks if the value of the field is `ResetBySoftware`"]
    #[inline(always)]
    pub fn is_reset_by_software(&self) -> bool {
        *self == TAMP1MSK_A::ResetBySoftware
    }
    #[doc = "Checks if the value of the field is `ResetByHardware`"]
    #[inline(always)]
    pub fn is_reset_by_hardware(&self) -> bool {
        *self == TAMP1MSK_A::ResetByHardware
    }
}
#[doc = "Field `TAMP1MSK` writer - TAMP1MSK"]
pub type TAMP1MSK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, TAMP1MSK_A, O>;
impl<'a, const O: u8> TAMP1MSK_W<'a, O> {
    #[doc = "Tamper x event generates a trigger event and TAMPxF must be cleared by software to allow next tamper event detection"]
    #[inline(always)]
    pub fn reset_by_software(self) -> &'a mut W {
        self.variant(TAMP1MSK_A::ResetBySoftware)
    }
    #[doc = "Tamper x event generates a trigger event. TAMPxF is masked and internally cleared by hardware. The backup registers are not erased. The tamper x interrupt must not be enabled when TAMP3MSK is set"]
    #[inline(always)]
    pub fn reset_by_hardware(self) -> &'a mut W {
        self.variant(TAMP1MSK_A::ResetByHardware)
    }
}
#[doc = "TAMP2MSK"]
pub use TAMP1MSK_A as TAMP2MSK_A;
#[doc = "TAMP3MSK"]
pub use TAMP1MSK_A as TAMP3MSK_A;
#[doc = "Field `TAMP2MSK` reader - TAMP2MSK"]
pub use TAMP1MSK_R as TAMP2MSK_R;
#[doc = "Field `TAMP3MSK` reader - TAMP3MSK"]
pub use TAMP1MSK_R as TAMP3MSK_R;
#[doc = "Field `TAMP2MSK` writer - TAMP2MSK"]
pub use TAMP1MSK_W as TAMP2MSK_W;
#[doc = "Field `TAMP3MSK` writer - TAMP3MSK"]
pub use TAMP1MSK_W as TAMP3MSK_W;
#[doc = "Backup registerserase\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BKERASE_A {
    #[doc = "1: Reset backup registers"]
    Reset = 1,
}
impl From<BKERASE_A> for bool {
    #[inline(always)]
    fn from(variant: BKERASE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BKERASE` reader - Backup registerserase"]
pub type BKERASE_R = crate::BitReader<BKERASE_A>;
impl BKERASE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<BKERASE_A> {
        match self.bits {
            true => Some(BKERASE_A::Reset),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `Reset`"]
    #[inline(always)]
    pub fn is_reset(&self) -> bool {
        *self == BKERASE_A::Reset
    }
}
#[doc = "Field `BKERASE` writer - Backup registerserase"]
pub type BKERASE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, BKERASE_A, O>;
impl<'a, const O: u8> BKERASE_W<'a, O> {
    #[doc = "Reset backup registers"]
    #[inline(always)]
    pub fn reset(self) -> &'a mut W {
        self.variant(BKERASE_A::Reset)
    }
}
#[doc = "TAMP1TRG\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TAMP1TRG_A {
    #[doc = "0: If TAMPFLT != 00 Tamper x input staying low triggers a tamper detection event. If TAMPFLT = 00 Tamper x input rising edge and high level triggers a tamper detection event"]
    FilteredLowOrUnfilteredHigh = 0,
    #[doc = "1: If TAMPFLT != 00 Tamper x input staying high triggers a tamper detection event. If TAMPFLT = 00 Tamper x input falling edge and low level triggers a tamper detection event"]
    FilteredHighOrUnfilteredLow = 1,
}
impl From<TAMP1TRG_A> for bool {
    #[inline(always)]
    fn from(variant: TAMP1TRG_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TAMP1TRG` reader - TAMP1TRG"]
pub type TAMP1TRG_R = crate::BitReader<TAMP1TRG_A>;
impl TAMP1TRG_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> TAMP1TRG_A {
        match self.bits {
            false => TAMP1TRG_A::FilteredLowOrUnfilteredHigh,
            true => TAMP1TRG_A::FilteredHighOrUnfilteredLow,
        }
    }
    #[doc = "Checks if the value of the field is `FilteredLowOrUnfilteredHigh`"]
    #[inline(always)]
    pub fn is_filtered_low_or_unfiltered_high(&self) -> bool {
        *self == TAMP1TRG_A::FilteredLowOrUnfilteredHigh
    }
    #[doc = "Checks if the value of the field is `FilteredHighOrUnfilteredLow`"]
    #[inline(always)]
    pub fn is_filtered_high_or_unfiltered_low(&self) -> bool {
        *self == TAMP1TRG_A::FilteredHighOrUnfilteredLow
    }
}
#[doc = "Field `TAMP1TRG` writer - TAMP1TRG"]
pub type TAMP1TRG_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, TAMP1TRG_A, O>;
impl<'a, const O: u8> TAMP1TRG_W<'a, O> {
    #[doc = "If TAMPFLT != 00 Tamper x input staying low triggers a tamper detection event. If TAMPFLT = 00 Tamper x input rising edge and high level triggers a tamper detection event"]
    #[inline(always)]
    pub fn filtered_low_or_unfiltered_high(self) -> &'a mut W {
        self.variant(TAMP1TRG_A::FilteredLowOrUnfilteredHigh)
    }
    #[doc = "If TAMPFLT != 00 Tamper x input staying high triggers a tamper detection event. If TAMPFLT = 00 Tamper x input falling edge and low level triggers a tamper detection event"]
    #[inline(always)]
    pub fn filtered_high_or_unfiltered_low(self) -> &'a mut W {
        self.variant(TAMP1TRG_A::FilteredHighOrUnfilteredLow)
    }
}
#[doc = "TAMP2TRG"]
pub use TAMP1TRG_A as TAMP2TRG_A;
#[doc = "TAMP3TRG"]
pub use TAMP1TRG_A as TAMP3TRG_A;
#[doc = "Field `TAMP2TRG` reader - TAMP2TRG"]
pub use TAMP1TRG_R as TAMP2TRG_R;
#[doc = "Field `TAMP3TRG` reader - TAMP3TRG"]
pub use TAMP1TRG_R as TAMP3TRG_R;
#[doc = "Field `TAMP2TRG` writer - TAMP2TRG"]
pub use TAMP1TRG_W as TAMP2TRG_W;
#[doc = "Field `TAMP3TRG` writer - TAMP3TRG"]
pub use TAMP1TRG_W as TAMP3TRG_W;
impl R {
    #[doc = "Bit 0 - TAMP1NOER"]
    #[inline(always)]
    pub fn tamp1noer(&self) -> TAMP1NOER_R {
        TAMP1NOER_R::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - TAMP2NOER"]
    #[inline(always)]
    pub fn tamp2noer(&self) -> TAMP2NOER_R {
        TAMP2NOER_R::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - TAMP3NOER"]
    #[inline(always)]
    pub fn tamp3noer(&self) -> TAMP3NOER_R {
        TAMP3NOER_R::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 16 - TAMP1MSK"]
    #[inline(always)]
    pub fn tamp1msk(&self) -> TAMP1MSK_R {
        TAMP1MSK_R::new(((self.bits >> 16) & 1) != 0)
    }
    #[doc = "Bit 17 - TAMP2MSK"]
    #[inline(always)]
    pub fn tamp2msk(&self) -> TAMP2MSK_R {
        TAMP2MSK_R::new(((self.bits >> 17) & 1) != 0)
    }
    #[doc = "Bit 18 - TAMP3MSK"]
    #[inline(always)]
    pub fn tamp3msk(&self) -> TAMP3MSK_R {
        TAMP3MSK_R::new(((self.bits >> 18) & 1) != 0)
    }
    #[doc = "Bit 23 - Backup registerserase"]
    #[inline(always)]
    pub fn bkerase(&self) -> BKERASE_R {
        BKERASE_R::new(((self.bits >> 23) & 1) != 0)
    }
    #[doc = "Bit 24 - TAMP1TRG"]
    #[inline(always)]
    pub fn tamp1trg(&self) -> TAMP1TRG_R {
        TAMP1TRG_R::new(((self.bits >> 24) & 1) != 0)
    }
    #[doc = "Bit 25 - TAMP2TRG"]
    #[inline(always)]
    pub fn tamp2trg(&self) -> TAMP2TRG_R {
        TAMP2TRG_R::new(((self.bits >> 25) & 1) != 0)
    }
    #[doc = "Bit 26 - TAMP3TRG"]
    #[inline(always)]
    pub fn tamp3trg(&self) -> TAMP3TRG_R {
        TAMP3TRG_R::new(((self.bits >> 26) & 1) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - TAMP1NOER"]
    #[inline(always)]
    pub fn tamp1noer(&mut self) -> TAMP1NOER_W<0> {
        TAMP1NOER_W::new(self)
    }
    #[doc = "Bit 1 - TAMP2NOER"]
    #[inline(always)]
    pub fn tamp2noer(&mut self) -> TAMP2NOER_W<1> {
        TAMP2NOER_W::new(self)
    }
    #[doc = "Bit 2 - TAMP3NOER"]
    #[inline(always)]
    pub fn tamp3noer(&mut self) -> TAMP3NOER_W<2> {
        TAMP3NOER_W::new(self)
    }
    #[doc = "Bit 16 - TAMP1MSK"]
    #[inline(always)]
    pub fn tamp1msk(&mut self) -> TAMP1MSK_W<16> {
        TAMP1MSK_W::new(self)
    }
    #[doc = "Bit 17 - TAMP2MSK"]
    #[inline(always)]
    pub fn tamp2msk(&mut self) -> TAMP2MSK_W<17> {
        TAMP2MSK_W::new(self)
    }
    #[doc = "Bit 18 - TAMP3MSK"]
    #[inline(always)]
    pub fn tamp3msk(&mut self) -> TAMP3MSK_W<18> {
        TAMP3MSK_W::new(self)
    }
    #[doc = "Bit 23 - Backup registerserase"]
    #[inline(always)]
    pub fn bkerase(&mut self) -> BKERASE_W<23> {
        BKERASE_W::new(self)
    }
    #[doc = "Bit 24 - TAMP1TRG"]
    #[inline(always)]
    pub fn tamp1trg(&mut self) -> TAMP1TRG_W<24> {
        TAMP1TRG_W::new(self)
    }
    #[doc = "Bit 25 - TAMP2TRG"]
    #[inline(always)]
    pub fn tamp2trg(&mut self) -> TAMP2TRG_W<25> {
        TAMP2TRG_W::new(self)
    }
    #[doc = "Bit 26 - TAMP3TRG"]
    #[inline(always)]
    pub fn tamp3trg(&mut self) -> TAMP3TRG_W<26> {
        TAMP3TRG_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "control register 2\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr2](index.html) module"]
pub struct CR2_SPEC;
impl crate::RegisterSpec for CR2_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [cr2::R](R) reader structure"]
impl crate::Readable for CR2_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cr2::W](W) writer structure"]
impl crate::Writable for CR2_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CR2 to value 0"]
impl crate::Resettable for CR2_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}