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

Optimize matrix scanning by removing variable shifts #14947

Merged
merged 1 commit into from
Oct 27, 2021

Conversation

chadaustin
Copy link

Description

AVR does not include a barrel shifter. Variable shifts compile into
loops that carry the bits across multiple 8-bit registers.

This small optimization increases the matrix scan rate on my keyboard
from 598 to 628.

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

AVR does not include a barrel shifter. Variable shifts compile into
loops that carry the bits across multiple 8-bit registers.

This small optimization increases the matrix scan rate on my keyboard
from 598 to 628.
@chadaustin
Copy link
Author

Note that the per-key debouncers would also benefit from this optimization, but the impact is smaller.

@tzarc tzarc changed the base branch from master to develop October 26, 2021 20:13
@tzarc
Copy link
Member

tzarc commented Oct 26, 2021

Retargeted against develop as it's a core change.

@tzarc tzarc requested a review from a team October 26, 2021 20:14
@tzarc tzarc requested a review from a team October 26, 2021 20:32
@drashna drashna merged commit ee23aae into qmk:develop Oct 27, 2021
cadusk pushed a commit to cadusk/qmk_firmware that referenced this pull request Oct 27, 2021
* qmk/develop: (24 commits)
  [Keyboard] add Lefty keyboard (qmk#14898)
  [Keyboard] Add support for bm65rgb, a revival of qmk#13361  (qmk#14800)
  [Keymap] Add personal lily58 keymap (qmk#14834)
  [Keyboard] binepad bn009 (qmk#14881)
  [Keyboard] Add MW65 Series PCB (qmk#14939)
  [Docs] Add instructions to create keymap before proceeding (qmk#14945)
  [Keyboard] Cradio keyboard (qmk#14946)
  [Keyboard] update(readme): with PCB reset instructions (qmk#14961)
  [Keymap] Add VLC keymap (qmk#14956)
  [Keyboard] Docs/folder organization and info json fixed (qmk#14239)
  Fix white spacing issues in kb files (qmk#14963)
  Optimize matrix scanning by removing variable shifts (qmk#14947)
  [Keymap] Add planck/pjanx and keebio/nyquist/pjanx keymaps (qmk#13115)
  [Keyboard] add ProjectCain Vault35; update Vault45 (qmk#13652)
  Add MAGIC_TOGGLE_GUI line to main keycode documentation (qmk#14959)
  Document `MAGIC` feature (qmk#14301)
  [Keyboard] Add minimon/Index tab 13x6 ortho (qmk#14765)
  [Keyboard] add support for Phoenix45_Ortho PCB (qmk#14798)
  [Keymap] Add via keymap for meishi2 (qmk#14892)
  Update mcu_selection.mk with current ChibiOS path (qmk#14909)
  ...
ptrxyz pushed a commit to ptrxyz/qmk_firmware that referenced this pull request Apr 9, 2022
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