]> git.donarmstrong.com Git - kiibohd-controller.git/blob - Scan/matrix/matrix_scan.h
2c3a65fc27ed3e78be53ce8633a6913eb74442f3
[kiibohd-controller.git] / Scan / matrix / matrix_scan.h
1 /* Copyright (C) 2011,2014 by Jacob Alexander
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 #ifndef __MATRIX_SCAN_H
23 #define __MATRIX_SCAN_H
24
25 // ----- Includes -----
26
27 // Compiler Includes
28 #include <stdint.h>
29
30 // Local Includes
31
32
33
34 // ----- Defines -----
35
36 // ----- Quick Map (don't change) -----
37 #define pinA0  0
38 #define pinA1  1
39 #define pinA2  2
40 #define pinA3  3
41 #define pinA4  4
42 #define pinA5  5
43 #define pinA6  6
44 #define pinA7  7
45
46 #define pinB0 10
47 #define pinB1 11
48 #define pinB2 12
49 #define pinB3 13
50 #define pinB4 14
51 #define pinB5 15
52 #define pinB6 16
53 #define pinB7 17
54
55 #define pinC0 20
56 #define pinC1 21
57 #define pinC2 22
58 #define pinC3 23
59 #define pinC4 24
60 #define pinC5 25
61 #define pinC6 26
62 #define pinC7 27
63
64 #define pinD0 30
65 #define pinD1 31
66 #define pinD2 32
67 #define pinD3 33
68 #define pinD4 34
69 #define pinD5 35
70 #define pinD6 36
71 #define pinD7 37
72
73 #define pinE0 40
74 #define pinE1 41
75 #define pinE2 42
76 #define pinE3 43
77 #define pinE4 44
78 #define pinE5 45
79 #define pinE6 46
80 #define pinE7 47
81
82 #define pinF0 50
83 #define pinF1 51
84 #define pinF2 52
85 #define pinF3 53
86 #define pinF4 54
87 #define pinF5 55
88 #define pinF6 56
89 #define pinF7 57
90
91 #define pinNULL 128
92
93
94
95 // ----- Scan Mode (usually dual-scan) -----
96 // Ordered by increasing memory/CPU usage
97 #define scanRow         0  // Needed for powered switches (Hall-Effect)
98 #define scanCol         1  // Opposite of scanRow
99 #define scanRow_powrCol 2  // NKRO supported matrix (simple detection)
100 #define scanCol_powrRow 3  // Opposite of scanRow_powrCol
101 #define scanDual        4  // Typical ~2KRO matrix
102
103 #define powrRow         5  // Matrix setup for powering a row, initially the row would be set low
104 #define powrCol         6  // Like powrRow but for columns
105
106
107 // ----- Direction -----
108 #define columnSet       0  // PIN_SET_COL for PIN_SET
109 #define rowSet          1  // PIN_SET_ROW for PIN_SET
110
111
112
113 // ----- Variables -----
114
115
116
117 // ----- Functions -----
118
119 void matrix_pinSetup( uint8_t *matrix, uint8_t scanType );
120 void matrix_scan( uint8_t *matrix, uint8_t *detectArray );
121
122 #endif // __MATRIX_SCAN_H
123