diff options
| author | フィルターペーパー <76888457+filterpaper@users.noreply.github.com> | 2025-11-07 07:03:28 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-06 23:03:28 +0000 |
| commit | 1a991ffd24b8a5414b72c10dfc0fbea0afc085c2 (patch) | |
| tree | f59c443f603f5331a10745d2e102981dedc65c72 /docs/squeezing_avr.md | |
| parent | 01d81b95508f8411490467fe785b84d73495bdb9 (diff) | |
Guard remapping logic with MAGIC_ENABLE (#25537)
* Only perform key and mod remapping in keycode_config() and mod_config() when MAGIC_ENABLE is defined.
* If not set, these functions now return the original keycode or modifier unchanged.
* Reduces firmware size, and unnecessary code when MAGIC_ENABLE is not enabled.
* Removed space saving suggestion with magic functions from squeezing AVR documentation
Diffstat (limited to 'docs/squeezing_avr.md')
| -rw-r--r-- | docs/squeezing_avr.md | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/docs/squeezing_avr.md b/docs/squeezing_avr.md index 458b442d59..3eed847f07 100644 --- a/docs/squeezing_avr.md +++ b/docs/squeezing_avr.md | |||
| @@ -87,26 +87,6 @@ Or if you're not using layers at all, you can outright remove the functionality | |||
| 87 | #define NO_ACTION_LAYER | 87 | #define NO_ACTION_LAYER |
| 88 | ``` | 88 | ``` |
| 89 | 89 | ||
| 90 | ## Magic Functions | ||
| 91 | |||
| 92 | There are two `__attribute__ ((weak))` placeholder functions available to customize magic keycodes. If you are not using that feature to swap keycodes, such as backslash with backspace, add the following to your `keymap.c` or user space code: | ||
| 93 | ```c | ||
| 94 | #ifndef MAGIC_ENABLE | ||
| 95 | uint16_t keycode_config(uint16_t keycode) { | ||
| 96 | return keycode; | ||
| 97 | } | ||
| 98 | #endif | ||
| 99 | ``` | ||
| 100 | Likewise, if you are not using magic keycodes to swap modifiers, such as Control with GUI, add the following to your `keymap.c` or user space code: | ||
| 101 | ```c | ||
| 102 | #ifndef MAGIC_ENABLE | ||
| 103 | uint8_t mod_config(uint8_t mod) { | ||
| 104 | return mod; | ||
| 105 | } | ||
| 106 | #endif | ||
| 107 | ``` | ||
| 108 | Both of them will overwrite the placeholder functions with a simple return statement to reduce firmware size. | ||
| 109 | |||
| 110 | ## OLED tweaks | 90 | ## OLED tweaks |
| 111 | 91 | ||
| 112 | One place you can save a bunch of space here is by not using `sprintf` or `snprintf`. This function call takes up ~1.5kB of firmware space, and can be rewritten. For instance, WPM uses this a lot. | 92 | One place you can save a bunch of space here is by not using `sprintf` or `snprintf`. This function call takes up ~1.5kB of firmware space, and can be rewritten. For instance, WPM uses this a lot. |
