Mercurial > louis > kiibohd-controller
annotate Scan/MD1/matrix.h @ 341:66eccdd9ced5
Code cleanup
- Changing header file ifndef define to pragma once's
- Removed duplicate output_com.h's
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Sun, 14 Jun 2015 13:56:56 -0700 |
parents | 3caf3217b604 |
children |
rev | line source |
---|---|
341 | 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 |
257
3caf3217b604
Moving MatrixARM header macros to separate file
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
24 // ----- Includes ----- |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
25 |
257
3caf3217b604
Moving MatrixARM header macros to separate file
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
26 // Project Includes |
3caf3217b604
Moving MatrixARM header macros to separate file
Jacob Alexander <haata@kiibohd.com>
parents:
187
diff
changeset
|
27 #include <matrix_setup.h> |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
28 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
29 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
30 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
31 // ----- Matrix Definition ----- |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
32 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
33 // Freescale ARM MK20's support GPIO PTA, PTB, PTC, PTD and PTE 0..31 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
34 // Not all chips have access to all of these pins (most don't have 160 pins :P) |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
35 // |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
36 // NOTE: |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
37 // Before using a pin, make sure it supports being a GPIO *and* doesn't have a default pull-up/pull-down |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
38 // Checking this is completely on the ownness of the user |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
39 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
40 // MD1 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
41 // |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
42 // Columns (Strobe) |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
43 // PTB0..3,16,17 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
44 // PTC4,5 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
45 // PTD0 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
46 // |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
47 // Rows (Sense) |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
48 // PTD1..7 |
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 // Define Rows (Sense) and Columns (Strobes) |
187
b250056298df
Matrix scanning for ARM now functional.
Jacob Alexander <haata@kiibohd.com>
parents:
186
diff
changeset
|
51 GPIO_Pin Matrix_cols[] = { gpio(B,0), gpio(B,1), gpio(B,2), gpio(B,3), gpio(B,16), gpio(B,17), gpio(C,4), gpio(C,5), gpio(D,0) }; |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
52 GPIO_Pin Matrix_rows[] = { gpio(D,1), gpio(D,2), gpio(D,3), gpio(D,4), gpio(D,5), gpio(D,6), gpio(D,7) }; |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
53 |
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
54 // Define type of scan matrix |
187
b250056298df
Matrix scanning for ARM now functional.
Jacob Alexander <haata@kiibohd.com>
parents:
186
diff
changeset
|
55 Config Matrix_type = Config_Pulldown; |
186
50702debf278
Initial MatrixARM implementation
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
56 |