diff options
author | Drashna Jael're <drashna@live.com> | 2021-06-29 12:23:03 -0700 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2021-06-29 12:24:07 -0700 |
commit | acf2c323e2927f6007b17ded577cf49fd86fec6c (patch) | |
tree | 8334dc5c71e6ab9bf33c76143eac7bb0e60159b0 /quantum/dynamic_keymap.c | |
parent | ec7a7beeed3046e9144d4c4ce0ef3b2c4f9e4341 (diff) | |
parent | f55e39e8a2246f6f96fd5d4a84a866e2615cde7b (diff) |
Merge upstream QMK Firmware at '0.12.52~1'
Diffstat (limited to 'quantum/dynamic_keymap.c')
-rw-r--r-- | quantum/dynamic_keymap.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c index 688379c9af..f76f37f997 100644 --- a/quantum/dynamic_keymap.c +++ b/quantum/dynamic_keymap.c @@ -14,16 +14,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "keymap.h" // to get keymaps[][][] -#include "eeprom.h" -#include "progmem.h" // to read default from flash + +#include "tmk_core/common/eeprom.h" #include "quantum.h" // for send_string() -#include "dynamic_keymap.h" -#ifdef VIA_ENABLE -# include "via.h" // for default VIA_EEPROM_ADDR_END -#else -# include "eeconfig.h" -#endif +#include "eeconfig.h" #ifndef DYNAMIC_KEYMAP_LAYER_COUNT # define DYNAMIC_KEYMAP_LAYER_COUNT 4 @@ -35,10 +29,18 @@ // This is the default EEPROM max address to use for dynamic keymaps. // The default is the ATmega32u4 EEPROM max address. -// Explicitly override it if the keyboard uses a microcontroller with +// Explicitly override it if the keyboard uses a microcontroller with // more EEPROM *and* it makes sense to increase it. #ifndef DYNAMIC_KEYMAP_EEPROM_MAX_ADDR -# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 1023 +# if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) +# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 +# elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) +# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095 +# elif defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega16U4__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATtiny85__) +# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 511 +# else +# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 1023 +# endif #endif // Due to usage of uint16_t check for max 65535 @@ -222,9 +224,9 @@ void dynamic_keymap_macro_send(uint8_t id) { ++p; } - // Send the macro string one or two chars at a time - // by making temporary 1 or 2 char strings - char data[3] = {0, 0, 0}; + // Send the macro string one or three chars at a time + // by making temporary 1 or 3 char strings + char data[4] = {0, 0, 0, 0}; // We already checked there was a null at the end of // the buffer, so this cannot go past the end while (1) { @@ -235,10 +237,12 @@ void dynamic_keymap_macro_send(uint8_t id) { break; } // If the char is magic (tap, down, up), - // add the next char (key to use) and send a 2 char string. + // add the next char (key to use) and send a 3 char string. if (data[0] == SS_TAP_CODE || data[0] == SS_DOWN_CODE || data[0] == SS_UP_CODE) { - data[1] = eeprom_read_byte(p++); - if (data[1] == 0) { + data[1] = data[0]; + data[0] = SS_QMK_PREFIX; + data[2] = eeprom_read_byte(p++); + if (data[2] == 0) { break; } } |