Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Keyboard: HexBoard #22493

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename GPIO functions
  • Loading branch information
earboxer committed Jun 18, 2024
commit ce04b920fd529919a5f634a471e7e46c248a5954
24 changes: 12 additions & 12 deletions keyboards/hexboard/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ void matrix_init_custom(void) {
// For each column pin...
for (int pinNumber = 0; pinNumber < MATRIX_COLS; pinNumber++) {
// set the pinMode to INPUT_PULLUP (+3.3V / HIGH).
setPinInputHigh(columns[pinNumber]);
gpio_set_pin_input_high(columns[pinNumber]);
}
setPinOutput(mux_pins[0]);
setPinOutput(mux_pins[1]);
setPinOutput(mux_pins[2]);
setPinOutput(mux_pins[3]);
gpio_set_pin_output(mux_pins[0]);
gpio_set_pin_output(mux_pins[1]);
gpio_set_pin_output(mux_pins[2]);
gpio_set_pin_output(mux_pins[3]);
}

bool matrix_scan_custom(matrix_row_t current_matrix[]) {
Expand All @@ -26,19 +26,19 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
// Button Deck
// Iterate through each of the row pins on the multiplexing chip.
for (int rowIndex = 0; rowIndex < 14; rowIndex++) {
writePin(mux_pins[0], rowIndex & 1);
writePin(mux_pins[1], (rowIndex & 2) >> 1);
writePin(mux_pins[2], (rowIndex & 4) >> 2);
writePin(mux_pins[3], (rowIndex & 8) >> 3);
gpio_write_pin(mux_pins[0], rowIndex & 1);
gpio_write_pin(mux_pins[1], (rowIndex & 2) >> 1);
gpio_write_pin(mux_pins[2], (rowIndex & 4) >> 2);
gpio_write_pin(mux_pins[3], (rowIndex & 8) >> 3);
// Now iterate through each of the column pins that are connected to the current row pin.
for (int columnIndex = 0; columnIndex < MATRIX_COLS; columnIndex++) {
// Hold the currently selected column pin in a variable.
pin_t columnPin = columns[columnIndex];
// Set that row pin to INPUT_PULLUP mode (+3.3V / HIGH).
setPinInputHigh(columnPin);
gpio_set_pin_input_high(columnPin);
matrix_io_delay();
bool previousValue = (current_matrix[rowIndex] >> columnIndex) & 1;
bool buttonState = !readPin(columnPin); // inverted...
bool buttonState = !gpio_read_pin(columnPin); // inverted...
matrix_has_changed |= previousValue != buttonState;
if (buttonState) {
current_matrix[rowIndex] |= (1 << columnIndex);
Expand All @@ -47,7 +47,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
}

// Set the selected column pin back to INPUT mode (0V / LOW).
setPinInput(columnPin);
gpio_set_pin_input(columnPin);
}
}

Expand Down