Mercurial > louis > kiibohd-controller
annotate Scan/MatrixARM/matrix_scan.h @ 415:293154e4aafe
Added support for ghosting matrices and code for elimination.
To use define GHOST in matrix.h, see example in Scan/CK3
author | CryHam <cryham@gmail.com> |
---|---|
date | Fri, 19 Feb 2016 18:10:25 +0100 |
parents | e464aaa4730f |
children | 060aa589b307 |
rev | line source |
---|---|
293
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
1 /* Copyright (C) 2014-2015 by Jacob Alexander |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
2 * |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
3 * Permission is hereby granted, free of charge, to any person obtaining a copy |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
4 * of this software and associated documentation files (the "Software"), to deal |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
5 * in the Software without restriction, including without limitation the rights |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
7 * copies of the Software, and to permit persons to whom the Software is |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
8 * furnished to do so, subject to the following conditions: |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
9 * |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
10 * The above copyright notice and this permission notice shall be included in |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
11 * all copies or substantial portions of the Software. |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
12 * |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
19 * THE SOFTWARE. |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
20 */ |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
21 |
341 | 22 #pragma once |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
23 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
24 // ----- Includes ----- |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
25 |
293
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
26 // KLL Generated Defines |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
27 #include <kll_defs.h> |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
28 |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
29 |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
30 |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
31 // ----- Defines ----- |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
32 |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
33 #if ( DebounceDivThreshold_define < 0xFF + 1 ) |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
34 #define DebounceCounter uint8_t |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
35 #elif ( DebounceDivThreshold_define < 0xFFFF + 1 ) |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
36 #define DebounceCounter uint16_t |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
37 #elif ( DebounceDivThreshold_define < 0xFFFFFFFF + 1 ) |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
38 #define DebounceCounter uint32_t |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
39 #else |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
40 #error "Debounce threshold is too high... 32 bit max. Check .kll defines." |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
41 #endif |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
42 |
343
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
43 #if ( MinDebounceTime_define > 0xFF ) |
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
44 #error "MinDebounceTime is a maximum of 255 ms" |
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
45 #elif ( MinDebounceTime_define < 0x00 ) |
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
46 #error "MinDebounceTime is a minimum 0 ms" |
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
47 #endif |
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
48 |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
49 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
50 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
51 // ----- Enums ----- |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
52 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
53 // Freescale MK20s have GPIO ports A...E |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
54 typedef enum Port { |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
55 Port_A = 0, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
56 Port_B = 1, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
57 Port_C = 2, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
58 Port_D = 3, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
59 Port_E = 4, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
60 } Port; |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
61 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
62 // Each port has a possible 32 pins |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
63 typedef enum Pin { |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
64 Pin_0 = 0, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
65 Pin_1 = 1, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
66 Pin_2 = 2, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
67 Pin_3 = 3, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
68 Pin_4 = 4, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
69 Pin_5 = 5, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
70 Pin_6 = 6, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
71 Pin_7 = 7, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
72 Pin_8 = 8, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
73 Pin_9 = 9, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
74 Pin_10 = 10, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
75 Pin_11 = 11, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
76 Pin_12 = 12, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
77 Pin_13 = 13, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
78 Pin_14 = 14, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
79 Pin_15 = 15, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
80 Pin_16 = 16, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
81 Pin_17 = 17, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
82 Pin_18 = 18, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
83 Pin_19 = 19, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
84 Pin_20 = 20, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
85 Pin_21 = 21, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
86 Pin_22 = 22, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
87 Pin_23 = 23, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
88 Pin_24 = 24, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
89 Pin_25 = 25, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
90 Pin_26 = 26, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
91 Pin_27 = 27, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
92 Pin_28 = 28, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
93 Pin_29 = 29, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
94 Pin_30 = 30, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
95 Pin_31 = 31, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
96 } Pin; |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
97 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
98 // Type of pin |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
99 typedef enum Type { |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
100 Type_StrobeOn, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
101 Type_StrobeOff, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
102 Type_StrobeSetup, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
103 Type_Sense, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
104 Type_SenseSetup, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
105 } Type; |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
106 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
107 // Sense/Strobe configuration |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
108 typedef enum Config { |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
109 Config_Pullup, // Internal pull-up |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
110 Config_Pulldown, // Internal pull-down |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
111 Config_Opendrain, // External pull resistor |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
112 } Config; |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
113 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
114 // Keypress States |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
115 typedef enum KeyPosition { |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
116 KeyState_Off = 0, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
117 KeyState_Press = 1, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
118 KeyState_Hold = 2, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
119 KeyState_Release = 3, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
120 KeyState_Invalid, |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
121 } KeyPosition; |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
122 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
123 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
124 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
125 // ----- Structs ----- |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
126 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
127 // Struct container for defining Rows (Sense) and Columns (Strobes) |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
128 typedef struct GPIO_Pin { |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
129 Port port; |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
130 Pin pin; |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
131 } GPIO_Pin; |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
132 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
133 // Debounce Element |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
134 typedef struct KeyState { |
343
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
135 DebounceCounter activeCount; |
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
136 DebounceCounter inactiveCount; |
293
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
137 KeyPosition prevState; |
57f40871c726
Adding configurable DebounceDivThreshold
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
138 KeyPosition curState; |
343
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
139 uint8_t prevDecisionTime; |
e464aaa4730f
Adding timing based debounce code
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
140 } __attribute__((packed)) KeyState; |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
141 |
415
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
142 // Ghost Element, after ghost detection/cancelation |
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
143 typedef struct KeyGhost { |
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
144 KeyPosition prev; |
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
145 KeyPosition cur; |
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
146 KeyPosition saved; // state before ghosting |
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
147 } __attribute__((packed)) KeyGhost; |
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
148 |
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
149 // utility |
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
150 inline uint8_t keyOn(/*KeyPosition*/uint8_t st) |
293154e4aafe
Added support for ghosting matrices and code for elimination.
CryHam <cryham@gmail.com>
parents:
343
diff
changeset
|
151 { return (st == KeyState_Press || st == KeyState_Hold) ? 1 : 0; } |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
152 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
153 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
154 // ----- Functions ----- |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
155 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
156 void Matrix_setup(); |
187
b250056298df
Matrix scanning for ARM now functional.
Jacob Alexander <haata@kiibohd.com>
parents:
186
diff
changeset
|
157 void Matrix_scan( uint16_t scanNum ); |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
158 |