|
@@ -21,6 +21,12 @@
|
|
#include "dynamic_keymap.h"
|
|
#include "dynamic_keymap.h"
|
|
#include "via.h" // for default VIA_EEPROM_ADDR_END
|
|
#include "via.h" // for default VIA_EEPROM_ADDR_END
|
|
|
|
|
|
|
|
+#ifdef ENCODER_ENABLE
|
|
|
|
+# include "encoder.h"
|
|
|
|
+#else
|
|
|
|
+# define NUM_ENCODERS 0
|
|
|
|
+#endif
|
|
|
|
+
|
|
#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
|
|
#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
|
|
# define DYNAMIC_KEYMAP_LAYER_COUNT 4
|
|
# define DYNAMIC_KEYMAP_LAYER_COUNT 4
|
|
#endif
|
|
#endif
|
|
@@ -63,20 +69,23 @@
|
|
# define DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2))
|
|
# define DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2))
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-// Dynamic macro starts after dynamic encoders
|
|
|
|
-#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
|
|
|
|
-# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * NUM_ENCODERS * 2 * 2))
|
|
|
|
-#endif
|
|
|
|
|
|
+// Dynamic macro starts after dynamic encoders, but only when using ENCODER_MAP
|
|
|
|
+#ifdef ENCODER_MAP_ENABLE
|
|
|
|
+# ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
|
|
|
|
+# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * NUM_ENCODERS * 2 * 2))
|
|
|
|
+# endif // DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
|
|
|
|
+#else // ENCODER_MAP_ENABLE
|
|
|
|
+# ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
|
|
|
|
+# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR)
|
|
|
|
+# endif // DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
|
|
|
|
+#endif // ENCODER_MAP_ENABLE
|
|
|
|
|
|
// Sanity check that dynamic keymaps fit in available EEPROM
|
|
// Sanity check that dynamic keymaps fit in available EEPROM
|
|
// If there's not 100 bytes available for macros, then something is wrong.
|
|
// If there's not 100 bytes available for macros, then something is wrong.
|
|
// The keyboard should override DYNAMIC_KEYMAP_LAYER_COUNT to reduce it,
|
|
// The keyboard should override DYNAMIC_KEYMAP_LAYER_COUNT to reduce it,
|
|
// or DYNAMIC_KEYMAP_EEPROM_MAX_ADDR to increase it, *only if* the microcontroller has
|
|
// or DYNAMIC_KEYMAP_EEPROM_MAX_ADDR to increase it, *only if* the microcontroller has
|
|
// more than the default.
|
|
// more than the default.
|
|
-#if DYNAMIC_KEYMAP_EEPROM_MAX_ADDR - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR < 100
|
|
|
|
-# pragma message STR(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR) " < 100"
|
|
|
|
-# error Dynamic keymaps are configured to use more EEPROM than is available.
|
|
|
|
-#endif
|
|
|
|
|
|
+_Static_assert((DYNAMIC_KEYMAP_EEPROM_MAX_ADDR) - (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR) >= 100, "Dynamic keymaps are configured to use more EEPROM than is available.");
|
|
|
|
|
|
// Dynamic macros are stored after the keymaps and use what is available
|
|
// Dynamic macros are stored after the keymaps and use what is available
|
|
// up to and including DYNAMIC_KEYMAP_EEPROM_MAX_ADDR.
|
|
// up to and including DYNAMIC_KEYMAP_EEPROM_MAX_ADDR.
|