1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#include "superduper.h"
#include "eeconfig.h"
#include "eeprom.h"
#include "keymap_colemak.h"
// SuperDuper
#define SUPERDUPER_COMBO_COUNT 3
#define EECONFIG_SUPERDUPER_INDEX (uint8_t *) 19
enum process_combo_event {
CB_SUPERDUPER,
};
enum supported_layers {
_QWERTY,
_COLEMAK,
_QWOC
};
const uint16_t PROGMEM superduper_combos[SUPERDUPER_COMBO_COUNT][3] = {
[_QWERTY] = {KC_S, KC_D, COMBO_END},
[_COLEMAK] = {KC_R, KC_S, COMBO_END},
[_QWOC] = {CM_S, CM_D, COMBO_END},
};
combo_t key_combos[COMBO_COUNT] = {
[CB_SUPERDUPER] = COMBO_ACTION(superduper_combos[_QWERTY]),
};
volatile bool superduper_enabled = true;
const uint16_t PROGMEM empty_combo[] = {COMBO_END};
bool toggle_superduper_mode(void) {
superduper_enabled = !superduper_enabled;
if (superduper_enabled) {
set_superduper_key_combos();
} else {
clear_superduper_key_combos();
}
return superduper_enabled;
}
void set_superduper_key_combo_layer(uint16_t layer) {
key_combos[CB_SUPERDUPER].keys = superduper_combos[layer];
eeprom_update_byte(EECONFIG_SUPERDUPER_INDEX, layer);
}
void set_superduper_key_combos(void) {
uint8_t layer = eeprom_read_byte(EECONFIG_SUPERDUPER_INDEX);
switch (layer) {
case _QWERTY:
case _COLEMAK:
case _QWOC:
key_combos[CB_SUPERDUPER].keys = superduper_combos[layer];
break;
}
}
void clear_superduper_key_combos(void) {
key_combos[CB_SUPERDUPER].keys = empty_combo;
}
|