Skip to content

Commit

Permalink
Convert Wasdat Code custom matrix to SN74x138 driver (qmk#16257)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and zykrah committed Jul 2, 2022
1 parent 79530d4 commit d9eba6f
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 311 deletions.
43 changes: 22 additions & 21 deletions keyboards/evyd13/wasdat/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;

/* col 0: C7
* col 1: B6
* col 2: C6
* col 3: B4
* col 4: B5
* col 5: D7
/* Columns 6-12 use a 74HC138 3-to-8 demultiplexer.
*
* These columns use a 74HC138 3 to 8 bit demultiplexer.
* A2 A1 A0
* col / pin: PD0 PD1 PD2
* 6: 1 1 1
* 7: 1 1 0
* 8: 1 0 1
* 9: 1 0 0
* 10: 0 1 1
* 11: 0 1 0
* 12: 0 0 1
* 0: C7
* 1: B6
* 2: C6
* 3: B4
* 4: B5
* 5: D7
*
* col 13: D3
* col 14: B7
* col 15: B3
* A2 A1 A0
* D0 D1 D2
* 6: 1 1 1
* 7: 1 1 0
* 8: 1 0 1
* 9: 1 0 0
* 10: 0 1 1
* 11: 0 1 0
* 12: 0 0 1
*
* 13: D3
* 14: B7
* 15: B3
*/
static void select_col(uint8_t col) {
if (col_pins[col] != NO_PIN) {
Expand Down Expand Up @@ -117,10 +118,10 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
}

void matrix_init_custom(void) {
// initialize key pins
init_pins();
// initialize demultiplexer
sn74x138_init();
// initialize key pins
init_pins();
}

bool matrix_scan_custom(matrix_row_t current_matrix[]) {
Expand Down
11 changes: 3 additions & 8 deletions keyboards/evyd13/wasdat_code/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define MATRIX_ROW_PINS { E6, C7, C6, B6, B5, B4, D7, D6 }
#define MATRIX_COL_PINS { }
#define MATRIX_COL_PINS { F7, F5, F6, F1, F4, F0, NO_PIN, D5, D3, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } // Columns 6 and 9-15 controlled by demux
#define UNUSED_PINS

/* COL2ROW, ROW2COL*/
#define DIODE_DIRECTION ROW2COL
#define SN74X138_ADDRESS_PINS { D2, D1, D0 }
#define SN74X138_E3_PIN D4

// For QMK DFU
#define QMK_ESC_OUTPUT E6
#define QMK_ESC_INPUT F0
#define QMK_LED B1

/*
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
*/
//#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6

#define LED_NUM_LOCK_PIN B3
#define LED_CAPS_LOCK_PIN B1
#define LED_SCROLL_LOCK_PIN B2
Expand Down
Loading

0 comments on commit d9eba6f

Please sign in to comment.