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
#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
//! KPP Registers
//!
//! Used by: imxrt1051, imxrt1052
use crate::RWRegister;
#[cfg(not(feature = "nosync"))]
use core::marker::PhantomData;
/// Keypad Control Register
pub mod KPCR {
/// Keypad Row Enable
pub mod KRE {
/// Offset (0 bits)
pub const offset: u16 = 0;
/// Mask (8 bits: 0xff << 0)
pub const mask: u16 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b00000000: Row is not included in the keypad key press detect.
pub const KRE_0: u16 = 0b00000000;
/// 0b00000001: Row is included in the keypad key press detect.
pub const KRE_1: u16 = 0b00000001;
}
}
/// Keypad Column Strobe Open-Drain Enable
pub mod KCO {
/// Offset (8 bits)
pub const offset: u16 = 8;
/// Mask (8 bits: 0xff << 8)
pub const mask: u16 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b00000000: Column strobe output is totem pole drive.
pub const TOTEM_POLE: u16 = 0b00000000;
/// 0b00000001: Column strobe output is open drain.
pub const OPEN_DRAIN: u16 = 0b00000001;
}
}
}
/// Keypad Status Register
pub mod KPSR {
/// Keypad Key Depress
pub mod KPKD {
/// Offset (0 bits)
pub const offset: u16 = 0;
/// Mask (1 bit: 1 << 0)
pub const mask: u16 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No key presses detected
pub const KPKD_0: u16 = 0b0;
/// 0b1: A key has been depressed
pub const KPKD_1: u16 = 0b1;
}
}
/// Keypad Key Release
pub mod KPKR {
/// Offset (1 bits)
pub const offset: u16 = 1;
/// Mask (1 bit: 1 << 1)
pub const mask: u16 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No key release detected
pub const KPKR_0: u16 = 0b0;
/// 0b1: All keys have been released
pub const KPKR_1: u16 = 0b1;
}
}
/// Key Depress Synchronizer Clear
pub mod KDSC {
/// Offset (2 bits)
pub const offset: u16 = 2;
/// Mask (1 bit: 1 << 2)
pub const mask: u16 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No effect
pub const KDSC_0: u16 = 0b0;
/// 0b1: Set bits that clear the keypad depress synchronizer chain
pub const KDSC_1: u16 = 0b1;
}
}
/// Key Release Synchronizer Set
pub mod KRSS {
/// Offset (3 bits)
pub const offset: u16 = 3;
/// Mask (1 bit: 1 << 3)
pub const mask: u16 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No effect
pub const KRSS_0: u16 = 0b0;
/// 0b1: Set bits which sets keypad release synchronizer chain
pub const KRSS_1: u16 = 0b1;
}
}
/// Keypad Key Depress Interrupt Enable
pub mod KDIE {
/// Offset (8 bits)
pub const offset: u16 = 8;
/// Mask (1 bit: 1 << 8)
pub const mask: u16 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No interrupt request is generated when KPKD is set.
pub const KDIE_0: u16 = 0b0;
/// 0b1: An interrupt request is generated when KPKD is set.
pub const KDIE_1: u16 = 0b1;
}
}
/// Keypad Release Interrupt Enable
pub mod KRIE {
/// Offset (9 bits)
pub const offset: u16 = 9;
/// Mask (1 bit: 1 << 9)
pub const mask: u16 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No interrupt request is generated when KPKR is set.
pub const KRIE_0: u16 = 0b0;
/// 0b1: An interrupt request is generated when KPKR is set.
pub const KRIE_1: u16 = 0b1;
}
}
}
/// Keypad Data Direction Register
pub mod KDDR {
/// Keypad Row Data Direction
pub mod KRDD {
/// Offset (0 bits)
pub const offset: u16 = 0;
/// Mask (8 bits: 0xff << 0)
pub const mask: u16 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b00000000: ROWn pin configured as an input.
pub const INPUT: u16 = 0b00000000;
/// 0b00000001: ROWn pin configured as an output.
pub const OUTPUT: u16 = 0b00000001;
}
}
/// Keypad Column Data Direction Register
pub mod KCDD {
/// Offset (8 bits)
pub const offset: u16 = 8;
/// Mask (8 bits: 0xff << 8)
pub const mask: u16 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b00000000: COLn pin is configured as an input.
pub const INPUT: u16 = 0b00000000;
/// 0b00000001: COLn pin is configured as an output.
pub const OUTPUT: u16 = 0b00000001;
}
}
}
/// Keypad Data Register
pub mod KPDR {
/// Keypad Row Data
pub mod KRD {
/// Offset (0 bits)
pub const offset: u16 = 0;
/// Mask (8 bits: 0xff << 0)
pub const mask: u16 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// Keypad Column Data
pub mod KCD {
/// Offset (8 bits)
pub const offset: u16 = 8;
/// Mask (8 bits: 0xff << 8)
pub const mask: u16 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
}
#[repr(C)]
pub struct RegisterBlock {
/// Keypad Control Register
pub KPCR: RWRegister<u16>,
/// Keypad Status Register
pub KPSR: RWRegister<u16>,
/// Keypad Data Direction Register
pub KDDR: RWRegister<u16>,
/// Keypad Data Register
pub KPDR: RWRegister<u16>,
}
pub struct ResetValues {
pub KPCR: u16,
pub KPSR: u16,
pub KDDR: u16,
pub KPDR: u16,
}
#[cfg(not(feature = "nosync"))]
pub struct Instance {
pub(crate) addr: u32,
pub(crate) _marker: PhantomData<*const RegisterBlock>,
}
#[cfg(not(feature = "nosync"))]
impl ::core::ops::Deref for Instance {
type Target = RegisterBlock;
#[inline(always)]
fn deref(&self) -> &RegisterBlock {
unsafe { &*(self.addr as *const _) }
}
}
#[cfg(feature = "rtfm")]
unsafe impl Send for Instance {}