rmk_q6_he_ansi/matrix/sensor_mapping.rs
1use crate::keymap::{COL, ROW};
2
3/// Compile-time guards: if `ROW` or `COL` in `keymap.rs` ever change, the
4/// hardcoded dimensions of [`SENSOR_POSITIONS`] must be updated to match.
5const _: [(); ROW] = [(); 6];
6const _: [(); COL] = [(); 21];
7
8/// Whether each matrix position has a physical hall-effect sensor.
9///
10/// Excluding these positions from calibration prevents their floating ADC
11/// readings from crossing the threshold spuriously and
12/// advancing `calibrated_count` to `total_keys` prematurely, which would cut
13/// the full-travel window short before all real keys are pressed.
14pub const SENSOR_POSITIONS: [[bool; COL]; ROW] = [
15 // Row 0: col 13 = AudioMute mapped to the encoder button; no hall switch.
16 [
17 true, true, true, true, true, true, true, true, true, true, true, true, true, false, true, true, true, true,
18 true, true, true,
19 ],
20 // Row 1: all 21 positions populated.
21 [
22 true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
23 true, true, true,
24 ],
25 // Row 2: all 21 positions populated.
26 [
27 true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
28 true, true, true,
29 ],
30 // Row 3: cols 13–16 = a!(No) (gap right of Enter + left nav cluster gap);
31 // col 20 = a!(No) (KpPlus spans rows 2–3, no second sensor).
32 [
33 true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true,
34 true, true, false,
35 ],
36 // Row 4: col 1 = a!(No) (LShift 2.25U wide, no second sensor),
37 // col 12 = a!(No) (RShift 2.75U wide, no second sensor),
38 // col 14 = a!(No) (gap left of Up arrow),
39 // col 16 = a!(No) (gap right of Up arrow).
40 [
41 true, false, true, true, true, true, true, true, true, true, true, true, false, true, false, true, false, true,
42 true, true, true,
43 ],
44 // Row 5: cols 3–5 = a!(No) (Space 6.25U wide, no additional sensors),
45 // cols 7–8 = df!(0)/df!(1) layer-toggle virtual keys (PB12 GPIO, no ADC),
46 // col 13 = a!(No) (gap right of RCtrl),
47 // cols 19–20 = a!(No) (KpEnter spans rows 4–5, no second sensor).
48 [
49 true, true, true, false, false, false, true, false, false, true, true, true, true, false, true, true, true,
50 true, true, false, false,
51 ],
52];