forked from vial-kb/vial-qmk
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
137 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
# Copyright 2024 splitkb.com (support@splitkb.com) | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
OLED_ENABLE = yes | ||
|
||
RGB_MATRIX_ENABLE = no | ||
RGBLIGHT_ENABLE = yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2024 splitkb.com (support@splitkb.com) | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include "matrix.h" | ||
#include "spi_master.h" | ||
|
||
// The matrix is hooked up to a chain of 74xx165 shift registers. | ||
// Pin F0 acts as Chip Select (active-low) | ||
// The signal goes to a NOT gate, whose output is wired to | ||
// a) the latch pin of the shift registers | ||
// b) the "enable" pin of a tri-state buffer, | ||
// attached between the shift registers and MISO | ||
// F0 has an external pull-up. | ||
// SCK works as usual. | ||
// | ||
// Note that the matrix contains a variety of data. | ||
// In addition to the keys, it also reads the rotary encoders | ||
// and whether the board is the left/right half. | ||
|
||
void matrix_init_custom(void) { | ||
// Note: `spi_init` has already been called | ||
// in `keyboard_pre_init_kb()`, so nothing to do here | ||
} | ||
|
||
bool matrix_scan_custom(matrix_row_t current_matrix[]) { | ||
// Enough to hold the shift registers | ||
uint16_t length = 5; | ||
uint8_t data[length]; | ||
|
||
// Matrix SPI config | ||
// 1) Pin | ||
// 2) Mode: Register shifts on rising clock, and clock idles low | ||
// pol = 0 & pha = 0 => mode 0 | ||
// 3) LSB first: Register outputs H first, and we want H as MSB, | ||
// as this result in a neat A-H order in the layout macro. | ||
// 4) Divisor: 2 is the fastest possible, at Fclk / 2. | ||
// range is 2-128 | ||
spi_start(GP13, false, 0, 128); | ||
spi_receive(data, length); | ||
spi_stop(); | ||
|
||
bool matrix_has_changed = false; | ||
for (uint8_t i = 0; i < length; i++) { | ||
// Bitwise NOT because we use pull-ups, | ||
// and switches short the pin to ground, | ||
// but the matrix uses 1 to indicate a pressed switch | ||
uint8_t word = ~data[i]; | ||
matrix_has_changed |= current_matrix[i] ^ word; | ||
current_matrix[i] = word; | ||
} | ||
#ifdef MYRIAD_ENABLE | ||
bool myriad_hook_matrix(matrix_row_t current_matrix[]); | ||
return matrix_has_changed || myriad_hook_matrix(current_matrix); | ||
#else | ||
return matrix_has_changed; | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.