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
#[doc = "Register `CONF0` reader"]
pub type R = crate::R<CONF0_SPEC>;
#[doc = "Register `CONF0` writer"]
pub type W = crate::W<CONF0_SPEC>;
#[doc = "Field `FILTER_THRES` reader - This sets the maximum threshold, in APB_CLK cycles, for the filter. Any pulses with width less than this will be ignored when the filter is enabled."]
pub type FILTER_THRES_R = crate::FieldReader<u16>;
#[doc = "Field `FILTER_THRES` writer - This sets the maximum threshold, in APB_CLK cycles, for the filter. Any pulses with width less than this will be ignored when the filter is enabled."]
pub type FILTER_THRES_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
#[doc = "Field `FILTER_EN` reader - This is the enable bit for unit %s's input filter."]
pub type FILTER_EN_R = crate::BitReader;
#[doc = "Field `FILTER_EN` writer - This is the enable bit for unit %s's input filter."]
pub type FILTER_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `THR_ZERO_EN` reader - This is the enable bit for unit %s's zero comparator."]
pub type THR_ZERO_EN_R = crate::BitReader;
#[doc = "Field `THR_ZERO_EN` writer - This is the enable bit for unit %s's zero comparator."]
pub type THR_ZERO_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `THR_H_LIM_EN` reader - This is the enable bit for unit %s's thr_h_lim comparator."]
pub type THR_H_LIM_EN_R = crate::BitReader;
#[doc = "Field `THR_H_LIM_EN` writer - This is the enable bit for unit %s's thr_h_lim comparator."]
pub type THR_H_LIM_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `THR_L_LIM_EN` reader - This is the enable bit for unit %s's thr_l_lim comparator."]
pub type THR_L_LIM_EN_R = crate::BitReader;
#[doc = "Field `THR_L_LIM_EN` writer - This is the enable bit for unit %s's thr_l_lim comparator."]
pub type THR_L_LIM_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `THR_THRES0_EN` reader - This is the enable bit for unit %s's thres0 comparator."]
pub type THR_THRES0_EN_R = crate::BitReader;
#[doc = "Field `THR_THRES0_EN` writer - This is the enable bit for unit %s's thres0 comparator."]
pub type THR_THRES0_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `THR_THRES1_EN` reader - This is the enable bit for unit %s's thres1 comparator."]
pub type THR_THRES1_EN_R = crate::BitReader;
#[doc = "Field `THR_THRES1_EN` writer - This is the enable bit for unit %s's thres1 comparator."]
pub type THR_THRES1_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Configures the behavior when the signal input of channel %s detects a negative edge.\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum EDGE_MODE {
    #[doc = "1: Increase the counter"]
    Increment = 1,
    #[doc = "2: Decrease the counter"]
    Decrement = 2,
    #[doc = "0: No effect on counter"]
    Hold = 0,
}
impl From<EDGE_MODE> for u8 {
    #[inline(always)]
    fn from(variant: EDGE_MODE) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for EDGE_MODE {
    type Ux = u8;
}
impl crate::IsEnum for EDGE_MODE {}
#[doc = "Field `CH_NEG_MODE(0-1)` reader - Configures the behavior when the signal input of channel %s detects a negative edge."]
pub type CH_NEG_MODE_R = crate::FieldReader<EDGE_MODE>;
impl CH_NEG_MODE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> EDGE_MODE {
        match self.bits {
            1 => EDGE_MODE::Increment,
            2 => EDGE_MODE::Decrement,
            _ => EDGE_MODE::Hold,
        }
    }
    #[doc = "Increase the counter"]
    #[inline(always)]
    pub fn is_increment(&self) -> bool {
        *self == EDGE_MODE::Increment
    }
    #[doc = "Decrease the counter"]
    #[inline(always)]
    pub fn is_decrement(&self) -> bool {
        *self == EDGE_MODE::Decrement
    }
    #[doc = "No effect on counter"]
    #[inline(always)]
    pub fn is_hold(&self) -> bool {
        matches!(self.variant(), EDGE_MODE::Hold)
    }
}
#[doc = "Field `CH_NEG_MODE(0-1)` writer - Configures the behavior when the signal input of channel %s detects a negative edge."]
pub type CH_NEG_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, EDGE_MODE, crate::Safe>;
impl<'a, REG> CH_NEG_MODE_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Increase the counter"]
    #[inline(always)]
    pub fn increment(self) -> &'a mut crate::W<REG> {
        self.variant(EDGE_MODE::Increment)
    }
    #[doc = "Decrease the counter"]
    #[inline(always)]
    pub fn decrement(self) -> &'a mut crate::W<REG> {
        self.variant(EDGE_MODE::Decrement)
    }
    #[doc = "No effect on counter"]
    #[inline(always)]
    pub fn hold(self) -> &'a mut crate::W<REG> {
        self.variant(EDGE_MODE::Hold)
    }
}
#[doc = "Field `CH_POS_MODE(0-1)` reader - Configures the behavior when the signal input of channel %s detects a positive edge."]
pub use CH_NEG_MODE_R as CH_POS_MODE_R;
#[doc = "Field `CH_POS_MODE(0-1)` writer - Configures the behavior when the signal input of channel %s detects a positive edge."]
pub use CH_NEG_MODE_W as CH_POS_MODE_W;
#[doc = "Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high.\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CTRL_MODE {
    #[doc = "0: No modification"]
    Keep = 0,
    #[doc = "1: Invert behavior (increase -> decrease"]
    Reverse = 1,
    #[doc = "2: Inhibit counter modification"]
    Disable = 2,
}
impl From<CTRL_MODE> for u8 {
    #[inline(always)]
    fn from(variant: CTRL_MODE) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for CTRL_MODE {
    type Ux = u8;
}
impl crate::IsEnum for CTRL_MODE {}
#[doc = "Field `CH_HCTRL_MODE(0-1)` reader - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high."]
pub type CH_HCTRL_MODE_R = crate::FieldReader<CTRL_MODE>;
impl CH_HCTRL_MODE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> CTRL_MODE {
        match self.bits {
            0 => CTRL_MODE::Keep,
            1 => CTRL_MODE::Reverse,
            _ => CTRL_MODE::Disable,
        }
    }
    #[doc = "No modification"]
    #[inline(always)]
    pub fn is_keep(&self) -> bool {
        *self == CTRL_MODE::Keep
    }
    #[doc = "Invert behavior (increase -> decrease"]
    #[inline(always)]
    pub fn is_reverse(&self) -> bool {
        *self == CTRL_MODE::Reverse
    }
    #[doc = "Inhibit counter modification"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        matches!(self.variant(), CTRL_MODE::Disable)
    }
}
#[doc = "Field `CH_HCTRL_MODE(0-1)` writer - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high."]
pub type CH_HCTRL_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CTRL_MODE, crate::Safe>;
impl<'a, REG> CH_HCTRL_MODE_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "No modification"]
    #[inline(always)]
    pub fn keep(self) -> &'a mut crate::W<REG> {
        self.variant(CTRL_MODE::Keep)
    }
    #[doc = "Invert behavior (increase -> decrease"]
    #[inline(always)]
    pub fn reverse(self) -> &'a mut crate::W<REG> {
        self.variant(CTRL_MODE::Reverse)
    }
    #[doc = "Inhibit counter modification"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut crate::W<REG> {
        self.variant(CTRL_MODE::Disable)
    }
}
#[doc = "Field `CH_LCTRL_MODE(0-1)` reader - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is low."]
pub use CH_HCTRL_MODE_R as CH_LCTRL_MODE_R;
#[doc = "Field `CH_LCTRL_MODE(0-1)` writer - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is low."]
pub use CH_HCTRL_MODE_W as CH_LCTRL_MODE_W;
impl R {
    #[doc = "Bits 0:9 - This sets the maximum threshold, in APB_CLK cycles, for the filter. Any pulses with width less than this will be ignored when the filter is enabled."]
    #[inline(always)]
    pub fn filter_thres(&self) -> FILTER_THRES_R {
        FILTER_THRES_R::new((self.bits & 0x03ff) as u16)
    }
    #[doc = "Bit 10 - This is the enable bit for unit %s's input filter."]
    #[inline(always)]
    pub fn filter_en(&self) -> FILTER_EN_R {
        FILTER_EN_R::new(((self.bits >> 10) & 1) != 0)
    }
    #[doc = "Bit 11 - This is the enable bit for unit %s's zero comparator."]
    #[inline(always)]
    pub fn thr_zero_en(&self) -> THR_ZERO_EN_R {
        THR_ZERO_EN_R::new(((self.bits >> 11) & 1) != 0)
    }
    #[doc = "Bit 12 - This is the enable bit for unit %s's thr_h_lim comparator."]
    #[inline(always)]
    pub fn thr_h_lim_en(&self) -> THR_H_LIM_EN_R {
        THR_H_LIM_EN_R::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bit 13 - This is the enable bit for unit %s's thr_l_lim comparator."]
    #[inline(always)]
    pub fn thr_l_lim_en(&self) -> THR_L_LIM_EN_R {
        THR_L_LIM_EN_R::new(((self.bits >> 13) & 1) != 0)
    }
    #[doc = "Bit 14 - This is the enable bit for unit %s's thres0 comparator."]
    #[inline(always)]
    pub fn thr_thres0_en(&self) -> THR_THRES0_EN_R {
        THR_THRES0_EN_R::new(((self.bits >> 14) & 1) != 0)
    }
    #[doc = "Bit 15 - This is the enable bit for unit %s's thres1 comparator."]
    #[inline(always)]
    pub fn thr_thres1_en(&self) -> THR_THRES1_EN_R {
        THR_THRES1_EN_R::new(((self.bits >> 15) & 1) != 0)
    }
    #[doc = "Configures the behavior when the signal input of channel (0-1) detects a negative edge."]
    #[doc = ""]
    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `CH0_NEG_MODE` field.</div>"]
    #[inline(always)]
    pub fn ch_neg_mode(&self, n: u8) -> CH_NEG_MODE_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        CH_NEG_MODE_R::new(((self.bits >> (n * 8 + 16)) & 3) as u8)
    }
    #[doc = "Iterator for array of:"]
    #[doc = "Configures the behavior when the signal input of channel (0-1) detects a negative edge."]
    #[inline(always)]
    pub fn ch_neg_mode_iter(&self) -> impl Iterator<Item = CH_NEG_MODE_R> + '_ {
        (0..2).map(move |n| CH_NEG_MODE_R::new(((self.bits >> (n * 8 + 16)) & 3) as u8))
    }
    #[doc = "Bits 16:17 - Configures the behavior when the signal input of channel 0 detects a negative edge."]
    #[inline(always)]
    pub fn ch0_neg_mode(&self) -> CH_NEG_MODE_R {
        CH_NEG_MODE_R::new(((self.bits >> 16) & 3) as u8)
    }
    #[doc = "Bits 24:25 - Configures the behavior when the signal input of channel 1 detects a negative edge."]
    #[inline(always)]
    pub fn ch1_neg_mode(&self) -> CH_NEG_MODE_R {
        CH_NEG_MODE_R::new(((self.bits >> 24) & 3) as u8)
    }
    #[doc = "Configures the behavior when the signal input of channel (0-1) detects a positive edge."]
    #[doc = ""]
    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `CH0_POS_MODE` field.</div>"]
    #[inline(always)]
    pub fn ch_pos_mode(&self, n: u8) -> CH_POS_MODE_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        CH_POS_MODE_R::new(((self.bits >> (n * 8 + 18)) & 3) as u8)
    }
    #[doc = "Iterator for array of:"]
    #[doc = "Configures the behavior when the signal input of channel (0-1) detects a positive edge."]
    #[inline(always)]
    pub fn ch_pos_mode_iter(&self) -> impl Iterator<Item = CH_POS_MODE_R> + '_ {
        (0..2).map(move |n| CH_POS_MODE_R::new(((self.bits >> (n * 8 + 18)) & 3) as u8))
    }
    #[doc = "Bits 18:19 - Configures the behavior when the signal input of channel 0 detects a positive edge."]
    #[inline(always)]
    pub fn ch0_pos_mode(&self) -> CH_POS_MODE_R {
        CH_POS_MODE_R::new(((self.bits >> 18) & 3) as u8)
    }
    #[doc = "Bits 26:27 - Configures the behavior when the signal input of channel 1 detects a positive edge."]
    #[inline(always)]
    pub fn ch1_pos_mode(&self) -> CH_POS_MODE_R {
        CH_POS_MODE_R::new(((self.bits >> 26) & 3) as u8)
    }
    #[doc = "Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high."]
    #[doc = ""]
    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `CH0_HCTRL_MODE` field.</div>"]
    #[inline(always)]
    pub fn ch_hctrl_mode(&self, n: u8) -> CH_HCTRL_MODE_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        CH_HCTRL_MODE_R::new(((self.bits >> (n * 8 + 20)) & 3) as u8)
    }
    #[doc = "Iterator for array of:"]
    #[doc = "Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high."]
    #[inline(always)]
    pub fn ch_hctrl_mode_iter(&self) -> impl Iterator<Item = CH_HCTRL_MODE_R> + '_ {
        (0..2).map(move |n| CH_HCTRL_MODE_R::new(((self.bits >> (n * 8 + 20)) & 3) as u8))
    }
    #[doc = "Bits 20:21 - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high."]
    #[inline(always)]
    pub fn ch0_hctrl_mode(&self) -> CH_HCTRL_MODE_R {
        CH_HCTRL_MODE_R::new(((self.bits >> 20) & 3) as u8)
    }
    #[doc = "Bits 28:29 - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high."]
    #[inline(always)]
    pub fn ch1_hctrl_mode(&self) -> CH_HCTRL_MODE_R {
        CH_HCTRL_MODE_R::new(((self.bits >> 28) & 3) as u8)
    }
    #[doc = "Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is low."]
    #[doc = ""]
    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `CH0_LCTRL_MODE` field.</div>"]
    #[inline(always)]
    pub fn ch_lctrl_mode(&self, n: u8) -> CH_LCTRL_MODE_R {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        CH_LCTRL_MODE_R::new(((self.bits >> (n * 8 + 22)) & 3) as u8)
    }
    #[doc = "Iterator for array of:"]
    #[doc = "Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is low."]
    #[inline(always)]
    pub fn ch_lctrl_mode_iter(&self) -> impl Iterator<Item = CH_LCTRL_MODE_R> + '_ {
        (0..2).map(move |n| CH_LCTRL_MODE_R::new(((self.bits >> (n * 8 + 22)) & 3) as u8))
    }
    #[doc = "Bits 22:23 - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is low."]
    #[inline(always)]
    pub fn ch0_lctrl_mode(&self) -> CH_LCTRL_MODE_R {
        CH_LCTRL_MODE_R::new(((self.bits >> 22) & 3) as u8)
    }
    #[doc = "Bits 30:31 - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is low."]
    #[inline(always)]
    pub fn ch1_lctrl_mode(&self) -> CH_LCTRL_MODE_R {
        CH_LCTRL_MODE_R::new(((self.bits >> 30) & 3) as u8)
    }
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("CONF0")
            .field("filter_thres", &self.filter_thres())
            .field("filter_en", &self.filter_en())
            .field("thr_zero_en", &self.thr_zero_en())
            .field("thr_h_lim_en", &self.thr_h_lim_en())
            .field("thr_l_lim_en", &self.thr_l_lim_en())
            .field("thr_thres0_en", &self.thr_thres0_en())
            .field("thr_thres1_en", &self.thr_thres1_en())
            .field("ch0_neg_mode", &self.ch0_neg_mode())
            .field("ch1_neg_mode", &self.ch1_neg_mode())
            .field("ch0_pos_mode", &self.ch0_pos_mode())
            .field("ch1_pos_mode", &self.ch1_pos_mode())
            .field("ch0_hctrl_mode", &self.ch0_hctrl_mode())
            .field("ch1_hctrl_mode", &self.ch1_hctrl_mode())
            .field("ch0_lctrl_mode", &self.ch0_lctrl_mode())
            .field("ch1_lctrl_mode", &self.ch1_lctrl_mode())
            .finish()
    }
}
impl W {
    #[doc = "Bits 0:9 - This sets the maximum threshold, in APB_CLK cycles, for the filter. Any pulses with width less than this will be ignored when the filter is enabled."]
    #[inline(always)]
    #[must_use]
    pub fn filter_thres(&mut self) -> FILTER_THRES_W<CONF0_SPEC> {
        FILTER_THRES_W::new(self, 0)
    }
    #[doc = "Bit 10 - This is the enable bit for unit %s's input filter."]
    #[inline(always)]
    #[must_use]
    pub fn filter_en(&mut self) -> FILTER_EN_W<CONF0_SPEC> {
        FILTER_EN_W::new(self, 10)
    }
    #[doc = "Bit 11 - This is the enable bit for unit %s's zero comparator."]
    #[inline(always)]
    #[must_use]
    pub fn thr_zero_en(&mut self) -> THR_ZERO_EN_W<CONF0_SPEC> {
        THR_ZERO_EN_W::new(self, 11)
    }
    #[doc = "Bit 12 - This is the enable bit for unit %s's thr_h_lim comparator."]
    #[inline(always)]
    #[must_use]
    pub fn thr_h_lim_en(&mut self) -> THR_H_LIM_EN_W<CONF0_SPEC> {
        THR_H_LIM_EN_W::new(self, 12)
    }
    #[doc = "Bit 13 - This is the enable bit for unit %s's thr_l_lim comparator."]
    #[inline(always)]
    #[must_use]
    pub fn thr_l_lim_en(&mut self) -> THR_L_LIM_EN_W<CONF0_SPEC> {
        THR_L_LIM_EN_W::new(self, 13)
    }
    #[doc = "Bit 14 - This is the enable bit for unit %s's thres0 comparator."]
    #[inline(always)]
    #[must_use]
    pub fn thr_thres0_en(&mut self) -> THR_THRES0_EN_W<CONF0_SPEC> {
        THR_THRES0_EN_W::new(self, 14)
    }
    #[doc = "Bit 15 - This is the enable bit for unit %s's thres1 comparator."]
    #[inline(always)]
    #[must_use]
    pub fn thr_thres1_en(&mut self) -> THR_THRES1_EN_W<CONF0_SPEC> {
        THR_THRES1_EN_W::new(self, 15)
    }
    #[doc = "Configures the behavior when the signal input of channel (0-1) detects a negative edge."]
    #[doc = ""]
    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `CH0_NEG_MODE` field.</div>"]
    #[inline(always)]
    #[must_use]
    pub fn ch_neg_mode(&mut self, n: u8) -> CH_NEG_MODE_W<CONF0_SPEC> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        CH_NEG_MODE_W::new(self, n * 8 + 16)
    }
    #[doc = "Bits 16:17 - Configures the behavior when the signal input of channel 0 detects a negative edge."]
    #[inline(always)]
    #[must_use]
    pub fn ch0_neg_mode(&mut self) -> CH_NEG_MODE_W<CONF0_SPEC> {
        CH_NEG_MODE_W::new(self, 16)
    }
    #[doc = "Bits 24:25 - Configures the behavior when the signal input of channel 1 detects a negative edge."]
    #[inline(always)]
    #[must_use]
    pub fn ch1_neg_mode(&mut self) -> CH_NEG_MODE_W<CONF0_SPEC> {
        CH_NEG_MODE_W::new(self, 24)
    }
    #[doc = "Configures the behavior when the signal input of channel (0-1) detects a positive edge."]
    #[doc = ""]
    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `CH0_POS_MODE` field.</div>"]
    #[inline(always)]
    #[must_use]
    pub fn ch_pos_mode(&mut self, n: u8) -> CH_POS_MODE_W<CONF0_SPEC> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        CH_POS_MODE_W::new(self, n * 8 + 18)
    }
    #[doc = "Bits 18:19 - Configures the behavior when the signal input of channel 0 detects a positive edge."]
    #[inline(always)]
    #[must_use]
    pub fn ch0_pos_mode(&mut self) -> CH_POS_MODE_W<CONF0_SPEC> {
        CH_POS_MODE_W::new(self, 18)
    }
    #[doc = "Bits 26:27 - Configures the behavior when the signal input of channel 1 detects a positive edge."]
    #[inline(always)]
    #[must_use]
    pub fn ch1_pos_mode(&mut self) -> CH_POS_MODE_W<CONF0_SPEC> {
        CH_POS_MODE_W::new(self, 26)
    }
    #[doc = "Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high."]
    #[doc = ""]
    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `CH0_HCTRL_MODE` field.</div>"]
    #[inline(always)]
    #[must_use]
    pub fn ch_hctrl_mode(&mut self, n: u8) -> CH_HCTRL_MODE_W<CONF0_SPEC> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        CH_HCTRL_MODE_W::new(self, n * 8 + 20)
    }
    #[doc = "Bits 20:21 - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high."]
    #[inline(always)]
    #[must_use]
    pub fn ch0_hctrl_mode(&mut self) -> CH_HCTRL_MODE_W<CONF0_SPEC> {
        CH_HCTRL_MODE_W::new(self, 20)
    }
    #[doc = "Bits 28:29 - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is high."]
    #[inline(always)]
    #[must_use]
    pub fn ch1_hctrl_mode(&mut self) -> CH_HCTRL_MODE_W<CONF0_SPEC> {
        CH_HCTRL_MODE_W::new(self, 28)
    }
    #[doc = "Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is low."]
    #[doc = ""]
    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `CH0_LCTRL_MODE` field.</div>"]
    #[inline(always)]
    #[must_use]
    pub fn ch_lctrl_mode(&mut self, n: u8) -> CH_LCTRL_MODE_W<CONF0_SPEC> {
        #[allow(clippy::no_effect)]
        [(); 2][n as usize];
        CH_LCTRL_MODE_W::new(self, n * 8 + 22)
    }
    #[doc = "Bits 22:23 - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is low."]
    #[inline(always)]
    #[must_use]
    pub fn ch0_lctrl_mode(&mut self) -> CH_LCTRL_MODE_W<CONF0_SPEC> {
        CH_LCTRL_MODE_W::new(self, 22)
    }
    #[doc = "Bits 30:31 - Configures how the CHn_POS_MODE/CHn_NEG_MODE settings will be modified when the control signal is low."]
    #[inline(always)]
    #[must_use]
    pub fn ch1_lctrl_mode(&mut self) -> CH_LCTRL_MODE_W<CONF0_SPEC> {
        CH_LCTRL_MODE_W::new(self, 30)
    }
}
#[doc = "Configuration register 0 for unit\n\nYou can [`read`](crate::Reg::read) this register and get [`conf0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`conf0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CONF0_SPEC;
impl crate::RegisterSpec for CONF0_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [`conf0::R`](R) reader structure"]
impl crate::Readable for CONF0_SPEC {}
#[doc = "`write(|w| ..)` method takes [`conf0::W`](W) writer structure"]
impl crate::Writable for CONF0_SPEC {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets CONF0 to value 0x3c10"]
impl crate::Resettable for CONF0_SPEC {
    const RESET_VALUE: u32 = 0x3c10;
}