Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
@@ -16,22 +16,22 @@
|
||||
#include "quantum.h"
|
||||
|
||||
void led_init_ports(void) {
|
||||
setPinOutput(E6);
|
||||
setPinOutput(B1);
|
||||
setPinOutput(D0);
|
||||
setPinOutput(D1);
|
||||
setPinOutput(F0);
|
||||
gpio_set_pin_output(E6);
|
||||
gpio_set_pin_output(B1);
|
||||
gpio_set_pin_output(D0);
|
||||
gpio_set_pin_output(D1);
|
||||
gpio_set_pin_output(F0);
|
||||
|
||||
writePinHigh(E6);
|
||||
writePinHigh(B1);
|
||||
writePinHigh(D0);
|
||||
writePinHigh(D1);
|
||||
writePinHigh(F0);
|
||||
gpio_write_pin_high(E6);
|
||||
gpio_write_pin_high(B1);
|
||||
gpio_write_pin_high(D0);
|
||||
gpio_write_pin_high(D1);
|
||||
gpio_write_pin_high(F0);
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
if(led_update_user(led_state)) {
|
||||
writePin(E6, !led_state.num_lock);
|
||||
gpio_write_pin(E6, !led_state.num_lock);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
// Enable top LED
|
||||
setPinOutput(B3);
|
||||
writePinLow(B3);
|
||||
gpio_set_pin_output(B3);
|
||||
gpio_write_pin_low(B3);
|
||||
}
|
||||
|
||||
@@ -17,20 +17,20 @@
|
||||
|
||||
void led_init_ports(void) {
|
||||
// * Enable LED anodes (Vbus pin is replaced by B0 on some boards)
|
||||
setPinOutput(B0);
|
||||
writePinHigh(B0);
|
||||
gpio_set_pin_output(B0);
|
||||
gpio_write_pin_high(B0);
|
||||
|
||||
// * Set our LED pins as output and high
|
||||
setPinOutput(F5);
|
||||
writePinHigh(F5);
|
||||
gpio_set_pin_output(F5);
|
||||
gpio_write_pin_high(F5);
|
||||
|
||||
setPinOutput(F4);
|
||||
writePinLow(F4);
|
||||
gpio_set_pin_output(F4);
|
||||
gpio_write_pin_low(F4);
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
if(led_update_user(led_state)) {
|
||||
writePin(F5, !led_state.caps_lock);
|
||||
gpio_write_pin(F5, !led_state.caps_lock);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -46,7 +46,7 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
*/
|
||||
static void select_col(uint8_t col) {
|
||||
if (col_pins[col] != NO_PIN) {
|
||||
writePinLow(col_pins[col]);
|
||||
gpio_write_pin_low(col_pins[col]);
|
||||
} else {
|
||||
sn74x138_set_addr(13 - col);
|
||||
}
|
||||
@@ -54,8 +54,8 @@ static void select_col(uint8_t col) {
|
||||
|
||||
static void unselect_col(uint8_t col) {
|
||||
if (col_pins[col] != NO_PIN) {
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinHigh(col_pins[col]);
|
||||
gpio_set_pin_output(col_pins[col]);
|
||||
gpio_write_pin_high(col_pins[col]);
|
||||
} else {
|
||||
sn74x138_set_addr(0);
|
||||
}
|
||||
@@ -65,8 +65,8 @@ static void unselect_cols(void) {
|
||||
// Native
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
if (col_pins[x] != NO_PIN) {
|
||||
setPinOutput(col_pins[x]);
|
||||
writePinHigh(col_pins[x]);
|
||||
gpio_set_pin_output(col_pins[x]);
|
||||
gpio_write_pin_high(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ static void unselect_cols(void) {
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
||||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index]) == 0) {
|
||||
if (gpio_read_pin(row_pins[row_index]) == 0) {
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
|
||||
@@ -48,7 +48,7 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
*/
|
||||
static void select_col(uint8_t col) {
|
||||
if (col_pins[col] != NO_PIN) {
|
||||
writePinLow(col_pins[col]);
|
||||
gpio_write_pin_low(col_pins[col]);
|
||||
} else {
|
||||
sn74x138_set_addr((col == 6) ? 7 : 15 - col);
|
||||
sn74x138_set_enabled(true);
|
||||
@@ -57,8 +57,8 @@ static void select_col(uint8_t col) {
|
||||
|
||||
static void unselect_col(uint8_t col) {
|
||||
if (col_pins[col] != NO_PIN) {
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinHigh(col_pins[col]);
|
||||
gpio_set_pin_output(col_pins[col]);
|
||||
gpio_write_pin_high(col_pins[col]);
|
||||
} else {
|
||||
sn74x138_set_enabled(false);
|
||||
}
|
||||
@@ -68,8 +68,8 @@ static void unselect_cols(void) {
|
||||
// Native
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
if (col_pins[x] != NO_PIN) {
|
||||
setPinOutput(col_pins[x]);
|
||||
writePinHigh(col_pins[x]);
|
||||
gpio_set_pin_output(col_pins[x]);
|
||||
gpio_write_pin_high(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ static void unselect_cols(void) {
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
gpio_set_pin_input_high(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
||||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index]) == 0) {
|
||||
if (gpio_read_pin(row_pins[row_index]) == 0) {
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user