annotate Scan/CK3/matrix.h @ 425:971e88d4420a

Updated CK3 with Scan_currentChange (copy from MD1).
author CryHam <cryham@gmail.com>
date Tue, 01 Mar 2016 21:00:23 +0100
parents be6b57c5b438
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
423
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
1 /* Copyright (C) 2014-2016 by Jacob Alexander, Crystal Hammer
415
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
2 *
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
4 * of this software and associated documentation files (the "Software"), to deal
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
5 * in the Software without restriction, including without limitation the rights
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
7 * copies of the Software, and to permit persons to whom the Software is
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
8 * furnished to do so, subject to the following conditions:
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
9 *
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
10 * The above copyright notice and this permission notice shall be included in
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
11 * all copies or substantial portions of the Software.
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
12 *
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
19 * THE SOFTWARE.
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
20 */
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
21
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
22 #pragma once
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
23
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
24 // ----- Includes -----
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
25
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
26 // Project Includes
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
27 #include <matrix_setup.h>
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
28
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
29
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
30 // ----- Matrix Definition -----
423
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
31 // CK3
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
32 // Columns (Strobe) 18
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
33 // Rows (Sense) 8
415
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
34
423
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
35 // This is the default map of just A4Tech KX-100 matrix
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
36 // scan codes for keys are defined in defaultMap.kll
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
37 /*
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
38 1| 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
39 -
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
40 1 Mcmp Bstp Esc \ F4 Up Del Ins Spc G H F6 == Vol- AltL xx F11 '
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
41 2 Calc ExA4 ExC2 ExE2 ExE1 <- Sub -> Dn B N ExC1 Apps Mnxt AltR xx F12 /
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
42 3 Mstp Bbck Z X C Mpau Mul Div NumL V M , . Vol+ xx CtrR Ent \
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
43 4 GuiR Bfwd A S D Ent PgDn Dn End F J K L ShiR xx == \ ;
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
44 5 xx Mail Q W E Add PgUp Up Home R U I O xx ScrL Paus ExE3 P
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
45 6 ExB1 GuiL Tab Caps F3 RB~ -> Del <- T Y ] F7 ShiL == Pwr Back [
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
46 7 xx Bsch 1 2 3 End PgDn xx Pwr 4 7 8 9 Msel Ptr F5 F10 0
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
47 8 Bhom Vmut `~ F1 F2 Home PgUp Ins Del 5 6 = F8 Mprv == CtrL F9 -
415
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
48
423
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
49 rows - columns |
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
50 1 3 5 7 1 3 5 7 9 11 13 15 17
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
51 2 4 6 8 2 4 6 8 10 12 14 16 18 connectors, PCB view
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
52 */
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
53 GPIO_Pin Matrix_cols[] = {
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
54 gpio(B,16), gpio(B,17), gpio(D,0), gpio(A,12), gpio(A,13), gpio(D,7), gpio(D,4), gpio(D,2), gpio(D,3),
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
55 gpio(C,2), gpio(C,1), gpio(D,6), gpio(D,5), gpio(B,2), gpio(B,3), gpio(B,1), gpio(B,0), gpio(C,0) };
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
56 GPIO_Pin Matrix_rows[] = {
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
57 gpio(C,10), gpio(C,11), gpio(B,18), gpio(A,4), gpio(A,5), gpio(B,19), gpio(C,9), gpio(C,8) };
415
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
58
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
59 // Define type of scan matrix
423
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
60 Config Matrix_type = Config_Pullup;
415
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
61
293154e4aafe Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
diff changeset
62
416
060aa589b307 Minor styling fixes.
CryHam <cryham@gmail.com>
parents: 415
diff changeset
63 // Define this if your matrix has ghosting (i.e. regular keyboard without diodes)
060aa589b307 Minor styling fixes.
CryHam <cryham@gmail.com>
parents: 415
diff changeset
64 // this will enable the anti-ghosting code
060aa589b307 Minor styling fixes.
CryHam <cryham@gmail.com>
parents: 415
diff changeset
65 #define GHOSTING_MATRIX
423
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
66
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
67 // delay in microseconds before and after each strobe change during matrix scan
be6b57c5b438 Changed CK3 matrix scan to Config_Pullup, inverted rows and columns
CryHam <cryham@gmail.com>
parents: 416
diff changeset
68 #define STROBE_DELAY 10