1
0
Fork 0

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

@ -37,23 +37,23 @@ static uint8_t* col_pins = col_pins_left;
static void init_pins(void) {
// Set cols to outputs, low
for (uint8_t pin = 0; pin < MATRIX_MUX_COLS; pin++) {
setPinOutput(col_pins[pin]);
gpio_set_pin_output(col_pins[pin]);
}
// Unselect cols
for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) {
writePinLow(col_pins[bit]);
gpio_write_pin_low(col_pins[bit]);
}
// Set rows to input, pullup
for (uint8_t pin = 0; pin < ROWS_PER_HAND; pin++) {
setPinInputHigh(row_pins[pin]);
gpio_set_pin_input_high(row_pins[pin]);
}
// Set extended pin (only on right side)
if (!isLeftHand) {
// Set extended pin to input, pullup
setPinInputHigh(MATRIX_EXT_PIN_RIGHT);
gpio_set_pin_input_high(MATRIX_EXT_PIN_RIGHT);
}
}
@ -61,7 +61,7 @@ static void select_col(uint8_t col) {
// Drive demux with correct column address
for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) {
uint8_t state = (col & (0b1 << bit)) >> bit;
writePin(col_pins[bit], !state);
gpio_write_pin(col_pins[bit], !state);
}
}
@ -71,7 +71,7 @@ static void read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
// Read each row sequentially
for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) {
if (readPin(row_pins[row_index]) == 0) {
if (gpio_read_pin(row_pins[row_index]) == 0) {
current_matrix[row_index] |= (COL_SHIFTER << current_col);
} else {
current_matrix[row_index] &= ~(COL_SHIFTER << current_col);
@ -82,7 +82,7 @@ static void read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
static void read_ext_pin(matrix_row_t current_matrix[]) {
// Read the state of the extended matrix pin
if (!isLeftHand) {
if (readPin(MATRIX_EXT_PIN_RIGHT) == 0) {
if (gpio_read_pin(MATRIX_EXT_PIN_RIGHT) == 0) {
current_matrix[EXT_PIN_ROW] |= (COL_SHIFTER << EXT_PIN_COL);
} else {
current_matrix[EXT_PIN_ROW] &= ~(COL_SHIFTER << EXT_PIN_COL);