diff options
Diffstat (limited to 'keyboards/handwired')
| -rw-r--r-- | keyboards/handwired/dactyl/matrix.c | 24 | ||||
| -rw-r--r-- | keyboards/handwired/frenchdev/matrix.c | 35 | ||||
| -rw-r--r-- | keyboards/handwired/xealous/matrix.c | 12 | ||||
| -rw-r--r-- | keyboards/handwired/xealous/matrix_scanrate.c | 39 | ||||
| -rw-r--r-- | keyboards/handwired/xealous/matrix_scanrate.h | 4 | ||||
| -rw-r--r-- | keyboards/handwired/xealous/rules.mk | 2 |
6 files changed, 1 insertions, 115 deletions
diff --git a/keyboards/handwired/dactyl/matrix.c b/keyboards/handwired/dactyl/matrix.c index 28cf37522..faa5c19cf 100644 --- a/keyboards/handwired/dactyl/matrix.c +++ b/keyboards/handwired/dactyl/matrix.c | |||
| @@ -76,11 +76,6 @@ uint8_t expander_status; | |||
| 76 | uint8_t expander_input_pin_mask; | 76 | uint8_t expander_input_pin_mask; |
| 77 | bool i2c_initialized = false; | 77 | bool i2c_initialized = false; |
| 78 | 78 | ||
| 79 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 80 | uint32_t matrix_timer; | ||
| 81 | uint32_t matrix_scan_count; | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #define ROW_SHIFTER ((matrix_row_t)1) | 79 | #define ROW_SHIFTER ((matrix_row_t)1) |
| 85 | 80 | ||
| 86 | __attribute__ ((weak)) | 81 | __attribute__ ((weak)) |
| @@ -129,11 +124,6 @@ void matrix_init(void) | |||
| 129 | matrix_debouncing[i] = 0; | 124 | matrix_debouncing[i] = 0; |
| 130 | } | 125 | } |
| 131 | 126 | ||
| 132 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 133 | matrix_timer = timer_read32(); | ||
| 134 | matrix_scan_count = 0; | ||
| 135 | #endif | ||
| 136 | |||
| 137 | matrix_init_quantum(); | 127 | matrix_init_quantum(); |
| 138 | } | 128 | } |
| 139 | 129 | ||
| @@ -236,20 +226,6 @@ uint8_t matrix_scan(void) | |||
| 236 | } | 226 | } |
| 237 | } | 227 | } |
| 238 | 228 | ||
| 239 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 240 | matrix_scan_count++; | ||
| 241 | |||
| 242 | uint32_t timer_now = timer_read32(); | ||
| 243 | if (TIMER_DIFF_32(timer_now, matrix_timer)>1000) { | ||
| 244 | print("matrix scan frequency: "); | ||
| 245 | pdec(matrix_scan_count); | ||
| 246 | print("\n"); | ||
| 247 | |||
| 248 | matrix_timer = timer_now; | ||
| 249 | matrix_scan_count = 0; | ||
| 250 | } | ||
| 251 | #endif | ||
| 252 | |||
| 253 | #if (DIODE_DIRECTION == COL2ROW) | 229 | #if (DIODE_DIRECTION == COL2ROW) |
| 254 | for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { | 230 | for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { |
| 255 | # if (DEBOUNCE > 0) | 231 | # if (DEBOUNCE > 0) |
diff --git a/keyboards/handwired/frenchdev/matrix.c b/keyboards/handwired/frenchdev/matrix.c index 26c2b3126..c9c7e94ae 100644 --- a/keyboards/handwired/frenchdev/matrix.c +++ b/keyboards/handwired/frenchdev/matrix.c | |||
| @@ -35,9 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 35 | #include "util.h" | 35 | #include "util.h" |
| 36 | #include "matrix.h" | 36 | #include "matrix.h" |
| 37 | #include "frenchdev.h" | 37 | #include "frenchdev.h" |
| 38 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 39 | #include "timer.h" | ||
| 40 | #endif | ||
| 41 | 38 | ||
| 42 | /* | 39 | /* |
| 43 | * This constant define not debouncing time in msecs, but amount of matrix | 40 | * This constant define not debouncing time in msecs, but amount of matrix |
| @@ -66,12 +63,6 @@ static void select_row(uint8_t row); | |||
| 66 | 63 | ||
| 67 | static uint8_t mcp23018_reset_loop; | 64 | static uint8_t mcp23018_reset_loop; |
| 68 | 65 | ||
| 69 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 70 | uint32_t matrix_timer; | ||
| 71 | uint32_t matrix_scan_count; | ||
| 72 | #endif | ||
| 73 | |||
| 74 | |||
| 75 | __attribute__ ((weak)) | 66 | __attribute__ ((weak)) |
| 76 | void matrix_init_user(void) {} | 67 | void matrix_init_user(void) {} |
| 77 | 68 | ||
| @@ -120,13 +111,7 @@ void matrix_init(void) | |||
| 120 | matrix_debouncing[i] = 0; | 111 | matrix_debouncing[i] = 0; |
| 121 | } | 112 | } |
| 122 | 113 | ||
| 123 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 124 | matrix_timer = timer_read32(); | ||
| 125 | matrix_scan_count = 0; | ||
| 126 | #endif | ||
| 127 | |||
| 128 | matrix_init_quantum(); | 114 | matrix_init_quantum(); |
| 129 | |||
| 130 | } | 115 | } |
| 131 | 116 | ||
| 132 | void matrix_power_up(void) { | 117 | void matrix_power_up(void) { |
| @@ -140,12 +125,6 @@ void matrix_power_up(void) { | |||
| 140 | matrix[i] = 0; | 125 | matrix[i] = 0; |
| 141 | matrix_debouncing[i] = 0; | 126 | matrix_debouncing[i] = 0; |
| 142 | } | 127 | } |
| 143 | |||
| 144 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 145 | matrix_timer = timer_read32(); | ||
| 146 | matrix_scan_count = 0; | ||
| 147 | #endif | ||
| 148 | |||
| 149 | } | 128 | } |
| 150 | 129 | ||
| 151 | uint8_t matrix_scan(void) | 130 | uint8_t matrix_scan(void) |
| @@ -165,20 +144,6 @@ uint8_t matrix_scan(void) | |||
| 165 | } | 144 | } |
| 166 | } | 145 | } |
| 167 | 146 | ||
| 168 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 169 | matrix_scan_count++; | ||
| 170 | |||
| 171 | uint32_t timer_now = timer_read32(); | ||
| 172 | if (TIMER_DIFF_32(timer_now, matrix_timer)>1000) { | ||
| 173 | print("matrix scan frequency: "); | ||
| 174 | pdec(matrix_scan_count); | ||
| 175 | print("\n"); | ||
| 176 | |||
| 177 | matrix_timer = timer_now; | ||
| 178 | matrix_scan_count = 0; | ||
| 179 | } | ||
| 180 | #endif | ||
| 181 | |||
| 182 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | 147 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
| 183 | select_row(i); | 148 | select_row(i); |
| 184 | wait_us(30); // without this wait read unstable value. | 149 | wait_us(30); // without this wait read unstable value. |
diff --git a/keyboards/handwired/xealous/matrix.c b/keyboards/handwired/xealous/matrix.c index e2d219939..6d43db4d9 100644 --- a/keyboards/handwired/xealous/matrix.c +++ b/keyboards/handwired/xealous/matrix.c | |||
| @@ -30,18 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 30 | #include "pro_micro.h" | 30 | #include "pro_micro.h" |
| 31 | #include "config.h" | 31 | #include "config.h" |
| 32 | #include "timer.h" | 32 | #include "timer.h" |
| 33 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 34 | #include "matrix_scanrate.h" | ||
| 35 | #endif | ||
| 36 | |||
| 37 | void matrix_scan_user(void) | ||
| 38 | { | ||
| 39 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 40 | matrix_check_scan_rate(); | ||
| 41 | matrix_time_between_scans(); | ||
| 42 | #endif | ||
| 43 | |||
| 44 | } | ||
| 45 | 33 | ||
| 46 | // Copy this code to split_common/matrix.c, | 34 | // Copy this code to split_common/matrix.c, |
| 47 | // and call it instead of the unoptimized col_reader. Scan-rate jumps from 1200->1920 | 35 | // and call it instead of the unoptimized col_reader. Scan-rate jumps from 1200->1920 |
diff --git a/keyboards/handwired/xealous/matrix_scanrate.c b/keyboards/handwired/xealous/matrix_scanrate.c deleted file mode 100644 index f2c7cbe6e..000000000 --- a/keyboards/handwired/xealous/matrix_scanrate.c +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | #include <stdint.h> | ||
| 2 | #include <stdbool.h> | ||
| 3 | #include <avr/io.h> | ||
| 4 | #include "wait.h" | ||
| 5 | #include "print.h" | ||
| 6 | #include "debug.h" | ||
| 7 | #include "util.h" | ||
| 8 | #include "matrix.h" | ||
| 9 | #include "timer.h" | ||
| 10 | |||
| 11 | #ifdef CONSOLE_ENABLE | ||
| 12 | static uint16_t matrix_scan_count = 0; | ||
| 13 | static uint32_t matrix_timer = 0; | ||
| 14 | void matrix_check_scan_rate(void) { | ||
| 15 | matrix_scan_count++; | ||
| 16 | if (matrix_scan_count > 1000) { | ||
| 17 | uint32_t timer_now = timer_read32(); | ||
| 18 | uint16_t ms_per_thousand = TIMER_DIFF_32(timer_now, matrix_timer); | ||
| 19 | uint16_t rate_per_second = 1000000UL / ms_per_thousand; | ||
| 20 | print("scan_rate: "); | ||
| 21 | pdec(rate_per_second); | ||
| 22 | print("\n"); | ||
| 23 | matrix_timer = timer_now; | ||
| 24 | matrix_scan_count = 0; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | static uint32_t last_scan_time = 0; | ||
| 29 | void matrix_time_between_scans(void) { | ||
| 30 | if (timer_elapsed(last_scan_time) > 1) | ||
| 31 | { | ||
| 32 | print(">1ms elapsed since last scan: "); | ||
| 33 | pdec(timer_elapsed(last_scan_time)); | ||
| 34 | print("\n"); | ||
| 35 | } | ||
| 36 | last_scan_time = timer_read(); | ||
| 37 | |||
| 38 | } | ||
| 39 | #endif | ||
diff --git a/keyboards/handwired/xealous/matrix_scanrate.h b/keyboards/handwired/xealous/matrix_scanrate.h deleted file mode 100644 index 18d56cd5b..000000000 --- a/keyboards/handwired/xealous/matrix_scanrate.h +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | __attribute__((weak)) | ||
| 2 | void matrix_check_scan_rate(void) {} | ||
| 3 | __attribute__((weak)) | ||
| 4 | void matrix_time_between_scans(void) {} | ||
diff --git a/keyboards/handwired/xealous/rules.mk b/keyboards/handwired/xealous/rules.mk index ef3357982..adbbf1e10 100644 --- a/keyboards/handwired/xealous/rules.mk +++ b/keyboards/handwired/xealous/rules.mk | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | SRC += matrix_scanrate.c matrix.c | 1 | SRC += matrix.c |
| 2 | 2 | ||
| 3 | # MCU name | 3 | # MCU name |
| 4 | MCU = atmega32u4 | 4 | MCU = atmega32u4 |
