From 22a7e71fb3fdca2d6c76d5775681bfb288e5f20a Mon Sep 17 00:00:00 2001 From: MechMerlin <30334081+mechmerlin@users.noreply.github.com> Date: Mon, 9 Sep 2019 21:38:08 -0700 Subject: [Keyboard] Add DP60 keyboard (#6679) * add dp60 keyboard * fixup wording in readme * fix layout name in default keymap. I was missing an r * Add QMK Configurator support for the additional layouts * Update keyboards/dp60/config.h Co-Authored-By: Drashna Jaelre * Update keyboards/dp60/config.h Co-Authored-By: Drashna Jaelre * Update keyboards/dp60/config.h Co-Authored-By: Drashna Jaelre * Update keyboards/dp60/config.h Co-Authored-By: Drashna Jaelre * Update keyboards/dp60/config.h Co-Authored-By: Drashna Jaelre * strip out the VIA enabling from default rules.mk * add a VIA only keymap --- keyboards/dp60/matrix.c | 245 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 keyboards/dp60/matrix.c (limited to 'keyboards/dp60/matrix.c') diff --git a/keyboards/dp60/matrix.c b/keyboards/dp60/matrix.c new file mode 100644 index 000000000..3aa5925fe --- /dev/null +++ b/keyboards/dp60/matrix.c @@ -0,0 +1,245 @@ +#include "quantum.h" + +static uint8_t debouncing = DEBOUNCE; + +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static uint8_t read_rows(void); +static void init_rows(void); +static void init_cols(void); +static void unselect_cols(void); +static void select_col(uint8_t col); + + +__attribute__ ((weak)) +void matrix_init_kb(void) +{ + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) +{ + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) {} + +__attribute__ ((weak)) +void matrix_scan_user(void) {} + +void matrix_init(void) +{ + //setPinOutput(F0); + //writePinHigh(F0); + setPinOutput(B4); + writePinLow(B4); + + init_cols(); + init_rows(); + + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + matrix_init_quantum(); +} + +uint8_t matrix_scan(void) +{ + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + select_col(col); + _delay_us(3); + + uint8_t rows = read_rows(); + + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<