Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
@@ -4,8 +4,8 @@ __attribute__ ((weak))
|
||||
void matrix_init_kb(void) {
|
||||
// Turn status LED on, with the exception of THK
|
||||
#if defined(__AVR_ATmega32U4__)
|
||||
setPinOutput(E6);
|
||||
writePinHigh(E6);
|
||||
gpio_set_pin_output(E6);
|
||||
gpio_write_pin_high(E6);
|
||||
#endif
|
||||
|
||||
matrix_init_user();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user