diff options
-rw-r--r-- | docs/config_options.md | 2 | ||||
-rw-r--r-- | quantum/matrix.c | 5 | ||||
-rw-r--r-- | quantum/matrix_common.c | 7 | ||||
-rw-r--r-- | quantum/split_common/matrix.c | 5 | ||||
-rw-r--r-- | tmk_core/common/matrix.h | 2 |
5 files changed, 15 insertions, 6 deletions
diff --git a/docs/config_options.md b/docs/config_options.md index 5344fe851..d048d1767 100644 --- a/docs/config_options.md +++ b/docs/config_options.md | |||
@@ -53,6 +53,8 @@ This is a C header file that is one of the first things included, and will persi | |||
53 | * pins of the rows, from top to bottom | 53 | * pins of the rows, from top to bottom |
54 | * `#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }` | 54 | * `#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }` |
55 | * pins of the columns, from left to right | 55 | * pins of the columns, from left to right |
56 | * `#define MATRIX_IO_DELAY 30` | ||
57 | * the delay in microseconds when between changing matrix pin state and reading values | ||
56 | * `#define UNUSED_PINS { D1, D2, D3, B1, B2, B3 }` | 58 | * `#define UNUSED_PINS { D1, D2, D3, B1, B2, B3 }` |
57 | * pins unused by the keyboard for reference | 59 | * pins unused by the keyboard for reference |
58 | * `#define MATRIX_HAS_GHOST` | 60 | * `#define MATRIX_HAS_GHOST` |
diff --git a/quantum/matrix.c b/quantum/matrix.c index 6bd604bb7..67d8af6ee 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c | |||
@@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
16 | */ | 16 | */ |
17 | #include <stdint.h> | 17 | #include <stdint.h> |
18 | #include <stdbool.h> | 18 | #include <stdbool.h> |
19 | #include "wait.h" | ||
20 | #include "util.h" | 19 | #include "util.h" |
21 | #include "matrix.h" | 20 | #include "matrix.h" |
22 | #include "debounce.h" | 21 | #include "debounce.h" |
@@ -94,7 +93,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) | |||
94 | 93 | ||
95 | // Select row and wait for row selecton to stabilize | 94 | // Select row and wait for row selecton to stabilize |
96 | select_row(current_row); | 95 | select_row(current_row); |
97 | wait_us(30); | 96 | matrix_io_delay(); |
98 | 97 | ||
99 | // For each col... | 98 | // For each col... |
100 | for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { | 99 | for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { |
@@ -138,7 +137,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) | |||
138 | 137 | ||
139 | // Select col and wait for col selecton to stabilize | 138 | // Select col and wait for col selecton to stabilize |
140 | select_col(current_col); | 139 | select_col(current_col); |
141 | wait_us(30); | 140 | matrix_io_delay(); |
142 | 141 | ||
143 | // For each row... | 142 | // For each row... |
144 | for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { | 143 | for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { |
diff --git a/quantum/matrix_common.c b/quantum/matrix_common.c index c326e59ca..de62b8070 100644 --- a/quantum/matrix_common.c +++ b/quantum/matrix_common.c | |||
@@ -1,8 +1,13 @@ | |||
1 | #include "matrix.h" | 1 | #include "matrix.h" |
2 | #include "debounce.h" | 2 | #include "debounce.h" |
3 | #include "wait.h" | ||
3 | #include "print.h" | 4 | #include "print.h" |
4 | #include "debug.h" | 5 | #include "debug.h" |
5 | 6 | ||
7 | #ifndef MATRIX_IO_DELAY | ||
8 | # define MATRIX_IO_DELAY 30 | ||
9 | #endif | ||
10 | |||
6 | /* matrix state(1:on, 0:off) */ | 11 | /* matrix state(1:on, 0:off) */ |
7 | matrix_row_t raw_matrix[MATRIX_ROWS]; | 12 | matrix_row_t raw_matrix[MATRIX_ROWS]; |
8 | matrix_row_t matrix[MATRIX_ROWS]; | 13 | matrix_row_t matrix[MATRIX_ROWS]; |
@@ -78,6 +83,8 @@ uint8_t matrix_key_count(void) { | |||
78 | return count; | 83 | return count; |
79 | } | 84 | } |
80 | 85 | ||
86 | __attribute__((weak)) void matrix_io_delay(void) { wait_us(MATRIX_IO_DELAY); } | ||
87 | |||
81 | // CUSTOM MATRIX 'LITE' | 88 | // CUSTOM MATRIX 'LITE' |
82 | __attribute__((weak)) void matrix_init_custom(void) {} | 89 | __attribute__((weak)) void matrix_init_custom(void) {} |
83 | 90 | ||
diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c index 2c0e028f7..a82334128 100644 --- a/quantum/split_common/matrix.c +++ b/quantum/split_common/matrix.c | |||
@@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
16 | */ | 16 | */ |
17 | #include <stdint.h> | 17 | #include <stdint.h> |
18 | #include <stdbool.h> | 18 | #include <stdbool.h> |
19 | #include "wait.h" | ||
20 | #include "util.h" | 19 | #include "util.h" |
21 | #include "matrix.h" | 20 | #include "matrix.h" |
22 | #include "debounce.h" | 21 | #include "debounce.h" |
@@ -111,7 +110,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) | |||
111 | 110 | ||
112 | // Select row and wait for row selecton to stabilize | 111 | // Select row and wait for row selecton to stabilize |
113 | select_row(current_row); | 112 | select_row(current_row); |
114 | wait_us(30); | 113 | matrix_io_delay(); |
115 | 114 | ||
116 | // For each col... | 115 | // For each col... |
117 | for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { | 116 | for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { |
@@ -155,7 +154,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) | |||
155 | 154 | ||
156 | // Select col and wait for col selecton to stabilize | 155 | // Select col and wait for col selecton to stabilize |
157 | select_col(current_col); | 156 | select_col(current_col); |
158 | wait_us(30); | 157 | matrix_io_delay(); |
159 | 158 | ||
160 | // For each row... | 159 | // For each row... |
161 | for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { | 160 | for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { |
diff --git a/tmk_core/common/matrix.h b/tmk_core/common/matrix.h index a2fedf5ff..78506059e 100644 --- a/tmk_core/common/matrix.h +++ b/tmk_core/common/matrix.h | |||
@@ -66,6 +66,8 @@ bool matrix_is_on(uint8_t row, uint8_t col); | |||
66 | matrix_row_t matrix_get_row(uint8_t row); | 66 | matrix_row_t matrix_get_row(uint8_t row); |
67 | /* print matrix for debug */ | 67 | /* print matrix for debug */ |
68 | void matrix_print(void); | 68 | void matrix_print(void); |
69 | /* delay between changing matrix pin state and reading values */ | ||
70 | void matrix_io_delay(void); | ||
69 | 71 | ||
70 | /* power control */ | 72 | /* power control */ |
71 | void matrix_power_up(void); | 73 | void matrix_power_up(void); |