diff options
author | Ryan <[email protected]> | 2024-05-03 15:21:29 +1000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-03 15:21:29 +1000 |
commit | d09a06a1b354760fd0e64a453abade972900e885 (patch) | |
tree | 88d94640f4507ac8d7f570607423825bec3c6f89 /keyboards/handwired/symmetric70_proto | |
parent | 5426a7a129acf2ff5c8b435014747f1238e17965 (diff) | |
download | qmk_firmware-d09a06a1b354760fd0e64a453abade972900e885.tar.gz qmk_firmware-d09a06a1b354760fd0e64a453abade972900e885.zip |
Update GPIO API usage in keyboard code (#23361)
Diffstat (limited to 'keyboards/handwired/symmetric70_proto')
3 files changed, 24 insertions, 24 deletions
diff --git a/keyboards/handwired/symmetric70_proto/debug_config.h b/keyboards/handwired/symmetric70_proto/debug_config.h index cba99e402f..5a575eb479 100644 --- a/keyboards/handwired/symmetric70_proto/debug_config.h +++ b/keyboards/handwired/symmetric70_proto/debug_config.h @@ -8,23 +8,23 @@ #include <gpio.h> static inline void setDebugPinOutput_Low(void) { - setPinOutput(MATRIX_DEBUG_PIN); - writePinLow(MATRIX_DEBUG_PIN); + gpio_set_pin_output(MATRIX_DEBUG_PIN); + gpio_write_pin_low(MATRIX_DEBUG_PIN); } #define MATRIX_DEBUG_PIN_INIT() setDebugPinOutput_Low() #ifdef MATRIX_DEBUG_SCAN -# define MATRIX_DEBUG_SCAN_START() writePinHigh(MATRIX_DEBUG_PIN) -# define MATRIX_DEBUG_SCAN_END() writePinLow(MATRIX_DEBUG_PIN) +# define MATRIX_DEBUG_SCAN_START() gpio_write_pin_high(MATRIX_DEBUG_PIN) +# define MATRIX_DEBUG_SCAN_END() gpio_write_pin_low(MATRIX_DEBUG_PIN) #else # define MATRIX_DEBUG_SCAN_START() # define MATRIX_DEBUG_SCAN_END() #endif #ifdef MATRIX_DEBUG_DELAY -# define MATRIX_DEBUG_DELAY_START() writePinHigh(MATRIX_DEBUG_PIN) -# define MATRIX_DEBUG_DELAY_END() writePinLow(MATRIX_DEBUG_PIN) +# define MATRIX_DEBUG_DELAY_START() gpio_write_pin_high(MATRIX_DEBUG_PIN) +# define MATRIX_DEBUG_DELAY_END() gpio_write_pin_low(MATRIX_DEBUG_PIN) #else # define MATRIX_DEBUG_DELAY_START() # define MATRIX_DEBUG_DELAY_END() diff --git a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c index d6fcb0f793..786c1b4a73 100644 --- a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c +++ b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c @@ -62,13 +62,13 @@ extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); + gpio_set_pin_output(pin); + gpio_write_pin_low(pin); } } static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } + ATOMIC_BLOCK_FORCEON { gpio_set_pin_input_high(pin); } } // matrix code @@ -80,7 +80,7 @@ static void init_pins(void) { for (int col = 0; col < MATRIX_COLS; col++) { pin_t pin = direct_pins[row][col]; if (pin != NO_PIN) { - setPinInputHigh(pin); + gpio_set_pin_input_high(pin); } } } @@ -93,7 +93,7 @@ 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++) { pin_t pin = direct_pins[current_row][col_index]; if (pin != NO_PIN) { - current_row_value |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); + current_row_value |= gpio_read_pin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); } } @@ -120,8 +120,8 @@ static void unselect_rows(void) { static void init_pins(void) { # ifdef MATRIX_MUL_SELECT - setPinOutput(MATRIX_MUL_SELECT); - writePinLow(MATRIX_MUL_SELECT); + gpio_set_pin_output(MATRIX_MUL_SELECT); + gpio_write_pin_low(MATRIX_MUL_SELECT); # endif unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { @@ -141,10 +141,10 @@ 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++) { // Select the col pin to read (active low) # ifdef MATRIX_MUL_SELECT - writePin(MATRIX_MUL_SELECT, col_sel[col_index]); + gpio_write_pin(MATRIX_MUL_SELECT, col_sel[col_index]); waitInputPinDelay(); # endif - uint8_t pin_state = readPin(col_pins[col_index]); + uint8_t pin_state = gpio_read_pin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -160,7 +160,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) is_pressed = false; for (uint8_t i = 0; i < ARRAY_SIZE(delay_ports); i++) { # ifdef MATRIX_IO_DELAY_MULSEL - writePin(MATRIX_MUL_SELECT, delay_sel[i]); + gpio_write_pin(MATRIX_MUL_SELECT, delay_sel[i]); waitInputPinDelay(); # endif is_pressed |= ((readPort(delay_ports[i]) & delay_masks[i]) != delay_masks[i]); @@ -174,10 +174,10 @@ 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_START(); # ifdef MATRIX_MUL_SELECT - writePin(MATRIX_MUL_SELECT, col_sel[col_index]); + gpio_write_pin(MATRIX_MUL_SELECT, col_sel[col_index]); waitInputPinDelay(); # endif - while (readPin(col_pins[col_index]) == 0) { + while (gpio_read_pin(col_pins[col_index]) == 0) { } MATRIX_DEBUG_DELAY_END(); } @@ -193,10 +193,10 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) MATRIX_DEBUG_DELAY_END(); MATRIX_DEBUG_DELAY_START(); # ifdef MATRIX_MUL_SELECT - writePin(MATRIX_MUL_SELECT, col_sel[col_index]); + gpio_write_pin(MATRIX_MUL_SELECT, col_sel[col_index]); waitInputPinDelay(); # endif - state |= (readPin(col_pins[col_index]) == 0); + state |= (gpio_read_pin(col_pins[col_index]) == 0); } MATRIX_DEBUG_DELAY_END(); } while (state); @@ -250,7 +250,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) matrix_row_t current_row_value = last_row_value; // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (gpio_read_pin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_row_value |= (MATRIX_ROW_SHIFTER << current_col); key_pressed = true; diff --git a/keyboards/handwired/symmetric70_proto/matrix_fast/matrix_extension_74hc15x.c b/keyboards/handwired/symmetric70_proto/matrix_fast/matrix_extension_74hc15x.c index 202454a221..25ecc668e5 100644 --- a/keyboards/handwired/symmetric70_proto/matrix_fast/matrix_extension_74hc15x.c +++ b/keyboards/handwired/symmetric70_proto/matrix_fast/matrix_extension_74hc15x.c @@ -51,9 +51,9 @@ static const pin_t sel_pins[] = { MATRIX_EXT_74HC15x }; LOCAL_FUNC ALWAYS_INLINE void select74HC15x(uint8_t devid); LOCAL_FUNC void select74HC15x(uint8_t devid) { - writePin(sel_pins[0], devid&1); + gpio_write_pin(sel_pins[0], devid&1); #if defined(MATRIX_EXTENSION_74HC153) - writePin(sel_pins[1], devid&2); + gpio_write_pin(sel_pins[1], devid&2); #endif } @@ -67,7 +67,7 @@ LOCAL_FUNC port_width_t readPortMultiplexer(uint8_t devid, pin_t port) { #define readMatrixPort(dev, port) \ ((dev) == MCU_GPIO)? readPort(port): (IS_74HC15x(dev))? readPortMultiplexer((dev)-MCU_GPIOa, port):0 -#define INIT_74HC15X(x) setPinOutput(x); writePinLow(x); +#define INIT_74HC15X(x) gpio_set_pin_output(x); gpio_write_pin_low(x); LOCAL_FUNC void init_74hc15x(void) { MAP(INIT_74HC15X, MATRIX_EXT_74HC15x) |