aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/kbdmania
diff options
context:
space:
mode:
authorRyan2024-05-03 07:21:29 +0200
committerGitHub2024-05-03 07:21:29 +0200
commitd09a06a1b354760fd0e64a453abade972900e885 (patch)
tree88d94640f4507ac8d7f570607423825bec3c6f89 /keyboards/kbdmania
parent5426a7a129acf2ff5c8b435014747f1238e17965 (diff)
Update GPIO API usage in keyboard code (#23361)
Diffstat (limited to 'keyboards/kbdmania')
-rw-r--r--keyboards/kbdmania/kmac/kmac.c30
-rw-r--r--keyboards/kbdmania/kmac/matrix.c24
-rw-r--r--keyboards/kbdmania/kmac_pad/kmac_pad.c4
-rw-r--r--keyboards/kbdmania/kmac_pad/matrix.c12
4 files changed, 35 insertions, 35 deletions
diff --git a/keyboards/kbdmania/kmac/kmac.c b/keyboards/kbdmania/kmac/kmac.c
index 29f7091084..c3f06349d8 100644
--- a/keyboards/kbdmania/kmac/kmac.c
+++ b/keyboards/kbdmania/kmac/kmac.c
@@ -19,11 +19,11 @@
#define WASD_MASK 0b10
void backlight_init_ports(void) {
- setPinOutput(B1);
- setPinOutput(B2);
- setPinOutput(B3);
- setPinOutput(B4);
- setPinOutput(D7);
+ gpio_set_pin_output(B1);
+ gpio_set_pin_output(B2);
+ gpio_set_pin_output(B3);
+ gpio_set_pin_output(B4);
+ gpio_set_pin_output(D7);
}
/* Backlight pin configuration
@@ -36,21 +36,21 @@ void backlight_init_ports(void) {
void backlight_set(uint8_t level) {
// F-row
if (level & F_ROW_MASK) {
- writePinHigh(B1);
+ gpio_write_pin_high(B1);
} else {
- writePinLow(B1);
+ gpio_write_pin_low(B1);
}
// WASD
if (level & WASD_MASK) {
- writePinLow(B2);
- writePinLow(B3);
- writePinLow(B4);
- writePinLow(D7);
+ gpio_write_pin_low(B2);
+ gpio_write_pin_low(B3);
+ gpio_write_pin_low(B4);
+ gpio_write_pin_low(D7);
} else {
- writePinHigh(B2);
- writePinHigh(B3);
- writePinHigh(B4);
- writePinHigh(D7);
+ gpio_write_pin_high(B2);
+ gpio_write_pin_high(B3);
+ gpio_write_pin_high(B4);
+ gpio_write_pin_high(D7);
}
}
diff --git a/keyboards/kbdmania/kmac/matrix.c b/keyboards/kbdmania/kmac/matrix.c
index 1843d19fd2..ea149c49ad 100644
--- a/keyboards/kbdmania/kmac/matrix.c
+++ b/keyboards/kbdmania/kmac/matrix.c
@@ -94,8 +94,8 @@ void matrix_print(void) {
*/
static void unselect_cols(void) {
for (uint8_t x = 0; x < 6; x++) {
- setPinOutput(col_pins[x]);
- writePinLow(col_pins[x]);
+ gpio_set_pin_output(col_pins[x]);
+ gpio_write_pin_low(col_pins[x]);
}
}
@@ -103,13 +103,13 @@ static void select_col(uint8_t col) {
if (col < 16) {
uint8_t c = col + 8;
- writePin(B6, c & 0b10000);
- writePin(C6, c & 0b01000);
- writePin(C7, c & 0b00100);
- writePin(F1, c & 0b00010);
- writePin(F0, c & 0b00001);
+ gpio_write_pin(B6, c & 0b10000);
+ gpio_write_pin(C6, c & 0b01000);
+ gpio_write_pin(C7, c & 0b00100);
+ gpio_write_pin(F1, c & 0b00010);
+ gpio_write_pin(F0, c & 0b00001);
} else {
- writePinHigh(B5);
+ gpio_write_pin_high(B5);
}
}
@@ -122,10 +122,10 @@ static void select_col(uint8_t col) {
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]);
}
- setPinInputHigh(E2);
+ gpio_set_pin_input_high(E2);
}
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
@@ -143,7 +143,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
// Check row pin state
// Use the otherwise unused row: 3, col: 0 for caps lock
if (row_index == 3 && current_col == 0) {
- if (readPin(E2) == 0) {
+ if (gpio_read_pin(E2) == 0) {
// Pin LO, set col bit
current_matrix[row_index] |= (ROW_SHIFTER << current_col);
} else {
@@ -151,7 +151,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
}
} else {
- if (readPin(row_pins[row_index]) == 0) {
+ if (gpio_read_pin(row_pins[row_index]) == 0) {
// Pin HI, clear col bit
current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
} else {
diff --git a/keyboards/kbdmania/kmac_pad/kmac_pad.c b/keyboards/kbdmania/kmac_pad/kmac_pad.c
index 3de2cb711e..064502710f 100644
--- a/keyboards/kbdmania/kmac_pad/kmac_pad.c
+++ b/keyboards/kbdmania/kmac_pad/kmac_pad.c
@@ -23,7 +23,7 @@ void keyboard_pre_init_kb(void) {
* FN Pin PB3
* PAD Pin PB1
*/
- setPinOutput(B3);
- setPinOutput(B1);
+ gpio_set_pin_output(B3);
+ gpio_set_pin_output(B1);
keyboard_pre_init_user();
}
diff --git a/keyboards/kbdmania/kmac_pad/matrix.c b/keyboards/kbdmania/kmac_pad/matrix.c
index ad7919e33c..1fe0502311 100644
--- a/keyboards/kbdmania/kmac_pad/matrix.c
+++ b/keyboards/kbdmania/kmac_pad/matrix.c
@@ -30,13 +30,13 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
*/
static void unselect_cols(void) {
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
- setPinOutput(col_pins[col]);
- writePinLow(col_pins[col]);
+ gpio_set_pin_output(col_pins[col]);
+ gpio_write_pin_low(col_pins[col]);
}
}
static void select_col(uint8_t col) {
- writePinHigh(col_pins[col]);
+ gpio_write_pin_high(col_pins[col]);
}
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
@@ -50,7 +50,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
if (current_col == 0) {
matrix_row_t last_row_value = current_matrix[0];
- if (readPin(row_pins[0]) == 0) {
+ if (gpio_read_pin(row_pins[0]) == 0) {
// Pin LO, set col bit
current_matrix[0] |= (1 << current_col);
} else {
@@ -68,7 +68,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
for (uint8_t row_index = 1; row_index < MATRIX_ROWS; row_index++) {
matrix_row_t last_row_value = current_matrix[row_index];
- if (readPin(row_pins[row_index]) == 0) {
+ if (gpio_read_pin(row_pins[row_index]) == 0) {
// Pin HI, clear col bit
current_matrix[row_index] &= ~(1 << current_col);
} else {
@@ -95,7 +95,7 @@ void matrix_init_custom(void) {
// initialize key pins
for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
- setPinInputHigh(row_pins[row_index]);
+ gpio_set_pin_input_high(row_pins[row_index]);
}
}