diff options
| author | Joel Challis <git@zvecr.com> | 2021-01-08 02:26:39 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-08 02:26:39 +0000 |
| commit | b609a07b45ccb1954054f85b8fdd53e03c76de90 (patch) | |
| tree | e3a6fe5e534b19ebfc725ca2bf4002de17240d91 | |
| parent | 2574bc27916acbee086d27072994a32bab290a75 (diff) | |
| download | qmk_firmware-b609a07b45ccb1954054f85b8fdd53e03c76de90.tar.gz qmk_firmware-b609a07b45ccb1954054f85b8fdd53e03c76de90.zip | |
Implement matrix_io_delay abstraction for Drop boards (#11472)
| -rw-r--r-- | keyboards/massdrop/alt/matrix.c | 8 | ||||
| -rw-r--r-- | keyboards/massdrop/ctrl/matrix.c | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/keyboards/massdrop/alt/matrix.c b/keyboards/massdrop/alt/matrix.c index 314115571..f635f37f2 100644 --- a/keyboards/massdrop/alt/matrix.c +++ b/keyboards/massdrop/alt/matrix.c | |||
| @@ -22,6 +22,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 22 | #include "clks.h" | 22 | #include "clks.h" |
| 23 | #include <string.h> | 23 | #include <string.h> |
| 24 | 24 | ||
| 25 | #ifndef MATRIX_IO_DELAY | ||
| 26 | # define MATRIX_IO_DELAY 1 | ||
| 27 | #endif | ||
| 28 | |||
| 25 | matrix_row_t mlatest[MATRIX_ROWS]; | 29 | matrix_row_t mlatest[MATRIX_ROWS]; |
| 26 | matrix_row_t mlast[MATRIX_ROWS]; | 30 | matrix_row_t mlast[MATRIX_ROWS]; |
| 27 | matrix_row_t mdebounced[MATRIX_ROWS]; | 31 | matrix_row_t mdebounced[MATRIX_ROWS]; |
| @@ -32,6 +36,8 @@ uint8_t col_ports[] = { MATRIX_COL_PORTS }; | |||
| 32 | uint8_t col_pins[] = { MATRIX_COL_PINS }; | 36 | uint8_t col_pins[] = { MATRIX_COL_PINS }; |
| 33 | uint32_t row_masks[2]; //NOTE: If more than PA PB used in the future, adjust code to accomodate | 37 | uint32_t row_masks[2]; //NOTE: If more than PA PB used in the future, adjust code to accomodate |
| 34 | 38 | ||
| 39 | __attribute__((weak)) void matrix_io_delay(void) { wait_us(MATRIX_IO_DELAY); } | ||
| 40 | |||
| 35 | __attribute__ ((weak)) | 41 | __attribute__ ((weak)) |
| 36 | void matrix_init_kb(void) { | 42 | void matrix_init_kb(void) { |
| 37 | matrix_init_user(); | 43 | matrix_init_user(); |
| @@ -95,7 +101,7 @@ uint8_t matrix_scan(void) | |||
| 95 | { | 101 | { |
| 96 | PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output | 102 | PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output |
| 97 | 103 | ||
| 98 | wait_us(1); //Delay for output | 104 | matrix_io_delay(); //Delay for output |
| 99 | 105 | ||
| 100 | scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data | 106 | scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data |
| 101 | scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PB row pins data | 107 | scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PB row pins data |
diff --git a/keyboards/massdrop/ctrl/matrix.c b/keyboards/massdrop/ctrl/matrix.c index f3529fe72..713fb89f6 100644 --- a/keyboards/massdrop/ctrl/matrix.c +++ b/keyboards/massdrop/ctrl/matrix.c | |||
| @@ -22,6 +22,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 22 | #include "clks.h" | 22 | #include "clks.h" |
| 23 | #include <string.h> | 23 | #include <string.h> |
| 24 | 24 | ||
| 25 | #ifndef MATRIX_IO_DELAY | ||
| 26 | # define MATRIX_IO_DELAY 1 | ||
| 27 | #endif | ||
| 28 | |||
| 25 | matrix_row_t mlatest[MATRIX_ROWS]; | 29 | matrix_row_t mlatest[MATRIX_ROWS]; |
| 26 | matrix_row_t mlast[MATRIX_ROWS]; | 30 | matrix_row_t mlast[MATRIX_ROWS]; |
| 27 | matrix_row_t mdebounced[MATRIX_ROWS]; | 31 | matrix_row_t mdebounced[MATRIX_ROWS]; |
| @@ -32,6 +36,8 @@ uint8_t col_ports[] = { MATRIX_COL_PORTS }; | |||
| 32 | uint8_t col_pins[] = { MATRIX_COL_PINS }; | 36 | uint8_t col_pins[] = { MATRIX_COL_PINS }; |
| 33 | uint32_t row_masks[2]; //NOTE: If more than PA PB used in the future, adjust code to accomodate | 37 | uint32_t row_masks[2]; //NOTE: If more than PA PB used in the future, adjust code to accomodate |
| 34 | 38 | ||
| 39 | __attribute__((weak)) void matrix_io_delay(void) { wait_us(MATRIX_IO_DELAY); } | ||
| 40 | |||
| 35 | __attribute__ ((weak)) | 41 | __attribute__ ((weak)) |
| 36 | void matrix_init_kb(void) { | 42 | void matrix_init_kb(void) { |
| 37 | matrix_init_user(); | 43 | matrix_init_user(); |
| @@ -95,7 +101,7 @@ uint8_t matrix_scan(void) | |||
| 95 | { | 101 | { |
| 96 | PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output | 102 | PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output |
| 97 | 103 | ||
| 98 | wait_us(1); //Delay for output | 104 | matrix_io_delay(); //Delay for output |
| 99 | 105 | ||
| 100 | scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data | 106 | scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data |
| 101 | scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PB row pins data | 107 | scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PB row pins data |
