diff --git a/keyboards/teensy_lc_synth/config.h b/keyboards/teensy_lc_synth/config.h index fdab46864f..1a48a7e91e 100644 --- a/keyboards/teensy_lc_synth/config.h +++ b/keyboards/teensy_lc_synth/config.h @@ -31,9 +31,8 @@ along with this program. If not, see . #define DESCRIPTION "QMK keyboard firmware test for ChibiOS" /* key matrix size */ -#define MATRIX_ROWS 4 -#define MATRIX_COLS 3 -#define DIODE_DIRECTION ROW2COL +#define MATRIX_ROWS 3 +#define MATRIX_COLS 4 /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 diff --git a/keyboards/teensy_lc_synth/matrix.c b/keyboards/teensy_lc_synth/matrix.c index cf5ca643a5..b8bbe5a754 100644 --- a/keyboards/teensy_lc_synth/matrix.c +++ b/keyboards/teensy_lc_synth/matrix.c @@ -43,29 +43,28 @@ static void select_row(uint8_t row); inline -uint8_t matrix_rows(void) -{ +uint8_t matrix_rows(void) { return MATRIX_ROWS; } inline -uint8_t matrix_cols(void) -{ +uint8_t matrix_cols(void) { return MATRIX_COLS; } -void matrix_init(void) -{ +void matrix_init(void) { // initialize row and col - unselect_rows(); + palSetPadMode(TEENSY_PIN13_IOPORT, TEENSY_PIN13, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(TEENSY_PIN12_IOPORT, TEENSY_PIN12, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(TEENSY_PIN18_IOPORT, TEENSY_PIN18, PAL_MODE_OUTPUT_PUSHPULL); init_cols(); // initialize LED - palSetPadMode(TEENSY_PIN20_IOPORT, TEENSY_PIN20, PAL_MODE_OUTPUT_PUSHPULL); + //palSetPadMode(TEENSY_PIN20_IOPORT, TEENSY_PIN20, PAL_MODE_OUTPUT_PUSHPULL); // Turn on C's LED - palClearPad(TEENSY_PIN20_IOPORT, TEENSY_PIN20); - palSetPad(TEENSY_PIN10_IOPORT, TEENSY_PIN10); + //palClearPad(TEENSY_PIN20_IOPORT, TEENSY_PIN20); + //palSetPad(TEENSY_PIN10_IOPORT, TEENSY_PIN10); // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { @@ -77,12 +76,12 @@ void matrix_init(void) debug_matrix = true; } -uint8_t matrix_scan(void) -{ +uint8_t matrix_scan(void) { for (uint8_t i = 0; i < MATRIX_ROWS; i++) { select_row(i); wait_us(30); // without this wait read unstable value. matrix_row_t cols = read_cols(); + printf("row:%d cols:%d\n", i, cols); if (matrix_debouncing[i] != cols) { matrix_debouncing[i] = cols; if (debouncing) { @@ -103,23 +102,23 @@ uint8_t matrix_scan(void) } } + print("\n"); // FIXME: only here for debugging + wait_ms(1000); // FIXME: only here for debugging + return 1; } inline -bool matrix_is_on(uint8_t row, uint8_t col) -{ +bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & ((matrix_row_t)1<