mirror of
https://github.com/openstenoproject/qmk
synced 2024-11-22 08:24:41 +00:00
Doc Fixes & Custom Matrix Fix (#14526)
This commit is contained in:
parent
121ca7eca9
commit
4dbeeaa0d6
5 changed files with 41 additions and 26 deletions
|
@ -148,8 +148,8 @@ This is useful for setting up stuff that you may need elsewhere, but isn't hardw
|
||||||
|
|
||||||
* GPIO pin initialisation: `void matrix_init_pins(void)`
|
* GPIO pin initialisation: `void matrix_init_pins(void)`
|
||||||
* This needs to perform the low-level initialisation of all row and column pins. By default this will initialise the input/output state of each of the GPIO pins listed in `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`, based on whether or not the keyboard is set up for `ROW2COL`, `COL2ROW`, or `DIRECT_PINS`. Should the keyboard designer override this function, no initialisation of pin state will occur within QMK itself, instead deferring to the keyboard's override.
|
* This needs to perform the low-level initialisation of all row and column pins. By default this will initialise the input/output state of each of the GPIO pins listed in `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`, based on whether or not the keyboard is set up for `ROW2COL`, `COL2ROW`, or `DIRECT_PINS`. Should the keyboard designer override this function, no initialisation of pin state will occur within QMK itself, instead deferring to the keyboard's override.
|
||||||
* `COL2ROW`-based row reads: `void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)`
|
* `COL2ROW`-based row reads: `void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)`
|
||||||
* `ROW2COL`-based column reads: `void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)`
|
* `ROW2COL`-based column reads: `void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)`
|
||||||
* `DIRECT_PINS`-based reads: `void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)`
|
* `DIRECT_PINS`-based reads: `void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)`
|
||||||
* These three functions need to perform the low-level retrieval of matrix state of relevant input pins, based on the matrix type. Only one of the functions should be implemented, if needed. By default this will iterate through `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`, configuring the inputs and outputs based on whether or not the keyboard is set up for `ROW2COL`, `COL2ROW`, or `DIRECT_PINS`. Should the keyboard designer override this function, no manipulation of matrix GPIO pin state will occur within QMK itself, instead deferring to the keyboard's override.
|
* These three functions need to perform the low-level retrieval of matrix state of relevant input pins, based on the matrix type. Only one of the functions should be implemented, if needed. By default this will iterate through `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`, configuring the inputs and outputs based on whether or not the keyboard is set up for `ROW2COL`, `COL2ROW`, or `DIRECT_PINS`. Should the keyboard designer override this function, no manipulation of matrix GPIO pin state will occur within QMK itself, instead deferring to the keyboard's override.
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#define MATRIX_SCAN_DEBUG
|
||||||
|
#if !defined(MATRIX_SCAN_DEBUG)
|
||||||
static void render_layer(void) {
|
static void render_layer(void) {
|
||||||
// Host Keyboard Layer Status
|
// Host Keyboard Layer Status
|
||||||
oled_write_P(PSTR("Layer"), false);
|
oled_write_P(PSTR("Layer"), false);
|
||||||
|
@ -190,8 +192,8 @@ static void render_touch(void)
|
||||||
oled_write_P(!touch_encoder_toggled() ? PSTR("TOUCH") : PSTR(" "), false);
|
oled_write_P(!touch_encoder_toggled() ? PSTR("TOUCH") : PSTR(" "), false);
|
||||||
oled_write_P(touch_encoder_calibrating() ? PSTR("CLBRT") : PSTR(" "), false);
|
oled_write_P(touch_encoder_calibrating() ? PSTR("CLBRT") : PSTR(" "), false);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
/*static uint32_t scan_counter = 0;
|
static uint32_t scan_counter = 0;
|
||||||
static uint32_t scan_value = 0;
|
static uint32_t scan_value = 0;
|
||||||
static uint16_t scan_timer = 1000;
|
static uint16_t scan_timer = 1000;
|
||||||
|
|
||||||
|
@ -218,27 +220,27 @@ void render_debug_scan(void) {
|
||||||
static char buffer[6] = {0};
|
static char buffer[6] = {0};
|
||||||
snprintf(buffer, sizeof(buffer), "%5d", scan_value);
|
snprintf(buffer, sizeof(buffer), "%5d", scan_value);
|
||||||
oled_write_ln_P(buffer, false);
|
oled_write_ln_P(buffer, false);
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void oled_task_user(void) {
|
void oled_task_user(void) {
|
||||||
|
#if !defined(MATRIX_SCAN_DEBUG)
|
||||||
if (is_keyboard_left()) {
|
if (is_keyboard_left()) {
|
||||||
render_layer();
|
render_layer();
|
||||||
oled_write_P(PSTR(" "), false);
|
oled_write_P(PSTR(" "), false);
|
||||||
render_leds();
|
render_leds();
|
||||||
oled_write_P(PSTR(" "), false);
|
oled_write_P(PSTR(" "), false);
|
||||||
render_touch();
|
render_touch();
|
||||||
//oled_write_P(PSTR(" "), false);
|
|
||||||
//render_debug_scan();
|
|
||||||
oled_set_cursor(0, 12);
|
|
||||||
render_icon();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
render_rgb_menu();
|
render_rgb_menu();
|
||||||
//oled_write_P(PSTR(" "), false);
|
|
||||||
//render_debug_scan();
|
|
||||||
oled_set_cursor(0, 12);
|
|
||||||
render_icon();
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
oled_write_P(PSTR(" "), false);
|
||||||
|
render_debug_scan();
|
||||||
|
#endif
|
||||||
|
oled_set_cursor(0, 12);
|
||||||
|
render_icon();
|
||||||
}
|
}
|
||||||
|
|
||||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
MOUSEKEY_ENABLE = yes # using for mouse wheel up and down, more granular than page up/down
|
MOUSEKEY_ENABLE = yes # using for mouse wheel up and down, more granular than page up/down
|
||||||
|
|
||||||
OPT_DEFS += -DRGB_UNLIMITED_POWER
|
OPT_DEFS += -DRGB_UNLIMITED_POWER
|
||||||
#DEBOUNCE_TYPE = sym_eager_pk
|
|
|
@ -11,7 +11,19 @@
|
||||||
#include "atomic_util.h"
|
#include "atomic_util.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
|
||||||
static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
#define ROWS_PER_HAND (MATRIX_ROWS / 2)
|
||||||
|
static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||||
|
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||||
|
|
||||||
|
void matrix_init_pins(void) {
|
||||||
|
for (size_t i = 0; i < MATRIX_COLS; i++) {
|
||||||
|
setPinInputHigh(col_pins[i]);
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < ROWS_PER_HAND; i++) {
|
||||||
|
setPinOutput(row_pins[i]);
|
||||||
|
writePinHigh(row_pins[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
|
void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
|
||||||
/* Drive row pin low. */
|
/* Drive row pin low. */
|
||||||
|
@ -22,15 +34,17 @@ void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||||
uint16_t porta = palReadPort(GPIOA);
|
uint16_t porta = palReadPort(GPIOA);
|
||||||
uint16_t portb = palReadPort(GPIOB);
|
uint16_t portb = palReadPort(GPIOB);
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
/* Order of pins on the mun is: A0, B11, B0, B10, B12, B2, A8
|
/* Order of pins on the mun is: A0, B11, B0, B10, B12, B2, A8
|
||||||
Pin is active low, therefore we have to invert the result. */
|
Pin is active low, therefore we have to invert the result. */
|
||||||
matrix_row_t cols = ~(((porta & (0x1 << 0)) >> 0) // A0 (0)
|
matrix_row_t cols = ~(((porta & (0x1 << 0)) >> 0) // A0 (0)
|
||||||
| ((portb & (0x1 << 11)) >> 10) // B11 (1)
|
| ((portb & (0x1 << 11)) >> 10) // B11 (1)
|
||||||
| ((portb & (0x1 << 0)) << 2) // B0 (2)
|
| ((portb & (0x1 << 0)) << 2) // B0 (2)
|
||||||
| ((portb & (0x1 << 10)) >> 7) // B10 (3)
|
| ((portb & (0x1 << 10)) >> 7) // B10 (3)
|
||||||
| ((portb & (0x1 << 12)) >> 8) // B12 (4)
|
| ((portb & (0x1 << 12)) >> 8) // B12 (4)
|
||||||
| ((portb & (0x1 << 2)) << 3) // B2 (5)
|
| ((portb & (0x1 << 2)) << 3) // B2 (5)
|
||||||
| ((porta & (0x1 << 8)) >> 2)); // A8 (6)
|
| ((porta & (0x1 << 8)) >> 2)); // A8 (6)
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
/* Reverse the order of columns for left hand as the board is flipped. */
|
/* Reverse the order of columns for left hand as the board is flipped. */
|
||||||
// if (isLeftHand) {
|
// if (isLeftHand) {
|
||||||
|
@ -50,7 +64,7 @@ void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||||
|
|
||||||
/* Drive row pin high again. */
|
/* Drive row pin high again. */
|
||||||
ATOMIC_BLOCK_FORCEON { writePinHigh(row_pins[current_row]); }
|
ATOMIC_BLOCK_FORCEON { writePinHigh(row_pins[current_row]); }
|
||||||
matrix_output_unselect_delay(current_row, row_pins[current_row] != 0);
|
matrix_output_unselect_delay(current_row, cols != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(BUSY_WAIT)
|
#if defined(BUSY_WAIT)
|
||||||
|
|
|
@ -39,7 +39,7 @@ OPT = 3
|
||||||
OPT_DEFS += -DOLED_FONT_H=\"../common/glcdfont.c\"
|
OPT_DEFS += -DOLED_FONT_H=\"../common/glcdfont.c\"
|
||||||
OPT_DEFS += -Ikeyboards/rgbkb/common
|
OPT_DEFS += -Ikeyboards/rgbkb/common
|
||||||
|
|
||||||
# matrix optimisations (broken, will fix later)
|
# matrix optimisations
|
||||||
#SRC += matrix.c
|
SRC += matrix.c
|
||||||
|
|
||||||
DEFAULT_FOLDER = rgbkb/mun/rev1
|
DEFAULT_FOLDER = rgbkb/mun/rev1
|
||||||
|
|
Loading…
Reference in a new issue