Update atomic GPIO macros in keyboard custom matrix (#23796)
This commit is contained in:
parent
5c43a9bed1
commit
1552cf2ddc
20 changed files with 270 additions and 270 deletions
|
@ -50,25 +50,25 @@ matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; }
|
|||
|
||||
void matrix_print(void) {}
|
||||
|
||||
static inline void setPinOutput_writeLow(pin_t pin) {
|
||||
static inline void gpio_atomic_set_pin_output_low(pin_t pin) {
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
gpio_set_pin_output(pin);
|
||||
gpio_write_pin_low(pin);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void setPinInputHigh_atomic(pin_t pin) {
|
||||
static inline void gpio_atomic_set_pin_input_high(pin_t pin) {
|
||||
ATOMIC_BLOCK_FORCEON { gpio_set_pin_input_high(pin); }
|
||||
}
|
||||
|
||||
// matrix code
|
||||
static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); }
|
||||
static void select_row(uint8_t row) { gpio_atomic_set_pin_output_low(row_pins[row]); }
|
||||
|
||||
static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); }
|
||||
static void unselect_row(uint8_t row) { gpio_atomic_set_pin_input_high(row_pins[row]); }
|
||||
|
||||
static void unselect_rows(void) {
|
||||
for (uint8_t x = 0; x < ROWS_PER_HAND; x++) {
|
||||
setPinInputHigh_atomic(row_pins[x]);
|
||||
gpio_atomic_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,24 +103,24 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); }
|
||||
static void select_col(uint8_t col) { gpio_atomic_set_pin_output_low(col_pins[col]); }
|
||||
|
||||
static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); }
|
||||
static void unselect_col(uint8_t col) { gpio_atomic_set_pin_input_high(col_pins[col]); }
|
||||
|
||||
static void unselect_cols(void) {
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh_atomic(col_pins[x]);
|
||||
gpio_atomic_set_pin_input_high(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_rows();
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh_atomic(col_pins[x]);
|
||||
gpio_atomic_set_pin_input_high(col_pins[x]);
|
||||
}
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < ROWS_PER_HAND; x++) {
|
||||
setPinInputHigh_atomic(row_pins[x]);
|
||||
gpio_atomic_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue