diff options
| author | Ryan <fauxpark@gmail.com> | 2024-05-03 15:21:29 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-03 15:21:29 +1000 |
| commit | d09a06a1b354760fd0e64a453abade972900e885 (patch) | |
| tree | 88d94640f4507ac8d7f570607423825bec3c6f89 /keyboards/planck | |
| parent | 5426a7a129acf2ff5c8b435014747f1238e17965 (diff) | |
Update GPIO API usage in keyboard code (#23361)
Diffstat (limited to 'keyboards/planck')
| -rw-r--r-- | keyboards/planck/planck.c | 4 | ||||
| -rw-r--r-- | keyboards/planck/rev6_drop/matrix.c | 12 | ||||
| -rw-r--r-- | keyboards/planck/rev7/matrix.c | 26 |
3 files changed, 21 insertions, 21 deletions
diff --git a/keyboards/planck/planck.c b/keyboards/planck/planck.c index 660be55bab..9410b71a97 100644 --- a/keyboards/planck/planck.c +++ b/keyboards/planck/planck.c | |||
| @@ -4,8 +4,8 @@ __attribute__ ((weak)) | |||
| 4 | void matrix_init_kb(void) { | 4 | void matrix_init_kb(void) { |
| 5 | // Turn status LED on, with the exception of THK | 5 | // Turn status LED on, with the exception of THK |
| 6 | #if defined(__AVR_ATmega32U4__) | 6 | #if defined(__AVR_ATmega32U4__) |
| 7 | setPinOutput(E6); | 7 | gpio_set_pin_output(E6); |
| 8 | writePinHigh(E6); | 8 | gpio_write_pin_high(E6); |
| 9 | #endif | 9 | #endif |
| 10 | 10 | ||
| 11 | matrix_init_user(); | 11 | matrix_init_user(); |
diff --git a/keyboards/planck/rev6_drop/matrix.c b/keyboards/planck/rev6_drop/matrix.c index d140356738..4d535fbb03 100644 --- a/keyboards/planck/rev6_drop/matrix.c +++ b/keyboards/planck/rev6_drop/matrix.c | |||
| @@ -27,13 +27,13 @@ static matrix_row_t matrix_inverted[MATRIX_COLS]; | |||
| 27 | void matrix_init_custom(void) { | 27 | void matrix_init_custom(void) { |
| 28 | // actual matrix setup - cols | 28 | // actual matrix setup - cols |
| 29 | for (int i = 0; i < MATRIX_COLS; i++) { | 29 | for (int i = 0; i < MATRIX_COLS; i++) { |
| 30 | setPinOutput(matrix_col_pins[i]); | 30 | gpio_set_pin_output(matrix_col_pins[i]); |
| 31 | writePinLow(matrix_col_pins[i]); | 31 | gpio_write_pin_low(matrix_col_pins[i]); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | // rows | 34 | // rows |
| 35 | for (int i = 0; i < MATRIX_ROWS; i++) { | 35 | for (int i = 0; i < MATRIX_ROWS; i++) { |
| 36 | setPinInputLow(matrix_row_pins[i]); | 36 | gpio_set_pin_input_low(matrix_row_pins[i]); |
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | 39 | ||
| @@ -45,18 +45,18 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { | |||
| 45 | matrix_row_t data = 0; | 45 | matrix_row_t data = 0; |
| 46 | 46 | ||
| 47 | // strobe col | 47 | // strobe col |
| 48 | writePinHigh(matrix_col_pins[col]); | 48 | gpio_write_pin_high(matrix_col_pins[col]); |
| 49 | 49 | ||
| 50 | // need wait to settle pin state | 50 | // need wait to settle pin state |
| 51 | wait_us(20); | 51 | wait_us(20); |
| 52 | 52 | ||
| 53 | // read row data | 53 | // read row data |
| 54 | for (int row = 0; row < MATRIX_ROWS; row++) { | 54 | for (int row = 0; row < MATRIX_ROWS; row++) { |
| 55 | data |= (readPin(matrix_row_pins[row]) << row); | 55 | data |= (gpio_read_pin(matrix_row_pins[row]) << row); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | // unstrobe col | 58 | // unstrobe col |
| 59 | writePinLow(matrix_col_pins[col]); | 59 | gpio_write_pin_low(matrix_col_pins[col]); |
| 60 | 60 | ||
| 61 | if (matrix_inverted[col] != data) { | 61 | if (matrix_inverted[col] != data) { |
| 62 | matrix_inverted[col] = data; | 62 | matrix_inverted[col] = data; |
diff --git a/keyboards/planck/rev7/matrix.c b/keyboards/planck/rev7/matrix.c index 8cadfa5e8d..777bd6a7fe 100644 --- a/keyboards/planck/rev7/matrix.c +++ b/keyboards/planck/rev7/matrix.c | |||
| @@ -44,18 +44,18 @@ static matrix_row_t matrix_inverted[MATRIX_COLS]; | |||
| 44 | void matrix_init_custom(void) { | 44 | void matrix_init_custom(void) { |
| 45 | // actual matrix setup - cols | 45 | // actual matrix setup - cols |
| 46 | for (int i = 0; i < MATRIX_COLS; i++) { | 46 | for (int i = 0; i < MATRIX_COLS; i++) { |
| 47 | setPinOutput(matrix_col_pins[i]); | 47 | gpio_set_pin_output(matrix_col_pins[i]); |
| 48 | writePinLow(matrix_col_pins[i]); | 48 | gpio_write_pin_low(matrix_col_pins[i]); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | // rows | 51 | // rows |
| 52 | for (int i = 0; i < MATRIX_ROWS; i++) { | 52 | for (int i = 0; i < MATRIX_ROWS; i++) { |
| 53 | setPinInputLow(matrix_row_pins[i]); | 53 | gpio_set_pin_input_low(matrix_row_pins[i]); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | // encoder A & B setup | 56 | // encoder A & B setup |
| 57 | setPinInputLow(B12); | 57 | gpio_set_pin_input_low(B12); |
| 58 | setPinInputLow(B13); | 58 | gpio_set_pin_input_low(B13); |
| 59 | 59 | ||
| 60 | #ifndef PLANCK_WATCHDOG_DISABLE | 60 | #ifndef PLANCK_WATCHDOG_DISABLE |
| 61 | wdgInit(); | 61 | wdgInit(); |
| @@ -81,18 +81,18 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { | |||
| 81 | matrix_row_t data = 0; | 81 | matrix_row_t data = 0; |
| 82 | 82 | ||
| 83 | // strobe col | 83 | // strobe col |
| 84 | writePinHigh(matrix_col_pins[col]); | 84 | gpio_write_pin_high(matrix_col_pins[col]); |
| 85 | 85 | ||
| 86 | // need wait to settle pin state | 86 | // need wait to settle pin state |
| 87 | wait_us(20); | 87 | wait_us(20); |
| 88 | 88 | ||
| 89 | // read row data | 89 | // read row data |
| 90 | for (int row = 0; row < MATRIX_ROWS; row++) { | 90 | for (int row = 0; row < MATRIX_ROWS; row++) { |
| 91 | data |= (readPin(matrix_row_pins[row]) << row); | 91 | data |= (gpio_read_pin(matrix_row_pins[row]) << row); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | // unstrobe col | 94 | // unstrobe col |
| 95 | writePinLow(matrix_col_pins[col]); | 95 | gpio_write_pin_low(matrix_col_pins[col]); |
| 96 | 96 | ||
| 97 | if (matrix_inverted[col] != data) { | 97 | if (matrix_inverted[col] != data) { |
| 98 | matrix_inverted[col] = data; | 98 | matrix_inverted[col] = data; |
| @@ -113,11 +113,11 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { | |||
| 113 | 113 | ||
| 114 | uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b) { | 114 | uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b) { |
| 115 | pin_t pin = pad_b ? B13: B12; | 115 | pin_t pin = pad_b ? B13: B12; |
| 116 | setPinInputHigh(pin); | 116 | gpio_set_pin_input_high(pin); |
| 117 | writePinLow(matrix_row_pins[index]); | 117 | gpio_write_pin_low(matrix_row_pins[index]); |
| 118 | wait_us(10); | 118 | wait_us(10); |
| 119 | uint8_t ret = readPin(pin) ? 1 : 0; | 119 | uint8_t ret = gpio_read_pin(pin) ? 1 : 0; |
| 120 | setPinInputLow(matrix_row_pins[index]); | 120 | gpio_set_pin_input_low(matrix_row_pins[index]); |
| 121 | setPinInputLow(pin); | 121 | gpio_set_pin_input_low(pin); |
| 122 | return ret; | 122 | return ret; |
| 123 | } | 123 | } |
