Update GPIO API usage in keyboard code (#23361)

This commit is contained in:
Ryan 2024-05-03 15:21:29 +10:00 committed by GitHub
parent 5426a7a129
commit d09a06a1b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
390 changed files with 3912 additions and 3913 deletions

View file

@ -44,18 +44,18 @@ 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]);
}
// encoder A & B setup
setPinInputLow(B12);
setPinInputLow(B13);
gpio_set_pin_input_low(B12);
gpio_set_pin_input_low(B13);
#ifndef PLANCK_WATCHDOG_DISABLE
wdgInit();
@ -81,18 +81,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;
@ -113,11 +113,11 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b) {
pin_t pin = pad_b ? B13: B12;
setPinInputHigh(pin);
writePinLow(matrix_row_pins[index]);
gpio_set_pin_input_high(pin);
gpio_write_pin_low(matrix_row_pins[index]);
wait_us(10);
uint8_t ret = readPin(pin) ? 1 : 0;
setPinInputLow(matrix_row_pins[index]);
setPinInputLow(pin);
uint8_t ret = gpio_read_pin(pin) ? 1 : 0;
gpio_set_pin_input_low(matrix_row_pins[index]);
gpio_set_pin_input_low(pin);
return ret;
}