-
-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Change lib8tion library to be usable in user keymaps #5598
Conversation
…clude lib8tion.c in QUANTUM_LIB_SRC
@pelrun Thank you for the notes! I have addressed them. |
With the custom animation pr coming up, you will be able to use the functions directly without any changes to lib8tion fyi #5338 This is because this method pulls you animation code into the rgb matrix compile unit after the math lib, so you will be able to access it without doing any includes on your end. |
Okay, looks like the build is having a tough time generating the lib8tion.a file, it's broken lots of keyboards. |
@XScorpion2 That will be awesome! Thank you for all of your work on improving the animation support in QMK, it's a huge help for new people like me getting into the ecosystem. Do you think it's worth making these changes in case a user wants to use these functions in custom code? I understand it'll be making changes to the underlying lib8tion library, but I think there still might be use in cleaning it up so it can be included from multiple sources if necessary.
@pelrun Thank you for your help here. I can take a look at the build breaks to see if I can figure out why they're happening. |
I think it's useful as you said to allow others to use these faster math functions. As for your change, I think you can get the same effect with a simpler change by just marking the array static. My main thoughts are around this point: how likely are we to take future updates to this lib? Right now most of this lib is inlined for performance costing ~150 bytes (with lto) of firmware space. So I do like the idea of ripping apart this lib into reusable c/h files and reduce in line code duplication at the cost of a bit of performance, but that definitely will prevent future lib updates easily. Tbh I'm really leaning towards this approach but just want to make 100% sure before pulling the trigger. |
Specifically, ARM boards are having this issue. |
Ah, there aren't any functions in there on an ARM build, just the variables. Libraries mustn't like that. |
Build is still failing, but from what I can tell the
@pelrun @XScorpion2 The code has been changed to match your suggestions to just convert the constant to I'm hoping this is a good compromise as it changes as little about the library as possible (in case of rewrite or wanting parity with lib8tion's main repo), and doesn't break ARM builds. Does anyone have issues with this workaround for the time being? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, failures in CI look unrelated to this change.
* upstream/master: (779 commits) [Keyboard] Signum3.0 remove sortedcontainers (qmk#5679) Simple extended space cadet (qmk#5277) Removed forced in lining for lib8tion functions (qmk#5670) Change lib8tion library to be usable in user keymaps (qmk#5598) [Keyboard] Fixing drag-and-drop (qmk#5728) [Keyboard] Adding ortho_4x12 & planck_mit layouts for KBD4X (qmk#5729) [Keyboard] Minor fixes for Baguette (qmk#5737) Updated rgb_led struct field modifier to flags (qmk#5619) RGB Matrix: Custom effects on a kb/user level (qmk#5338) Fix Planck and Preonic builds (qmk#5658) [Keymap] dz60 keymap w/ hhkb-esque default layer (qmk#5708) [Keymap] Added compatibility for Planck rev6 (qmk#5706) [Keyboard] Satisfaction75 i2c fix and VIA layout (qmk#5726) A better new_project.sh (qmk#5191) Fix sendstring "#" producing "£" instead (qmk#5724) [Keyboard] Added WT69-A PCB (qmk#5721) [Keymap] Fix typo and function layer image for Quefrency (qmk#5719) [Keymap] Initial keyboard layout for KBD67 (qmk#5720) [Keymap] New keymap for Quefrency 65% with split backspace, RGB, media keys, mouse keys (qmk#5717) [Keyboard] Update Gergo to use newer Ergodox Matrix code (qmk#5703) ...
* Move lib8tion header-defined constant into implementation file, add to build * Move b_m16_interleave initializtion to lib8tion.c, change build to include lib8tion.c in QUANTUM_LIB_SRC * Remove left-over whitespace * Move lib8tion include by RGB_MATRIX_ENABLE code in makefile * Revert build changes and change lib8tion b_m16_interleave constant to static
* Move lib8tion header-defined constant into implementation file, add to build * Move b_m16_interleave initializtion to lib8tion.c, change build to include lib8tion.c in QUANTUM_LIB_SRC * Remove left-over whitespace * Move lib8tion include by RGB_MATRIX_ENABLE code in makefile * Revert build changes and change lib8tion b_m16_interleave constant to static
* Move lib8tion header-defined constant into implementation file, add to build * Move b_m16_interleave initializtion to lib8tion.c, change build to include lib8tion.c in QUANTUM_LIB_SRC * Remove left-over whitespace * Move lib8tion include by RGB_MATRIX_ENABLE code in makefile * Revert build changes and change lib8tion b_m16_interleave constant to static
* Move lib8tion header-defined constant into implementation file, add to build * Move b_m16_interleave initializtion to lib8tion.c, change build to include lib8tion.c in QUANTUM_LIB_SRC * Remove left-over whitespace * Move lib8tion include by RGB_MATRIX_ENABLE code in makefile * Revert build changes and change lib8tion b_m16_interleave constant to static
* Move lib8tion header-defined constant into implementation file, add to build * Move b_m16_interleave initializtion to lib8tion.c, change build to include lib8tion.c in QUANTUM_LIB_SRC * Remove left-over whitespace * Move lib8tion include by RGB_MATRIX_ENABLE code in makefile * Revert build changes and change lib8tion b_m16_interleave constant to static
This PR moves a header-defined constant in the lib8tion library to an implementation file so that FastLED library functions can be included and used in user code. Using the FastLED functions in code outside of rgb_matrix.c was previously not possible due to the header-defined
b_m16_interleave
array. See #5597:This PR takes the second approach since it seems a little cleaner and will save a handful of bytes for
RGB_MATRIX_ENABLE
d keyboards.This is my first time contributing here, so please let me know if you'd prefer the
static
approach or would rather this be accomplished in a different way. Thank you!