Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
parent
5426a7a129
commit
d09a06a1b3
390 changed files with 3912 additions and 3913 deletions
|
@ -27,13 +27,13 @@ static matrix_row_t matrix_inverted[MATRIX_COLS];
|
|||
void matrix_init_custom(void) {
|
||||
// actual matrix setup - cols
|
||||
for (int i = 0; i < MATRIX_COLS; i++) {
|
||||
setPinOutput(matrix_col_pins[i]);
|
||||
writePinLow(matrix_col_pins[i]);
|
||||
gpio_set_pin_output(matrix_col_pins[i]);
|
||||
gpio_write_pin_low(matrix_col_pins[i]);
|
||||
}
|
||||
|
||||
// rows
|
||||
for (int i = 0; i < MATRIX_ROWS; i++) {
|
||||
setPinInputLow(matrix_row_pins[i]);
|
||||
gpio_set_pin_input_low(matrix_row_pins[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,18 +45,18 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
|||
matrix_row_t data = 0;
|
||||
|
||||
// strobe col
|
||||
writePinHigh(matrix_col_pins[col]);
|
||||
gpio_write_pin_high(matrix_col_pins[col]);
|
||||
|
||||
// need wait to settle pin state
|
||||
wait_us(20);
|
||||
|
||||
// read row data
|
||||
for (int row = 0; row < MATRIX_ROWS; row++) {
|
||||
data |= (readPin(matrix_row_pins[row]) << row);
|
||||
data |= (gpio_read_pin(matrix_row_pins[row]) << row);
|
||||
}
|
||||
|
||||
// unstrobe col
|
||||
writePinLow(matrix_col_pins[col]);
|
||||
gpio_write_pin_low(matrix_col_pins[col]);
|
||||
|
||||
if (matrix_inverted[col] != data) {
|
||||
matrix_inverted[col] = data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue