diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2017-06-18 23:49:38 +0300 |
|---|---|---|
| committer | Fred Sundvik <fsundvik@gmail.com> | 2017-06-18 23:49:38 +0300 |
| commit | 36f820be7e80bc8f1f5489373708356cf142c269 (patch) | |
| tree | cf3561b80650e536a2c41f0e3bb4bc70635b6435 /tests/test_common/matrix.c | |
| parent | e85b1857968d4c0378b9778650c30b9d2bca3ea9 (diff) | |
| download | qmk_firmware-36f820be7e80bc8f1f5489373708356cf142c269.tar.gz qmk_firmware-36f820be7e80bc8f1f5489373708356cf142c269.zip | |
Add a test fixture
It only initializes QMK once, and clears the matrix after each test.
Diffstat (limited to 'tests/test_common/matrix.c')
| -rw-r--r-- | tests/test_common/matrix.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_common/matrix.c b/tests/test_common/matrix.c index 5ab5bac6c..0d9fa68b0 100644 --- a/tests/test_common/matrix.c +++ b/tests/test_common/matrix.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | static matrix_row_t matrix[MATRIX_ROWS] = {}; | 22 | static matrix_row_t matrix[MATRIX_ROWS] = {}; |
| 23 | 23 | ||
| 24 | void matrix_init(void) { | 24 | void matrix_init(void) { |
| 25 | memset(matrix, 0, sizeof(matrix)); | 25 | clear_all_keys(); |
| 26 | matrix_init_quantum(); | 26 | matrix_init_quantum(); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| @@ -54,3 +54,7 @@ void press_key(uint8_t col, uint8_t row) { | |||
| 54 | void release_key(uint8_t col, uint8_t row) { | 54 | void release_key(uint8_t col, uint8_t row) { |
| 55 | matrix[row] &= ~(1 << col); | 55 | matrix[row] &= ~(1 << col); |
| 56 | } | 56 | } |
| 57 | |||
| 58 | void clear_all_keys(void) { | ||
| 59 | memset(matrix, 0, sizeof(matrix)); | ||
| 60 | } | ||
