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