aboutsummaryrefslogtreecommitdiff
path: root/quantum/dynamic_keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/dynamic_keymap.c')
-rw-r--r--quantum/dynamic_keymap.c55
1 files changed, 31 insertions, 24 deletions
diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c
index ca056f630..11d28592d 100644
--- a/quantum/dynamic_keymap.c
+++ b/quantum/dynamic_keymap.c
@@ -20,28 +20,37 @@
20#include "progmem.h" // to read default from flash 20#include "progmem.h" // to read default from flash
21#include "quantum.h" // for send_string() 21#include "quantum.h" // for send_string()
22#include "dynamic_keymap.h" 22#include "dynamic_keymap.h"
23 23#include "via.h" // for default VIA_EEPROM_ADDR_END
24#ifdef DYNAMIC_KEYMAP_ENABLE 24
25 25#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
26# ifndef DYNAMIC_KEYMAP_EEPROM_ADDR 26# define DYNAMIC_KEYMAP_LAYER_COUNT 4
27# error DYNAMIC_KEYMAP_EEPROM_ADDR not defined 27#endif
28# endif 28
29 29#ifndef DYNAMIC_KEYMAP_MACRO_COUNT
30# ifndef DYNAMIC_KEYMAP_LAYER_COUNT 30# define DYNAMIC_KEYMAP_MACRO_COUNT 16
31# error DYNAMIC_KEYMAP_LAYER_COUNT not defined 31#endif
32# endif 32
33 33// If DYNAMIC_KEYMAP_EEPROM_ADDR not explicitly defined in config.h,
34# ifndef DYNAMIC_KEYMAP_MACRO_COUNT 34// default it start after VIA_EEPROM_CUSTOM_ADDR+VIA_EEPROM_CUSTOM_SIZE
35# error DYNAMIC_KEYMAP_MACRO_COUNT not defined 35#ifndef DYNAMIC_KEYMAP_EEPROM_ADDR
36# endif 36# ifdef VIA_EEPROM_CUSTOM_CONFIG_ADDR
37 37# define DYNAMIC_KEYMAP_EEPROM_ADDR (VIA_EEPROM_CUSTOM_CONFIG_ADDR+VIA_EEPROM_CUSTOM_CONFIG_SIZE)
38# ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 38# else
39# error DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR not defined 39# error DYNAMIC_KEYMAP_EEPROM_ADDR not defined
40# endif 40# endif
41 41#endif
42# ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 42
43# error DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE not defined 43// Dynamic macro starts after dynamic keymaps
44# endif 44#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
45# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR+(DYNAMIC_KEYMAP_LAYER_COUNT*MATRIX_ROWS*MATRIX_COLS*2))
46#endif
47
48// Dynamic macro uses up all remaining memory
49// Assumes 1K EEPROM on ATMega32U4
50// Override for anything different
51#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE
52# define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE (1024-DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR)
53#endif
45 54
46uint8_t dynamic_keymap_get_layer_count(void) { return DYNAMIC_KEYMAP_LAYER_COUNT; } 55uint8_t dynamic_keymap_get_layer_count(void) { return DYNAMIC_KEYMAP_LAYER_COUNT; }
47 56
@@ -208,5 +217,3 @@ void dynamic_keymap_macro_send(uint8_t id) {
208 send_string(data); 217 send_string(data);
209 } 218 }
210} 219}
211
212#endif // DYNAMIC_KEYMAP_ENABLE