From 816accda3d48ba6d199644acb0ee5966987a09c8 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Thu, 22 Jul 2021 21:42:59 -0700 Subject: Fix errors with matrix_output_unselect_delay function calls (#13645) --- .../symmetric70_proto/matrix_debug/matrix.c | 69 +++++++++++----------- .../symmetric70_proto/proton_c/proton_c.c | 6 +- 2 files changed, 39 insertions(+), 36 deletions(-) (limited to 'keyboards/handwired/symmetric70_proto') diff --git a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c index c84efe2915..a892707f8b 100644 --- a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c +++ b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c @@ -32,7 +32,7 @@ along with this program. If not, see . # define MATRIX_DEBUG_DELAY_END() # define MATRIX_DEBUG_GAP() #else -# define MATRIX_DEBUG_GAP() asm volatile("nop \n nop":::"memory") +# define MATRIX_DEBUG_GAP() asm volatile("nop \n nop" ::: "memory") #endif #ifndef MATRIX_IO_DELAY_ALWAYS @@ -44,16 +44,16 @@ static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; #elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW) static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; -# ifdef MATRIX_MUL_SELECT -static const pin_t col_sel[MATRIX_COLS] = MATRIX_MUL_SEL; -# endif +# ifdef MATRIX_MUL_SELECT +static const pin_t col_sel[MATRIX_COLS] = MATRIX_MUL_SEL; +# endif #endif #ifdef MATRIX_IO_DELAY_PORTS -static const pin_t delay_ports[] = { MATRIX_IO_DELAY_PORTS }; -static const port_data_t delay_masks[] = { MATRIX_IO_DELAY_MASKS }; +static const pin_t delay_ports[] = {MATRIX_IO_DELAY_PORTS}; +static const port_data_t delay_masks[] = {MATRIX_IO_DELAY_MASKS}; # ifdef MATRIX_IO_DELAY_MULSEL -static const uint8_t delay_sel[] = { MATRIX_IO_DELAY_MULSEL }; +static const uint8_t delay_sel[] = {MATRIX_IO_DELAY_MULSEL}; # endif #endif @@ -120,10 +120,10 @@ static void unselect_rows(void) { } static void init_pins(void) { -#ifdef MATRIX_MUL_SELECT +# ifdef MATRIX_MUL_SELECT setPinOutput(MATRIX_MUL_SELECT); writePinLow(MATRIX_MUL_SELECT); -#endif +# endif unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { setPinInputHigh_atomic(col_pins[x]); @@ -141,10 +141,10 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // For each col... for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { // Select the col pin to read (active low) -#ifdef MATRIX_MUL_SELECT - writePin(MATRIX_MUL_SELECT,col_sel[col_index]); +# ifdef MATRIX_MUL_SELECT + writePin(MATRIX_MUL_SELECT, col_sel[col_index]); waitInputPinDelay(); -#endif +# endif uint8_t pin_state = readPin(col_pins[col_index]); // Populate the matrix row with the state of the col pin @@ -153,37 +153,38 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // Unselect row unselect_row(current_row); -#ifdef MATRIX_IO_DELAY_PORTS +# ifdef MATRIX_IO_DELAY_PORTS if (current_row_value) { // wait for col signal to go HIGH bool is_pressed; do { MATRIX_DEBUG_DELAY_START(); is_pressed = false; - for (uint8_t i = 0; i < sizeof(delay_ports)/sizeof(pin_t); i++ ) { -# ifdef MATRIX_IO_DELAY_MULSEL + for (uint8_t i = 0; i < sizeof(delay_ports) / sizeof(pin_t); i++) { +# ifdef MATRIX_IO_DELAY_MULSEL writePin(MATRIX_MUL_SELECT, delay_sel[i]); waitInputPinDelay(); -# endif - is_pressed |= ( (readPort(delay_ports[i]) & delay_masks[i]) != delay_masks[i] ); +# endif + is_pressed |= ((readPort(delay_ports[i]) & delay_masks[i]) != delay_masks[i]); } MATRIX_DEBUG_DELAY_END(); } while (is_pressed); } -#endif -#ifdef MATRIX_IO_DELAY_ADAPTIVE +# endif +# ifdef MATRIX_IO_DELAY_ADAPTIVE if (current_row_value) { // wait for col signal to go HIGH for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { MATRIX_DEBUG_DELAY_START(); -#ifdef MATRIX_MUL_SELECT - writePin(MATRIX_MUL_SELECT,col_sel[col_index]); +# ifdef MATRIX_MUL_SELECT + writePin(MATRIX_MUL_SELECT, col_sel[col_index]); waitInputPinDelay(); -#endif - while (readPin(col_pins[col_index]) == 0) {} +# endif + while (readPin(col_pins[col_index]) == 0) { + } MATRIX_DEBUG_DELAY_END(); } } -#endif -#ifdef MATRIX_IO_DELAY_ADAPTIVE2 +# endif +# ifdef MATRIX_IO_DELAY_ADAPTIVE2 if (current_row_value) { // wait for col signal to go HIGH pin_t state; do { @@ -192,19 +193,19 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { MATRIX_DEBUG_DELAY_END(); MATRIX_DEBUG_DELAY_START(); -#ifdef MATRIX_MUL_SELECT - writePin(MATRIX_MUL_SELECT,col_sel[col_index]); +# ifdef MATRIX_MUL_SELECT + writePin(MATRIX_MUL_SELECT, col_sel[col_index]); waitInputPinDelay(); -#endif +# endif state |= (readPin(col_pins[col_index]) == 0); } MATRIX_DEBUG_DELAY_END(); } while (state); } -#endif +# endif if (MATRIX_IO_DELAY_ALWAYS || current_row + 1 < MATRIX_ROWS) { MATRIX_DEBUG_DELAY_START(); - matrix_output_unselect_delay(); // wait for col signal to go HIGH + matrix_output_unselect_delay(current_row, current_row_value != 0); MATRIX_DEBUG_DELAY_END(); } @@ -267,7 +268,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) // Unselect col unselect_col(current_col); if (MATRIX_IO_DELAY_ALWAYS || current_col + 1 < MATRIX_COLS) { - matrix_output_unselect_delay(); // wait for col signal to go HIGH + matrix_output_unselect_delay(current_row, current_row_value != 0); } return matrix_changed; @@ -311,11 +312,13 @@ uint8_t matrix_scan(void) { changed |= read_rows_on_col(raw_matrix, current_col); } #endif - MATRIX_DEBUG_SCAN_END(); MATRIX_DEBUG_GAP(); + MATRIX_DEBUG_SCAN_END(); + MATRIX_DEBUG_GAP(); MATRIX_DEBUG_SCAN_START(); debounce(raw_matrix, matrix, MATRIX_ROWS, changed); - MATRIX_DEBUG_SCAN_END(); MATRIX_DEBUG_GAP(); + MATRIX_DEBUG_SCAN_END(); + MATRIX_DEBUG_GAP(); MATRIX_DEBUG_SCAN_START(); matrix_scan_quantum(); diff --git a/keyboards/handwired/symmetric70_proto/proton_c/proton_c.c b/keyboards/handwired/symmetric70_proto/proton_c/proton_c.c index 3fe5bc297c..dfdc9d7597 100644 --- a/keyboards/handwired/symmetric70_proto/proton_c/proton_c.c +++ b/keyboards/handwired/symmetric70_proto/proton_c/proton_c.c @@ -4,9 +4,9 @@ /* In tmk_core/common/wait.h, the implementation for PROTOCOL_CHIBIOS * calls 'chThdSleepMicroseconds(1)' when 'wait_us(0)'. * However, 'wait_us(0)' should do nothing. */ -void matrix_output_unselect_delay(void) { -# if !defined(MATRIX_IO_DELAY) || MATRIX_IO_DELAY > 0 +void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { +# if !defined(MATRIX_IO_DELAY) || MATRIX_IO_DELAY > 0 matrix_io_delay(); -# endif +# endif } #endif -- cgit v1.2.3 From 5b904a92c4ef143fe1d10927bbda94dd27f78a1d Mon Sep 17 00:00:00 2001 From: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Date: Sat, 24 Jul 2021 01:05:06 +0900 Subject: [Keyboard] Fix symmetric70_proto build break on develop branch (#13667) Co-authored-by: Drashna Jaelre --- keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'keyboards/handwired/symmetric70_proto') diff --git a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c index a892707f8b..ba0018a70f 100644 --- a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c +++ b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c @@ -205,7 +205,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) # endif if (MATRIX_IO_DELAY_ALWAYS || current_row + 1 < MATRIX_ROWS) { MATRIX_DEBUG_DELAY_START(); - matrix_output_unselect_delay(current_row, current_row_value != 0); + matrix_output_unselect_delay(current_row, current_row_value != 0); // wait for col signal to go HIGH MATRIX_DEBUG_DELAY_END(); } @@ -238,6 +238,7 @@ static void init_pins(void) { static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { bool matrix_changed = false; + bool key_pressed = false; // Select col select_col(current_col); @@ -253,6 +254,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) if (readPin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_row_value |= (MATRIX_ROW_SHIFTER << current_col); + key_pressed = true; } else { // Pin HI, clear col bit current_row_value &= ~(MATRIX_ROW_SHIFTER << current_col); @@ -268,7 +270,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) // Unselect col unselect_col(current_col); if (MATRIX_IO_DELAY_ALWAYS || current_col + 1 < MATRIX_COLS) { - matrix_output_unselect_delay(current_row, current_row_value != 0); + matrix_output_unselect_delay(current_col, key_pressed); // wait for col signal to go HIGH } return matrix_changed; -- cgit v1.2.3 From a03aa301def77c867ae6c6c840f7fc82b26d91d6 Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Fri, 6 Aug 2021 23:59:56 -0700 Subject: Remove Full Bootmagic (#13846) * disambiguate Bootmagic rules in keymaps The files edited by this commit were added at a point in time where `BOOTMAGIC_ENABLE = yes` enabled full Bootmagic. This commit edits the files to specify that full Bootmagic is intended. * remove BOOTMAGIC_ENABLE=full setting * unify commented BOOTMAGIC_ENABLE rules in keyboards Explicitly sets `BOOTMAGIC_ENABLE = no` in keyboards where the rule was commented out. Command: ``` find keyboards/ -type f -name 'rules.mk' -and -not -path '*/keymaps/*' -exec sed -i -e 's;#[ \t]*\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-zA-Z]\+\).*;\1 = no # Virtual DIP switch configuration;g' {} + ``` * remove commented Bootmagic rules from keymap/user level Command: ``` find keyboards/ layouts/ users/ -type f -name 'rules.mk' -exec sed -i -e '/#.*\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-z]\+\).*/d' {} + ``` * update keyboard BOOTMAGIC_ENABLE rule formatting Sets the formatting of BOOTMAGIC_ENABLE rules to `BOOTMAGIC_ENABLE = [value]`, without the inline comments (which will be replaced later). Command: ``` find keyboards/ -type f -name 'rules.mk' -and -not -path '*/keymaps/*' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-z]\+\).*;\1 = \2;g' '{}' + ``` * update keyboards' BOOTMAGIC_ENABLE settings Updates keyboard `rules.mk` files to use `BOOTMAGIC_ENABLE = lite` where `BOOTMAGIC_ENABLE = full` was being used. Command: ``` find keyboards/ -type f -name 'rules.mk' -and -not -path '*/keymaps/*' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE = \)full;\1lite;g' '{}' + ``` * update keymap/user BOOTMAGIC_ENABLE settings Updates keymap/user `rules.mk` files to use `BOOTMAGIC_ENABLE = lite` where `BOOTMAGIC_ENABLE = full` was being used. Commands: ``` find keyboards/ -type f -name 'rules.mk' -and -path '*/keymaps/*' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE[ \t=]\+\)full;\1lite;g' '{}' + find layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE[ \t=]\+\)full;\1lite;g' '{}' + ``` * remove and replace inline comments in keyboards and keymap/user files Removes and replaces the inline comments, which have been updated to read `Enable Bootmagic Lite`. Commands: ``` find keyboards/ -type f -name 'rules.mk' -and -path '*/keymaps/*' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-z]\+\).*;\1 = \2;g' '{}' + find layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-z]\+\).*;\1 = \2;g' '{}' + find keyboards/ layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE = lite\);\1 # Enable Bootmagic Lite;g' '{}' + find keyboards/ layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE = yes\);\1 # Enable Bootmagic Lite;g' '{}' + find keyboards/ layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE = no\);\1 # Enable Bootmagic Lite;g' '{}' + ``` * rename improperly named makefiles Some files intended to be used as makefiles had improper names causing them to not be used as intended when building. This commit corrects the filenames of the affected files. * update renamed file with new rule formatting * update QMK's template files Updates QMK's `rules.mk` templates to use the new inline comment. * update QMK Docs - remove documentation of full Bootmagic - update links to Bootmagic Lite doc - add doc for Magic Keycodes * rules.mk patch for coarse/ixora and coarse/vinta --- keyboards/handwired/symmetric70_proto/promicro/rules.mk | 2 +- keyboards/handwired/symmetric70_proto/proton_c/rules.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'keyboards/handwired/symmetric70_proto') diff --git a/keyboards/handwired/symmetric70_proto/promicro/rules.mk b/keyboards/handwired/symmetric70_proto/promicro/rules.mk index 822b1a84d9..ff631aa31b 100644 --- a/keyboards/handwired/symmetric70_proto/promicro/rules.mk +++ b/keyboards/handwired/symmetric70_proto/promicro/rules.mk @@ -7,7 +7,7 @@ BOOTLOADER = caterina # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = no # Audio control and System control CONSOLE_ENABLE = no # Console for debug diff --git a/keyboards/handwired/symmetric70_proto/proton_c/rules.mk b/keyboards/handwired/symmetric70_proto/proton_c/rules.mk index e8b0948461..b39c045c14 100644 --- a/keyboards/handwired/symmetric70_proto/proton_c/rules.mk +++ b/keyboards/handwired/symmetric70_proto/proton_c/rules.mk @@ -8,7 +8,7 @@ BOOTLOADER = stm32-dfu # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = no # Audio control and System control CONSOLE_ENABLE = no # Console for debug -- cgit v1.2.3