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