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

[Keyboard] Update ZSA Moonlander #23911

Merged
merged 7 commits into from
Aug 19, 2024
Merged
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
fix mcp functions
  • Loading branch information
drashna committed Jun 20, 2024
commit cafac226ad42b75b8181d76179391358e96060b0
7 changes: 3 additions & 4 deletions keyboards/zsa/moonlander/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ uint8_t mcp23018_errors;

bool io_expander_ready(void) {
uint8_t tx;
return mcp23018_readPins(MCP23018_DEFAULT_ADDRESS, mcp23018_PORTA, &tx);
return mcp23018_read_pins(MCP23018_DEFAULT_ADDRESS, mcp23018_PORTA, &tx);
}

void matrix_init_custom(void) {
Expand Down Expand Up @@ -116,8 +116,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
// Selecting the row on the right side of the keyboard.
if (!mcp23018_errors) {
// select row
mcp23018_errors += !mcp23018_set_output(MCP23018_DEFAULT_ADDRESS, mcp23018_PORTA, (0b01111111 & ~(1 << (row))) | ((uint8_t)!mcp23018_leds[2] << 7));
mcp23018_errors += !mcp23018_set_output(MCP23018_DEFAULT_ADDRESS, mcp23018_PORTB, ((uint8_t)!mcp23018_leds[1] << 6) | ((uint8_t)!mcp23018_leds[0] << 7));
mcp23018_errors += !mcp23018_set_output_all(MCP23018_DEFAULT_ADDRESS, (0b01111111 & ~(1 << (row))) | ((uint8_t)!mcp23018_leds[2] << 7), ((uint8_t)!mcp23018_leds[1] << 6) | ((uint8_t)!mcp23018_leds[0] << 7));
}

// Reading the left side of the keyboard.
Expand Down Expand Up @@ -162,7 +161,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
// Reading the right side of the keyboard.
if (!mcp23018_errors) {
uint8_t rx;
mcp23018_errors += !mcp23018_readPins(MCP23018_DEFAULT_ADDRESS, mcp23018_PORTB, &rx);
mcp23018_errors += !mcp23018_read_pins(MCP23018_DEFAULT_ADDRESS, mcp23018_PORTB, &rx);
data = ~(rx & 0b00111111);
} else {
data = 0;
Expand Down
Loading