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

Add keymap wrappers for introspection into the keymap. #17229

Merged
merged 2 commits into from
Jun 5, 2022

Conversation

tzarc
Copy link
Member

@tzarc tzarc commented May 29, 2022

Description

Adds some APIs for getting the number of layers defined in keymap and encoder map.
Should be useful for XAP to return extent information without requiring a #define.

Types of Changes

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

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

@tzarc tzarc added the xap XAP-related issues/PRs label May 29, 2022
@tzarc tzarc requested review from zvecr and a team May 29, 2022 00:19
@github-actions github-actions bot added the core label May 29, 2022
@tzarc tzarc force-pushed the keymap-wrap branch 3 times, most recently from 1c9df73 to 5482e46 Compare May 29, 2022 00:23
@tzarc tzarc changed the title Merge branch 'master' into develop Add keymap wrappers for introspection into the keymap. May 29, 2022
@tzarc tzarc merged commit 08c556b into qmk:develop Jun 5, 2022
@tzarc tzarc deleted the keymap-wrap branch June 5, 2022 00:26
@masiullah
Copy link

I am getting the below error when compiling a userspace keymap, the keymap used to work fine earlier but now it is not working

Compiling: quantum/keymap_introspection.c quantum/keymap_introspection.c: In function 'keymap_layer_count':
quantum/keymap_introspection.c:9:45: error: 'keymaps' undeclared (first use in this function)
9 | #define NUM_KEYMAP_LAYERS ((uint8_t)(sizeof(keymaps) / ((MATRIX_ROWS) * (MATRIX_COLS) * sizeof(uint16_t))))

When I remove the code at line 406 in build_keyboard.mk then it works. Is there something I am missing that I need to do to make this work without build_keyboard changes

line 406 in build_keyboard.mk
$(QUANTUM_DIR)/keymap_introspection.c \

I am able to reproduce this using the below command and it is also happening to a simple user space keymap I created for myself
make splitkb/kyria/rev1:manna-harbour_miryoku

@tzarc
Copy link
Member Author

tzarc commented Jul 4, 2022

Seems that keymap does some weird stuff with how it locates the keymap array.
Will have a look and raise a bugfix later today.

0xcharly pushed a commit to Bastardkb/bastardkb-qmk that referenced this pull request Jul 4, 2022
* Introspection handlers for keymaps.

* Renaming.
@drzony
Copy link
Contributor

drzony commented Jul 23, 2022

This approach breaks compile_commads.json since keymap.c is included instead of being compiled separately

@sigprof sigprof mentioned this pull request Jan 29, 2023
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core xap XAP-related issues/PRs
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants