summaryrefslogtreecommitdiff
path: root/quantum/keymap_extras/sendstring_bepo.h
diff options
context:
space:
mode:
authorTed M Lin <tedmlin@gmail.com>2020-03-02 18:43:18 -0500
committerGitHub <noreply@github.com>2020-03-03 10:43:18 +1100
commit552f8d81b9bff8010b328ee944d50830cfcaea5c (patch)
tree645321809be268907d4676759bb10c7eff4e4400 /quantum/keymap_extras/sendstring_bepo.h
parentabd36de5adbb484695d3500ad790df557d4f5419 (diff)
Reduce PROGMEM usage for sendstring LUT (#8109)
* Reduce PROGMEM usage for keycode map Bit-pack the keycode bool array to gain back a small amount of flash space. The trade-off is an increase in runtime instructions when running macros. It does make the code a bit harder to read, as well as maintain. For configs that use send_string() et al, it saves ~100 bytes. * Switch to macro and common definition Rewrite the array declarations so both the unpacked (original) and packed LUT arrays can use the same value definitions. This is done by defining a macro that "knows what to do". This makes the code much easier to read and maintain. * Fix macro typos and improve perf Pack the bits in a more efficient order for extraction. And also fix the copy/paste error in the macro... * Switch fully to packed LUT Some minor reformatting. Compile tested all sendstring_xyz.h to make sure they were converted properly. Also checked that an unconverted version would generate a compile error. * Apply whitespace suggestions from code review Co-Authored-By: Ryan <fauxpark@gmail.com> Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'quantum/keymap_extras/sendstring_bepo.h')
-rw-r--r--quantum/keymap_extras/sendstring_bepo.h69
1 files changed, 35 insertions, 34 deletions
diff --git a/quantum/keymap_extras/sendstring_bepo.h b/quantum/keymap_extras/sendstring_bepo.h
index ca5f73d7ec..f0cc88bd22 100644
--- a/quantum/keymap_extras/sendstring_bepo.h
+++ b/quantum/keymap_extras/sendstring_bepo.h
@@ -19,47 +19,48 @@
#pragma once
#include "keymap_bepo.h"
+#include "quantum.h"
// clang-format off
-const bool ascii_to_shift_lut[128] PROGMEM = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 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