annotate Scan/BudKeypad/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 ab4515606277
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
341
66eccdd9ced5 Code cleanup
Jacob Alexander <haata@kiibohd.com>
parents: 308
diff changeset
1 /* Copyright (C) 2011,2015 by Jacob Alexander
308
ab4515606277 Fix whitespace
Rowan Decker <Smasher816@gmail.com>
parents: 69
diff changeset
2 *
31
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
4 * of this software and associated documentation files (the "Software"), to deal
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
5 * in the Software without restriction, including without limitation the rights
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
7 * copies of the Software, and to permit persons to whom the Software is
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
8 * furnished to do so, subject to the following conditions:
308
ab4515606277 Fix whitespace
Rowan Decker <Smasher816@gmail.com>
parents: 69
diff changeset
9 *
31
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
10 * The above copyright notice and this permission notice shall be included in
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
11 * all copies or substantial portions of the Software.
308
ab4515606277 Fix whitespace
Rowan Decker <Smasher816@gmail.com>
parents: 69
diff changeset
12 *
31
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
19 * THE SOFTWARE.
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
20 */
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
21
341
66eccdd9ced5 Code cleanup
Jacob Alexander <haata@kiibohd.com>
parents: 308
diff changeset
22 #pragma once
31
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
23
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
24 // ----- Includes -----
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
25
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
26 // Compiler Includes
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
27 #include <stdint.h>
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
28
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
29
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
30
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
31 // ----- Scan Mode Setting (See matrix_scan.h for more details) -----
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
32 #define scanMode scanCol
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
33
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
34
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
35
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
36 // ----- Key Settings -----
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
37
69
87658fa6091b Updating AVR abstraction to be compatible with ARM, nearly ready for ARM files
Jacob Alexander <triplehaata@gmail.com>
parents: 31
diff changeset
38 #define KEYBOARD_KEYS 16 // # of keys
31
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
39 #define MAX_ROW_SIZE 16 // # of keys in the largest row
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
40 #define MAX_COL_SIZE 1 // # of keys in the largest column
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
41
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
42
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
43
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
44 // ----- Matrix Configuration -----
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
45 static const uint8_t matrix_pinout[][MAX_ROW_SIZE + 1] = {
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
46
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
47
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
48
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
49 // Just layout the matrix by rows and columns
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
50 // Usually you'll want to set the scanMode above to scanDual or scanCol_powrRow/scanRow_powrCol
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
51 // The mode allows for optimization in the kind of scanning algorithms that are done
308
ab4515606277 Fix whitespace
Rowan Decker <Smasher816@gmail.com>
parents: 69
diff changeset
52 //
31
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
53 // The key numbers are used to translate into the keymap table (array) (and always start from 1, not 0).
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
54 // Thus if a row doesn't use all the key positions, you can denote it as 0, which will be ignored/skipped on each scan
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
55 // See the keymap.h file for the various preconfigured arrays.
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
56
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
57 // Scan Mode | Col 1 | Col 2 | Col 3 | Col 4 | Col 5 | ...
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
58 // -------------------------------------------------------
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
59 // Row 1 | Key 1 Key 7 Key32 ...
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
60 // Row 2 | Key 3 Key92 ...
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
61 // Row 3 | Key23 ...
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
62 // Row 4 | ...
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
63 // Row 5 |
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
64 // ... |
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
65
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
66 // See Scan/matrix/matrix_template.h for more details
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
67
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
68
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
69 { scanMode, pinF0, pinF4, pinB7, pinD3, pinF5, pinF1, pinD1, pinD2, pinF6, pinF7, pinB2, pinD0, pinB0, pinB6, pinB1, pinB3 },
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
70 { pinNULL, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
71
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
72
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
73
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
74 };
a004d4015fbb Making sub-modules of matrix for HeathZenith and BudKeypad
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
75