Update GPIO API usage in keyboard code (#23361)
This commit is contained in:
parent
5426a7a129
commit
d09a06a1b3
390 changed files with 3912 additions and 3913 deletions
|
@ -21,9 +21,9 @@
|
|||
|
||||
void matrix_init_kb(void)
|
||||
{
|
||||
setPinOutput(NUM_PIN);
|
||||
setPinOutput(CAPS_PIN);
|
||||
setPinOutput(SCROLL_PIN);
|
||||
gpio_set_pin_output(NUM_PIN);
|
||||
gpio_set_pin_output(CAPS_PIN);
|
||||
gpio_set_pin_output(SCROLL_PIN);
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
@ -32,9 +32,9 @@ bool led_update_kb(led_t led_state)
|
|||
{
|
||||
bool res = led_update_user(led_state);
|
||||
if (res) {
|
||||
writePin(NUM_PIN, led_state.num_lock);
|
||||
writePin(CAPS_PIN, led_state.caps_lock);
|
||||
writePin(SCROLL_PIN, led_state.scroll_lock);
|
||||
gpio_write_pin(NUM_PIN, led_state.num_lock);
|
||||
gpio_write_pin(CAPS_PIN, led_state.caps_lock);
|
||||
gpio_write_pin(SCROLL_PIN, led_state.scroll_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
void matrix_init_kb(void)
|
||||
{
|
||||
// enable charge
|
||||
setPinOutput(CHG_EN_PIN);
|
||||
writePinHigh(CHG_EN_PIN);
|
||||
gpio_set_pin_output(CHG_EN_PIN);
|
||||
gpio_write_pin_high(CHG_EN_PIN);
|
||||
|
||||
// enable led power
|
||||
setPinOutput(LED_POWER_PIN);
|
||||
writePinHigh(LED_POWER_PIN);
|
||||
gpio_set_pin_output(LED_POWER_PIN);
|
||||
gpio_write_pin_high(LED_POWER_PIN);
|
||||
|
||||
}
|
||||
|
|
|
@ -22,22 +22,22 @@ static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
|||
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
|
||||
static void select_col(uint8_t col) {
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinHigh(col_pins[col]);
|
||||
gpio_set_pin_output(col_pins[col]);
|
||||
gpio_write_pin_high(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col) { setPinInputLow(col_pins[col]); }
|
||||
static void unselect_col(uint8_t col) { gpio_set_pin_input_low(col_pins[col]); }
|
||||
|
||||
static void unselect_cols(void) {
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputLow(col_pins[x]);
|
||||
gpio_set_pin_input_low(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputLow(row_pins[x]);
|
||||
gpio_set_pin_input_low(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
matrix_row_t current_row_value = last_row_value;
|
||||
|
||||
// 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_row_value |= (MATRIX_ROW_SHIFTER << current_col);
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "quantum.h"
|
||||
|
||||
void board_init(void) {
|
||||
writePinLow(A8);
|
||||
gpio_write_pin_low(A8);
|
||||
}
|
||||
|
||||
void bootloader_jump(void) {
|
||||
|
|
|
@ -4,20 +4,20 @@
|
|||
|
||||
#include "quantum.h"
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
setPinOutput(C6);
|
||||
setPinOutput(B2);
|
||||
setPinOutput(B1);
|
||||
|
||||
matrix_init_user();
|
||||
void matrix_init_user(void) {
|
||||
gpio_set_pin_output(C6);
|
||||
gpio_set_pin_output(B2);
|
||||
gpio_set_pin_output(B1);
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if (res) {
|
||||
writePin(B1, !led_state.num_lock);
|
||||
writePin(C6, !led_state.caps_lock);
|
||||
writePin(B2, !led_state.scroll_lock);
|
||||
gpio_write_pin(B1, !led_state.num_lock);
|
||||
gpio_write_pin(C6, !led_state.caps_lock);
|
||||
gpio_write_pin(B2, !led_state.scroll_lock);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue