Merge upstream QMK Firmware at '0.12.52~1'

This commit is contained in:
Drashna Jael're
2021-06-29 12:23:03 -07:00
415 changed files with 18692 additions and 7301 deletions

View File

@@ -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;
}
}