imxrt_ral/blocks/imxrt1021/
cmp.rs

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
#[doc = "High-Speed Comparator (CMP), Voltage Reference (VREF) Digital-to-Analog Converter (DAC), and Analog Mux (ANMUX)"]
#[repr(C)]
pub struct RegisterBlock {
    #[doc = "CMP Control Register 0"]
    pub CR0: crate::RWRegister<u8>,
    #[doc = "CMP Control Register 1"]
    pub CR1: crate::RWRegister<u8>,
    #[doc = "CMP Filter Period Register"]
    pub FPR: crate::RWRegister<u8>,
    #[doc = "CMP Status and Control Register"]
    pub SCR: crate::RWRegister<u8>,
    #[doc = "DAC Control Register"]
    pub DACCR: crate::RWRegister<u8>,
    #[doc = "MUX Control Register"]
    pub MUXCR: crate::RWRegister<u8>,
}
#[doc = "CMP Control Register 0"]
pub mod CR0 {
    #[doc = "Comparator hard block hysteresis control"]
    pub mod HYSTCTR {
        pub const offset: u8 = 0;
        pub const mask: u8 = 0x03 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Level 0"]
            pub const HYSTCTR_0: u8 = 0;
            #[doc = "Level 1"]
            pub const HYSTCTR_1: u8 = 0x01;
            #[doc = "Level 2"]
            pub const HYSTCTR_2: u8 = 0x02;
            #[doc = "Level 3"]
            pub const HYSTCTR_3: u8 = 0x03;
        }
    }
    #[doc = "Filter Sample Count"]
    pub mod FILTER_CNT {
        pub const offset: u8 = 4;
        pub const mask: u8 = 0x07 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Filter is disabled. If SE = 1, then COUT is a logic 0. This is not a legal state, and is not recommended. If SE = 0, COUT = COUTA."]
            pub const FILTER_CNT_0: u8 = 0;
            #[doc = "One sample must agree. The comparator output is simply sampled."]
            pub const FILTER_CNT_1: u8 = 0x01;
            #[doc = "2 consecutive samples must agree."]
            pub const FILTER_CNT_2: u8 = 0x02;
            #[doc = "3 consecutive samples must agree."]
            pub const FILTER_CNT_3: u8 = 0x03;
            #[doc = "4 consecutive samples must agree."]
            pub const FILTER_CNT_4: u8 = 0x04;
            #[doc = "5 consecutive samples must agree."]
            pub const FILTER_CNT_5: u8 = 0x05;
            #[doc = "6 consecutive samples must agree."]
            pub const FILTER_CNT_6: u8 = 0x06;
            #[doc = "7 consecutive samples must agree."]
            pub const FILTER_CNT_7: u8 = 0x07;
        }
    }
}
#[doc = "CMP Control Register 1"]
pub mod CR1 {
    #[doc = "Comparator Module Enable"]
    pub mod EN {
        pub const offset: u8 = 0;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Analog Comparator is disabled."]
            pub const EN_0: u8 = 0;
            #[doc = "Analog Comparator is enabled."]
            pub const EN_1: u8 = 0x01;
        }
    }
    #[doc = "Comparator Output Pin Enable"]
    pub mod OPE {
        pub const offset: u8 = 1;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "CMPO is not available on the associated CMPO output pin. If the comparator does not own the pin, this field has no effect."]
            pub const OPE_0: u8 = 0;
            #[doc = "CMPO is available on the associated CMPO output pin. The comparator output (CMPO) is driven out on the associated CMPO output pin if the comparator owns the pin. If the comparator does not own the field, this bit has no effect."]
            pub const OPE_1: u8 = 0x01;
        }
    }
    #[doc = "Comparator Output Select"]
    pub mod COS {
        pub const offset: u8 = 2;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Set the filtered comparator output (CMPO) to equal COUT."]
            pub const COS_0: u8 = 0;
            #[doc = "Set the unfiltered comparator output (CMPO) to equal COUTA."]
            pub const COS_1: u8 = 0x01;
        }
    }
    #[doc = "Comparator INVERT"]
    pub mod INV {
        pub const offset: u8 = 3;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Does not invert the comparator output."]
            pub const INV_0: u8 = 0;
            #[doc = "Inverts the comparator output."]
            pub const INV_1: u8 = 0x01;
        }
    }
    #[doc = "Power Mode Select"]
    pub mod PMODE {
        pub const offset: u8 = 4;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Low-Speed (LS) Comparison mode selected. In this mode, CMP has slower output propagation delay and lower current consumption."]
            pub const PMODE_0: u8 = 0;
            #[doc = "High-Speed (HS) Comparison mode selected. In this mode, CMP has faster output propagation delay and higher current consumption."]
            pub const PMODE_1: u8 = 0x01;
        }
    }
    #[doc = "Windowing Enable"]
    pub mod WE {
        pub const offset: u8 = 6;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Windowing mode is not selected."]
            pub const WE_0: u8 = 0;
            #[doc = "Windowing mode is selected."]
            pub const WE_1: u8 = 0x01;
        }
    }
    #[doc = "Sample Enable"]
    pub mod SE {
        pub const offset: u8 = 7;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Sampling mode is not selected."]
            pub const SE_0: u8 = 0;
            #[doc = "Sampling mode is selected."]
            pub const SE_1: u8 = 0x01;
        }
    }
}
#[doc = "CMP Filter Period Register"]
pub mod FPR {
    #[doc = "Filter Sample Period"]
    pub mod FILT_PER {
        pub const offset: u8 = 0;
        pub const mask: u8 = 0xff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "CMP Status and Control Register"]
pub mod SCR {
    #[doc = "Analog Comparator Output"]
    pub mod COUT {
        pub const offset: u8 = 0;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "Analog Comparator Flag Falling"]
    pub mod CFF {
        pub const offset: u8 = 1;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Falling-edge on COUT has not been detected."]
            pub const CFF_0: u8 = 0;
            #[doc = "Falling-edge on COUT has occurred."]
            pub const CFF_1: u8 = 0x01;
        }
    }
    #[doc = "Analog Comparator Flag Rising"]
    pub mod CFR {
        pub const offset: u8 = 2;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Rising-edge on COUT has not been detected."]
            pub const CFR_0: u8 = 0;
            #[doc = "Rising-edge on COUT has occurred."]
            pub const CFR_1: u8 = 0x01;
        }
    }
    #[doc = "Comparator Interrupt Enable Falling"]
    pub mod IEF {
        pub const offset: u8 = 3;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Interrupt is disabled."]
            pub const IEF_0: u8 = 0;
            #[doc = "Interrupt is enabled."]
            pub const IEF_1: u8 = 0x01;
        }
    }
    #[doc = "Comparator Interrupt Enable Rising"]
    pub mod IER {
        pub const offset: u8 = 4;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Interrupt is disabled."]
            pub const IER_0: u8 = 0;
            #[doc = "Interrupt is enabled."]
            pub const IER_1: u8 = 0x01;
        }
    }
    #[doc = "DMA Enable Control"]
    pub mod DMAEN {
        pub const offset: u8 = 6;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "DMA is disabled."]
            pub const DMAEN_0: u8 = 0;
            #[doc = "DMA is enabled."]
            pub const DMAEN_1: u8 = 0x01;
        }
    }
}
#[doc = "DAC Control Register"]
pub mod DACCR {
    #[doc = "DAC Output Voltage Select"]
    pub mod VOSEL {
        pub const offset: u8 = 0;
        pub const mask: u8 = 0x3f << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "Supply Voltage Reference Source Select"]
    pub mod VRSEL {
        pub const offset: u8 = 6;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Vin1 is selected as resistor ladder network supply reference."]
            pub const VRSEL_0: u8 = 0;
            #[doc = "Vin2 is selected as resistor ladder network supply reference."]
            pub const VRSEL_1: u8 = 0x01;
        }
    }
    #[doc = "DAC Enable"]
    pub mod DACEN {
        pub const offset: u8 = 7;
        pub const mask: u8 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "DAC is disabled."]
            pub const DACEN_0: u8 = 0;
            #[doc = "DAC is enabled."]
            pub const DACEN_1: u8 = 0x01;
        }
    }
}
#[doc = "MUX Control Register"]
pub mod MUXCR {
    #[doc = "Minus Input Mux Control"]
    pub mod MSEL {
        pub const offset: u8 = 0;
        pub const mask: u8 = 0x07 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "IN0"]
            pub const MSEL_0: u8 = 0;
            #[doc = "IN1"]
            pub const MSEL_1: u8 = 0x01;
            #[doc = "IN2"]
            pub const MSEL_2: u8 = 0x02;
            #[doc = "IN3"]
            pub const MSEL_3: u8 = 0x03;
            #[doc = "IN4"]
            pub const MSEL_4: u8 = 0x04;
            #[doc = "IN5"]
            pub const MSEL_5: u8 = 0x05;
            #[doc = "IN6"]
            pub const MSEL_6: u8 = 0x06;
            #[doc = "IN7"]
            pub const MSEL_7: u8 = 0x07;
        }
    }
    #[doc = "Plus Input Mux Control"]
    pub mod PSEL {
        pub const offset: u8 = 3;
        pub const mask: u8 = 0x07 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "IN0"]
            pub const PSEL_0: u8 = 0;
            #[doc = "IN1"]
            pub const PSEL_1: u8 = 0x01;
            #[doc = "IN2"]
            pub const PSEL_2: u8 = 0x02;
            #[doc = "IN3"]
            pub const PSEL_3: u8 = 0x03;
            #[doc = "IN4"]
            pub const PSEL_4: u8 = 0x04;
            #[doc = "IN5"]
            pub const PSEL_5: u8 = 0x05;
            #[doc = "IN6"]
            pub const PSEL_6: u8 = 0x06;
            #[doc = "IN7"]
            pub const PSEL_7: u8 = 0x07;
        }
    }
}