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

Core: Support inverted scan logic for optical switches #19053

Merged
merged 8 commits into from
Dec 8, 2022

Conversation

dexter93
Copy link
Contributor

@dexter93 dexter93 commented Nov 13, 2022

Some optical switch designs use inverted logic for pressed state.

To invert the keypress logic, configure matrix_pins.input_pressed_state in info.json:

    "matrix_pins": {
        "input_pressed_state": 1,
},

or, define MATRIX_INPUT_PRESSED_STATE 1 in config.h

Description

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@dexter93
Copy link
Contributor Author

Update on now stale #16340.

static inline uint8_t readMatrixPin(pin_t pin) should also probably become
static inline bool readMatrixPin(pin_t pin) since it's only spitting out 1/0

@dexter93
Copy link
Contributor Author

Some thoughts on this can be found in SonixQMK#299

@dexter93
Copy link
Contributor Author

functionality verified with no adverse effects in either input logic state

@drashna drashna requested a review from a team November 20, 2022 05:40
@tzarc tzarc merged commit f2a8a13 into qmk:develop Dec 8, 2022
omikronik pushed a commit to omikronik/qmk_firmware that referenced this pull request Jan 22, 2023
ssgelm pushed a commit to ssgelm/qmk_firmware that referenced this pull request Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants