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

@ -18,17 +18,17 @@
void set_bitc_LED(uint8_t mode) {
switch(mode) {
case LED_ON:
setPinOutput(PIN_LED);
writePin(PIN_LED, GPIO_STATE_HIGH);
gpio_set_pin_output(PIN_LED);
gpio_write_pin(PIN_LED, GPIO_STATE_HIGH);
break;
case LED_DIM:
setPinInput(PIN_LED);
gpio_set_pin_input(PIN_LED);
break;
case LED_OFF:
setPinOutput(PIN_LED);
writePin(PIN_LED, GPIO_STATE_LOW);
gpio_set_pin_output(PIN_LED);
gpio_write_pin(PIN_LED, GPIO_STATE_LOW);
break;
default:

View file

@ -24,13 +24,13 @@ void set_big_LED_rgb(uint8_t r_mode, uint8_t g_mode, uint8_t b_mode) {
void set_big_LED_r(uint8_t mode) {
switch(mode) {
case LED_ON:
setPinOutput(BIG_LED_R_PIN);
writePin(BIG_LED_R_PIN, GPIO_STATE_HIGH);
gpio_set_pin_output(BIG_LED_R_PIN);
gpio_write_pin(BIG_LED_R_PIN, GPIO_STATE_HIGH);
break;
case LED_OFF:
setPinOutput(BIG_LED_R_PIN);
writePin(BIG_LED_R_PIN, GPIO_STATE_LOW);
gpio_set_pin_output(BIG_LED_R_PIN);
gpio_write_pin(BIG_LED_R_PIN, GPIO_STATE_LOW);
break;
default:
@ -41,13 +41,13 @@ void set_big_LED_r(uint8_t mode) {
void set_big_LED_g(uint8_t mode) {
switch(mode) {
case LED_ON:
setPinOutput(BIG_LED_G_PIN);
writePin(BIG_LED_G_PIN, GPIO_STATE_HIGH);
gpio_set_pin_output(BIG_LED_G_PIN);
gpio_write_pin(BIG_LED_G_PIN, GPIO_STATE_HIGH);
break;
case LED_OFF:
setPinOutput(BIG_LED_G_PIN);
writePin(BIG_LED_G_PIN, GPIO_STATE_LOW);
gpio_set_pin_output(BIG_LED_G_PIN);
gpio_write_pin(BIG_LED_G_PIN, GPIO_STATE_LOW);
break;
default:
@ -58,13 +58,13 @@ void set_big_LED_g(uint8_t mode) {
void set_big_LED_b(uint8_t mode) {
switch(mode) {
case LED_ON:
setPinOutput(BIG_LED_B_PIN);
writePin(BIG_LED_B_PIN, GPIO_STATE_HIGH);
gpio_set_pin_output(BIG_LED_B_PIN);
gpio_write_pin(BIG_LED_B_PIN, GPIO_STATE_HIGH);
break;
case LED_OFF:
setPinOutput(BIG_LED_B_PIN);
writePin(BIG_LED_B_PIN, GPIO_STATE_LOW);
gpio_set_pin_output(BIG_LED_B_PIN);
gpio_write_pin(BIG_LED_B_PIN, GPIO_STATE_LOW);
break;
default:

View file

@ -27,17 +27,17 @@ static const uint8_t col_pins[MATRIX_MUX_COLS] = MATRIX_COL_MUX_PINS;
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 < MATRIX_ROWS; pin++) {
setPinInputHigh(row_pins[pin]);
gpio_set_pin_input_high(row_pins[pin]);
}
}
@ -45,7 +45,7 @@ static void select_col(uint8_t col)
{
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);
}
}
@ -60,7 +60,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];
if (!readPin(row_pins[row_index]))
if (!gpio_read_pin(row_pins[row_index]))
{
current_matrix[row_index] |= (COL_SHIFTER << current_col);
}

View file

@ -6,17 +6,17 @@
void set_scramble_LED(uint8_t mode) {
switch(mode) {
case LED_ON:
setPinOutput(PIN_LED);
writePin(PIN_LED, GPIO_STATE_HIGH);
gpio_set_pin_output(PIN_LED);
gpio_write_pin(PIN_LED, GPIO_STATE_HIGH);
break;
case LED_DIM:
setPinInput(PIN_LED);
gpio_set_pin_input(PIN_LED);
break;
case LED_OFF:
setPinOutput(PIN_LED);
writePin(PIN_LED, GPIO_STATE_LOW);
gpio_set_pin_output(PIN_LED);
gpio_write_pin(PIN_LED, GPIO_STATE_LOW);
break;
default:

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);