diff options
author | Hugh Enxing <henxing@draper.com> | 2017-03-28 12:11:49 -0400 |
---|---|---|
committer | Hugh Enxing <henxing@draper.com> | 2017-03-28 12:11:49 -0400 |
commit | 3fdc45b4e9581c823ac09545241241e0c6d3f313 (patch) | |
tree | f17c050672086233a2de4e4c8d0ba72c5bd87841 | |
parent | 25f2295ba88627521bed63ec4e5412b983626901 (diff) | |
parent | 5e4daf1c6db980fad269fe7b013205008bfe701e (diff) | |
download | qmk_firmware-3fdc45b4e9581c823ac09545241241e0c6d3f313.tar.gz qmk_firmware-3fdc45b4e9581c823ac09545241241e0c6d3f313.zip |
Merge branch 'master' into default_atreus_layout
101 files changed, 4925 insertions, 782 deletions
diff --git a/.gitignore b/.gitignore index f66a961fd..6029afce4 100644 --- a/.gitignore +++ b/.gitignore | |||
@@ -1,5 +1,6 @@ | |||
1 | .dep | 1 | .dep |
2 | *.o | 2 | *.o |
3 | *.bin | ||
3 | *.eep | 4 | *.eep |
4 | *.elf | 5 | *.elf |
5 | *.hex | 6 | *.hex |
diff --git a/build_keyboard.mk b/build_keyboard.mk index 4a6fc0980..82464d583 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk | |||
@@ -23,9 +23,9 @@ ifdef master | |||
23 | MASTER = $(master) | 23 | MASTER = $(master) |
24 | endif | 24 | endif |
25 | 25 | ||
26 | ifeq ($(MASTER),right) | 26 | ifeq ($(MASTER),right) |
27 | OPT_DEFS += -DMASTER_IS_ON_RIGHT | 27 | OPT_DEFS += -DMASTER_IS_ON_RIGHT |
28 | else | 28 | else |
29 | ifneq ($(MASTER),left) | 29 | ifneq ($(MASTER),left) |
30 | $(error MASTER does not have a valid value(left/right)) | 30 | $(error MASTER does not have a valid value(left/right)) |
31 | endif | 31 | endif |
@@ -38,7 +38,7 @@ KEYBOARD_C := $(KEYBOARD_PATH)/$(KEYBOARD).c | |||
38 | 38 | ||
39 | ifneq ("$(wildcard $(KEYBOARD_C))","") | 39 | ifneq ("$(wildcard $(KEYBOARD_C))","") |
40 | include $(KEYBOARD_PATH)/rules.mk | 40 | include $(KEYBOARD_PATH)/rules.mk |
41 | else | 41 | else |
42 | $(error "$(KEYBOARD_C)" does not exist) | 42 | $(error "$(KEYBOARD_C)" does not exist) |
43 | endif | 43 | endif |
44 | 44 | ||
@@ -49,7 +49,7 @@ ifneq ($(SUBPROJECT),) | |||
49 | ifneq ("$(wildcard $(SUBPROJECT_C))","") | 49 | ifneq ("$(wildcard $(SUBPROJECT_C))","") |
50 | OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT) | 50 | OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT) |
51 | include $(SUBPROJECT_PATH)/rules.mk | 51 | include $(SUBPROJECT_PATH)/rules.mk |
52 | else | 52 | else |
53 | $(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist) | 53 | $(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist) |
54 | endif | 54 | endif |
55 | endif | 55 | endif |
@@ -83,7 +83,7 @@ ifneq ($(SUBPROJECT),) | |||
83 | endif | 83 | endif |
84 | endif | 84 | endif |
85 | 85 | ||
86 | # Save the defines and includes here, so we don't include any keymap specific ones | 86 | # Save the defines and includes here, so we don't include any keymap specific ones |
87 | PROJECT_DEFS := $(OPT_DEFS) | 87 | PROJECT_DEFS := $(OPT_DEFS) |
88 | PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(SUBPROJECT_PATH) $(KEYBOARD_PATH) | 88 | PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(SUBPROJECT_PATH) $(KEYBOARD_PATH) |
89 | PROJECT_CONFIG := $(CONFIG_H) | 89 | PROJECT_CONFIG := $(CONFIG_H) |
@@ -139,11 +139,27 @@ ifeq ($(strip $(API_SYSEX_ENABLE)), yes) | |||
139 | MIDI_ENABLE=yes | 139 | MIDI_ENABLE=yes |
140 | endif | 140 | endif |
141 | 141 | ||
142 | MUSIC_ENABLE := 0 | ||
143 | |||
144 | ifeq ($(strip $(AUDIO_ENABLE)), yes) | ||
145 | OPT_DEFS += -DAUDIO_ENABLE | ||
146 | MUSIC_ENABLE := 1 | ||
147 | SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c | ||
148 | SRC += $(QUANTUM_DIR)/audio/audio.c | ||
149 | SRC += $(QUANTUM_DIR)/audio/voices.c | ||
150 | SRC += $(QUANTUM_DIR)/audio/luts.c | ||
151 | endif | ||
152 | |||
142 | ifeq ($(strip $(MIDI_ENABLE)), yes) | 153 | ifeq ($(strip $(MIDI_ENABLE)), yes) |
143 | OPT_DEFS += -DMIDI_ENABLE | 154 | OPT_DEFS += -DMIDI_ENABLE |
155 | MUSIC_ENABLE := 1 | ||
144 | SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c | 156 | SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c |
145 | endif | 157 | endif |
146 | 158 | ||
159 | ifeq ($(MUSIC_ENABLE), 1) | ||
160 | SRC += $(QUANTUM_DIR)/process_keycode/process_music.c | ||
161 | endif | ||
162 | |||
147 | ifeq ($(strip $(COMBO_ENABLE)), yes) | 163 | ifeq ($(strip $(COMBO_ENABLE)), yes) |
148 | OPT_DEFS += -DCOMBO_ENABLE | 164 | OPT_DEFS += -DCOMBO_ENABLE |
149 | SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c | 165 | SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c |
@@ -153,14 +169,6 @@ ifeq ($(strip $(VIRTSER_ENABLE)), yes) | |||
153 | OPT_DEFS += -DVIRTSER_ENABLE | 169 | OPT_DEFS += -DVIRTSER_ENABLE |
154 | endif | 170 | endif |
155 | 171 | ||
156 | ifeq ($(strip $(AUDIO_ENABLE)), yes) | ||
157 | OPT_DEFS += -DAUDIO_ENABLE | ||
158 | SRC += $(QUANTUM_DIR)/process_keycode/process_music.c | ||
159 | SRC += $(QUANTUM_DIR)/audio/audio.c | ||
160 | SRC += $(QUANTUM_DIR)/audio/voices.c | ||
161 | SRC += $(QUANTUM_DIR)/audio/luts.c | ||
162 | endif | ||
163 | |||
164 | ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes) | 172 | ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes) |
165 | OPT_DEFS += -DFAUXCLICKY_ENABLE | 173 | OPT_DEFS += -DFAUXCLICKY_ENABLE |
166 | SRC += $(QUANTUM_DIR)/fauxclicky.c | 174 | SRC += $(QUANTUM_DIR)/fauxclicky.c |
@@ -250,7 +258,7 @@ endif | |||
250 | 258 | ||
251 | OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT) | 259 | OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT) |
252 | $(KEYMAP_OUTPUT)_SRC := $(SRC) | 260 | $(KEYMAP_OUTPUT)_SRC := $(SRC) |
253 | $(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\" | 261 | $(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\" |
254 | $(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS) | 262 | $(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS) |
255 | $(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H) | 263 | $(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H) |
256 | $(KEYBOARD_OUTPUT)_SRC := $(CHIBISRC) | 264 | $(KEYBOARD_OUTPUT)_SRC := $(CHIBISRC) |
diff --git a/doc/keymap.md b/doc/keymap.md index 6f2a663fc..2b0d2cd95 100644 --- a/doc/keymap.md +++ b/doc/keymap.md | |||
@@ -549,6 +549,9 @@ Layer switching with tap key: | |||
549 | 549 | ||
550 | [dual_role]: http://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys | 550 | [dual_role]: http://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys |
551 | 551 | ||
552 | When user hold a key after tap, it repeat the tapped key rather to hold a modifier key. | ||
553 | If you prefer to hold a modifier instead, define `TAPPING_FORCE_HOLD` in `config.h`. | ||
554 | See https://github.com/qmk/qmk_firmware/issues/889 for the detail. | ||
552 | 555 | ||
553 | ### 4.2 Tap Toggle | 556 | ### 4.2 Tap Toggle |
554 | This is a feature to assign both toggle layer and momentary switch layer action to just same one physical key. It works as momentary layer switch when holding a key but toggle switch with several taps. | 557 | This is a feature to assign both toggle layer and momentary switch layer action to just same one physical key. It works as momentary layer switch when holding a key but toggle switch with several taps. |
diff --git a/keyboards/atreus62/atreus62.h b/keyboards/atreus62/atreus62.h index eacf5b451..ca5cda8a8 100644 --- a/keyboards/atreus62/atreus62.h +++ b/keyboards/atreus62/atreus62.h | |||
@@ -9,18 +9,34 @@ void promicro_bootloader_jmp(bool program); | |||
9 | // The first section contains all of the arguements | 9 | // The first section contains all of the arguements |
10 | // The second converts the arguments into a two-dimensional array | 10 | // The second converts the arguments into a two-dimensional array |
11 | #define KEYMAP( \ | 11 | #define KEYMAP( \ |
12 | k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | 12 | k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ |
13 | k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | 13 | k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ |
14 | k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | 14 | k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ |
15 | k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \ | 15 | k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \ |
16 | k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, k4d \ | 16 | k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, k4d \ |
17 | ) \ | 17 | ) \ |
18 | { \ | 18 | { \ |
19 | { k00, k01, k02, k03, k04, k05, KC_NO, k06, k07, k08, k09, k0a, k0b }, \ | 19 | { k00, k01, k02, k03, k04, k05, KC_NO, k06, k07, k08, k09, k0a, k0b }, \ |
20 | { k10, k11, k12, k13, k14, k15, KC_NO, k16, k17, k18, k19, k1a, k1b }, \ | 20 | { k10, k11, k12, k13, k14, k15, KC_NO, k16, k17, k18, k19, k1a, k1b }, \ |
21 | { k20, k21, k22, k23, k24, k25, KC_NO, k26, k27, k28, k29, k2a, k2b }, \ | 21 | { k20, k21, k22, k23, k24, k25, KC_NO, k26, k27, k28, k29, k2a, k2b }, \ |
22 | { k30, k31, k32, k33, k34, k35, k46, k36, k37, k38, k39, k3a, k3b }, \ | 22 | { k30, k31, k32, k33, k34, k35, k46, k36, k37, k38, k39, k3a, k3b }, \ |
23 | { k40, k41, k42, k43, k44, k45, k47, k48, k49, k4a, k4b, k4c, k4d } \ | 23 | { k40, k41, k42, k43, k44, k45, k47, k48, k49, k4a, k4b, k4c, k4d } \ |
24 | } | 24 | } |
25 | 25 | ||
26 | #endif \ No newline at end of file | 26 | // Used to create a keymap using only KC_ prefixed keys. |
27 | #define KC_KEYMAP( \ | ||
28 | k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | ||
29 | k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | ||
30 | k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | ||
31 | k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \ | ||
32 | k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, k4d \ | ||
33 | ) \ | ||
34 | { \ | ||
35 | { KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05, KC_NO, KC_##k06, KC_##k07, KC_##k08, KC_##k09, KC_##k0a, KC_##k0b }, \ | ||
36 | { KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15, KC_NO, KC_##k16, KC_##k17, KC_##k18, KC_##k19, KC_##k1a, KC_##k1b }, \ | ||
37 | { KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25, KC_NO, KC_##k26, KC_##k27, KC_##k28, KC_##k29, KC_##k2a, KC_##k2b }, \ | ||
38 | { KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35, KC_##k46, KC_##k36, KC_##k37, KC_##k38, KC_##k39, KC_##k3a, KC_##k3b }, \ | ||
39 | { KC_##k40, KC_##k41, KC_##k42, KC_##k43, KC_##k44, KC_##k45, KC_##k47, KC_##k48, KC_##k49, KC_##k4a, KC_##k4b, KC_##k4c, KC_##k4d } \ | ||
40 | } | ||
41 | |||
42 | #endif | ||
diff --git a/keyboards/ergodox/keymaps/italian/keymap.c b/keyboards/ergodox/keymaps/italian/keymap.c new file mode 100644 index 000000000..e4c7a569c --- /dev/null +++ b/keyboards/ergodox/keymaps/italian/keymap.c | |||
@@ -0,0 +1,223 @@ | |||
1 | #include "ergodox.h" | ||
2 | #include "debug.h" | ||
3 | #include "action_layer.h" | ||
4 | #include "version.h" | ||
5 | |||
6 | #define BASE 0 // default layer | ||
7 | #define SYMB 1 // symbols | ||
8 | #define MDIA 2 // media keys | ||
9 | |||
10 | enum custom_keycodes { | ||
11 | PLACEHOLDER = SAFE_RANGE, // can always be here | ||
12 | EPRM, | ||
13 | VRSN, | ||
14 | RGB_SLD | ||
15 | }; | ||
16 | |||
17 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
18 | /* Keymap 0: Basic layer | ||
19 | * | ||
20 | * ,--------------------------------------------------. ,--------------------------------------------------. | ||
21 | * | \ | 1 | 2 | 3 | 4 | 5 | ESC | | T2 | 6 | 7 | 8 | 9 | 0 | ' | | ||
22 | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | ||
23 | * | Tab | Q | W | E | R | T | TT1 | | TT1 | Y | U | I | O | P | è | | ||
24 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
25 | * | Caps | A | S | D | F | G |------| |------| H | J | K | L | ò | à | | ||
26 | * |--------+------+------+------+------+------| Alt | | Alt |------+------+------+------+------+--------| | ||
27 | * | LShift | Z | X | C | V | B | | | | N | M | , | . | ù |-/RShift| | ||
28 | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | ||
29 | * |</Win | + | - | * |//Ctr | |ì/RAlt| Left | Down | Up | Right | ~L1 | | ||
30 | * `----------------------------------' `----------------------------------' | ||
31 | * ,-------------. ,-------------. | ||
32 | * | Ins | LGui | | Win | Ctrl | | ||
33 | * ,------|------|------| |------+--------+------. | ||
34 | * | | | Home | | PgUp | | | | ||
35 | * |Backsp| Del |------| |------| Enter |Space | | ||
36 | * |ace | | End | | PgDn | | | | ||
37 | * `--------------------' `----------------------' | ||
38 | */ | ||
39 | // If it accepts an argument (i.e, is a function), it doesn't need KC_. | ||
40 | // Otherwise, it needs KC_* | ||
41 | [BASE] = KEYMAP( // layer 0 : default | ||
42 | // left hand | ||
43 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, | ||
44 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TT(SYMB), | ||
45 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, | ||
46 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LALT, | ||
47 | MT(MOD_LGUI,KC_NONUS_BSLASH),KC_PPLS, KC_PMNS,KC_PAST,MT(MOD_LCTL,KC_PSLS), | ||
48 | KC_INS, KC_LGUI, | ||
49 | KC_HOME, | ||
50 | KC_BSPC,KC_DEL, KC_END, | ||
51 | // right hand | ||
52 | TG(MDIA), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, | ||
53 | TT(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, | ||
54 | KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
55 | KC_LALT, KC_N, KC_M, KC_COMM,KC_DOT, KC_BSLASH, MT(MOD_RSFT,KC_SLSH), | ||
56 | MT(MOD_RALT,KC_EQL), KC_LEFT,KC_DOWN,KC_UP, KC_RIGHT, | ||
57 | KC_LGUI, KC_RCTL, | ||
58 | KC_PGUP, | ||
59 | KC_PGDN, KC_ENT, KC_SPC | ||
60 | ), | ||
61 | /* Keymap 1: Symbol Layer | ||
62 | * | ||
63 | * ,--------------------------------------------------. ,--------------------------------------------------. | ||
64 | * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | | ||
65 | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | ||
66 | * | | ! | @ | { | } | | | | | | | 7 | 8 | 9 | | F12 | | ||
67 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
68 | * | | # | $ | [ | ] | & |------| |------| | 4 | 5 | 6 | | | | ||
69 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
70 | * | | % | ^ | ( | ) | | | | | | 1 | 2 | 3 | | | | ||
71 | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | ||
72 | * | | | | | | | . | | | | | | ||
73 | * `----------------------------------' `----------------------------------' | ||
74 | * ,-------------. ,-------------. | ||
75 | * | | | | | | | ||
76 | * ,------|------|------| |------+------+------. | ||
77 | * | | | | | | | | | ||
78 | * | | |------| |------| | 0 | | ||
79 | * | | | | | | | | | ||
80 | * `--------------------' `--------------------' | ||
81 | */ | ||
82 | // SYMBOLS | ||
83 | [SYMB] = KEYMAP( | ||
84 | // left hand | ||
85 | M(0), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, | ||
86 | KC_TRNS, KC_EXLM, RALT(KC_SCLN), RALT(KC_LCBR), RALT(KC_RCBR), KC_TILD, KC_TRNS, | ||
87 | KC_TRNS, RALT(KC_QUOT), KC_DLR, RALT(KC_LBRC), RALT(KC_RBRC), KC_CIRC, | ||
88 | KC_TRNS, KC_PERC, LSFT(KC_EQL), LSFT(KC_8), LSFT(KC_9), KC_TRNS, KC_TRNS, | ||
89 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
90 | KC_TRNS, KC_TRNS, | ||
91 | KC_TRNS, | ||
92 | KC_TRNS, KC_TRNS, KC_TRNS, | ||
93 | // right hand | ||
94 | KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, | ||
95 | KC_TRNS, KC_TRNS, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, | ||
96 | KC_TRNS, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, | ||
97 | KC_TRNS, KC_TRNS, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, | ||
98 | KC_DOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
99 | KC_TRNS, KC_TRNS, | ||
100 | KC_TRNS, | ||
101 | KC_TRNS, KC_TRNS, KC_0 | ||
102 | ), | ||
103 | /* Keymap 2: Media and mouse keys | ||
104 | * | ||
105 | * ,--------------------------------------------------. ,--------------------------------------------------. | ||
106 | * | | | | | | | | | | | | | | | | | ||
107 | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | ||
108 | * | | | | MsUp | | | | | | Lclk | Rclk | | | | | | ||
109 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
110 | * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play | | ||
111 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
112 | * | | | | | | | | | | | | Prev | Next | | | | ||
113 | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | ||
114 | * | | | | | | |VolUp |VolDn | Mute | | | | ||
115 | * `----------------------------------' `----------------------------------' | ||
116 | * ,-------------. ,-------------. | ||
117 | * | | | | | | | ||
118 | * ,------|------|------| |------+------+------. | ||
119 | * | | | | | | |Brwser| | ||
120 | * | | |------| |------| |Back | | ||
121 | * | | | | | | | | | ||
122 | * `--------------------' `--------------------' | ||
123 | */ | ||
124 | // MEDIA AND MOUSE | ||
125 | [MDIA] = KEYMAP( | ||
126 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
127 | KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, | ||
128 | KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, | ||
129 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
130 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
131 | KC_TRNS, KC_TRNS, | ||
132 | KC_TRNS, | ||
133 | KC_TRNS, KC_TRNS, KC_TRNS, | ||
134 | // right hand | ||
135 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
136 | KC_TRNS, KC_BTN1, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
137 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, | ||
138 | KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, | ||
139 | KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, | ||
140 | KC_TRNS, KC_TRNS, | ||
141 | KC_TRNS, | ||
142 | KC_TRNS, KC_TRNS, KC_WBAK | ||
143 | ), | ||
144 | }; | ||
145 | |||
146 | const uint16_t PROGMEM fn_actions[] = { | ||
147 | [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) | ||
148 | }; | ||
149 | |||
150 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
151 | { | ||
152 | // MACRODOWN only works in this function | ||
153 | switch(id) { | ||
154 | case 0: | ||
155 | if (record->event.pressed) { | ||
156 | SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | ||
157 | } | ||
158 | break; | ||
159 | case 1: | ||
160 | if (record->event.pressed) { // For resetting EEPROM | ||
161 | eeconfig_init(); | ||
162 | } | ||
163 | break; | ||
164 | } | ||
165 | return MACRO_NONE; | ||
166 | }; | ||
167 | |||
168 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
169 | switch (keycode) { | ||
170 | // dynamically generate these. | ||
171 | case EPRM: | ||
172 | if (record->event.pressed) { | ||
173 | eeconfig_init(); | ||
174 | } | ||
175 | return false; | ||
176 | break; | ||
177 | case VRSN: | ||
178 | if (record->event.pressed) { | ||
179 | SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | ||
180 | } | ||
181 | return false; | ||
182 | break; | ||
183 | case RGB_SLD: | ||
184 | if (record->event.pressed) { | ||
185 | #ifdef RGBLIGHT_ENABLE | ||
186 | rgblight_mode(1); | ||
187 | #endif | ||
188 | } | ||
189 | return false; | ||
190 | break; | ||
191 | } | ||
192 | return true; | ||
193 | } | ||
194 | |||
195 | // Runs just one time when the keyboard initializes. | ||
196 | void matrix_init_user(void) { | ||
197 | |||
198 | }; | ||
199 | |||
200 | |||
201 | // Runs constantly in the background, in a loop. | ||
202 | void matrix_scan_user(void) { | ||
203 | |||
204 | uint8_t layer = biton32(layer_state); | ||
205 | |||
206 | ergodox_board_led_off(); | ||
207 | ergodox_right_led_1_off(); | ||
208 | ergodox_right_led_2_off(); | ||
209 | ergodox_right_led_3_off(); | ||
210 | switch (layer) { | ||
211 | // TODO: Make this relevant to the ErgoDox EZ. | ||
212 | case 1: | ||
213 | ergodox_right_led_1_on(); | ||
214 | break; | ||
215 | case 2: | ||
216 | ergodox_right_led_2_on(); | ||
217 | break; | ||
218 | default: | ||
219 | // none | ||
220 | break; | ||
221 | } | ||
222 | |||
223 | }; | ||
diff --git a/keyboards/ergodox/keymaps/italian/readme.md b/keyboards/ergodox/keymaps/italian/readme.md new file mode 100644 index 000000000..215c24a5a --- /dev/null +++ b/keyboards/ergodox/keymaps/italian/readme.md | |||
@@ -0,0 +1,72 @@ | |||
1 | # ErgoDox Italian layout | ||
2 | |||
3 | ## Layer 0 | ||
4 | ``` | ||
5 | |||
6 | ,--------------------------------------------------. ,--------------------------------------------------. | ||
7 | | \ | 1 | 2 | 3 | 4 | 5 | ESC | | T2 | 6 | 7 | 8 | 9 | 0 | ' | | ||
8 | |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | ||
9 | | Tab | Q | W | E | R | T | TT1 | | TT1 | Y | U | I | O | P | è | | ||
10 | |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
11 | | Caps | A | S | D | F | G |------| |------| H | J | K | L | ò | à | | ||
12 | |--------+------+------+------+------+------| Alt | | Alt |------+------+------+------+------+--------| | ||
13 | | LShift | Z | X | C | V | B | | | | N | M | , | . | ù |-/RShift| | ||
14 | `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | ||
15 | |</Win | + | - | * |//Ctr | |ì/RAlt| Left | Down | Up | Right | ~L1 | | ||
16 | `----------------------------------' `----------------------------------' | ||
17 | ,-------------. ,-------------. | ||
18 | | Ins | LGui | | Win | Ctrl | | ||
19 | ,------|------|------| |------+--------+------. | ||
20 | | | | Home | | PgUp | | | | ||
21 | |Backsp| Del |------| |------| Enter |Space | | ||
22 | |ace | | End | | PgDn | | | | ||
23 | `--------------------' `----------------------' | ||
24 | ``` | ||
25 | |||
26 | ## Layer 1 | ||
27 | ``` | ||
28 | |||
29 | ,--------------------------------------------------. ,--------------------------------------------------. | ||
30 | |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | | ||
31 | |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | ||
32 | | | ! | @ | { | } | | | | | | | 7 | 8 | 9 | | F12 | | ||
33 | |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
34 | | | # | $ | [ | ] | & |------| |------| | 4 | 5 | 6 | | | | ||
35 | |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
36 | | | % | ^ | ( | ) | | | | | | 1 | 2 | 3 | | | | ||
37 | `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | ||
38 | | | | | | | | . | | | | | | ||
39 | `----------------------------------' `----------------------------------' | ||
40 | ,-------------. ,-------------. | ||
41 | | | | | | | | ||
42 | ,------|------|------| |------+------+------. | ||
43 | | | | | | | | | | ||
44 | | | |------| |------| | 0 | | ||
45 | | | | | | | | | | ||
46 | `--------------------' `--------------------' | ||
47 | ``` | ||
48 | |||
49 | ## Layer 2 | ||
50 | ``` | ||
51 | |||
52 | ,--------------------------------------------------. ,--------------------------------------------------. | ||
53 | | | | | | | | | | | | | | | | | | ||
54 | |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| | ||
55 | | | | | MsUp | | | | | | Lclk | Rclk | | | | | | ||
56 | |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
57 | | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play | | ||
58 | |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| | ||
59 | | | | | | | | | | | | | Prev | Next | | | | ||
60 | `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' | ||
61 | | | | | | | |VolUp |VolDn | Mute | | | | ||
62 | `----------------------------------' `----------------------------------' | ||
63 | ,-------------. ,-------------. | ||
64 | | | | | | | | ||
65 | ,------|------|------| |------+------+------. | ||
66 | | | | | | | |Brwser| | ||
67 | | | |------| |------| |Back | | ||
68 | | | | | | | | | | ||
69 | `--------------------' `--------------------' | ||
70 | ``` | ||
71 | |||
72 | |||
diff --git a/keyboards/lets_split/rev2fliphalf/Makefile b/keyboards/frosty_flake/Makefile index 4e2a6f00f..57b2ef62e 100644 --- a/keyboards/lets_split/rev2fliphalf/Makefile +++ b/keyboards/frosty_flake/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | ifndef MAKEFILE_INCLUDED | 1 | ifndef MAKEFILE_INCLUDED |
2 | include ../../Makefile | 2 | include ../../Makefile |
3 | endif \ No newline at end of file | 3 | endif |
diff --git a/keyboards/frosty_flake/config.h b/keyboards/frosty_flake/config.h new file mode 100644 index 000000000..2c73f1074 --- /dev/null +++ b/keyboards/frosty_flake/config.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef CONFIG_H | ||
19 | #define CONFIG_H | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* USB Device descriptor parameter */ | ||
24 | #define VENDOR_ID 0xFEED | ||
25 | #define PRODUCT_ID 0x6060 | ||
26 | #define DEVICE_VER 0x0001 | ||
27 | #define MANUFACTURER Bathroom Epiphanies | ||
28 | #define PRODUCT frosty_flake | ||
29 | #define DESCRIPTION Frosty Flake controller for the CM Storm Quick Fire Rapid | ||
30 | |||
31 | /* | ||
32 | * Frosty Flake Rev. 20140521 made by Bathroom Ephiphanies | ||
33 | * Ported from the Bathroom Epiphanies TMK Firmware: | ||
34 | * https://github.com/BathroomEpiphanies/epiphanies_tmk_keyboard/tree/master/be_controllers | ||
35 | * | ||
36 | */ | ||
37 | |||
38 | /* key matrix size */ | ||
39 | #define MATRIX_ROWS 8 // Row0 - Row7 in the schematic | ||
40 | #define MATRIX_COLS 18 // ColA - ColR in the schematic | ||
41 | |||
42 | /* | ||
43 | * Keyboard Matrix Assignments | ||
44 | */ | ||
45 | #define UNUSED_PINS { B0, C4, D3 } | ||
46 | |||
47 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
48 | #define DEBOUNCING_DELAY 5 | ||
49 | |||
50 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
51 | #define LOCKING_SUPPORT_ENABLE | ||
52 | /* Locking resynchronize hack */ | ||
53 | #define LOCKING_RESYNC_ENABLE | ||
54 | |||
55 | /* | ||
56 | * Force NKRO | ||
57 | * | ||
58 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved | ||
59 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the | ||
60 | * makefile for this to work.) | ||
61 | * | ||
62 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) | ||
63 | * until the next keyboard reset. | ||
64 | * | ||
65 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is | ||
66 | * fully operational during normal computer usage. | ||
67 | * | ||
68 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) | ||
69 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by | ||
70 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a | ||
71 | * power-up. | ||
72 | * | ||
73 | */ | ||
74 | //#define FORCE_NKRO | ||
75 | |||
76 | /* | ||
77 | * Magic Key Options | ||
78 | * | ||
79 | * Magic keys are hotkey commands that allow control over firmware functions of | ||
80 | * the keyboard. They are best used in combination with the HID Listen program, | ||
81 | * found here: https://www.pjrc.com/teensy/hid_listen.html | ||
82 | * | ||
83 | * The options below allow the magic key functionality to be changed. This is | ||
84 | * useful if your keyboard/keypad is missing keys and you want magic key support. | ||
85 | * | ||
86 | */ | ||
87 | |||
88 | /* key combination for magic key command */ | ||
89 | #define IS_COMMAND() ( \ | ||
90 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
91 | ) | ||
92 | |||
93 | /* control how magic key switches layers */ | ||
94 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true | ||
95 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true | ||
96 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false | ||
97 | |||
98 | /* override magic key keymap */ | ||
99 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS | ||
100 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS | ||
101 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM | ||
102 | //#define MAGIC_KEY_HELP1 H | ||
103 | //#define MAGIC_KEY_HELP2 SLASH | ||
104 | //#define MAGIC_KEY_DEBUG D | ||
105 | //#define MAGIC_KEY_DEBUG_MATRIX X | ||
106 | //#define MAGIC_KEY_DEBUG_KBD K | ||
107 | //#define MAGIC_KEY_DEBUG_MOUSE M | ||
108 | //#define MAGIC_KEY_VERSION V | ||
109 | //#define MAGIC_KEY_STATUS S | ||
110 | //#define MAGIC_KEY_CONSOLE C | ||
111 | //#define MAGIC_KEY_LAYER0_ALT1 ESC | ||
112 | //#define MAGIC_KEY_LAYER0_ALT2 GRAVE | ||
113 | //#define MAGIC_KEY_LAYER0 0 | ||
114 | //#define MAGIC_KEY_LAYER1 1 | ||
115 | //#define MAGIC_KEY_LAYER2 2 | ||
116 | //#define MAGIC_KEY_LAYER3 3 | ||
117 | //#define MAGIC_KEY_LAYER4 4 | ||
118 | //#define MAGIC_KEY_LAYER5 5 | ||
119 | //#define MAGIC_KEY_LAYER6 6 | ||
120 | //#define MAGIC_KEY_LAYER7 7 | ||
121 | //#define MAGIC_KEY_LAYER8 8 | ||
122 | //#define MAGIC_KEY_LAYER9 9 | ||
123 | //#define MAGIC_KEY_BOOTLOADER PAUSE | ||
124 | //#define MAGIC_KEY_LOCK CAPS | ||
125 | //#define MAGIC_KEY_EEPROM E | ||
126 | //#define MAGIC_KEY_NKRO N | ||
127 | //#define MAGIC_KEY_SLEEP_LED Z | ||
128 | |||
129 | /* | ||
130 | * Feature disable options | ||
131 | * These options are also useful to firmware size reduction. | ||
132 | */ | ||
133 | |||
134 | /* disable debug print */ | ||
135 | //#define NO_DEBUG | ||
136 | |||
137 | /* disable print */ | ||
138 | //#define NO_PRINT | ||
139 | |||
140 | /* disable action features */ | ||
141 | //#define NO_ACTION_LAYER | ||
142 | //#define NO_ACTION_TAPPING | ||
143 | //#define NO_ACTION_ONESHOT | ||
144 | //#define NO_ACTION_MACRO | ||
145 | //#define NO_ACTION_FUNCTION | ||
146 | |||
147 | #endif | ||
diff --git a/keyboards/frosty_flake/frosty_flake.c b/keyboards/frosty_flake/frosty_flake.c new file mode 100644 index 000000000..1cd476038 --- /dev/null +++ b/keyboards/frosty_flake/frosty_flake.c | |||
@@ -0,0 +1,63 @@ | |||
1 | #include "frosty_flake.h" | ||
2 | |||
3 | void matrix_init_kb(void) { | ||
4 | // put your keyboard start-up code here | ||
5 | // runs once when the firmware starts up | ||
6 | |||
7 | matrix_init_user(); | ||
8 | } | ||
9 | |||
10 | void matrix_scan_kb(void) { | ||
11 | // put your looping keyboard code here | ||
12 | // runs every cycle (a lot) | ||
13 | |||
14 | matrix_scan_user(); | ||
15 | } | ||
16 | |||
17 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
18 | // put your per-action keyboard code here | ||
19 | // runs for every action, just before processing by the firmware | ||
20 | |||
21 | return process_record_user(keycode, record); | ||
22 | } | ||
23 | |||
24 | void led_set_kb(uint8_t usb_led) { | ||
25 | DDRB |= (1<<7); | ||
26 | DDRC |= (1<<5) | (1<<6); | ||
27 | |||
28 | print_dec(usb_led); | ||
29 | |||
30 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) | ||
31 | PORTC &= ~(1<<5); | ||
32 | else | ||
33 | PORTC |= (1<<5); | ||
34 | |||
35 | if (usb_led & (1<<USB_LED_NUM_LOCK)) | ||
36 | PORTB &= ~(1<<7); | ||
37 | else | ||
38 | PORTB |= (1<<7); | ||
39 | |||
40 | if (usb_led & (1<<USB_LED_SCROLL_LOCK)) | ||
41 | PORTC &= ~(1<<6); | ||
42 | else | ||
43 | PORTC |= (1<<6); | ||
44 | |||
45 | led_set_user(usb_led); | ||
46 | } | ||
47 | |||
48 | __attribute__ ((weak)) | ||
49 | void matrix_init_user(void) { | ||
50 | } | ||
51 | |||
52 | __attribute__ ((weak)) | ||
53 | void matrix_scan_user(void) { | ||
54 | } | ||
55 | |||
56 | __attribute__ ((weak)) | ||
57 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
58 | return true; | ||
59 | } | ||
60 | |||
61 | __attribute__ ((weak)) | ||
62 | void led_set_user(uint8_t usb_led) { | ||
63 | } \ No newline at end of file | ||
diff --git a/keyboards/frosty_flake/frosty_flake.h b/keyboards/frosty_flake/frosty_flake.h new file mode 100644 index 000000000..3b52df6ba --- /dev/null +++ b/keyboards/frosty_flake/frosty_flake.h | |||
@@ -0,0 +1,50 @@ | |||
1 | #ifndef FROSTY_FLAKE_H | ||
2 | #define FROSTY_FLAKE_H | ||
3 | |||
4 | #include "quantum.h" | ||
5 | |||
6 | // This a shortcut to help you visually see your layout. | ||
7 | // The following is an example using the Planck MIT layout | ||
8 | // The first section contains all of the arguements | ||
9 | // The second converts the arguments into a two-dimensional array | ||
10 | |||
11 | /* | ||
12 | Matrix col/row mapping | ||
13 | |||
14 | ,----. ,-------------------. ,-------------------. ,-------------------. ,--------------. | ||
15 | | J6 | | I4 | H4 | H2 | H6 | | A7 | E6 | D2 | D4 | | B4 | B7 | B6 | B0 | | C7 | C5 | A5 | | ||
16 | `----' `-------------------' `-------------------' `-------------------' `--------------' | ||
17 | ,-------------------------------------------------------------------------. ,--------------. ,-------------------. | ||
18 | | J4 | J7 | I7 | H7 | G7 | G4 | F4 | F7 | E7 | D7 | R7 | R4 | E4 | B2 | | L4 | O4 | Q4 | | K1 | L1 | Q1 | Q0 | | ||
19 | |-------------------------------------------------------------------------| |--------------| |-------------------| | ||
20 | | J2 | J5 | I5 | H5 | G5 | G2 | F2 | F5 | E5 | D5 | R5 | R2 | E2 | B3 | | K4 | O7 | Q7 | | K5 | L5 | Q5 | O5 | | ||
21 | |-------------------------------------------------------------------------| '--------------' |-------------- | | ||
22 | | O5 | J3 | I3 | H3 | G3 | G6 | F6 | F3 | E3 | D3 | R3 | R6 | B1 | | K2 | L2 | Q2 | | | ||
23 | |-------------------------------------------------------------------------| ,----. |-------------------| | ||
24 | | N2 | J1 | I1 | H1 | G1 | G0 | F0 | F1 | E1 | D1 | R0 | N3 | | O6 | | K3 | L3 | Q3 | O3 | | ||
25 | |-------------------------------------------------------------------------| ,--------------. |-------------- | | ||
26 | | A4 | P2 | C6 | K6 | C0 | M3 | D0 | A1 | | O0 | K0 | L0 | | L6 | Q6 | | | ||
27 | `-------------------------------------------------------------------------' `--------------' `-------------------' | ||
28 | */ | ||
29 | #define KEYMAP( \ | ||
30 | KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \ | ||
31 | KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, KK1, KL1, KQ1, KQ0, \ | ||
32 | KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, KK5, KL5, KQ5, KO5, \ | ||
33 | KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1, KK2, KL2, KQ2, \ | ||
34 | KN2, KI6, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, KO6, KK3, KL3, KQ3, KO3, \ | ||
35 | KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0, KL6, KQ6 \ | ||
36 | ) \ | ||
37 | { \ | ||
38 | /* Columns and rows need to be swapped in the below definition */ \ | ||
39 | /* A B C D E F G H I J K L M N O P Q R */ \ | ||
40 | /* 0 */ { KC_NO, KB0, KC0, KD0, KC_NO, KF0, KG0, KC_NO, KC_NO, KC_NO, KK0, KL0, KC_NO, KC_NO, KO0, KC_NO, KQ0, KR0 }, \ | ||
41 | /* 1 */ { KA1, KB1, KC_NO, KD1, KE1, KF1, KG1, KH1, KI1, KJ1, KK1, KL1, KC_NO, KC_NO, KC_NO, KC_NO, KQ1, KC_NO }, \ | ||
42 | /* 2 */ { KC_NO, KB2, KC_NO, KD2, KE2, KF2, KG2, KH2, KI2, KJ2, KK2, KL2, KC_NO, KN2, KC_NO, KP2, KQ2, KR2 }, \ | ||
43 | /* 3 */ { KC_NO, KB3, KC_NO, KD3, KE3, KF3, KG3, KH3, KI3, KJ3, KK3, KL3, KM3, KN3, KO3, KC_NO, KQ3, KR3 }, \ | ||
44 | /* 4 */ { KA4, KB4, KC_NO, KD4, KE4, KF4, KG4, KH4, KI4, KJ4, KK4, KL4, KC_NO, KC_NO, KO4, KC_NO, KQ4, KR4 }, \ | ||
45 | /* 5 */ { KA5, KC_NO, KC5, KD5, KE5, KF5, KG5, KH5, KI5, KJ5, KK5, KL5, KC_NO, KC_NO, KO5, KC_NO, KQ5, KR5 }, \ | ||
46 | /* 6 */ { KC_NO, KB6, KC6, KC_NO, KE6, KF6, KG6, KH6, KI6, KJ6, KK6, KL6, KC_NO, KC_NO, KO6, KC_NO, KQ6, KR6 }, \ | ||
47 | /* 7 */ { KA7, KB7, KC7, KD7, KE7, KF7, KG7, KH7, KI7, KJ7, KC_NO, KC_NO, KC_NO, KC_NO, KO7, KC_NO, KQ7, KR7 } \ | ||
48 | } | ||
49 | |||
50 | #endif | ||
diff --git a/keyboards/frosty_flake/keymaps/default/Makefile b/keyboards/frosty_flake/keymaps/default/Makefile new file mode 100644 index 000000000..9d3df5964 --- /dev/null +++ b/keyboards/frosty_flake/keymaps/default/Makefile | |||
@@ -0,0 +1,21 @@ | |||
1 | # Build Options | ||
2 | # change to "no" to disable the options, or define them in the Makefile in | ||
3 | # the appropriate keymap folder that will get included automatically | ||
4 | # | ||
5 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
6 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
7 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
8 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
9 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
10 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
11 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
12 | MIDI_ENABLE = no # MIDI controls | ||
13 | AUDIO_ENABLE = no # Audio output on port C6 | ||
14 | UNICODE_ENABLE = no # Unicode | ||
15 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
16 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
17 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
18 | |||
19 | ifndef QUANTUM_DIR | ||
20 | include ../../../../Makefile | ||
21 | endif | ||
diff --git a/keyboards/frosty_flake/keymaps/default/config.h b/keyboards/frosty_flake/keymaps/default/config.h new file mode 100644 index 000000000..8893d122e --- /dev/null +++ b/keyboards/frosty_flake/keymaps/default/config.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | // place overrides here | ||
7 | |||
8 | #endif | ||
diff --git a/keyboards/frosty_flake/keymaps/default/keymap.c b/keyboards/frosty_flake/keymaps/default/keymap.c new file mode 100644 index 000000000..4dc7ed655 --- /dev/null +++ b/keyboards/frosty_flake/keymaps/default/keymap.c | |||
@@ -0,0 +1,11 @@ | |||
1 | #include "frosty_flake.h" | ||
2 | |||
3 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
4 | [0] = KEYMAP(\ | ||
5 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS, \ | ||
6 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_INS,KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ | ||
7 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,KC_PPLS, \ | ||
8 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, \ | ||
9 | KC_LSFT,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \ | ||
10 | KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT) | ||
11 | }; \ No newline at end of file | ||
diff --git a/keyboards/frosty_flake/keymaps/default/readme.md b/keyboards/frosty_flake/keymaps/default/readme.md new file mode 100644 index 000000000..11bf4825f --- /dev/null +++ b/keyboards/frosty_flake/keymaps/default/readme.md | |||
@@ -0,0 +1 @@ | |||
# The default keymap for frosty_flake | |||
diff --git a/keyboards/frosty_flake/matrix.c b/keyboards/frosty_flake/matrix.c new file mode 100644 index 000000000..05dffdb64 --- /dev/null +++ b/keyboards/frosty_flake/matrix.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | Copyright 2017 Gabriel Young <gabeplaysdrums@live.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #include <stdint.h> | ||
19 | #include <stdbool.h> | ||
20 | #include <avr/io.h> | ||
21 | #include <util/delay.h> | ||
22 | #include "print.h" | ||
23 | #include "debug.h" | ||
24 | #include "util.h" | ||
25 | #include "matrix.h" | ||
26 | |||
27 | #ifndef DEBOUNCING_DELAY | ||
28 | # define DEBOUNCING_DELAY 5 | ||
29 | #endif | ||
30 | static uint8_t debouncing = DEBOUNCING_DELAY; | ||
31 | |||
32 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
33 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
34 | |||
35 | static matrix_row_t scan_col(void) { | ||
36 | return ( | ||
37 | (PINC&(1<<7) ? 0 : ((matrix_row_t)1<<0)) | | ||
38 | (PINB&(1<<5) ? 0 : ((matrix_row_t)1<<1)) | | ||
39 | (PINB&(1<<4) ? 0 : ((matrix_row_t)1<<2)) | | ||
40 | (PINB&(1<<6) ? 0 : ((matrix_row_t)1<<3)) | | ||
41 | (PINB&(1<<1) ? 0 : ((matrix_row_t)1<<4)) | | ||
42 | (PINB&(1<<2) ? 0 : ((matrix_row_t)1<<5)) | | ||
43 | (PINB&(1<<3) ? 0 : ((matrix_row_t)1<<6)) | | ||
44 | (PINB&(1<<0) ? 0 : ((matrix_row_t)1<<7)) | ||
45 | ); | ||
46 | } | ||
47 | |||
48 | static void select_col(uint8_t col) { | ||
49 | switch (col) { | ||
50 | case 0: PORTD = (PORTD & ~0b01111011) | 0b00011011; break; | ||
51 | case 1: PORTD = (PORTD & ~0b01111011) | 0b01000011; break; | ||
52 | case 2: PORTD = (PORTD & ~0b01111011) | 0b01101010; break; | ||
53 | case 3: PORTD = (PORTD & ~0b01111011) | 0b01111001; break; | ||
54 | case 4: PORTD = (PORTD & ~0b01111011) | 0b01100010; break; | ||
55 | case 5: PORTD = (PORTD & ~0b01111011) | 0b01110001; break; | ||
56 | case 6: PORTD = (PORTD & ~0b01111011) | 0b01100001; break; | ||
57 | case 7: PORTD = (PORTD & ~0b01111011) | 0b01110000; break; | ||
58 | case 8: PORTD = (PORTD & ~0b01111011) | 0b01100000; break; | ||
59 | case 9: PORTD = (PORTD & ~0b01111011) | 0b01101000; break; | ||
60 | case 10: PORTD = (PORTD & ~0b01111011) | 0b00101011; break; | ||
61 | case 11: PORTD = (PORTD & ~0b01111011) | 0b00110011; break; | ||
62 | case 12: PORTD = (PORTD & ~0b01111011) | 0b00100011; break; | ||
63 | case 13: PORTD = (PORTD & ~0b01111011) | 0b01111000; break; | ||
64 | case 14: PORTD = (PORTD & ~0b01111011) | 0b00010011; break; | ||
65 | case 15: PORTD = (PORTD & ~0b01111011) | 0b01101001; break; | ||
66 | case 16: PORTD = (PORTD & ~0b01111011) | 0b00001011; break; | ||
67 | case 17: PORTD = (PORTD & ~0b01111011) | 0b00111011; break; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | void matrix_init(void) { | ||
72 | /* Row output pins */ | ||
73 | DDRD |= 0b01111011; | ||
74 | /* Column input pins */ | ||
75 | DDRC &= ~0b10000000; | ||
76 | DDRB &= ~0b01111111; | ||
77 | PORTC |= 0b10000000; | ||
78 | PORTB |= 0b01111111; | ||
79 | |||
80 | for (uint8_t i=0; i < MATRIX_ROWS; i++) | ||
81 | matrix[i] = matrix_debouncing[i] = 0; | ||
82 | |||
83 | matrix_init_quantum(); | ||
84 | } | ||
85 | |||
86 | uint8_t matrix_scan(void) { | ||
87 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
88 | select_col(col); | ||
89 | _delay_us(3); | ||
90 | matrix_row_t col_scan = scan_col(); | ||
91 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
92 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
93 | bool curr_bit = col_scan & (1<<row); | ||
94 | if (prev_bit != curr_bit) { | ||
95 | matrix_debouncing[row] ^= ((matrix_row_t)1<<col); | ||
96 | debouncing = DEBOUNCING_DELAY; | ||
97 | } | ||
98 | } | ||
99 | } | ||
100 | |||
101 | if (debouncing) { | ||
102 | if (--debouncing) | ||
103 | _delay_ms(1); | ||
104 | else | ||
105 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) | ||
106 | matrix[i] = matrix_debouncing[i]; | ||
107 | } | ||
108 | |||
109 | matrix_scan_quantum(); | ||
110 | return 1; | ||
111 | } | ||
112 | |||
113 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
114 | return matrix[row]; | ||
115 | } | ||
116 | |||
117 | void matrix_print(void) { | ||
118 | print("\nr\\c ABCDEFGHIJKLMNOPQR\n"); | ||
119 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
120 | matrix_row_t matrix_row = matrix_get_row(row); | ||
121 | xprintf("%02X: ", row); | ||
122 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
123 | bool curr_bit = matrix_row & (1<<col); | ||
124 | xprintf("%c", curr_bit ? '*' : '.'); | ||
125 | } | ||
126 | print("\n"); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | uint8_t matrix_key_count(void) { | ||
131 | uint8_t count = 0; | ||
132 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) | ||
133 | count += bitpop32(matrix[row]); | ||
134 | return count; | ||
135 | } \ No newline at end of file | ||
diff --git a/keyboards/frosty_flake/readme.md b/keyboards/frosty_flake/readme.md new file mode 100644 index 000000000..ff440e33b --- /dev/null +++ b/keyboards/frosty_flake/readme.md | |||
@@ -0,0 +1,32 @@ | |||
1 | frosty_flake keyboard firmware | ||
2 | ====================== | ||
3 | |||
4 | This is the firmware for Rev. 20140521 of the Frosty Flake controller by [Bathroom Epiphanies](http://bathroomepiphanies.com/controllers/), a replacement controller for the [Cooler Master Quick Fire Rapid](http://www.coolermaster.com/peripheral/keyboards/quickfirerapid/). | ||
5 | |||
6 | The code was adapted from the [BathroomEpiphanies TMK Firmware](https://github.com/BathroomEpiphanies/epiphanies_tmk_keyboard/tree/master/be_controllers), but has been cleaned up to match the [schematic](https://deskthority.net/wiki/File:Frosty_Flake_Schematics.pdf) and gone through some minor refactoring for QMK. | ||
7 | |||
8 | ## Quantum MK Firmware | ||
9 | |||
10 | For the full Quantum feature list, see [the parent readme](/). | ||
11 | |||
12 | ## Building | ||
13 | |||
14 | Download or clone the whole firmware and navigate to the keyboards/frosty_flake folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file. | ||
15 | |||
16 | Depending on which keymap you would like to use, you will have to compile slightly differently. | ||
17 | |||
18 | ### Default | ||
19 | |||
20 | To build with the default keymap, simply run `make default`. | ||
21 | |||
22 | ### Other Keymaps | ||
23 | |||
24 | Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files. | ||
25 | |||
26 | To build the firmware binary hex file with a keymap just do `make` with a keymap like this: | ||
27 | |||
28 | ``` | ||
29 | $ make [default|jack|<name>] | ||
30 | ``` | ||
31 | |||
32 | Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder. | ||
diff --git a/keyboards/frosty_flake/rules.mk b/keyboards/frosty_flake/rules.mk new file mode 100644 index 000000000..dd2f4b6ee --- /dev/null +++ b/keyboards/frosty_flake/rules.mk | |||
@@ -0,0 +1,71 @@ | |||
1 | # MCU name | ||
2 | #MCU = at90usb1287 | ||
3 | MCU = atmega32u2 | ||
4 | |||
5 | # Processor frequency. | ||
6 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
7 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
8 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
9 | # automatically to create a 32-bit value in your source code. | ||
10 | # | ||
11 | # This will be an integer division of F_USB below, as it is sourced by | ||
12 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
13 | # does not *change* the processor frequency - it should merely be updated to | ||
14 | # reflect the processor speed set externally so that the code can use accurate | ||
15 | # software delays. | ||
16 | F_CPU = 16000000 | ||
17 | |||
18 | |||
19 | # | ||
20 | # LUFA specific | ||
21 | # | ||
22 | # Target architecture (see library "Board Types" documentation). | ||
23 | ARCH = AVR8 | ||
24 | |||
25 | # Input clock frequency. | ||
26 | # This will define a symbol, F_USB, in all source code files equal to the | ||
27 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
28 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
29 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
30 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
31 | # at the end, this will be done automatically to create a 32-bit value in your | ||
32 | # source code. | ||
33 | # | ||
34 | # If no clock division is performed on the input clock inside the AVR (via the | ||
35 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
36 | F_USB = $(F_CPU) | ||
37 | |||
38 | # Interrupt driven control endpoint task(+60) | ||
39 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
40 | |||
41 | |||
42 | # Boot Section Size in *bytes* | ||
43 | # Teensy halfKay 512 | ||
44 | # Teensy++ halfKay 1024 | ||
45 | # Atmel DFU loader 4096 | ||
46 | # LUFA bootloader 4096 | ||
47 | # USBaspLoader 2048 | ||
48 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
49 | |||
50 | |||
51 | # Build Options | ||
52 | # change yes to no to disable | ||
53 | # | ||
54 | BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | ||
55 | MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) | ||
56 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
57 | CONSOLE_ENABLE ?= yes # Console for debug(+400) | ||
58 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
59 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
60 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | ||
61 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
62 | NKRO_ENABLE ?= no # USB Nkey Rollover | ||
63 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default | ||
64 | MIDI_ENABLE ?= no # MIDI controls | ||
65 | UNICODE_ENABLE ?= no # Unicode | ||
66 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
67 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
68 | FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches | ||
69 | |||
70 | CUSTOM_MATRIX = yes | ||
71 | SRC += matrix.c \ No newline at end of file | ||
diff --git a/keyboards/handwired/atreus50/Makefile b/keyboards/handwired/atreus50/Makefile new file mode 100644 index 000000000..57b2ef62e --- /dev/null +++ b/keyboards/handwired/atreus50/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | ifndef MAKEFILE_INCLUDED | ||
2 | include ../../Makefile | ||
3 | endif | ||
diff --git a/keyboards/handwired/atreus50/atreus50.c b/keyboards/handwired/atreus50/atreus50.c new file mode 100644 index 000000000..225a51bcc --- /dev/null +++ b/keyboards/handwired/atreus50/atreus50.c | |||
@@ -0,0 +1,10 @@ | |||
1 | #include "atreus50.h" | ||
2 | |||
3 | void matrix_init_kb(void) { | ||
4 | |||
5 | // Turn status LED on | ||
6 | //DDRE |= (1<<6); | ||
7 | PORTE |= (1<<6); | ||
8 | |||
9 | matrix_init_user(); | ||
10 | }; | ||
diff --git a/keyboards/handwired/atreus50/atreus50.h b/keyboards/handwired/atreus50/atreus50.h new file mode 100644 index 000000000..de06f255e --- /dev/null +++ b/keyboards/handwired/atreus50/atreus50.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef ATREUS50_H | ||
2 | #define ATREUS50_H | ||
3 | |||
4 | #include "quantum.h" | ||
5 | |||
6 | // The first section contains all of the arguements | ||
7 | // The second converts the arguments into a two-dimensional array | ||
8 | #define KEYMAP( \ | ||
9 | k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | ||
10 | k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | ||
11 | k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | ||
12 | k30, k31, k32, k33, k34, k35, km0, km1, k36, k37, k38, k39, k3a, k3b \ | ||
13 | ) \ | ||
14 | { \ | ||
15 | { k00, k01, k02, k03, k04, k05, KC_NO, k06, k07, k08, k09, k0a, k0b }, \ | ||
16 | { k10, k11, k12, k13, k14, k15, KC_NO, k16, k17, k18, k19, k1a, k1b }, \ | ||
17 | { k20, k21, k22, k23, k24, k25, km0, k26, k27, k28, k29, k2a, k2b }, \ | ||
18 | { k30, k31, k32, k33, k34, k35, km1, k36, k37, k38, k39, k3a, k3b } \ | ||
19 | } | ||
20 | |||
21 | #define COMPACT_KEYMAP( \ | ||
22 | k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | ||
23 | k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | ||
24 | k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | ||
25 | k30, k31, k32, k33, k34, k35, km0, km1, k36, k37, k38, k39, k3a, k3b \ | ||
26 | ) \ | ||
27 | { \ | ||
28 | { KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05, KC_NO, KC_##k06, KC_##k07, KC_##k08, KC_##k09, KC_##k0a, KC_##k0b }, \ | ||
29 | { KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15, KC_NO, KC_##k16, KC_##k17, KC_##k18, KC_##k19, KC_##k1a, KC_##k1b }, \ | ||
30 | { KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25, KC_##km0, KC_##k26, KC_##k27, KC_##k28, KC_##k29, KC_##k2a, KC_##k2b }, \ | ||
31 | { KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35, KC_##km1, KC_##k36, KC_##k37, KC_##k38, KC_##k39, KC_##k3a, KC_##k3b } \ | ||
32 | } | ||
33 | |||
34 | #define KC_ KC_TRNS | ||
35 | |||
36 | #endif | ||
diff --git a/keyboards/handwired/atreus50/config.h b/keyboards/handwired/atreus50/config.h new file mode 100644 index 000000000..2e34e0f89 --- /dev/null +++ b/keyboards/handwired/atreus50/config.h | |||
@@ -0,0 +1,163 @@ | |||
1 | /* | ||
2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef CONFIG_H | ||
19 | #define CONFIG_H | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* USB Device descriptor parameter */ | ||
24 | #define VENDOR_ID 0xBB80 | ||
25 | #define PRODUCT_ID 0x040D | ||
26 | #define DEVICE_VER 0x0001 | ||
27 | #define MANUFACTURER Hexwire | ||
28 | #define PRODUCT Atreus 50 Keyboard | ||
29 | #define DESCRIPTION Atreus layout with extra column | ||
30 | |||
31 | /* key matrix size */ | ||
32 | #define MATRIX_ROWS 4 | ||
33 | #define MATRIX_COLS 13 | ||
34 | |||
35 | /* Planck PCB default pin-out */ | ||
36 | #define MATRIX_ROW_PINS { D3, D2, D1, D0 } | ||
37 | #define MATRIX_COL_PINS { D4, D7, E6, B4, B5, B6, B2, B3, B1, F7, F6, F5, F4 } | ||
38 | #define UNUSED_PINS | ||
39 | |||
40 | /* COL2ROW or ROW2COL */ | ||
41 | #define DIODE_DIRECTION COL2ROW | ||
42 | |||
43 | // #define BACKLIGHT_PIN B7 | ||
44 | // #define BACKLIGHT_BREATHING | ||
45 | // #define BACKLIGHT_LEVELS 3 | ||
46 | |||
47 | |||
48 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
49 | #define DEBOUNCING_DELAY 5 | ||
50 | |||
51 | /* define if matrix has ghost (lacks anti-ghosting diodes) */ | ||
52 | //#define MATRIX_HAS_GHOST | ||
53 | |||
54 | /* number of backlight levels */ | ||
55 | |||
56 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
57 | #define LOCKING_SUPPORT_ENABLE | ||
58 | /* Locking resynchronize hack */ | ||
59 | #define LOCKING_RESYNC_ENABLE | ||
60 | |||
61 | |||
62 | /* ws2812 RGB LED */ | ||
63 | #define RGB_DI_PIN C6 | ||
64 | #define RGBLIGHT_ANIMATIONS | ||
65 | #define RGBLED_NUM 12 // Number of LEDs | ||
66 | #define RGBLIGHT_HUE_STEP 10 | ||
67 | #define RGBLIGHT_SAT_STEP 17 | ||
68 | #define RGBLIGHT_VAL_STEP 17 | ||
69 | |||
70 | |||
71 | /* | ||
72 | * Force NKRO | ||
73 | * | ||
74 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved | ||
75 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the | ||
76 | * makefile for this to work.) | ||
77 | * | ||
78 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) | ||
79 | * until the next keyboard reset. | ||
80 | * | ||
81 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is | ||
82 | * fully operational during normal computer usage. | ||
83 | * | ||
84 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) | ||
85 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by | ||
86 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a | ||
87 | * power-up. | ||
88 | * | ||
89 | */ | ||
90 | //#define FORCE_NKRO | ||
91 | |||
92 | /* | ||
93 | * Magic Key Options | ||
94 | * | ||
95 | * Magic keys are hotkey commands that allow control over firmware functions of | ||
96 | * the keyboard. They are best used in combination with the HID Listen program, | ||
97 | * found here: https://www.pjrc.com/teensy/hid_listen.html | ||
98 | * | ||
99 | * The options below allow the magic key functionality to be changed. This is | ||
100 | * useful if your keyboard/keypad is missing keys and you want magic key support. | ||
101 | * | ||
102 | */ | ||
103 | |||
104 | /* key combination for magic key command */ | ||
105 | #define IS_COMMAND() ( \ | ||
106 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
107 | ) | ||
108 | |||
109 | /* control how magic key switches layers */ | ||
110 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true | ||
111 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true | ||
112 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false | ||
113 | |||
114 | /* override magic key keymap */ | ||
115 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS | ||
116 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS | ||
117 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM | ||
118 | //#define MAGIC_KEY_HELP1 H | ||
119 | //#define MAGIC_KEY_HELP2 SLASH | ||
120 | //#define MAGIC_KEY_DEBUG D | ||
121 | //#define MAGIC_KEY_DEBUG_MATRIX X | ||
122 | //#define MAGIC_KEY_DEBUG_KBD K | ||
123 | //#define MAGIC_KEY_DEBUG_MOUSE M | ||
124 | //#define MAGIC_KEY_VERSION V | ||
125 | //#define MAGIC_KEY_STATUS S | ||
126 | //#define MAGIC_KEY_CONSOLE C | ||
127 | //#define MAGIC_KEY_LAYER0_ALT1 ESC | ||
128 | //#define MAGIC_KEY_LAYER0_ALT2 GRAVE | ||
129 | //#define MAGIC_KEY_LAYER0 0 | ||
130 | //#define MAGIC_KEY_LAYER1 1 | ||
131 | //#define MAGIC_KEY_LAYER2 2 | ||
132 | //#define MAGIC_KEY_LAYER3 3 | ||
133 | //#define MAGIC_KEY_LAYER4 4 | ||
134 | //#define MAGIC_KEY_LAYER5 5 | ||
135 | //#define MAGIC_KEY_LAYER6 6 | ||
136 | //#define MAGIC_KEY_LAYER7 7 | ||
137 | //#define MAGIC_KEY_LAYER8 8 | ||
138 | //#define MAGIC_KEY_LAYER9 9 | ||
139 | //#define MAGIC_KEY_BOOTLOADER PAUSE | ||
140 | //#define MAGIC_KEY_LOCK CAPS | ||
141 | //#define MAGIC_KEY_EEPROM E | ||
142 | //#define MAGIC_KEY_NKRO N | ||
143 | //#define MAGIC_KEY_SLEEP_LED Z | ||
144 | |||
145 | /* | ||
146 | * Feature disable options | ||
147 | * These options are also useful to firmware size reduction. | ||
148 | */ | ||
149 | |||
150 | /* disable debug print */ | ||
151 | //#define NO_DEBUG | ||
152 | |||
153 | /* disable print */ | ||
154 | //#define NO_PRINT | ||
155 | |||
156 | /* disable action features */ | ||
157 | //#define NO_ACTION_LAYER | ||
158 | //#define NO_ACTION_TAPPING | ||
159 | //#define NO_ACTION_ONESHOT | ||
160 | //#define NO_ACTION_MACRO | ||
161 | //#define NO_ACTION_FUNCTION | ||
162 | |||
163 | #endif | ||
diff --git a/keyboards/handwired/atreus50/keymaps/default/Makefile b/keyboards/handwired/atreus50/keymaps/default/Makefile new file mode 100644 index 000000000..d7b0fa7fd --- /dev/null +++ b/keyboards/handwired/atreus50/keymaps/default/Makefile | |||
@@ -0,0 +1,6 @@ | |||
1 | RGBLIGHT_ENABLE = yes | ||
2 | AUDIO_ENABLE = no | ||
3 | |||
4 | ifndef QUANTUM_DIR | ||
5 | include ../../../../Makefile | ||
6 | endif \ No newline at end of file | ||
diff --git a/keyboards/handwired/atreus50/keymaps/default/keymap.c b/keyboards/handwired/atreus50/keymaps/default/keymap.c new file mode 100644 index 000000000..415405ec2 --- /dev/null +++ b/keyboards/handwired/atreus50/keymaps/default/keymap.c | |||
@@ -0,0 +1,250 @@ | |||
1 | #include "atreus50.h" | ||
2 | #include "action_layer.h" | ||
3 | #include "eeconfig.h" | ||
4 | #ifdef AUDIO_ENABLE | ||
5 | #include "audio.h" | ||
6 | #endif | ||
7 | |||
8 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
9 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
10 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
11 | // entirely and just use numbers. | ||
12 | #define _QWERTY 0 | ||
13 | #define _COLEMAK 1 | ||
14 | #define _DVORAK 2 | ||
15 | #define _LOWER 3 | ||
16 | #define _RAISE 4 | ||
17 | #define _MOVEMENT 5 | ||
18 | #define _ADJUST 16 | ||
19 | |||
20 | enum custom_keycodes { | ||
21 | QWERTY = SAFE_RANGE, | ||
22 | COLEMAK, | ||
23 | DVORAK, | ||
24 | LOWER, | ||
25 | RAISE, | ||
26 | MOVEMENT, | ||
27 | BACKLIT | ||
28 | }; | ||
29 | |||
30 | // Fillers to make layering more clear | ||
31 | #define _______ KC_TRNS | ||
32 | #define XXXXXXX KC_NO | ||
33 | #define KC_X0 MT(MOD_LCTL, KC_ESC) // Hold for Left Ctrl, Tap for ESC | ||
34 | #define KC_X1 LOWER | ||
35 | #define KC_X2 RAISE | ||
36 | #define KC_X3 MO(_MOVEMENT) | ||
37 | #define KC_X4 MT(MOD_LSFT, KC_ENT) // Hold for Left Shift, Tap for Enter | ||
38 | |||
39 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
40 | |||
41 | [_QWERTY] = COMPACT_KEYMAP( | ||
42 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | ||
43 | TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS, | ||
44 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
45 | X0 , A , S , D , F , G , H , J , K , L ,SCLN,QUOT, | ||
46 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
47 | LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH, X4 , | ||
48 | //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| | ||
49 | GRV ,LCTL,LALT,LGUI, X1 ,SPC , X3 ,RSFT,BSPC, X2 ,LEFT,DOWN, UP ,RGHT | ||
50 | //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' | ||
51 | ), | ||
52 | |||
53 | [_COLEMAK] = COMPACT_KEYMAP( | ||
54 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | ||
55 | TAB , Q , W , F , P , G , J , L , U , Y ,SCLN,MINS, | ||
56 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
57 | X0 , A , R , S , T , D , H , N , E , I , O ,QUOT, | ||
58 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
59 | LSFT, Z , X , C , V , B , K , M ,COMM,DOT ,SLSH, X4 , | ||
60 | //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| | ||
61 | GRV ,LCTL,LALT,LGUI, X1 ,SPC , X3 ,RSFT,BSPC, X2 ,LEFT,DOWN, UP ,RGHT | ||
62 | //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' | ||
63 | ), | ||
64 | |||
65 | [_DVORAK] = COMPACT_KEYMAP( | ||
66 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | ||
67 | TAB ,QUOT,COMM,DOT , P , Y , F , G , C , R , L ,MINS, | ||
68 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
69 | X0 , A , O , E , U , I , D , H , R , N , S ,SLSH, | ||
70 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
71 | LSFT,SCLN, Q , J , K , X , B , M , W , V , Z , X4 , | ||
72 | //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| | ||
73 | GRV ,LCTL,LALT,LGUI, X1 ,SPC , X3 ,RSFT,BSPC, X2 ,LEFT,DOWN, UP ,RGHT | ||
74 | //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' | ||
75 | ), | ||
76 | |||
77 | [_LOWER] = COMPACT_KEYMAP( | ||
78 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | ||
79 | TILD,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,DEL , | ||
80 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
81 | DEL , F1 , F2 , F3 , F4 , F5 , F6 ,UNDS,PLUS,LCBR,RCBR,PIPE, | ||
82 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
83 | , F7 , F8 , F9 ,F10 ,F11 , F12 ,END , , , , , | ||
84 | //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| | ||
85 | , , , , , , , , , ,MNXT,VOLD,VOLU,MPLY | ||
86 | //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' | ||
87 | ), | ||
88 | |||
89 | [_RAISE] = COMPACT_KEYMAP( | ||
90 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | ||
91 | GRV , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,DEL , | ||
92 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
93 | DEL , F1 , F2 , F3 , F4 , F5 , F6 ,MINS,EQL ,LBRC,RBRC,BSLS, | ||
94 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
95 | , F7 , F8 , F9 ,F10 ,F11 , F12 ,NUHS,NUBS, , , , | ||
96 | //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| | ||
97 | , , , , , , , , , ,MNXT,VOLD,VOLU,MPLY | ||
98 | //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' | ||
99 | ), | ||
100 | |||
101 | [_MOVEMENT] = COMPACT_KEYMAP( | ||
102 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | ||
103 | TILD,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR, UP ,LPRN,RPRN,DEL , | ||
104 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
105 | DEL , F1 , F2 , F3 , F4 , F5 , F6 ,LEFT,DOWN,RGHT,RCBR,PIPE, | ||
106 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | ||
107 | , F7 , F8 , F9 ,F10 ,F11 , F12 ,END , , , , , | ||
108 | //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| | ||
109 | , , , , , , , ,PGDN,PGUP,MNXT,VOLD,VOLU,MPLY | ||
110 | //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' | ||
111 | ), | ||
112 | |||
113 | /* Adjust (Lower + Raise) | ||
114 | * |------+------+------+------+------+------. ,------+------+------+------+------+------| | ||
115 | * | | Reset| | | | | | | | | | | Del | | ||
116 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
117 | * | | | |Audoff|Aud on|AGnorm| |AGswap|Qwerty|Colemk|Dvorak| | | | ||
118 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
119 | * | |Voice-|Voice+|Musoff|Mus on| | | | | | | | | | ||
120 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
121 | * | | | | | | | | | | | | | | | | ||
122 | * `-------------------------------------------------------------------------------------------------' | ||
123 | */ | ||
124 | [_ADJUST] = KEYMAP( \ | ||
125 | _______, RESET, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, KC_DEL, \ | ||
126 | _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ | ||
127 | _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, \ | ||
128 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
129 | ) | ||
130 | |||
131 | }; | ||
132 | |||
133 | #ifdef AUDIO_ENABLE | ||
134 | float tone_startup[][2] = { | ||
135 | {NOTE_B5, 20}, | ||
136 | {NOTE_B6, 8}, | ||
137 | {NOTE_DS6, 20}, | ||
138 | {NOTE_B6, 8} | ||
139 | }; | ||
140 | |||
141 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
142 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
143 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
144 | |||
145 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
146 | |||
147 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
148 | #endif | ||
149 | |||
150 | void persistant_default_layer_set(uint16_t default_layer) { | ||
151 | eeconfig_update_default_layer(default_layer); | ||
152 | default_layer_set(default_layer); | ||
153 | } | ||
154 | |||
155 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
156 | switch (keycode) { | ||
157 | case QWERTY: | ||
158 | if (record->event.pressed) { | ||
159 | #ifdef AUDIO_ENABLE | ||
160 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
161 | #endif | ||
162 | persistant_default_layer_set(1UL<<_QWERTY); | ||
163 | } | ||
164 | return false; | ||
165 | break; | ||
166 | case COLEMAK: | ||
167 | if (record->event.pressed) { | ||
168 | #ifdef AUDIO_ENABLE | ||
169 | PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||
170 | #endif | ||
171 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
172 | } | ||
173 | return false; | ||
174 | break; | ||
175 | case DVORAK: | ||
176 | if (record->event.pressed) { | ||
177 | #ifdef AUDIO_ENABLE | ||
178 | PLAY_NOTE_ARRAY(tone_dvorak, false, 0); | ||
179 | #endif | ||
180 | persistant_default_layer_set(1UL<<_DVORAK); | ||
181 | } | ||
182 | return false; | ||
183 | break; | ||
184 | case LOWER: | ||
185 | if (record->event.pressed) { | ||
186 | layer_on(_LOWER); | ||
187 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
188 | } else { | ||
189 | layer_off(_LOWER); | ||
190 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
191 | } | ||
192 | return false; | ||
193 | break; | ||
194 | case RAISE: | ||
195 | if (record->event.pressed) { | ||
196 | layer_on(_RAISE); | ||
197 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
198 | } else { | ||
199 | layer_off(_RAISE); | ||
200 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
201 | } | ||
202 | return false; | ||
203 | break; | ||
204 | case BACKLIT: | ||
205 | if (record->event.pressed) { | ||
206 | register_code(KC_RSFT); | ||
207 | #ifdef BACKLIGHT_ENABLE | ||
208 | backlight_step(); | ||
209 | #endif | ||
210 | } else { | ||
211 | unregister_code(KC_RSFT); | ||
212 | } | ||
213 | return false; | ||
214 | break; | ||
215 | } | ||
216 | return true; | ||
217 | }; | ||
218 | |||
219 | void matrix_init_user(void) { | ||
220 | #ifdef AUDIO_ENABLE | ||
221 | startup_user(); | ||
222 | #endif | ||
223 | } | ||
224 | |||
225 | #ifdef AUDIO_ENABLE | ||
226 | |||
227 | void startup_user() | ||
228 | { | ||
229 | _delay_ms(20); // gets rid of tick | ||
230 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
231 | } | ||
232 | |||
233 | void shutdown_user() | ||
234 | { | ||
235 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
236 | _delay_ms(150); | ||
237 | stop_all_notes(); | ||
238 | } | ||
239 | |||
240 | void music_on_user(void) | ||
241 | { | ||
242 | music_scale_user(); | ||
243 | } | ||
244 | |||
245 | void music_scale_user(void) | ||
246 | { | ||
247 | PLAY_NOTE_ARRAY(music_scale, false, 0); | ||
248 | } | ||
249 | |||
250 | #endif | ||
diff --git a/keyboards/handwired/atreus50/readme.md b/keyboards/handwired/atreus50/readme.md new file mode 100644 index 000000000..0c24f67db --- /dev/null +++ b/keyboards/handwired/atreus50/readme.md | |||
@@ -0,0 +1,16 @@ | |||
1 | Handwired Atreus50 | ||
2 | ================== | ||
3 | |||
4 | This firmware is for a Handwired Atreus50 using an Arduino Pro Micro. | ||
5 | |||
6 | ## Pinout | ||
7 | |||
8 | The following pins are used: | ||
9 | - Columns 1-13: D4, D7, E6, B4, B5, B6, B2, B3, B1, F7, F6, F5, F4 | ||
10 | - Rows 1-4: D3, D2, D1, D0 | ||
11 | |||
12 | ## Compiling and loading the firmware | ||
13 | |||
14 | To build the firmware, run `make`. | ||
15 | |||
16 | To flash the firemware onto the microcontroller, run `make avrdude`, and press the reset button. | ||
diff --git a/keyboards/handwired/atreus50/rules.mk b/keyboards/handwired/atreus50/rules.mk new file mode 100644 index 000000000..7770ea2a2 --- /dev/null +++ b/keyboards/handwired/atreus50/rules.mk | |||
@@ -0,0 +1,81 @@ | |||
1 | |||
2 | |||
3 | # MCU name | ||
4 | #MCU = at90usb1287 | ||
5 | MCU = atmega32u4 | ||
6 | |||
7 | # Processor frequency. | ||
8 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
9 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
10 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
11 | # automatically to create a 32-bit value in your source code. | ||
12 | # | ||
13 | # This will be an integer division of F_USB below, as it is sourced by | ||
14 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
15 | # does not *change* the processor frequency - it should merely be updated to | ||
16 | # reflect the processor speed set externally so that the code can use accurate | ||
17 | # software delays. | ||
18 | F_CPU = 16000000 | ||
19 | |||
20 | # | ||
21 | # LUFA specific | ||
22 | # | ||
23 | # Target architecture (see library "Board Types" documentation). | ||
24 | ARCH = AVR8 | ||
25 | |||
26 | # Input clock frequency. | ||
27 | # This will define a symbol, F_USB, in all source code files equal to the | ||
28 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
29 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
30 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
31 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
32 | # at the end, this will be done automatically to create a 32-bit value in your | ||
33 | # source code. | ||
34 | # | ||
35 | # If no clock division is performed on the input clock inside the AVR (via the | ||
36 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
37 | F_USB = $(F_CPU) | ||
38 | |||
39 | # Interrupt driven control endpoint task(+60) | ||
40 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
41 | |||
42 | |||
43 | # Boot Section Size in *bytes* | ||
44 | # Teensy halfKay 512 | ||
45 | # Teensy++ halfKay 1024 | ||
46 | # Atmel DFU loader 4096 | ||
47 | # LUFA bootloader 4096 | ||
48 | # USBaspLoader 2048 | ||
49 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
50 | |||
51 | # Build Options | ||
52 | # change to "no" to disable the options, or define them in the Makefile in | ||
53 | # the appropriate keymap folder that will get included automatically | ||
54 | # | ||
55 | BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | ||
56 | MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) | ||
57 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
58 | CONSOLE_ENABLE ?= no # Console for debug(+400) | ||
59 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
60 | NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
61 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality | ||
62 | MIDI_ENABLE ?= no # MIDI controls | ||
63 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
64 | UNICODE_ENABLE ?= no # Unicode | ||
65 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
66 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
67 | |||
68 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
69 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | ||
70 | |||
71 | avrdude: build | ||
72 | ls /dev/tty* > /tmp/1; \ | ||
73 | echo "Reset your Pro Micro now"; \ | ||
74 | while [[ -z $$USB ]]; do \ | ||
75 | sleep 1; \ | ||
76 | ls /dev/tty* > /tmp/2; \ | ||
77 | USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ | ||
78 | done; \ | ||
79 | avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex | ||
80 | |||
81 | .PHONY: avrdude | ||
diff --git a/keyboards/lets_split/common/glcdfont.c b/keyboards/lets_split/common/glcdfont.c new file mode 100644 index 000000000..6f88bd23a --- /dev/null +++ b/keyboards/lets_split/common/glcdfont.c | |||
@@ -0,0 +1,276 @@ | |||
1 | // This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. | ||
2 | // See gfxfont.h for newer custom bitmap font info. | ||
3 | |||
4 | #ifndef FONT5X7_H | ||
5 | #define FONT5X7_H | ||
6 | |||
7 | #ifdef __AVR__ | ||
8 | #include <avr/io.h> | ||
9 | #include <avr/pgmspace.h> | ||
10 | #elif defined(ESP8266) | ||
11 | #include <pgmspace.h> | ||
12 | #else | ||
13 | #define PROGMEM | ||
14 | #endif | ||
15 | |||
16 | // Standard ASCII 5x7 font | ||
17 | |||
18 | static const unsigned char font[] PROGMEM = { | ||
19 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
20 | 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, | ||
21 | 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, | ||
22 | 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, | ||
23 | 0x18, 0x3C, 0x7E, 0x3C, 0x18, | ||
24 | 0x1C, 0x57, 0x7D, 0x57, 0x1C, | ||
25 | 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, | ||
26 | 0x00, 0x18, 0x3C, 0x18, 0x00, | ||
27 | 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, | ||
28 | 0x00, 0x18, 0x24, 0x18, 0x00, | ||
29 | 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, | ||
30 | 0x30, 0x48, 0x3A, 0x06, 0x0E, | ||
31 | 0x26, 0x29, 0x79, 0x29, 0x26, | ||
32 | 0x40, 0x7F, 0x05, 0x05, 0x07, | ||
33 | 0x40, 0x7F, 0x05, 0x25, 0x3F, | ||
34 | 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, | ||
35 | 0x7F, 0x3E, 0x1C, 0x1C, 0x08, | ||
36 | 0x08, 0x1C, 0x1C, 0x3E, 0x7F, | ||
37 | 0x14, 0x22, 0x7F, 0x22, 0x14, | ||
38 | 0x5F, 0x5F, 0x00, 0x5F, 0x5F, | ||
39 | 0x06, 0x09, 0x7F, 0x01, 0x7F, | ||
40 | 0x00, 0x66, 0x89, 0x95, 0x6A, | ||
41 | 0x60, 0x60, 0x60, 0x60, 0x60, | ||
42 | 0x94, 0xA2, 0xFF, 0xA2, 0x94, | ||
43 | 0x08, 0x04, 0x7E, 0x04, 0x08, | ||
44 | 0x10, 0x20, 0x7E, 0x20, 0x10, | ||
45 | 0x08, 0x08, 0x2A, 0x1C, 0x08, | ||
46 | 0x08, 0x1C, 0x2A, 0x08, 0x08, | ||
47 | 0x1E, 0x10, 0x10, 0x10, 0x10, | ||
48 | 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, | ||
49 | 0x30, 0x38, 0x3E, 0x38, 0x30, | ||
50 | 0x06, 0x0E, 0x3E, 0x0E, 0x06, | ||
51 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
52 | 0x00, 0x00, 0x5F, 0x00, 0x00, | ||
53 | 0x00, 0x07, 0x00, 0x07, 0x00, | ||
54 | 0x14, 0x7F, 0x14, 0x7F, 0x14, | ||
55 | 0x24, 0x2A, 0x7F, 0x2A, 0x12, | ||
56 | 0x23, 0x13, 0x08, 0x64, 0x62, | ||
57 | 0x36, 0x49, 0x56, 0x20, 0x50, | ||
58 | 0x00, 0x08, 0x07, 0x03, 0x00, | ||
59 | 0x00, 0x1C, 0x22, 0x41, 0x00, | ||
60 | 0x00, 0x41, 0x22, 0x1C, 0x00, | ||
61 | 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, | ||
62 | 0x08, 0x08, 0x3E, 0x08, 0x08, | ||
63 | 0x00, 0x80, 0x70, 0x30, 0x00, | ||
64 | 0x08, 0x08, 0x08, 0x08, 0x08, | ||
65 | 0x00, 0x00, 0x60, 0x60, 0x00, | ||
66 | 0x20, 0x10, 0x08, 0x04, 0x02, | ||
67 | 0x3E, 0x51, 0x49, 0x45, 0x3E, | ||
68 | 0x00, 0x42, 0x7F, 0x40, 0x00, | ||
69 | 0x72, 0x49, 0x49, 0x49, 0x46, | ||
70 | 0x21, 0x41, 0x49, 0x4D, 0x33, | ||
71 | 0x18, 0x14, 0x12, 0x7F, 0x10, | ||
72 | 0x27, 0x45, 0x45, 0x45, 0x39, | ||
73 | 0x3C, 0x4A, 0x49, 0x49, 0x31, | ||
74 | 0x41, 0x21, 0x11, 0x09, 0x07, | ||
75 | 0x36, 0x49, 0x49, 0x49, 0x36, | ||
76 | 0x46, 0x49, 0x49, 0x29, 0x1E, | ||
77 | 0x00, 0x00, 0x14, 0x00, 0x00, | ||
78 | 0x00, 0x40, 0x34, 0x00, 0x00, | ||
79 | 0x00, 0x08, 0x14, 0x22, 0x41, | ||
80 | 0x14, 0x14, 0x14, 0x14, 0x14, | ||
81 | 0x00, 0x41, 0x22, 0x14, 0x08, | ||
82 | 0x02, 0x01, 0x59, 0x09, 0x06, | ||
83 | 0x3E, 0x41, 0x5D, 0x59, 0x4E, | ||
84 | 0x7C, 0x12, 0x11, 0x12, 0x7C, | ||
85 | 0x7F, 0x49, 0x49, 0x49, 0x36, | ||
86 | 0x3E, 0x41, 0x41, 0x41, 0x22, | ||
87 | 0x7F, 0x41, 0x41, 0x41, 0x3E, | ||
88 | 0x7F, 0x49, 0x49, 0x49, 0x41, | ||
89 | 0x7F, 0x09, 0x09, 0x09, 0x01, | ||
90 | 0x3E, 0x41, 0x41, 0x51, 0x73, | ||
91 | 0x7F, 0x08, 0x08, 0x08, 0x7F, | ||
92 | 0x00, 0x41, 0x7F, 0x41, 0x00, | ||
93 | 0x20, 0x40, 0x41, 0x3F, 0x01, | ||
94 | 0x7F, 0x08, 0x14, 0x22, 0x41, | ||
95 | 0x7F, 0x40, 0x40, 0x40, 0x40, | ||
96 | 0x7F, 0x02, 0x1C, 0x02, 0x7F, | ||
97 | 0x7F, 0x04, 0x08, 0x10, 0x7F, | ||
98 | 0x3E, 0x41, 0x41, 0x41, 0x3E, | ||
99 | 0x7F, 0x09, 0x09, 0x09, 0x06, | ||
100 | 0x3E, 0x41, 0x51, 0x21, 0x5E, | ||
101 | 0x7F, 0x09, 0x19, 0x29, 0x46, | ||
102 | 0x26, 0x49, 0x49, 0x49, 0x32, | ||
103 | 0x03, 0x01, 0x7F, 0x01, 0x03, | ||
104 | 0x3F, 0x40, 0x40, 0x40, 0x3F, | ||
105 | 0x1F, 0x20, 0x40, 0x20, 0x1F, | ||
106 | 0x3F, 0x40, 0x38, 0x40, 0x3F, | ||
107 | 0x63, 0x14, 0x08, 0x14, 0x63, | ||
108 | 0x03, 0x04, 0x78, 0x04, 0x03, | ||
109 | 0x61, 0x59, 0x49, 0x4D, 0x43, | ||
110 | 0x00, 0x7F, 0x41, 0x41, 0x41, | ||
111 | 0x02, 0x04, 0x08, 0x10, 0x20, | ||
112 | 0x00, 0x41, 0x41, 0x41, 0x7F, | ||
113 | 0x04, 0x02, 0x01, 0x02, 0x04, | ||
114 | 0x40, 0x40, 0x40, 0x40, 0x40, | ||
115 | 0x00, 0x03, 0x07, 0x08, 0x00, | ||
116 | 0x20, 0x54, 0x54, 0x78, 0x40, | ||
117 | 0x7F, 0x28, 0x44, 0x44, 0x38, | ||
118 | 0x38, 0x44, 0x44, 0x44, 0x28, | ||
119 | 0x38, 0x44, 0x44, 0x28, 0x7F, | ||
120 | 0x38, 0x54, 0x54, 0x54, 0x18, | ||
121 | 0x00, 0x08, 0x7E, 0x09, 0x02, | ||
122 | 0x18, 0xA4, 0xA4, 0x9C, 0x78, | ||
123 | 0x7F, 0x08, 0x04, 0x04, 0x78, | ||
124 | 0x00, 0x44, 0x7D, 0x40, 0x00, | ||
125 | 0x20, 0x40, 0x40, 0x3D, 0x00, | ||
126 | 0x7F, 0x10, 0x28, 0x44, 0x00, | ||
127 | 0x00, 0x41, 0x7F, 0x40, 0x00, | ||
128 | 0x7C, 0x04, 0x78, 0x04, 0x78, | ||
129 | 0x7C, 0x08, 0x04, 0x04, 0x78, | ||
130 | 0x38, 0x44, 0x44, 0x44, 0x38, | ||
131 | 0xFC, 0x18, 0x24, 0x24, 0x18, | ||
132 | 0x18, 0x24, 0x24, 0x18, 0xFC, | ||
133 | 0x7C, 0x08, 0x04, 0x04, 0x08, | ||
134 | 0x48, 0x54, 0x54, 0x54, 0x24, | ||
135 | 0x04, 0x04, 0x3F, 0x44, 0x24, | ||
136 | 0x3C, 0x40, 0x40, 0x20, 0x7C, | ||
137 | 0x1C, 0x20, 0x40, 0x20, 0x1C, | ||
138 | 0x3C, 0x40, 0x30, 0x40, 0x3C, | ||
139 | 0x44, 0x28, 0x10, 0x28, 0x44, | ||
140 | 0x4C, 0x90, 0x90, 0x90, 0x7C, | ||
141 | 0x44, 0x64, 0x54, 0x4C, 0x44, | ||
142 | 0x00, 0x08, 0x36, 0x41, 0x00, | ||
143 | 0x00, 0x00, 0x77, 0x00, 0x00, | ||
144 | 0x00, 0x41, 0x36, 0x08, 0x00, | ||
145 | 0x02, 0x01, 0x02, 0x04, 0x02, | ||
146 | 0x3C, 0x26, 0x23, 0x26, 0x3C, | ||
147 | 0x1E, 0xA1, 0xA1, 0x61, 0x12, | ||
148 | 0x3A, 0x40, 0x40, 0x20, 0x7A, | ||
149 | 0x38, 0x54, 0x54, 0x55, 0x59, | ||
150 | 0x21, 0x55, 0x55, 0x79, 0x41, | ||
151 | 0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut | ||
152 | 0x21, 0x55, 0x54, 0x78, 0x40, | ||
153 | 0x20, 0x54, 0x55, 0x79, 0x40, | ||
154 | 0x0C, 0x1E, 0x52, 0x72, 0x12, | ||
155 | 0x39, 0x55, 0x55, 0x55, 0x59, | ||
156 | 0x39, 0x54, 0x54, 0x54, 0x59, | ||
157 | 0x39, 0x55, 0x54, 0x54, 0x58, | ||
158 | 0x00, 0x00, 0x45, 0x7C, 0x41, | ||
159 | 0x00, 0x02, 0x45, 0x7D, 0x42, | ||
160 | 0x00, 0x01, 0x45, 0x7C, 0x40, | ||
161 | 0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut | ||
162 | 0xF0, 0x28, 0x25, 0x28, 0xF0, | ||
163 | 0x7C, 0x54, 0x55, 0x45, 0x00, | ||
164 | 0x20, 0x54, 0x54, 0x7C, 0x54, | ||
165 | 0x7C, 0x0A, 0x09, 0x7F, 0x49, | ||
166 | 0x32, 0x49, 0x49, 0x49, 0x32, | ||
167 | 0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut | ||
168 | 0x32, 0x4A, 0x48, 0x48, 0x30, | ||
169 | 0x3A, 0x41, 0x41, 0x21, 0x7A, | ||
170 | 0x3A, 0x42, 0x40, 0x20, 0x78, | ||
171 | 0x00, 0x9D, 0xA0, 0xA0, 0x7D, | ||
172 | 0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut | ||
173 | 0x3D, 0x40, 0x40, 0x40, 0x3D, | ||
174 | 0x3C, 0x24, 0xFF, 0x24, 0x24, | ||
175 | 0x48, 0x7E, 0x49, 0x43, 0x66, | ||
176 | 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, | ||
177 | 0xFF, 0x09, 0x29, 0xF6, 0x20, | ||
178 | 0xC0, 0x88, 0x7E, 0x09, 0x03, | ||
179 | 0x20, 0x54, 0x54, 0x79, 0x41, | ||
180 | 0x00, 0x00, 0x44, 0x7D, 0x41, | ||
181 | 0x30, 0x48, 0x48, 0x4A, 0x32, | ||
182 | 0x38, 0x40, 0x40, 0x22, 0x7A, | ||
183 | 0x00, 0x7A, 0x0A, 0x0A, 0x72, | ||
184 | 0x7D, 0x0D, 0x19, 0x31, 0x7D, | ||
185 | 0x26, 0x29, 0x29, 0x2F, 0x28, | ||
186 | 0x26, 0x29, 0x29, 0x29, 0x26, | ||
187 | 0x30, 0x48, 0x4D, 0x40, 0x20, | ||
188 | 0x38, 0x08, 0x08, 0x08, 0x08, | ||
189 | 0x08, 0x08, 0x08, 0x08, 0x38, | ||
190 | 0x2F, 0x10, 0xC8, 0xAC, 0xBA, | ||
191 | 0x2F, 0x10, 0x28, 0x34, 0xFA, | ||
192 | 0x00, 0x00, 0x7B, 0x00, 0x00, | ||
193 | 0x08, 0x14, 0x2A, 0x14, 0x22, | ||
194 | 0x22, 0x14, 0x2A, 0x14, 0x08, | ||
195 | 0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code | ||
196 | 0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block | ||
197 | 0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block | ||
198 | 0x00, 0x00, 0x00, 0xFF, 0x00, | ||
199 | 0x10, 0x10, 0x10, 0xFF, 0x00, | ||
200 | 0x14, 0x14, 0x14, 0xFF, 0x00, | ||
201 | 0x10, 0x10, 0xFF, 0x00, 0xFF, | ||
202 | 0x10, 0x10, 0xF0, 0x10, 0xF0, | ||
203 | 0x14, 0x14, 0x14, 0xFC, 0x00, | ||
204 | 0x14, 0x14, 0xF7, 0x00, 0xFF, | ||
205 | 0x00, 0x00, 0xFF, 0x00, 0xFF, | ||
206 | 0x14, 0x14, 0xF4, 0x04, 0xFC, | ||
207 | 0x14, 0x14, 0x17, 0x10, 0x1F, | ||
208 | 0x10, 0x10, 0x1F, 0x10, 0x1F, | ||
209 | 0x14, 0x14, 0x14, 0x1F, 0x00, | ||
210 | 0x10, 0x10, 0x10, 0xF0, 0x00, | ||
211 | 0x00, 0x00, 0x00, 0x1F, 0x10, | ||
212 | 0x10, 0x10, 0x10, 0x1F, 0x10, | ||
213 | 0x10, 0x10, 0x10, 0xF0, 0x10, | ||
214 | 0x00, 0x00, 0x00, 0xFF, 0x10, | ||
215 | 0x10, 0x10, 0x10, 0x10, 0x10, | ||
216 | 0x10, 0x10, 0x10, 0xFF, 0x10, | ||
217 | 0x00, 0x00, 0x00, 0xFF, 0x14, | ||
218 | 0x00, 0x00, 0xFF, 0x00, 0xFF, | ||
219 | 0x00, 0x00, 0x1F, 0x10, 0x17, | ||
220 | 0x00, 0x00, 0xFC, 0x04, 0xF4, | ||
221 | 0x14, 0x14, 0x17, 0x10, 0x17, | ||
222 | 0x14, 0x14, 0xF4, 0x04, 0xF4, | ||
223 | 0x00, 0x00, 0xFF, 0x00, 0xF7, | ||
224 | 0x14, 0x14, 0x14, 0x14, 0x14, | ||
225 | 0x14, 0x14, 0xF7, 0x00, 0xF7, | ||
226 | 0x14, 0x14, 0x14, 0x17, 0x14, | ||
227 | 0x10, 0x10, 0x1F, 0x10, 0x1F, | ||
228 | 0x14, 0x14, 0x14, 0xF4, 0x14, | ||
229 | 0x10, 0x10, 0xF0, 0x10, 0xF0, | ||
230 | 0x00, 0x00, 0x1F, 0x10, 0x1F, | ||
231 | 0x00, 0x00, 0x00, 0x1F, 0x14, | ||
232 | 0x00, 0x00, 0x00, 0xFC, 0x14, | ||
233 | 0x00, 0x00, 0xF0, 0x10, 0xF0, | ||
234 | 0x10, 0x10, 0xFF, 0x10, 0xFF, | ||
235 | 0x14, 0x14, 0x14, 0xFF, 0x14, | ||
236 | 0x10, 0x10, 0x10, 0x1F, 0x00, | ||
237 | 0x00, 0x00, 0x00, 0xF0, 0x10, | ||
238 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
239 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, | ||
240 | 0xFF, 0xFF, 0xFF, 0x00, 0x00, | ||
241 | 0x00, 0x00, 0x00, 0xFF, 0xFF, | ||
242 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, | ||
243 | 0x38, 0x44, 0x44, 0x38, 0x44, | ||
244 | 0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta | ||
245 | 0x7E, 0x02, 0x02, 0x06, 0x06, | ||
246 | 0x02, 0x7E, 0x02, 0x7E, 0x02, | ||
247 | 0x63, 0x55, 0x49, 0x41, 0x63, | ||
248 | 0x38, 0x44, 0x44, 0x3C, 0x04, | ||
249 | 0x40, 0x7E, 0x20, 0x1E, 0x20, | ||
250 | 0x06, 0x02, 0x7E, 0x02, 0x02, | ||
251 | 0x99, 0xA5, 0xE7, 0xA5, 0x99, | ||
252 | 0x1C, 0x2A, 0x49, 0x2A, 0x1C, | ||
253 | 0x4C, 0x72, 0x01, 0x72, 0x4C, | ||
254 | 0x30, 0x4A, 0x4D, 0x4D, 0x30, | ||
255 | 0x30, 0x48, 0x78, 0x48, 0x30, | ||
256 | 0xBC, 0x62, 0x5A, 0x46, 0x3D, | ||
257 | 0x3E, 0x49, 0x49, 0x49, 0x00, | ||
258 | 0x7E, 0x01, 0x01, 0x01, 0x7E, | ||
259 | 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, | ||
260 | 0x44, 0x44, 0x5F, 0x44, 0x44, | ||
261 | 0x40, 0x51, 0x4A, 0x44, 0x40, | ||
262 | 0x40, 0x44, 0x4A, 0x51, 0x40, | ||
263 | 0x00, 0x00, 0xFF, 0x01, 0x03, | ||
264 | 0xE0, 0x80, 0xFF, 0x00, 0x00, | ||
265 | 0x08, 0x08, 0x6B, 0x6B, 0x08, | ||
266 | 0x36, 0x12, 0x36, 0x24, 0x36, | ||
267 | 0x06, 0x0F, 0x09, 0x0F, 0x06, | ||
268 | 0x00, 0x00, 0x18, 0x18, 0x00, | ||
269 | 0x00, 0x00, 0x10, 0x10, 0x00, | ||
270 | 0x30, 0x40, 0xFF, 0x01, 0x01, | ||
271 | 0x00, 0x1F, 0x01, 0x01, 0x1E, | ||
272 | 0x00, 0x19, 0x1D, 0x17, 0x12, | ||
273 | 0x00, 0x3C, 0x3C, 0x3C, 0x3C, | ||
274 | 0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP | ||
275 | }; | ||
276 | #endif // FONT5X7_H | ||
diff --git a/keyboards/lets_split/i2c.h b/keyboards/lets_split/i2c.h index 08ce4b009..c15b6bc50 100644 --- a/keyboards/lets_split/i2c.h +++ b/keyboards/lets_split/i2c.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #define SLAVE_BUFFER_SIZE 0x10 | 16 | #define SLAVE_BUFFER_SIZE 0x10 |
17 | 17 | ||
18 | // i2c SCL clock frequency | 18 | // i2c SCL clock frequency |
19 | #define SCL_CLOCK 100000L | 19 | #define SCL_CLOCK 400000L |
20 | 20 | ||
21 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | 21 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; |
22 | 22 | ||
@@ -28,4 +28,22 @@ uint8_t i2c_master_read(int); | |||
28 | void i2c_reset_state(void); | 28 | void i2c_reset_state(void); |
29 | void i2c_slave_init(uint8_t address); | 29 | void i2c_slave_init(uint8_t address); |
30 | 30 | ||
31 | |||
32 | static inline unsigned char i2c_start_read(unsigned char addr) { | ||
33 | return i2c_master_start((addr << 1) | I2C_READ); | ||
34 | } | ||
35 | |||
36 | static inline unsigned char i2c_start_write(unsigned char addr) { | ||
37 | return i2c_master_start((addr << 1) | I2C_WRITE); | ||
38 | } | ||
39 | |||
40 | // from SSD1306 scrips | ||
41 | extern unsigned char i2c_rep_start(unsigned char addr); | ||
42 | extern void i2c_start_wait(unsigned char addr); | ||
43 | extern unsigned char i2c_readAck(void); | ||
44 | extern unsigned char i2c_readNak(void); | ||
45 | extern unsigned char i2c_read(unsigned char ack); | ||
46 | |||
47 | #define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); | ||
48 | |||
31 | #endif | 49 | #endif |
diff --git a/keyboards/lets_split/keymaps/OLED_sample/Makefile b/keyboards/lets_split/keymaps/OLED_sample/Makefile new file mode 100644 index 000000000..90616d1f1 --- /dev/null +++ b/keyboards/lets_split/keymaps/OLED_sample/Makefile | |||
@@ -0,0 +1,25 @@ | |||
1 | |||
2 | # Build Options | ||
3 | # change to "no" to disable the options, or define them in the Makefile in | ||
4 | # the appropriate keymap folder that will get included automatically | ||
5 | # | ||
6 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
7 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
8 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
9 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
10 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
11 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
12 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
13 | MIDI_ENABLE = no # MIDI controls | ||
14 | AUDIO_ENABLE = no # Audio output on port C6 | ||
15 | UNICODE_ENABLE = no # Unicode | ||
16 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
17 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
18 | ONEHAND_ENABLE = no # Enable one-hand typing | ||
19 | |||
20 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
21 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
22 | |||
23 | ifndef QUANTUM_DIR | ||
24 | include ../../../../Makefile | ||
25 | endif \ No newline at end of file | ||
diff --git a/keyboards/lets_split/keymaps/OLED_sample/config.h b/keyboards/lets_split/keymaps/OLED_sample/config.h new file mode 100644 index 000000000..353ea368c --- /dev/null +++ b/keyboards/lets_split/keymaps/OLED_sample/config.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #define USE_I2C | ||
19 | //#define USE_SERIAL | ||
20 | //#define MASTER_RIGHT | ||
21 | #define FLIP_HALF | ||
22 | |||
23 | #define SSD1306OLED | ||
24 | |||
25 | |||
26 | #define PREVENT_STUCK_MODIFIERS | ||
27 | #define TAPPING_FORCE_HOLD | ||
28 | #define TAPPING_TERM 100 | ||
29 | |||
30 | #undef RGBLED_NUM | ||
31 | #define RGBLIGHT_ANIMATIONS | ||
32 | #define RGBLED_NUM 6 | ||
33 | #define RGBLIGHT_HUE_STEP 10 | ||
34 | #define RGBLIGHT_SAT_STEP 17 | ||
35 | #define RGBLIGHT_VAL_STEP 17 | ||
36 | |||
37 | |||
38 | |||
39 | |||
40 | #ifdef SUBPROJECT_rev1 | ||
41 | #include "../../rev1/config.h" | ||
42 | #endif | ||
43 | #ifdef SUBPROJECT_rev2 | ||
44 | #include "../../rev2/config.h" | ||
45 | #endif \ No newline at end of file | ||
diff --git a/keyboards/lets_split/keymaps/OLED_sample/keymap.c b/keyboards/lets_split/keymaps/OLED_sample/keymap.c new file mode 100644 index 000000000..072b825ab --- /dev/null +++ b/keyboards/lets_split/keymaps/OLED_sample/keymap.c | |||
@@ -0,0 +1,356 @@ | |||
1 | #include "lets_split.h" | ||
2 | #include "bootloader.h" | ||
3 | #include "action_layer.h" | ||
4 | #include "eeconfig.h" | ||
5 | #include "tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/Peripheral/TWI.h" | ||
6 | #ifdef AUDIO_ENABLE | ||
7 | #include "audio.h" | ||
8 | #endif | ||
9 | |||
10 | extern keymap_config_t keymap_config; | ||
11 | |||
12 | //Following line allows macro to read current RGB settings | ||
13 | extern rgblight_config_t rgblight_config; | ||
14 | |||
15 | |||
16 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
17 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
18 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
19 | // entirely and just use numbers. | ||
20 | #define _QWERTY 0 | ||
21 | #define _COLEMAK 1 | ||
22 | #define _DVORAK 2 | ||
23 | #define _LOWER 3 | ||
24 | #define _RAISE 4 | ||
25 | #define _ADJUST 16 | ||
26 | |||
27 | enum custom_keycodes { | ||
28 | QWERTY = SAFE_RANGE, | ||
29 | COLEMAK, | ||
30 | DVORAK, | ||
31 | LOWER, | ||
32 | RAISE, | ||
33 | ADJUST, | ||
34 | BACKLIT, | ||
35 | RGBLED_TOGGLE, | ||
36 | RGBLED_STEP_MODE, | ||
37 | RGBLED_INCREASE_HUE, | ||
38 | RGBLED_DECREASE_HUE, | ||
39 | RGBLED_INCREASE_SAT, | ||
40 | RGBLED_DECREASE_SAT, | ||
41 | RGBLED_INCREASE_VAL, | ||
42 | RGBLED_DECREASE_VAL, | ||
43 | }; | ||
44 | |||
45 | enum macro_keycodes { | ||
46 | KC_SAMPLEMACRO, | ||
47 | }; | ||
48 | |||
49 | |||
50 | // Fillers to make layering more clear | ||
51 | #define _______ KC_TRNS | ||
52 | #define XXXXXXX KC_NO | ||
53 | //Macros | ||
54 | #define M_SAMPLE M(KC_SAMPLEMACRO) | ||
55 | |||
56 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
57 | |||
58 | /* Qwerty | ||
59 | * ,-----------------------------------------------------------------------------------. | ||
60 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
61 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
62 | * | Esc | A | S | D | F | G | H | J | K | L | ; | " | | ||
63 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
64 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
65 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
66 | * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | | ||
67 | * `-----------------------------------------------------------------------------------' | ||
68 | */ | ||
69 | [_QWERTY] = KEYMAP( \ | ||
70 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ | ||
71 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | ||
72 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ | ||
73 | ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
74 | ), | ||
75 | |||
76 | /* Colemak | ||
77 | * ,-----------------------------------------------------------------------------------. | ||
78 | * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | | ||
79 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
80 | * | Esc | A | R | S | T | D | H | N | E | I | O | " | | ||
81 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
82 | * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | | ||
83 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
84 | * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | | ||
85 | * `-----------------------------------------------------------------------------------' | ||
86 | */ | ||
87 | [_COLEMAK] = KEYMAP( \ | ||
88 | KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ | ||
89 | KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ | ||
90 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ | ||
91 | ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
92 | ), | ||
93 | |||
94 | /* Dvorak | ||
95 | * ,-----------------------------------------------------------------------------------. | ||
96 | * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | | ||
97 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
98 | * | Esc | A | O | E | U | I | D | H | T | N | S | / | | ||
99 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
100 | * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | | ||
101 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
102 | * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | | ||
103 | * `-----------------------------------------------------------------------------------' | ||
104 | */ | ||
105 | [_DVORAK] = KEYMAP( \ | ||
106 | KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ | ||
107 | KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ | ||
108 | KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ | ||
109 | ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
110 | ), | ||
111 | |||
112 | /* Lower | ||
113 | * ,-----------------------------------------------------------------------------------. | ||
114 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
115 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
116 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | | ||
117 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
118 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | | ||
119 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
120 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
121 | * `-----------------------------------------------------------------------------------' | ||
122 | */ | ||
123 | [_LOWER] = KEYMAP( \ | ||
124 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ | ||
125 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ | ||
126 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ | ||
127 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
128 | ), | ||
129 | |||
130 | /* Raise | ||
131 | * ,-----------------------------------------------------------------------------------. | ||
132 | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
133 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
134 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
135 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
136 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | | ||
137 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
138 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
139 | * `-----------------------------------------------------------------------------------' | ||
140 | */ | ||
141 | [_RAISE] = KEYMAP( \ | ||
142 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ | ||
143 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ | ||
144 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ | ||
145 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
146 | ), | ||
147 | |||
148 | /* Adjust (Lower + Raise) | ||
149 | * ,-----------------------------------------------------------------------------------. | ||
150 | * | | Reset| | | | | | | | | | Del | | ||
151 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
152 | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | | ||
153 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
154 | * | | | | | | | | | | | | | | ||
155 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
156 | * | | | | | | | | | | | | | ||
157 | * `-----------------------------------------------------------------------------------' | ||
158 | */ | ||
159 | [_ADJUST] = KEYMAP( \ | ||
160 | _______, RESET, _______, M_SAMPLE, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ | ||
161 | _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ | ||
162 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
163 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
164 | ) | ||
165 | |||
166 | |||
167 | }; | ||
168 | |||
169 | |||
170 | #ifdef AUDIO_ENABLE | ||
171 | |||
172 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
173 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
174 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
175 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
176 | float tone_plover[][2] = SONG(PLOVER_SOUND); | ||
177 | float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); | ||
178 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
179 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
180 | #endif | ||
181 | |||
182 | // define variables for reactive RGB | ||
183 | bool TOG_STATUS = false; | ||
184 | int RGB_current_mode; | ||
185 | |||
186 | void persistant_default_layer_set(uint16_t default_layer) { | ||
187 | eeconfig_update_default_layer(default_layer); | ||
188 | default_layer_set(default_layer); | ||
189 | } | ||
190 | |||
191 | // Setting ADJUST layer RGB back to default | ||
192 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | ||
193 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | ||
194 | rgblight_mode(RGB_current_mode); | ||
195 | layer_on(layer3); | ||
196 | } else { | ||
197 | layer_off(layer3); | ||
198 | } | ||
199 | } | ||
200 | |||
201 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
202 | switch (keycode) { | ||
203 | case QWERTY: | ||
204 | if (record->event.pressed) { | ||
205 | #ifdef AUDIO_ENABLE | ||
206 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
207 | #endif | ||
208 | persistant_default_layer_set(1UL<<_QWERTY); | ||
209 | } | ||
210 | return false; | ||
211 | break; | ||
212 | case COLEMAK: | ||
213 | if (record->event.pressed) { | ||
214 | #ifdef AUDIO_ENABLE | ||
215 | PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||
216 | #endif | ||
217 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
218 | } | ||
219 | return false; | ||
220 | break; | ||
221 | case DVORAK: | ||
222 | if (record->event.pressed) { | ||
223 | #ifdef AUDIO_ENABLE | ||
224 | PLAY_NOTE_ARRAY(tone_dvorak, false, 0); | ||
225 | #endif | ||
226 | persistant_default_layer_set(1UL<<_DVORAK); | ||
227 | } | ||
228 | return false; | ||
229 | break; | ||
230 | case LOWER: | ||
231 | if (record->event.pressed) { | ||
232 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
233 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
234 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
235 | } else { | ||
236 | TOG_STATUS = !TOG_STATUS; | ||
237 | rgblight_mode(16); | ||
238 | } | ||
239 | layer_on(_LOWER); | ||
240 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
241 | } else { | ||
242 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
243 | TOG_STATUS = false; | ||
244 | layer_off(_LOWER); | ||
245 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
246 | } | ||
247 | return false; | ||
248 | break; | ||
249 | case RAISE: | ||
250 | if (record->event.pressed) { | ||
251 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
252 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
253 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
254 | } else { | ||
255 | TOG_STATUS = !TOG_STATUS; | ||
256 | rgblight_mode(15); | ||
257 | } | ||
258 | layer_on(_RAISE); | ||
259 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
260 | } else { | ||
261 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
262 | layer_off(_RAISE); | ||
263 | TOG_STATUS = false; | ||
264 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
265 | } | ||
266 | return false; | ||
267 | break; | ||
268 | case BACKLIT: | ||
269 | if (record->event.pressed) { | ||
270 | register_code(KC_RSFT); | ||
271 | #ifdef BACKLIGHT_ENABLE | ||
272 | backlight_step(); | ||
273 | #endif | ||
274 | } else { | ||
275 | unregister_code(KC_RSFT); | ||
276 | } | ||
277 | return false; | ||
278 | break; | ||
279 | //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released | ||
280 | case RGB_MOD: | ||
281 | if (record->event.pressed) { | ||
282 | rgblight_mode(RGB_current_mode); | ||
283 | rgblight_step(); | ||
284 | RGB_current_mode = rgblight_config.mode; | ||
285 | } | ||
286 | return false; | ||
287 | break; | ||
288 | } | ||
289 | return true; | ||
290 | } | ||
291 | |||
292 | void matrix_init_user(void) { | ||
293 | #ifdef AUDIO_ENABLE | ||
294 | startup_user(); | ||
295 | #endif | ||
296 | RGB_current_mode = rgblight_config.mode; | ||
297 | } | ||
298 | |||
299 | //SSD1306 OLED init and update loop, make sure to add #define SSD1306OLED in config.h | ||
300 | #ifdef SSD1306OLED | ||
301 | void matrix_master_OLED_init (void) { | ||
302 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | ||
303 | iota_gfx_init(); // turns on the display | ||
304 | } | ||
305 | |||
306 | void matrix_scan_user(void) { | ||
307 | iota_gfx_task(); // this is what updates the display continuously | ||
308 | } | ||
309 | #endif | ||
310 | |||
311 | #ifdef AUDIO_ENABLE | ||
312 | |||
313 | void startup_user() | ||
314 | { | ||
315 | _delay_ms(20); // gets rid of tick | ||
316 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
317 | } | ||
318 | |||
319 | void shutdown_user() | ||
320 | { | ||
321 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
322 | _delay_ms(150); | ||
323 | stop_all_notes(); | ||
324 | } | ||
325 | |||
326 | void music_on_user(void) | ||
327 | { | ||
328 | music_scale_user(); | ||
329 | } | ||
330 | |||
331 | void music_scale_user(void) | ||
332 | { | ||
333 | PLAY_NOTE_ARRAY(music_scale, false, 0); | ||
334 | } | ||
335 | |||
336 | #endif | ||
337 | |||
338 | /* | ||
339 | * Macro definition | ||
340 | */ | ||
341 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
342 | { | ||
343 | if (!eeconfig_is_enabled()) { | ||
344 | eeconfig_init(); | ||
345 | } | ||
346 | |||
347 | switch (id) { | ||
348 | case KC_SAMPLEMACRO: | ||
349 | if (record->event.pressed){ | ||
350 | return MACRO (I(10), T(H), T(E), T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END); | ||
351 | } | ||
352 | |||
353 | } | ||
354 | |||
355 | return MACRO_NONE; | ||
356 | } | ||
diff --git a/keyboards/lets_split/keymaps/OLED_sample/readme.md b/keyboards/lets_split/keymaps/OLED_sample/readme.md new file mode 100644 index 000000000..02888855b --- /dev/null +++ b/keyboards/lets_split/keymaps/OLED_sample/readme.md | |||
@@ -0,0 +1,25 @@ | |||
1 | SSD1306 OLED Display via I2C | ||
2 | ====== | ||
3 | |||
4 | Features | ||
5 | -------- | ||
6 | |||
7 | Some features supported by the firmware: | ||
8 | |||
9 | |||
10 | * I2C connection between the two halves is required as the OLED display will use this connection as well. Note this | ||
11 | requires pull-up resistors on the data and clock lines. | ||
12 | * OLED display will connect from either side | ||
13 | |||
14 | |||
15 | Wiring | ||
16 | ------ | ||
17 | |||
18 | |||
19 | Work in progress... | ||
20 | |||
21 | |||
22 | OLED Configuration | ||
23 | ------------------------------- | ||
24 | |||
25 | Work in progress... | ||
diff --git a/keyboards/lets_split/keymaps/hexwire/Makefile b/keyboards/lets_split/keymaps/hexwire/Makefile index 1e3cebb14..1e5761278 100644 --- a/keyboards/lets_split/keymaps/hexwire/Makefile +++ b/keyboards/lets_split/keymaps/hexwire/Makefile | |||
@@ -1 +1,5 @@ | |||
1 | RGBLIGHT_ENABLE = yes | 1 | RGBLIGHT_ENABLE = yes |
2 | |||
3 | ifndef QUANTUM_DIR | ||
4 | include ../../../../Makefile | ||
5 | endif | ||
diff --git a/keyboards/lets_split/keymaps/hexwire/compact_keymap.h b/keyboards/lets_split/keymaps/hexwire/compact_keymap.h deleted file mode 100644 index d9d063fbf..000000000 --- a/keyboards/lets_split/keymaps/hexwire/compact_keymap.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #ifndef COMPACT_KEYMAP_H | ||
2 | #define COMPACT_KEYMAP_H | ||
3 | |||
4 | #define COMPACT_KEYMAP( \ | ||
5 | k00, k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, k40, \ | ||
6 | k10, k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, k50, \ | ||
7 | k20, k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, k60, \ | ||
8 | k30, k31, k32, k33, k34, k35, k75, k74, k73, k72, k71, k70 \ | ||
9 | ) \ | ||
10 | { \ | ||
11 | { KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05 }, \ | ||
12 | { KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15 }, \ | ||
13 | { KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25 }, \ | ||
14 | { KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35 }, \ | ||
15 | { KC_##k40, KC_##k41, KC_##k42, KC_##k43, KC_##k44, KC_##k45 }, \ | ||
16 | { KC_##k50, KC_##k51, KC_##k52, KC_##k53, KC_##k54, KC_##k55 }, \ | ||
17 | { KC_##k60, KC_##k61, KC_##k62, KC_##k63, KC_##k64, KC_##k65 }, \ | ||
18 | { KC_##k70, KC_##k71, KC_##k72, KC_##k73, KC_##k74, KC_##k75 } \ | ||
19 | } | ||
20 | |||
21 | #define KC_ KC_TRNS | ||
22 | |||
23 | #endif \ No newline at end of file | ||
diff --git a/keyboards/lets_split/keymaps/hexwire/config.h b/keyboards/lets_split/keymaps/hexwire/config.h index 983f8e352..9c8c6d7f4 100644 --- a/keyboards/lets_split/keymaps/hexwire/config.h +++ b/keyboards/lets_split/keymaps/hexwire/config.h | |||
@@ -18,10 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
18 | 18 | ||
19 | #define USE_SERIAL | 19 | #define USE_SERIAL |
20 | 20 | ||
21 | #define EE_HANDS | 21 | #define TAPPING_TERM 150 |
22 | 22 | ||
23 | #undef RGBLED_NUM | 23 | #undef RGBLED_NUM |
24 | #define RGB_DI_PIN B0 | ||
25 | #define RGBLIGHT_ANIMATIONS | 24 | #define RGBLIGHT_ANIMATIONS |
26 | #define RGBLED_NUM 8 | 25 | #define RGBLED_NUM 8 |
27 | #define RGBLIGHT_HUE_STEP 8 | 26 | #define RGBLIGHT_HUE_STEP 8 |
@@ -30,9 +29,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
30 | 29 | ||
31 | #ifdef SUBPROJECT_rev1 | 30 | #ifdef SUBPROJECT_rev1 |
32 | #include "../../rev1/config.h" | 31 | #include "../../rev1/config.h" |
32 | #define COMPACT_KEYMAP( \ | ||
33 | k00, k01, k02, k03, k04, k05, k40, k41, k42, k43, k44, k45, \ | ||
34 | k10, k11, k12, k13, k14, k15, k50, k51, k52, k53, k54, k55, \ | ||
35 | k20, k21, k22, k23, k24, k25, k60, k61, k62, k63, k64, k65, \ | ||
36 | k30, k31, k32, k33, k34, k35, k70, k71, k72, k73, k74, k75 \ | ||
37 | ) \ | ||
38 | { \ | ||
39 | { KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05 }, \ | ||
40 | { KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15 }, \ | ||
41 | { KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25 }, \ | ||
42 | { KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35 }, \ | ||
43 | { KC_##k40, KC_##k41, KC_##k42, KC_##k43, KC_##k44, KC_##k45 }, \ | ||
44 | { KC_##k50, KC_##k51, KC_##k52, KC_##k53, KC_##k54, KC_##k55 }, \ | ||
45 | { KC_##k60, KC_##k61, KC_##k62, KC_##k63, KC_##k64, KC_##k65 }, \ | ||
46 | { KC_##k70, KC_##k71, KC_##k72, KC_##k73, KC_##k74, KC_##k75 } \ | ||
47 | } | ||
33 | #endif | 48 | #endif |
34 | #ifdef SUBPROJECT_rev2 | 49 | #ifdef SUBPROJECT_rev2 |
35 | #include "../../rev2/config.h" | 50 | #include "../../rev2/config.h" |
51 | #define COMPACT_KEYMAP( \ | ||
52 | k00, k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, k40, \ | ||
53 | k10, k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, k50, \ | ||
54 | k20, k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, k60, \ | ||
55 | k30, k31, k32, k33, k34, k35, k75, k74, k73, k72, k71, k70 \ | ||
56 | ) \ | ||
57 | { \ | ||
58 | { KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05 }, \ | ||
59 | { KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15 }, \ | ||
60 | { KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25 }, \ | ||
61 | { KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35 }, \ | ||
62 | { KC_##k40, KC_##k41, KC_##k42, KC_##k43, KC_##k44, KC_##k45 }, \ | ||
63 | { KC_##k50, KC_##k51, KC_##k52, KC_##k53, KC_##k54, KC_##k55 }, \ | ||
64 | { KC_##k60, KC_##k61, KC_##k62, KC_##k63, KC_##k64, KC_##k65 }, \ | ||
65 | { KC_##k70, KC_##k71, KC_##k72, KC_##k73, KC_##k74, KC_##k75 } \ | ||
66 | } | ||
36 | #endif | 67 | #endif |
37 | #ifdef SUBPROJECT_rev2fliphalf | 68 | #ifdef SUBPROJECT_rev2fliphalf |
38 | #include "../../rev2fliphalf/config.h" | 69 | #include "../../rev2fliphalf/config.h" |
diff --git a/keyboards/lets_split/keymaps/hexwire/keymap.c b/keyboards/lets_split/keymaps/hexwire/keymap.c index 796a1fcab..f8370490d 100644 --- a/keyboards/lets_split/keymaps/hexwire/keymap.c +++ b/keyboards/lets_split/keymaps/hexwire/keymap.c | |||
@@ -1,7 +1,6 @@ | |||
1 | #include "lets_split.h" | 1 | #include "lets_split.h" |
2 | #include "action_layer.h" | 2 | #include "action_layer.h" |
3 | #include "eeconfig.h" | 3 | #include "eeconfig.h" |
4 | #include "compact_keymap.h" | ||
5 | 4 | ||
6 | extern keymap_config_t keymap_config; | 5 | extern keymap_config_t keymap_config; |
7 | 6 | ||
@@ -25,6 +24,7 @@ enum custom_keycodes { | |||
25 | ADJUST, | 24 | ADJUST, |
26 | }; | 25 | }; |
27 | 26 | ||
27 | #define KC_ KC_TRNS | ||
28 | #define _______ KC_TRNS | 28 | #define _______ KC_TRNS |
29 | 29 | ||
30 | #define KC_CAPW LGUI(LSFT(KC_3)) // Capture whole screen | 30 | #define KC_CAPW LGUI(LSFT(KC_3)) // Capture whole screen |
diff --git a/keyboards/lets_split/matrix.c b/keyboards/lets_split/matrix.c index 138969004..81dfb1445 100644 --- a/keyboards/lets_split/matrix.c +++ b/keyboards/lets_split/matrix.c | |||
@@ -226,9 +226,7 @@ uint8_t matrix_scan(void) | |||
226 | TXLED0; | 226 | TXLED0; |
227 | error_count = 0; | 227 | error_count = 0; |
228 | } | 228 | } |
229 | |||
230 | matrix_scan_quantum(); | 229 | matrix_scan_quantum(); |
231 | |||
232 | return ret; | 230 | return ret; |
233 | } | 231 | } |
234 | 232 | ||
diff --git a/keyboards/lets_split/rev1/config.h b/keyboards/lets_split/rev1/config.h index 2f5bde953..5fb87cf5d 100644 --- a/keyboards/lets_split/rev1/config.h +++ b/keyboards/lets_split/rev1/config.h | |||
@@ -63,6 +63,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
63 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | 63 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ |
64 | ) | 64 | ) |
65 | 65 | ||
66 | /* ws2812 RGB LED */ | ||
67 | #define RGB_DI_PIN D3 | ||
68 | #define RGBLIGHT_TIMER | ||
69 | #define RGBLED_NUM 16 // Number of LEDs | ||
70 | #define ws2812_PORTREG PORTD | ||
71 | #define ws2812_DDRREG DDRD | ||
72 | |||
66 | /* | 73 | /* |
67 | * Feature disable options | 74 | * Feature disable options |
68 | * These options are also useful to firmware size reduction. | 75 | * These options are also useful to firmware size reduction. |
diff --git a/keyboards/lets_split/rev2/rev2.c b/keyboards/lets_split/rev2/rev2.c index c505d3a6e..8bfa171d0 100644 --- a/keyboards/lets_split/rev2/rev2.c +++ b/keyboards/lets_split/rev2/rev2.c | |||
@@ -5,6 +5,13 @@ | |||
5 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | 5 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); |
6 | #endif | 6 | #endif |
7 | 7 | ||
8 | #ifdef SSD1306OLED | ||
9 | void led_set_kb(uint8_t usb_led) { | ||
10 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
11 | led_set_user(usb_led); | ||
12 | } | ||
13 | #endif | ||
14 | |||
8 | void matrix_init_kb(void) { | 15 | void matrix_init_kb(void) { |
9 | 16 | ||
10 | #ifdef AUDIO_ENABLE | 17 | #ifdef AUDIO_ENABLE |
@@ -30,3 +37,4 @@ void shutdown_user(void) { | |||
30 | stop_all_notes(); | 37 | stop_all_notes(); |
31 | #endif | 38 | #endif |
32 | } | 39 | } |
40 | |||
diff --git a/keyboards/lets_split/rev2/rev2.h b/keyboards/lets_split/rev2/rev2.h index 990976de2..054731366 100644 --- a/keyboards/lets_split/rev2/rev2.h +++ b/keyboards/lets_split/rev2/rev2.h | |||
@@ -6,23 +6,66 @@ | |||
6 | //void promicro_bootloader_jmp(bool program); | 6 | //void promicro_bootloader_jmp(bool program); |
7 | #include "quantum.h" | 7 | #include "quantum.h" |
8 | 8 | ||
9 | |||
10 | #ifdef USE_I2C | ||
11 | #include <stddef.h> | ||
12 | #ifdef __AVR__ | ||
13 | #include <avr/io.h> | ||
14 | #include <avr/interrupt.h> | ||
15 | #endif | ||
16 | #ifdef SSD1306OLED | ||
17 | extern bool iota_gfx_init(void); | ||
18 | extern void iota_gfx_task(void); | ||
19 | extern bool iota_gfx_off(void); | ||
20 | extern bool iota_gfx_on(void); | ||
21 | extern void iota_gfx_flush(void); | ||
22 | extern void iota_gfx_write_char(uint8_t c); | ||
23 | extern void iota_gfx_write(const char *data); | ||
24 | extern void iota_gfx_write_P(const char *data); | ||
25 | extern void iota_gfx_clear_screen(void); | ||
26 | #endif | ||
27 | #endif | ||
28 | |||
9 | //void promicro_bootloader_jmp(bool program); | 29 | //void promicro_bootloader_jmp(bool program); |
10 | 30 | ||
31 | #ifndef FLIP_HALF | ||
32 | //Standard Keymap | ||
11 | #define KEYMAP( \ | 33 | #define KEYMAP( \ |
12 | k00, k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, k40, \ | 34 | k40, k41, k42, k43, k44, k45, k05, k04, k03, k02, k01, k00, \ |
13 | k10, k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, k50, \ | 35 | k50, k51, k52, k53, k54, k55, k15, k14, k13, k12, k11, k10, \ |
14 | k20, k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, k60, \ | 36 | k60, k61, k62, k63, k64, k65, k25, k24, k23, k22, k21, k20, \ |
15 | k30, k31, k32, k33, k34, k35, k75, k74, k73, k72, k71, k70 \ | 37 | k70, k71, k72, k73, k74, k75, k35, k34, k33, k32, k31, k30 \ |
38 | ) \ | ||
39 | { \ | ||
40 | { k45, k44, k43, k42, k41, k40 }, \ | ||
41 | { k55, k54, k53, k52, k51, k50 }, \ | ||
42 | { k65, k64, k63, k62, k61, k60 }, \ | ||
43 | { k75, k74, k73, k72, k71, k70 }, \ | ||
44 | { k00, k01, k02, k03, k04, k05 }, \ | ||
45 | { k10, k11, k12, k13, k14, k15 }, \ | ||
46 | { k20, k21, k22, k23, k24, k25 }, \ | ||
47 | { k30, k31, k32, k33, k34, k35 } \ | ||
48 | } | ||
49 | |||
50 | #else | ||
51 | // Keymap with one side flipped | ||
52 | #define KEYMAP( \ | ||
53 | k00, k01, k02, k03, k04, k05, k40, k41, k42, k43, k44, k45, \ | ||
54 | k10, k11, k12, k13, k14, k15, k50, k51, k52, k53, k54, k55, \ | ||
55 | k20, k21, k22, k23, k24, k25, k60, k61, k62, k63, k64, k65, \ | ||
56 | k30, k31, k32, k33, k34, k35, k70, k71, k72, k73, k74, k75 \ | ||
16 | ) \ | 57 | ) \ |
17 | { \ | 58 | { \ |
18 | { k00, k01, k02, k03, k04, k05 }, \ | 59 | { k00, k01, k02, k03, k04, k05 }, \ |
19 | { k10, k11, k12, k13, k14, k15 }, \ | 60 | { k10, k11, k12, k13, k14, k15 }, \ |
20 | { k20, k21, k22, k23, k24, k25 }, \ | 61 | { k20, k21, k22, k23, k24, k25 }, \ |
21 | { k30, k31, k32, k33, k34, k35 }, \ | 62 | { k30, k31, k32, k33, k34, k35 }, \ |
22 | { k40, k41, k42, k43, k44, k45 }, \ | 63 | { k45, k44, k43, k42, k41, k40 }, \ |
23 | { k50, k51, k52, k53, k54, k55 }, \ | 64 | { k55, k54, k53, k52, k51, k50 }, \ |
24 | { k60, k61, k62, k63, k64, k65 }, \ | 65 | { k65, k64, k63, k62, k61, k60 }, \ |
25 | { k70, k71, k72, k73, k74, k75 } \ | 66 | { k75, k74, k73, k72, k71, k70 } \ |
26 | } | 67 | } |
68 | #endif | ||
69 | |||
27 | 70 | ||
28 | #endif \ No newline at end of file | 71 | #endif \ No newline at end of file |
diff --git a/keyboards/lets_split/rev2fliphalf/rev2fliphalf.c b/keyboards/lets_split/rev2fliphalf/rev2fliphalf.c deleted file mode 100644 index c505d3a6e..000000000 --- a/keyboards/lets_split/rev2fliphalf/rev2fliphalf.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #include "lets_split.h" | ||
2 | |||
3 | #ifdef AUDIO_ENABLE | ||
4 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
5 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
6 | #endif | ||
7 | |||
8 | void matrix_init_kb(void) { | ||
9 | |||
10 | #ifdef AUDIO_ENABLE | ||
11 | _delay_ms(20); // gets rid of tick | ||
12 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
13 | #endif | ||
14 | |||
15 | // // green led on | ||
16 | // DDRD |= (1<<5); | ||
17 | // PORTD &= ~(1<<5); | ||
18 | |||
19 | // // orange led on | ||
20 | // DDRB |= (1<<0); | ||
21 | // PORTB &= ~(1<<0); | ||
22 | |||
23 | matrix_init_user(); | ||
24 | }; | ||
25 | |||
26 | void shutdown_user(void) { | ||
27 | #ifdef AUDIO_ENABLE | ||
28 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
29 | _delay_ms(150); | ||
30 | stop_all_notes(); | ||
31 | #endif | ||
32 | } | ||
diff --git a/keyboards/lets_split/rev2fliphalf/rev2fliphalf.h b/keyboards/lets_split/rev2fliphalf/rev2fliphalf.h deleted file mode 100644 index 7dc8e5ba8..000000000 --- a/keyboards/lets_split/rev2fliphalf/rev2fliphalf.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | #ifndef REV2FLIPHALF_H | ||
2 | #define REV2FLIPHALF_H | ||
3 | |||
4 | #include "../lets_split.h" | ||
5 | |||
6 | //void promicro_bootloader_jmp(bool program); | ||
7 | #include "quantum.h" | ||
8 | |||
9 | //void promicro_bootloader_jmp(bool program); | ||
10 | |||
11 | #define KEYMAP( \ | ||
12 | k00, k01, k02, k03, k04, k05, k40, k41, k42, k43, k44, k45, \ | ||
13 | k10, k11, k12, k13, k14, k15, k50, k51, k52, k53, k54, k55, \ | ||
14 | k20, k21, k22, k23, k24, k25, k60, k61, k62, k63, k64, k65, \ | ||
15 | k30, k31, k32, k33, k34, k35, k70, k71, k72, k73, k74, k75 \ | ||
16 | ) \ | ||
17 | { \ | ||
18 | { k00, k01, k02, k03, k04, k05 }, \ | ||
19 | { k10, k11, k12, k13, k14, k15 }, \ | ||
20 | { k20, k21, k22, k23, k24, k25 }, \ | ||
21 | { k30, k31, k32, k33, k34, k35 }, \ | ||
22 | { k40, k41, k42, k43, k44, k45 }, \ | ||
23 | { k50, k51, k52, k53, k54, k55 }, \ | ||
24 | { k60, k61, k62, k63, k64, k65 }, \ | ||
25 | { k70, k71, k72, k73, k74, k75 } \ | ||
26 | } | ||
27 | |||
28 | #endif \ No newline at end of file | ||
diff --git a/keyboards/lets_split/rev2fliphalf/rules.mk b/keyboards/lets_split/rev2fliphalf/rules.mk deleted file mode 100644 index 80a942d06..000000000 --- a/keyboards/lets_split/rev2fliphalf/rules.mk +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BACKLIGHT_ENABLE = no | ||
2 | |||
3 | ifndef QUANTUM_DIR | ||
4 | include ../../../Makefile | ||
5 | endif | ||
diff --git a/keyboards/lets_split/rules.mk b/keyboards/lets_split/rules.mk index 0efa78550..ff159e0f0 100644 --- a/keyboards/lets_split/rules.mk +++ b/keyboards/lets_split/rules.mk | |||
@@ -1,7 +1,8 @@ | |||
1 | SRC += matrix.c \ | 1 | SRC += matrix.c \ |
2 | i2c.c \ | 2 | i2c.c \ |
3 | split_util.c \ | 3 | split_util.c \ |
4 | serial.c | 4 | serial.c\ |
5 | ssd1306.c | ||
5 | 6 | ||
6 | # MCU name | 7 | # MCU name |
7 | #MCU = at90usb1287 | 8 | #MCU = at90usb1287 |
@@ -73,15 +74,3 @@ USE_I2C ?= yes | |||
73 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | 74 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend |
74 | 75 | ||
75 | CUSTOM_MATRIX = yes | 76 | CUSTOM_MATRIX = yes |
76 | |||
77 | avrdude: build | ||
78 | ls /dev/tty* > /tmp/1; \ | ||
79 | echo "Reset your Pro Micro now"; \ | ||
80 | while [[ -z $$USB ]]; do \ | ||
81 | sleep 1; \ | ||
82 | ls /dev/tty* > /tmp/2; \ | ||
83 | USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ | ||
84 | done; \ | ||
85 | avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex | ||
86 | |||
87 | .PHONY: avrdude | ||
diff --git a/keyboards/lets_split/split_util.c b/keyboards/lets_split/split_util.c index 226dc1881..46586fbc0 100644 --- a/keyboards/lets_split/split_util.c +++ b/keyboards/lets_split/split_util.c | |||
@@ -21,7 +21,7 @@ static void setup_handedness(void) { | |||
21 | #ifdef EE_HANDS | 21 | #ifdef EE_HANDS |
22 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); | 22 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); |
23 | #else | 23 | #else |
24 | // I2C_MASTER_RIGHT is deprecated use MASTER_RIGHT instead since this works for both serial and i2c | 24 | // I2c_MASTER_RIGHT ish deprecate use MASTER_RIGHT instead since this works for both serial and i2c: |
25 | #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) | 25 | #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) |
26 | isLeftHand = !has_usb(); | 26 | isLeftHand = !has_usb(); |
27 | #else | 27 | #else |
@@ -33,6 +33,9 @@ static void setup_handedness(void) { | |||
33 | static void keyboard_master_setup(void) { | 33 | static void keyboard_master_setup(void) { |
34 | #ifdef USE_I2C | 34 | #ifdef USE_I2C |
35 | i2c_master_init(); | 35 | i2c_master_init(); |
36 | #ifdef SSD1306OLED | ||
37 | matrix_master_OLED_init (); | ||
38 | #endif | ||
36 | #else | 39 | #else |
37 | serial_master_init(); | 40 | serial_master_init(); |
38 | #endif | 41 | #endif |
diff --git a/keyboards/lets_split/split_util.h b/keyboards/lets_split/split_util.h index 6b896679c..3ae76c209 100644 --- a/keyboards/lets_split/split_util.h +++ b/keyboards/lets_split/split_util.h | |||
@@ -19,4 +19,6 @@ void split_keyboard_setup(void); | |||
19 | bool has_usb(void); | 19 | bool has_usb(void); |
20 | void keyboard_slave_loop(void); | 20 | void keyboard_slave_loop(void); |
21 | 21 | ||
22 | void matrix_master_OLED_init (void); | ||
23 | |||
22 | #endif | 24 | #endif |
diff --git a/keyboards/lets_split/ssd1306.c b/keyboards/lets_split/ssd1306.c new file mode 100644 index 000000000..3c7816bb3 --- /dev/null +++ b/keyboards/lets_split/ssd1306.c | |||
@@ -0,0 +1,468 @@ | |||
1 | #include "config.h" | ||
2 | #include "i2c.h" | ||
3 | #include <stdbool.h> | ||
4 | #include <string.h> | ||
5 | #include <stdio.h> | ||
6 | #include "print.h" | ||
7 | #include "lets_split.h" | ||
8 | #include "common/glcdfont.c" | ||
9 | #ifdef ADAFRUIT_BLE_ENABLE | ||
10 | #include "adafruit_ble.h" | ||
11 | #endif | ||
12 | #ifdef PROTOCOL_LUFA | ||
13 | #include "lufa.h" | ||
14 | #endif | ||
15 | #include "sendchar.h" | ||
16 | #include "pincontrol.h" | ||
17 | |||
18 | //assign the right code to your layers | ||
19 | #define _BASE 0 | ||
20 | #define _LOWER 8 | ||
21 | #define _RAISE 16 | ||
22 | #define _FNLAYER 64 | ||
23 | #define _NUMLAY 128 | ||
24 | #define _NLOWER 136 | ||
25 | #define _NFNLAYER 192 | ||
26 | #define _MOUSECURSOR 256 | ||
27 | #define _ADJUST 65560 | ||
28 | |||
29 | // Set this to 1 to help diagnose early startup problems | ||
30 | // when testing power-on with ble. Turn it off otherwise, | ||
31 | // as the latency of printing most of the debug info messes | ||
32 | // with the matrix scan, causing keys to drop. | ||
33 | #define DEBUG_TO_SCREEN 0 | ||
34 | |||
35 | // Controls the SSD1306 128x32 OLED display via i2c | ||
36 | |||
37 | #define i2cAddress 0x3C | ||
38 | |||
39 | #define DisplayHeight 32 | ||
40 | #define DisplayWidth 128 | ||
41 | |||
42 | #define FontHeight 8 | ||
43 | #define FontWidth 6 | ||
44 | |||
45 | #define MatrixRows (DisplayHeight / FontHeight) | ||
46 | #define MatrixCols (DisplayWidth / FontWidth) | ||
47 | |||
48 | struct CharacterMatrix { | ||
49 | uint8_t display[MatrixRows][MatrixCols]; | ||
50 | uint8_t *cursor; | ||
51 | bool dirty; | ||
52 | }; | ||
53 | |||
54 | static struct CharacterMatrix display; | ||
55 | //static uint16_t last_battery_update; | ||
56 | //static uint32_t vbat; | ||
57 | //#define BatteryUpdateInterval 10000 /* milliseconds */ | ||
58 | #define ScreenOffInterval 300000 /* milliseconds */ | ||
59 | #if DEBUG_TO_SCREEN | ||
60 | static uint8_t displaying; | ||
61 | #endif | ||
62 | static uint16_t last_flush; | ||
63 | |||
64 | enum ssd1306_cmds { | ||
65 | DisplayOff = 0xAE, | ||
66 | DisplayOn = 0xAF, | ||
67 | |||
68 | SetContrast = 0x81, | ||
69 | DisplayAllOnResume = 0xA4, | ||
70 | |||
71 | DisplayAllOn = 0xA5, | ||
72 | NormalDisplay = 0xA6, | ||
73 | InvertDisplay = 0xA7, | ||
74 | SetDisplayOffset = 0xD3, | ||
75 | SetComPins = 0xda, | ||
76 | SetVComDetect = 0xdb, | ||
77 | SetDisplayClockDiv = 0xD5, | ||
78 | SetPreCharge = 0xd9, | ||
79 | SetMultiPlex = 0xa8, | ||
80 | SetLowColumn = 0x00, | ||
81 | SetHighColumn = 0x10, | ||
82 | SetStartLine = 0x40, | ||
83 | |||
84 | SetMemoryMode = 0x20, | ||
85 | ColumnAddr = 0x21, | ||
86 | PageAddr = 0x22, | ||
87 | |||
88 | ComScanInc = 0xc0, | ||
89 | ComScanDec = 0xc8, | ||
90 | SegRemap = 0xa0, | ||
91 | SetChargePump = 0x8d, | ||
92 | ExternalVcc = 0x01, | ||
93 | SwitchCapVcc = 0x02, | ||
94 | |||
95 | ActivateScroll = 0x2f, | ||
96 | DeActivateScroll = 0x2e, | ||
97 | SetVerticalScrollArea = 0xa3, | ||
98 | RightHorizontalScroll = 0x26, | ||
99 | LeftHorizontalScroll = 0x27, | ||
100 | VerticalAndRightHorizontalScroll = 0x29, | ||
101 | VerticalAndLeftHorizontalScroll = 0x2a, | ||
102 | }; | ||
103 | |||
104 | |||
105 | // Write command sequence. | ||
106 | // Returns true on success. | ||
107 | static inline bool _send_cmd1(uint8_t cmd) { | ||
108 | bool res = false; | ||
109 | |||
110 | if (i2c_start_write(i2cAddress)) { | ||
111 | xprintf("failed to start write to %d\n", i2cAddress); | ||
112 | goto done; | ||
113 | } | ||
114 | |||
115 | if (i2c_master_write(0x0 /* command byte follows */)) { | ||
116 | print("failed to write control byte\n"); | ||
117 | |||
118 | goto done; | ||
119 | } | ||
120 | |||
121 | if (i2c_master_write(cmd)) { | ||
122 | xprintf("failed to write command %d\n", cmd); | ||
123 | goto done; | ||
124 | } | ||
125 | res = true; | ||
126 | done: | ||
127 | i2c_master_stop(); | ||
128 | return res; | ||
129 | } | ||
130 | |||
131 | // Write 2-byte command sequence. | ||
132 | // Returns true on success | ||
133 | static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { | ||
134 | if (!_send_cmd1(cmd)) { | ||
135 | return false; | ||
136 | } | ||
137 | return _send_cmd1(opr); | ||
138 | } | ||
139 | |||
140 | // Write 3-byte command sequence. | ||
141 | // Returns true on success | ||
142 | static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { | ||
143 | if (!_send_cmd1(cmd)) { | ||
144 | return false; | ||
145 | } | ||
146 | if (!_send_cmd1(opr1)) { | ||
147 | return false; | ||
148 | } | ||
149 | return _send_cmd1(opr2); | ||
150 | } | ||
151 | |||
152 | #define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} | ||
153 | #define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} | ||
154 | #define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} | ||
155 | |||
156 | static void matrix_clear(struct CharacterMatrix *matrix); | ||
157 | |||
158 | static void clear_display(void) { | ||
159 | matrix_clear(&display); | ||
160 | |||
161 | // Clear all of the display bits (there can be random noise | ||
162 | // in the RAM on startup) | ||
163 | send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); | ||
164 | send_cmd3(ColumnAddr, 0, DisplayWidth - 1); | ||
165 | |||
166 | if (i2c_start_write(i2cAddress)) { | ||
167 | goto done; | ||
168 | } | ||
169 | if (i2c_master_write(0x40)) { | ||
170 | // Data mode | ||
171 | goto done; | ||
172 | } | ||
173 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
174 | for (uint8_t col = 0; col < DisplayWidth; ++col) { | ||
175 | i2c_master_write(0); | ||
176 | } | ||
177 | } | ||
178 | |||
179 | display.dirty = false; | ||
180 | |||
181 | done: | ||
182 | i2c_master_stop(); | ||
183 | } | ||
184 | |||
185 | #if DEBUG_TO_SCREEN | ||
186 | #undef sendchar | ||
187 | static int8_t capture_sendchar(uint8_t c) { | ||
188 | sendchar(c); | ||
189 | iota_gfx_write_char(c); | ||
190 | |||
191 | if (!displaying) { | ||
192 | iota_gfx_flush(); | ||
193 | } | ||
194 | return 0; | ||
195 | } | ||
196 | #endif | ||
197 | |||
198 | bool iota_gfx_init(void) { | ||
199 | bool success = false; | ||
200 | |||
201 | send_cmd1(DisplayOff); | ||
202 | send_cmd2(SetDisplayClockDiv, 0x80); | ||
203 | send_cmd2(SetMultiPlex, DisplayHeight - 1); | ||
204 | |||
205 | send_cmd2(SetDisplayOffset, 0); | ||
206 | |||
207 | |||
208 | send_cmd1(SetStartLine | 0x0); | ||
209 | send_cmd2(SetChargePump, 0x14 /* Enable */); | ||
210 | send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); | ||
211 | |||
212 | /// Flips the display orientation 0 degrees | ||
213 | send_cmd1(SegRemap | 0x1); | ||
214 | send_cmd1(ComScanDec); | ||
215 | /* | ||
216 | // the following Flip the display orientation 180 degrees | ||
217 | send_cmd1(SegRemap); | ||
218 | send_cmd1(ComScanInc); | ||
219 | // end flip */ | ||
220 | send_cmd2(SetComPins, 0x2); | ||
221 | send_cmd2(SetContrast, 0x8f); | ||
222 | send_cmd2(SetPreCharge, 0xf1); | ||
223 | send_cmd2(SetVComDetect, 0x40); | ||
224 | send_cmd1(DisplayAllOnResume); | ||
225 | send_cmd1(NormalDisplay); | ||
226 | send_cmd1(DeActivateScroll); | ||
227 | send_cmd1(DisplayOn); | ||
228 | |||
229 | send_cmd2(SetContrast, 0); // Dim | ||
230 | |||
231 | clear_display(); | ||
232 | |||
233 | success = true; | ||
234 | |||
235 | iota_gfx_flush(); | ||
236 | |||
237 | #if DEBUG_TO_SCREEN | ||
238 | print_set_sendchar(capture_sendchar); | ||
239 | #endif | ||
240 | |||
241 | done: | ||
242 | return success; | ||
243 | } | ||
244 | |||
245 | bool iota_gfx_off(void) { | ||
246 | bool success = false; | ||
247 | |||
248 | send_cmd1(DisplayOff); | ||
249 | success = true; | ||
250 | |||
251 | done: | ||
252 | return success; | ||
253 | } | ||
254 | |||
255 | bool iota_gfx_on(void) { | ||
256 | bool success = false; | ||
257 | |||
258 | send_cmd1(DisplayOn); | ||
259 | success = true; | ||
260 | |||
261 | done: | ||
262 | return success; | ||
263 | } | ||
264 | |||
265 | static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { | ||
266 | *matrix->cursor = c; | ||
267 | ++matrix->cursor; | ||
268 | |||
269 | if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { | ||
270 | // We went off the end; scroll the display upwards by one line | ||
271 | memmove(&matrix->display[0], &matrix->display[1], | ||
272 | MatrixCols * (MatrixRows - 1)); | ||
273 | matrix->cursor = &matrix->display[MatrixRows - 1][0]; | ||
274 | memset(matrix->cursor, ' ', MatrixCols); | ||
275 | } | ||
276 | } | ||
277 | |||
278 | static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { | ||
279 | matrix->dirty = true; | ||
280 | |||
281 | if (c == '\n') { | ||
282 | // Clear to end of line from the cursor and then move to the | ||
283 | // start of the next line | ||
284 | uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; | ||
285 | |||
286 | while (cursor_col++ < MatrixCols) { | ||
287 | matrix_write_char_inner(matrix, ' '); | ||
288 | } | ||
289 | return; | ||
290 | } | ||
291 | |||
292 | matrix_write_char_inner(matrix, c); | ||
293 | } | ||
294 | |||
295 | void iota_gfx_write_char(uint8_t c) { | ||
296 | matrix_write_char(&display, c); | ||
297 | } | ||
298 | |||
299 | static void matrix_write(struct CharacterMatrix *matrix, const char *data) { | ||
300 | const char *end = data + strlen(data); | ||
301 | while (data < end) { | ||
302 | matrix_write_char(matrix, *data); | ||
303 | ++data; | ||
304 | } | ||
305 | } | ||
306 | |||
307 | void iota_gfx_write(const char *data) { | ||
308 | matrix_write(&display, data); | ||
309 | } | ||
310 | |||
311 | static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { | ||
312 | while (true) { | ||
313 | uint8_t c = pgm_read_byte(data); | ||
314 | if (c == 0) { | ||
315 | return; | ||
316 | } | ||
317 | matrix_write_char(matrix, c); | ||
318 | ++data; | ||
319 | } | ||
320 | } | ||
321 | |||
322 | void iota_gfx_write_P(const char *data) { | ||
323 | matrix_write_P(&display, data); | ||
324 | } | ||
325 | |||
326 | static void matrix_clear(struct CharacterMatrix *matrix) { | ||
327 | memset(matrix->display, ' ', sizeof(matrix->display)); | ||
328 | matrix->cursor = &matrix->display[0][0]; | ||
329 | matrix->dirty = true; | ||
330 | } | ||
331 | |||
332 | void iota_gfx_clear_screen(void) { | ||
333 | matrix_clear(&display); | ||
334 | } | ||
335 | |||
336 | static void matrix_render(struct CharacterMatrix *matrix) { | ||
337 | last_flush = timer_read(); | ||
338 | iota_gfx_on(); | ||
339 | #if DEBUG_TO_SCREEN | ||
340 | ++displaying; | ||
341 | #endif | ||
342 | |||
343 | // Move to the home position | ||
344 | send_cmd3(PageAddr, 0, MatrixRows - 1); | ||
345 | send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); | ||
346 | |||
347 | if (i2c_start_write(i2cAddress)) { | ||
348 | goto done; | ||
349 | } | ||
350 | if (i2c_master_write(0x40)) { | ||
351 | // Data mode | ||
352 | goto done; | ||
353 | } | ||
354 | |||
355 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
356 | for (uint8_t col = 0; col < MatrixCols; ++col) { | ||
357 | const uint8_t *glyph = font + (matrix->display[row][col] * (FontWidth - 1)); | ||
358 | |||
359 | for (uint8_t glyphCol = 0; glyphCol < FontWidth - 1; ++glyphCol) { | ||
360 | uint8_t colBits = pgm_read_byte(glyph + glyphCol); | ||
361 | i2c_master_write(colBits); | ||
362 | } | ||
363 | |||
364 | // 1 column of space between chars (it's not included in the glyph) | ||
365 | i2c_master_write(0); | ||
366 | } | ||
367 | } | ||
368 | |||
369 | matrix->dirty = false; | ||
370 | |||
371 | done: | ||
372 | i2c_master_stop(); | ||
373 | #if DEBUG_TO_SCREEN | ||
374 | --displaying; | ||
375 | #endif | ||
376 | } | ||
377 | |||
378 | void iota_gfx_flush(void) { | ||
379 | matrix_render(&display); | ||
380 | } | ||
381 | |||
382 | static void matrix_update(struct CharacterMatrix *dest, | ||
383 | const struct CharacterMatrix *source) { | ||
384 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
385 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
386 | dest->dirty = true; | ||
387 | } | ||
388 | } | ||
389 | |||
390 | static void render_status_info(void) { | ||
391 | #if DEBUG_TO_SCREEN | ||
392 | if (debug_enable) { | ||
393 | return; | ||
394 | } | ||
395 | #endif | ||
396 | |||
397 | struct CharacterMatrix matrix; | ||
398 | |||
399 | matrix_clear(&matrix); | ||
400 | matrix_write_P(&matrix, PSTR("USB: ")); | ||
401 | #ifdef PROTOCOL_LUFA | ||
402 | switch (USB_DeviceState) { | ||
403 | case DEVICE_STATE_Unattached: | ||
404 | matrix_write_P(&matrix, PSTR("Unattached")); | ||
405 | break; | ||
406 | case DEVICE_STATE_Suspended: | ||
407 | matrix_write_P(&matrix, PSTR("Suspended")); | ||
408 | break; | ||
409 | case DEVICE_STATE_Configured: | ||
410 | matrix_write_P(&matrix, PSTR("Connected")); | ||
411 | break; | ||
412 | case DEVICE_STATE_Powered: | ||
413 | matrix_write_P(&matrix, PSTR("Powered")); | ||
414 | break; | ||
415 | case DEVICE_STATE_Default: | ||
416 | matrix_write_P(&matrix, PSTR("Default")); | ||
417 | break; | ||
418 | case DEVICE_STATE_Addressed: | ||
419 | matrix_write_P(&matrix, PSTR("Addressed")); | ||
420 | break; | ||
421 | default: | ||
422 | matrix_write_P(&matrix, PSTR("Invalid")); | ||
423 | } | ||
424 | #endif | ||
425 | |||
426 | // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below | ||
427 | |||
428 | char buf[40]; | ||
429 | snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); | ||
430 | matrix_write_P(&matrix, PSTR("\n\nLayer: ")); | ||
431 | switch (layer_state) { | ||
432 | case _BASE: | ||
433 | matrix_write_P(&matrix, PSTR("Default")); | ||
434 | break; | ||
435 | case _RAISE: | ||
436 | matrix_write_P(&matrix, PSTR("Raise")); | ||
437 | break; | ||
438 | case _LOWER: | ||
439 | matrix_write_P(&matrix, PSTR("Lower")); | ||
440 | break; | ||
441 | case _ADJUST: | ||
442 | matrix_write_P(&matrix, PSTR("ADJUST")); | ||
443 | break; | ||
444 | default: | ||
445 | matrix_write(&matrix, buf); | ||
446 | } | ||
447 | |||
448 | // Host Keyboard LED Status | ||
449 | char led[40]; | ||
450 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
451 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
452 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
453 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
454 | matrix_write(&matrix, led); | ||
455 | matrix_update(&display, &matrix); | ||
456 | } | ||
457 | |||
458 | void iota_gfx_task(void) { | ||
459 | render_status_info(); | ||
460 | |||
461 | if (display.dirty) { | ||
462 | iota_gfx_flush(); | ||
463 | } | ||
464 | |||
465 | if (timer_elapsed(last_flush) > ScreenOffInterval) { | ||
466 | iota_gfx_off(); | ||
467 | } | ||
468 | } | ||
diff --git a/keyboards/planck/keymaps/dbroqua/config.h b/keyboards/planck/keymaps/dbroqua/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/dbroqua/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/default/config.h b/keyboards/planck/keymaps/default/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/default/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/experimental/config.h b/keyboards/planck/keymaps/experimental/config.h index cc093bee4..492490ca1 100644 --- a/keyboards/planck/keymaps/experimental/config.h +++ b/keyboards/planck/keymaps/experimental/config.h | |||
@@ -14,4 +14,27 @@ | |||
14 | #define RGBLIGHT_HUE_STEP 10 | 14 | #define RGBLIGHT_HUE_STEP 10 |
15 | #define RGBLIGHT_SAT_STEP 17 | 15 | #define RGBLIGHT_SAT_STEP 17 |
16 | 16 | ||
17 | /* | ||
18 | * MIDI options | ||
19 | */ | ||
20 | |||
21 | /* Prevent use of disabled MIDI features in the keymap */ | ||
22 | //#define MIDI_ENABLE_STRICT 1 | ||
23 | |||
24 | /* enable basic MIDI features: | ||
25 | - MIDI notes can be sent when in Music mode is on | ||
26 | */ | ||
27 | #define MIDI_BASIC | ||
28 | |||
29 | /* enable advanced MIDI features: | ||
30 | - MIDI notes can be added to the keymap | ||
31 | - Octave shift and transpose | ||
32 | - Virtual sustain, portamento, and modulation wheel | ||
33 | - etc. | ||
34 | */ | ||
35 | //#define MIDI_ADVANCED | ||
36 | |||
37 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
38 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
39 | |||
17 | #endif | 40 | #endif |
diff --git a/keyboards/planck/keymaps/impossible/config.h b/keyboards/planck/keymaps/impossible/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/impossible/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/jeebak/config.h b/keyboards/planck/keymaps/jeebak/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/jeebak/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/jhenahan/config.h b/keyboards/planck/keymaps/jhenahan/config.h index cd3adc41c..1e42b92b9 100644 --- a/keyboards/planck/keymaps/jhenahan/config.h +++ b/keyboards/planck/keymaps/jhenahan/config.h | |||
@@ -6,4 +6,27 @@ | |||
6 | #define FORCE_NKRO | 6 | #define FORCE_NKRO |
7 | #define WORKMAN_SOUND COLEMAK_SOUND | 7 | #define WORKMAN_SOUND COLEMAK_SOUND |
8 | 8 | ||
9 | /* | ||
10 | * MIDI options | ||
11 | */ | ||
12 | |||
13 | /* Prevent use of disabled MIDI features in the keymap */ | ||
14 | //#define MIDI_ENABLE_STRICT 1 | ||
15 | |||
16 | /* enable basic MIDI features: | ||
17 | - MIDI notes can be sent when in Music mode is on | ||
18 | */ | ||
19 | #define MIDI_BASIC | ||
20 | |||
21 | /* enable advanced MIDI features: | ||
22 | - MIDI notes can be added to the keymap | ||
23 | - Octave shift and transpose | ||
24 | - Virtual sustain, portamento, and modulation wheel | ||
25 | - etc. | ||
26 | */ | ||
27 | //#define MIDI_ADVANCED | ||
28 | |||
29 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
30 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
31 | |||
9 | #endif | 32 | #endif |
diff --git a/keyboards/planck/keymaps/khord/Makefile b/keyboards/planck/keymaps/khord/Makefile new file mode 100644 index 000000000..f0ed9e8dc --- /dev/null +++ b/keyboards/planck/keymaps/khord/Makefile | |||
@@ -0,0 +1,4 @@ | |||
1 | TAP_DANCE_ENABLE = yes | ||
2 | ifndef QUANTUM_DIR | ||
3 | include ../../../../Makefile | ||
4 | endif | ||
diff --git a/keyboards/lets_split/rev2fliphalf/config.h b/keyboards/planck/keymaps/khord/config.h index 1c45cf136..008f3a5c2 100644 --- a/keyboards/lets_split/rev2fliphalf/config.h +++ b/keyboards/planck/keymaps/khord/config.h | |||
@@ -22,23 +22,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
22 | 22 | ||
23 | /* USB Device descriptor parameter */ | 23 | /* USB Device descriptor parameter */ |
24 | #define VENDOR_ID 0xFEED | 24 | #define VENDOR_ID 0xFEED |
25 | #define PRODUCT_ID 0x3060 | 25 | #define PRODUCT_ID 0x6060 |
26 | #define DEVICE_VER 0x0001 | 26 | #define MANUFACTURER Ortholinear Keyboards |
27 | #define MANUFACTURER Wootpatoot | 27 | #define PRODUCT The Planck Keyboard |
28 | #define PRODUCT Lets Split v2 | 28 | #define DESCRIPTION A compact ortholinear keyboard |
29 | #define DESCRIPTION A split keyboard for the cheap makers | ||
30 | 29 | ||
31 | /* key matrix size */ | 30 | /* key matrix size */ |
32 | // Rows are doubled-up | 31 | #define MATRIX_ROWS 4 |
33 | #define MATRIX_ROWS 8 | 32 | #define MATRIX_COLS 12 |
34 | #define MATRIX_COLS 6 | ||
35 | 33 | ||
36 | // wiring of each half | 34 | /* Planck PCB default pin-out */ |
37 | #define MATRIX_ROW_PINS { D7, E6, B4, B5 } | 35 | #define MATRIX_ROW_PINS { D0, D5, B5, B6 } |
38 | //#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 } | 36 | #define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } |
39 | #define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6 } //uncomment this line and comment line above if you need to reverse left-to-right key order | 37 | #define UNUSED_PINS |
40 | 38 | ||
41 | //#define CATERINA_BOOTLOADER | 39 | #define AUDIO_VOICES |
40 | |||
41 | #define BACKLIGHT_PIN B7 | ||
42 | 42 | ||
43 | /* COL2ROW or ROW2COL */ | 43 | /* COL2ROW or ROW2COL */ |
44 | #define DIODE_DIRECTION COL2ROW | 44 | #define DIODE_DIRECTION COL2ROW |
@@ -47,7 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
47 | //#define MATRIX_HAS_GHOST | 47 | //#define MATRIX_HAS_GHOST |
48 | 48 | ||
49 | /* number of backlight levels */ | 49 | /* number of backlight levels */ |
50 | // #define BACKLIGHT_LEVELS 3 | 50 | #define BACKLIGHT_LEVELS 3 |
51 | 51 | ||
52 | /* Set 0 if debouncing isn't needed */ | 52 | /* Set 0 if debouncing isn't needed */ |
53 | #define DEBOUNCING_DELAY 5 | 53 | #define DEBOUNCING_DELAY 5 |
@@ -62,12 +62,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
62 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | 62 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ |
63 | ) | 63 | ) |
64 | 64 | ||
65 | /* ws2812 RGB LED */ | 65 | /* Tap Dance */ |
66 | #define RGB_DI_PIN D3 | 66 | #define TAPPING_TERM 150 |
67 | #define RGBLIGHT_TIMER | ||
68 | #define RGBLED_NUM 12 // Number of LEDs | ||
69 | #define ws2812_PORTREG PORTD | ||
70 | #define ws2812_DDRREG DDRD | ||
71 | 67 | ||
72 | /* | 68 | /* |
73 | * Feature disable options | 69 | * Feature disable options |
@@ -75,10 +71,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
75 | */ | 71 | */ |
76 | 72 | ||
77 | /* disable debug print */ | 73 | /* disable debug print */ |
78 | // #define NO_DEBUG | 74 | //#define NO_DEBUG |
79 | 75 | ||
80 | /* disable print */ | 76 | /* disable print */ |
81 | // #define NO_PRINT | 77 | //#define NO_PRINT |
82 | 78 | ||
83 | /* disable action features */ | 79 | /* disable action features */ |
84 | //#define NO_ACTION_LAYER | 80 | //#define NO_ACTION_LAYER |
@@ -87,5 +83,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
87 | //#define NO_ACTION_MACRO | 83 | //#define NO_ACTION_MACRO |
88 | //#define NO_ACTION_FUNCTION | 84 | //#define NO_ACTION_FUNCTION |
89 | 85 | ||
86 | #ifdef SUBPROJECT_rev3 | ||
87 | #include "rev3/config.h" | ||
88 | #endif | ||
89 | #ifdef SUBPROJECT_rev4 | ||
90 | #include "rev4/config.h" | ||
91 | #endif | ||
90 | 92 | ||
91 | #endif \ No newline at end of file | 93 | #endif |
diff --git a/keyboards/planck/keymaps/khord/keymap.c b/keyboards/planck/keymaps/khord/keymap.c new file mode 100644 index 000000000..8001a0986 --- /dev/null +++ b/keyboards/planck/keymaps/khord/keymap.c | |||
@@ -0,0 +1,336 @@ | |||
1 | // This is the canonical layout file for the Quantum project. If you want to add another keyboard, | ||
2 | // this is the style you want to emulate. | ||
3 | |||
4 | #include "planck.h" | ||
5 | #include "action_layer.h" | ||
6 | #ifdef AUDIO_ENABLE | ||
7 | #include "audio.h" | ||
8 | #endif | ||
9 | #include "eeconfig.h" | ||
10 | |||
11 | extern keymap_config_t keymap_config; | ||
12 | |||
13 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
14 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
15 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
16 | // entirely and just use numbers. | ||
17 | #define _QWERTY 0 | ||
18 | #define _COLEMAK 1 | ||
19 | #define _DVORAK 2 | ||
20 | #define _LOWER 3 | ||
21 | #define _RAISE 4 | ||
22 | #define _PLOVER 5 | ||
23 | #define _ADJUST 16 | ||
24 | |||
25 | enum planck_keycodes { | ||
26 | QWERTY = SAFE_RANGE, | ||
27 | COLEMAK, | ||
28 | DVORAK, | ||
29 | PLOVER, | ||
30 | LOWER, | ||
31 | RAISE, | ||
32 | BACKLIT, | ||
33 | EXT_PLV | ||
34 | }; | ||
35 | |||
36 | // Fillers to make layering more clear | ||
37 | #define _______ KC_TRNS | ||
38 | #define XXXXXXX KC_NO | ||
39 | |||
40 | // Tap Dance Declarations | ||
41 | enum { | ||
42 | ESC_CAP = 0, | ||
43 | LFT_HOM, | ||
44 | DWN_PDN, | ||
45 | UPP_PUP, | ||
46 | RGT_END | ||
47 | }; | ||
48 | |||
49 | // Dylan's additions | ||
50 | #define C_A_DEL LALT(LCTL(KC_DEL)) | ||
51 | #define C_A_INS LALT(LCTL(KC_INS)) | ||
52 | |||
53 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
54 | |||
55 | /* Qwerty | ||
56 | * ,-----------------------------------------------------------------------------------. | ||
57 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
58 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
59 | * | Esc | A | S | D | F | G | H | J | K | L | ; | " | | ||
60 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
61 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
62 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
63 | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | ||
64 | * `-----------------------------------------------------------------------------------' | ||
65 | */ | ||
66 | [_QWERTY] = { | ||
67 | {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC }, | ||
68 | {TD(ESC_CAP), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT }, | ||
69 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT)}, | ||
70 | {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT } | ||
71 | }, | ||
72 | |||
73 | /* Colemak | ||
74 | * ,-----------------------------------------------------------------------------------. | ||
75 | * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | | ||
76 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
77 | * | Esc | A | R | S | T | D | H | N | E | I | O | " | | ||
78 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
79 | * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | | ||
80 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
81 | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | ||
82 | * `-----------------------------------------------------------------------------------' | ||
83 | */ | ||
84 | [_COLEMAK] = { | ||
85 | {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, | ||
86 | {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, | ||
87 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, | ||
88 | {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | ||
89 | }, | ||
90 | |||
91 | /* Dvorak | ||
92 | * ,-----------------------------------------------------------------------------------. | ||
93 | * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | | ||
94 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
95 | * | Esc | A | O | E | U | I | D | H | T | N | S | / | | ||
96 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
97 | * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | | ||
98 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
99 | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | | ||
100 | * `-----------------------------------------------------------------------------------' | ||
101 | */ | ||
102 | [_DVORAK] = { | ||
103 | {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, | ||
104 | {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, | ||
105 | {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, | ||
106 | {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} | ||
107 | }, | ||
108 | |||
109 | /* Lower | ||
110 | * ,-----------------------------------------------------------------------------------. | ||
111 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
112 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
113 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | ||
114 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
115 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | END | HOME |Enter | | ||
116 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
117 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
118 | * `-----------------------------------------------------------------------------------' | ||
119 | */ | ||
120 | [_LOWER] = { | ||
121 | {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, | ||
122 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, | ||
123 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),KC_END, KC_HOME, _______}, | ||
124 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | ||
125 | }, | ||
126 | |||
127 | /* Raise | ||
128 | * ,-----------------------------------------------------------------------------------. | ||
129 | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
130 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
131 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
132 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
133 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |PG DN |PG UP |Enter | | ||
134 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
135 | * | | | | | | | | Next | Vol- | Vol+ | Play | | ||
136 | * `-----------------------------------------------------------------------------------' | ||
137 | */ | ||
138 | [_RAISE] = { | ||
139 | {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, | ||
140 | {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, | ||
141 | {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGDN, KC_PGUP, _______}, | ||
142 | {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} | ||
143 | }, | ||
144 | |||
145 | /* Plover layer (http://opensteno.org) | ||
146 | * ,-----------------------------------------------------------------------------------. | ||
147 | * | # | # | # | # | # | # | # | # | # | # | # | # | | ||
148 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
149 | * | | S | T | P | H | * | * | F | P | L | T | D | | ||
150 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
151 | * |TogOut| S | K | W | R | * | * | R | B | G | S | Z | | ||
152 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
153 | * | Exit | | | A | O | | E | U | | | | | ||
154 | * `-----------------------------------------------------------------------------------' | ||
155 | */ | ||
156 | |||
157 | [_PLOVER] = { | ||
158 | {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 }, | ||
159 | {XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC}, | ||
160 | {XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, | ||
161 | {EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX} | ||
162 | }, | ||
163 | |||
164 | /* Adjust (Lower + Raise) | ||
165 | * ,-----------------------------------------------------------------------------------. | ||
166 | * | | Reset| | | | | | | | | | Del | | ||
167 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
168 | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | | ||
169 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
170 | * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | | ||
171 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
172 | * | | | | | | | | | | | | | ||
173 | * `-----------------------------------------------------------------------------------' | ||
174 | */ | ||
175 | [_ADJUST] = { | ||
176 | {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, | ||
177 | {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______}, | ||
178 | {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, | ||
179 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, C_A_INS, C_A_DEL} | ||
180 | } | ||
181 | |||
182 | |||
183 | }; | ||
184 | |||
185 | |||
186 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
187 | [ESC_CAP] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), | ||
188 | [LFT_HOM] = ACTION_TAP_DANCE_DOUBLE(KC_LEFT, KC_HOME), | ||
189 | [DWN_PDN] = ACTION_TAP_DANCE_DOUBLE(KC_DOWN, KC_PGDN), | ||
190 | [UPP_PUP] = ACTION_TAP_DANCE_DOUBLE(KC_UP, KC_PGUP), | ||
191 | [RGT_END] = ACTION_TAP_DANCE_DOUBLE(KC_RGHT, KC_END) | ||
192 | }; | ||
193 | |||
194 | #ifdef AUDIO_ENABLE | ||
195 | |||
196 | float tone_startup[][2] = SONG(SONIC_RING); //plug in | ||
197 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
198 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
199 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
200 | float tone_plover[][2] = SONG(PLOVER_SOUND); | ||
201 | float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); | ||
202 | float music_scale[][2] = SONG(ZELDA_PUZZLE); //music mode | ||
203 | |||
204 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
205 | #endif | ||
206 | |||
207 | |||
208 | void persistant_default_layer_set(uint16_t default_layer) { | ||
209 | eeconfig_update_default_layer(default_layer); | ||
210 | default_layer_set(default_layer); | ||
211 | } | ||
212 | |||
213 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
214 | switch (keycode) { | ||
215 | case QWERTY: | ||
216 | if (record->event.pressed) { | ||
217 | #ifdef AUDIO_ENABLE | ||
218 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
219 | #endif | ||
220 | persistant_default_layer_set(1UL<<_QWERTY); | ||
221 | } | ||
222 | return false; | ||
223 | break; | ||
224 | case COLEMAK: | ||
225 | if (record->event.pressed) { | ||
226 | #ifdef AUDIO_ENABLE | ||
227 | PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||
228 | #endif | ||
229 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
230 | } | ||
231 | return false; | ||
232 | break; | ||
233 | case DVORAK: | ||
234 | if (record->event.pressed) { | ||
235 | #ifdef AUDIO_ENABLE | ||
236 | PLAY_NOTE_ARRAY(tone_dvorak, false, 0); | ||
237 | #endif | ||
238 | persistant_default_layer_set(1UL<<_DVORAK); | ||
239 | } | ||
240 | return false; | ||
241 | break; | ||
242 | case LOWER: | ||
243 | if (record->event.pressed) { | ||
244 | layer_on(_LOWER); | ||
245 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
246 | } else { | ||
247 | layer_off(_LOWER); | ||
248 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
249 | } | ||
250 | return false; | ||
251 | break; | ||
252 | case RAISE: | ||
253 | if (record->event.pressed) { | ||
254 | layer_on(_RAISE); | ||
255 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
256 | } else { | ||
257 | layer_off(_RAISE); | ||
258 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
259 | } | ||
260 | return false; | ||
261 | break; | ||
262 | case BACKLIT: | ||
263 | if (record->event.pressed) { | ||
264 | register_code(KC_RSFT); | ||
265 | #ifdef BACKLIGHT_ENABLE | ||
266 | backlight_step(); | ||
267 | #endif | ||
268 | } else { | ||
269 | unregister_code(KC_RSFT); | ||
270 | } | ||
271 | return false; | ||
272 | break; | ||
273 | case PLOVER: | ||
274 | if (record->event.pressed) { | ||
275 | #ifdef AUDIO_ENABLE | ||
276 | stop_all_notes(); | ||
277 | PLAY_NOTE_ARRAY(tone_plover, false, 0); | ||
278 | #endif | ||
279 | layer_off(_RAISE); | ||
280 | layer_off(_LOWER); | ||
281 | layer_off(_ADJUST); | ||
282 | layer_on(_PLOVER); | ||
283 | if (!eeconfig_is_enabled()) { | ||
284 | eeconfig_init(); | ||
285 | } | ||
286 | keymap_config.raw = eeconfig_read_keymap(); | ||
287 | keymap_config.nkro = 1; | ||
288 | eeconfig_update_keymap(keymap_config.raw); | ||
289 | } | ||
290 | return false; | ||
291 | break; | ||
292 | case EXT_PLV: | ||
293 | if (record->event.pressed) { | ||
294 | #ifdef AUDIO_ENABLE | ||
295 | PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); | ||
296 | #endif | ||
297 | layer_off(_PLOVER); | ||
298 | } | ||
299 | return false; | ||
300 | break; | ||
301 | } | ||
302 | return true; | ||
303 | } | ||
304 | |||
305 | void matrix_init_user(void) { | ||
306 | #ifdef AUDIO_ENABLE | ||
307 | startup_user(); | ||
308 | #endif | ||
309 | } | ||
310 | |||
311 | #ifdef AUDIO_ENABLE | ||
312 | |||
313 | void startup_user() | ||
314 | { | ||
315 | _delay_ms(20); // gets rid of tick | ||
316 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
317 | } | ||
318 | |||
319 | void shutdown_user() | ||
320 | { | ||
321 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
322 | _delay_ms(150); | ||
323 | stop_all_notes(); | ||
324 | } | ||
325 | |||
326 | void music_on_user(void) | ||
327 | { | ||
328 | music_scale_user(); | ||
329 | } | ||
330 | |||
331 | void music_scale_user(void) | ||
332 | { | ||
333 | PLAY_NOTE_ARRAY(music_scale, false, 0); | ||
334 | } | ||
335 | |||
336 | #endif | ||
diff --git a/keyboards/planck/keymaps/premek/config.h b/keyboards/planck/keymaps/premek/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/premek/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/sgoodwin/config.h b/keyboards/planck/keymaps/sgoodwin/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/sgoodwin/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/smt/config.h b/keyboards/planck/keymaps/smt/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/smt/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/thermal_printer/config.h b/keyboards/planck/keymaps/thermal_printer/config.h index 430b6493c..bcd098930 100644 --- a/keyboards/planck/keymaps/thermal_printer/config.h +++ b/keyboards/planck/keymaps/thermal_printer/config.h | |||
@@ -20,4 +20,27 @@ | |||
20 | sei(); \ | 20 | sei(); \ |
21 | } while(0) | 21 | } while(0) |
22 | 22 | ||
23 | /* | ||
24 | * MIDI options | ||
25 | */ | ||
26 | |||
27 | /* Prevent use of disabled MIDI features in the keymap */ | ||
28 | //#define MIDI_ENABLE_STRICT 1 | ||
29 | |||
30 | /* enable basic MIDI features: | ||
31 | - MIDI notes can be sent when in Music mode is on | ||
32 | */ | ||
33 | #define MIDI_BASIC | ||
34 | |||
35 | /* enable advanced MIDI features: | ||
36 | - MIDI notes can be added to the keymap | ||
37 | - Octave shift and transpose | ||
38 | - Virtual sustain, portamento, and modulation wheel | ||
39 | - etc. | ||
40 | */ | ||
41 | //#define MIDI_ADVANCED | ||
42 | |||
43 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
44 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
45 | |||
23 | #endif \ No newline at end of file | 46 | #endif \ No newline at end of file |
diff --git a/keyboards/planck/keymaps/unicode/config.h b/keyboards/planck/keymaps/unicode/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/unicode/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/xyverz/config.h b/keyboards/planck/keymaps/xyverz/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/xyverz/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/preonic/keymaps/CMD-Preonic/config.h b/keyboards/preonic/keymaps/CMD-Preonic/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/preonic/keymaps/CMD-Preonic/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/preonic/keymaps/default/config.h b/keyboards/preonic/keymaps/default/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/preonic/keymaps/default/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/preonic/keymaps/smt/config.h b/keyboards/preonic/keymaps/smt/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/preonic/keymaps/smt/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/satan/keymaps/midi/Makefile b/keyboards/satan/keymaps/midi/Makefile new file mode 100644 index 000000000..89c34b394 --- /dev/null +++ b/keyboards/satan/keymaps/midi/Makefile | |||
@@ -0,0 +1,21 @@ | |||
1 | # Build Options | ||
2 | # change to "no" to disable the options, or define them in the Makefile in | ||
3 | # the appropriate keymap folder that will get included automatically | ||
4 | # | ||
5 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
6 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
7 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
8 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
9 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
10 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
11 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
12 | MIDI_ENABLE = yes # MIDI support (+2400 to 4200, depending on config) | ||
13 | AUDIO_ENABLE = no # Audio output on port C6 | ||
14 | UNICODE_ENABLE = no # Unicode | ||
15 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
16 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
17 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
18 | |||
19 | ifndef QUANTUM_DIR | ||
20 | include ../../../../Makefile | ||
21 | endif | ||
diff --git a/keyboards/satan/keymaps/midi/config.h b/keyboards/satan/keymaps/midi/config.h new file mode 100644 index 000000000..8e10b04ec --- /dev/null +++ b/keyboards/satan/keymaps/midi/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | #define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | #define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | #define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/satan/keymaps/midi/keymap.c b/keyboards/satan/keymaps/midi/keymap.c new file mode 100644 index 000000000..8378b4e4b --- /dev/null +++ b/keyboards/satan/keymaps/midi/keymap.c | |||
@@ -0,0 +1,77 @@ | |||
1 | #include "satan.h" | ||
2 | |||
3 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
4 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
5 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
6 | // entirely and just use numbers. | ||
7 | #define _BL 0 | ||
8 | #define _ML 1 | ||
9 | |||
10 | // readability | ||
11 | #define _______ KC_TRNS | ||
12 | #define XXXXXXX KC_NO | ||
13 | |||
14 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
15 | /* Keymap _BL: (Base Layer) Default Layer | ||
16 | * ,-----------------------------------------------------------. | ||
17 | * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | | ||
18 | * |-----------------------------------------------------------| | ||
19 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | | ||
20 | * |-----------------------------------------------------------| | ||
21 | * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | | ||
22 | * |-----------------------------------------------------------| | ||
23 | * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | ||
24 | * |-----------------------------------------------------------| | ||
25 | * |Ctrl|Gui |Alt | Space |Alt |Gui |Midi|Ctrl | | ||
26 | * `-----------------------------------------------------------' | ||
27 | */ | ||
28 | [_BL] = KEYMAP_ANSI( | ||
29 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ | ||
30 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSLS, \ | ||
31 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT, \ | ||
32 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \ | ||
33 | KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, TG(_ML), KC_RCTL), | ||
34 | |||
35 | #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) | ||
36 | /* Keymap _ML: MIDI Layer (Advanced) | ||
37 | * ,------------------------------------------------------------------------. | ||
38 | * | Exit | | | | | | | | | | | | | | | ||
39 | * |------------------------------------------------------------------------| | ||
40 | * | Ch+ | | C# | D# | | F# | G# | A# | | C# | D# | | | | | ||
41 | * |------------------------------------------------------------------------| | ||
42 | * | Mod | C | D | E | F | G | A | B | C | D | E | F | | | ||
43 | * |------------------------------------------------------------------------| | ||
44 | * | Sustain |Oct-|Oct+|Mod-|Mod+| | | |Tns-|Tns+|Tns0| Sustain | | ||
45 | * |------------------------------------------------------------------------| | ||
46 | * | | | | All notes off | | | | | | ||
47 | * `------------------------------------------------------------------------' | ||
48 | */ | ||
49 | [_ML] = KEYMAP_ANSI( | ||
50 | TG(_ML), MI_VEL_1, MI_VEL_2, MI_VEL_3, MI_VEL_4, MI_VEL_5, MI_VEL_6, MI_VEL_7, MI_VEL_8, MI_VEL_9, MI_VEL_10, XXXXXXX, XXXXXXX, XXXXXXX, \ | ||
51 | MI_CHU, XXXXXXX, MI_Cs, MI_Ds, XXXXXXX, MI_Fs, MI_Gs, MI_As, XXXXXXX, MI_Cs_1, MI_Ds_1, XXXXXXX, XXXXXXX, XXXXXXX, \ | ||
52 | MI_MOD, MI_C, MI_D, MI_E, MI_F, MI_G, MI_A, MI_B, MI_C_1, MI_D_1, MI_E_1, MI_F_1, _______, \ | ||
53 | MI_SUS, MI_OCTD, MI_OCTU, MI_MODSD, MI_MODSU, XXXXXXX, XXXXXXX, XXXXXXX, MI_TRNSD, MI_TRNSU, MI_TRNS_0, MI_SUS, \ | ||
54 | _______, _______, _______, MI_ALLOFF, _______, _______, _______, _______), | ||
55 | #elif defined(MIDI_ENABLE) && defined(MIDI_BASIC) | ||
56 | /* Keymap _ML: MIDI Layer (Advanced) | ||
57 | * ,------------------------------------------------------------------------. | ||
58 | * | Exit | | | | | | | | | | | | | | | ||
59 | * |------------------------------------------------------------------------| | ||
60 | * | | | | | | | | | | | | | | | | ||
61 | * |------------------------------------------------------------------------| | ||
62 | * | | | | | | | | | | | | | | | ||
63 | * |------------------------------------------------------------------------| | ||
64 | * | |MuOn|MuOf|MiOn|MiOf| | | | | | | | | ||
65 | * |------------------------------------------------------------------------| | ||
66 | * | | | | | | | | | | ||
67 | * `------------------------------------------------------------------------' | ||
68 | */ | ||
69 | |||
70 | [_ML] = KEYMAP_ANSI( | ||
71 | TG(_ML), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
72 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
73 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
74 | _______, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, _______, _______, \ | ||
75 | _______, _______, _______, _______, _______, _______, _______, _______), | ||
76 | #endif | ||
77 | }; \ No newline at end of file | ||
diff --git a/keyboards/satan/keymaps/midi/readme.md b/keyboards/satan/keymaps/midi/readme.md new file mode 100644 index 000000000..87844a854 --- /dev/null +++ b/keyboards/satan/keymaps/midi/readme.md | |||
@@ -0,0 +1 @@ | |||
# Satan GH60 layout demonstrating MIDI key mapping | |||
diff --git a/keyboards/satan/keymaps/smt/Makefile b/keyboards/satan/keymaps/smt/Makefile new file mode 100644 index 000000000..0c9ae824f --- /dev/null +++ b/keyboards/satan/keymaps/smt/Makefile | |||
@@ -0,0 +1,21 @@ | |||
1 | # Build Options | ||
2 | # change to "no" to disable the options, or define them in the Makefile in | ||
3 | # the appropriate keymap folder that will get included automatically | ||
4 | # | ||
5 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
6 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
7 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
8 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
9 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
10 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
11 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
12 | MIDI_ENABLE = no # MIDI controls | ||
13 | AUDIO_ENABLE = no # Audio output on port C6 | ||
14 | UNICODE_ENABLE = no # Unicode | ||
15 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
16 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
17 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
18 | |||
19 | ifndef QUANTUM_DIR | ||
20 | include ../../../../Makefile | ||
21 | endif | ||
diff --git a/keyboards/satan/keymaps/smt/keymap.c b/keyboards/satan/keymaps/smt/keymap.c new file mode 100644 index 000000000..d90849914 --- /dev/null +++ b/keyboards/satan/keymaps/smt/keymap.c | |||
@@ -0,0 +1,141 @@ | |||
1 | #include "satan.h" | ||
2 | |||
3 | |||
4 | // Used for SHIFT_ESC | ||
5 | #define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) | ||
6 | |||
7 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
8 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
9 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
10 | // entirely and just use numbers. | ||
11 | #define _QWERTY 0 | ||
12 | #define _COLEMAK 1 | ||
13 | #define _DVORAK 2 | ||
14 | #define _FUNC 3 | ||
15 | |||
16 | enum planck_keycodes { | ||
17 | QWERTY = SAFE_RANGE, | ||
18 | COLEMAK, | ||
19 | DVORAK | ||
20 | }; | ||
21 | |||
22 | #define _______ KC_TRNS | ||
23 | #define XXXXXXX KC_NO | ||
24 | |||
25 | // Custom macros | ||
26 | #define ALT_GRV ALT_T(KC_GRV) // Tap for Backtick, hold for Alt | ||
27 | #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl | ||
28 | #define HPR_TAB ALL_T(KC_TAB) // Tap for Tab, hold for Hyper (Super+Ctrl+Shift+Alt) | ||
29 | #define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift | ||
30 | |||
31 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
32 | /* Keymap _QWERTY: (Base Layer) Default Layer | ||
33 | * ,-----------------------------------------------------------. | ||
34 | * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | | ||
35 | * |-----------------------------------------------------------| | ||
36 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | | ||
37 | * |-----------------------------------------------------------| | ||
38 | * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | | ||
39 | * |-----------------------------------------------------------| | ||
40 | * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | ||
41 | * |-----------------------------------------------------------| | ||
42 | * |Ctrl|Gui |Alt | Space |Alt |Gui |Fn |Ctrl | | ||
43 | * `-----------------------------------------------------------' | ||
44 | */ | ||
45 | [_QWERTY] = KEYMAP_ANSI( | ||
46 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ | ||
47 | HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSLS, \ | ||
48 | CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT, \ | ||
49 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, SFT_ENT, \ | ||
50 | KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,MO(_FUNC),KC_RCTL), | ||
51 | |||
52 | /* Keymap _COLEMAK: (Base Layer) Default Layer | ||
53 | * ,-----------------------------------------------------------. | ||
54 | * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | | ||
55 | * |-----------------------------------------------------------| | ||
56 | * |Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \ | | ||
57 | * |-----------------------------------------------------------| | ||
58 | * |CAPS | A| R| S| T| D| H| N| E| I| O| '|Return | | ||
59 | * |-----------------------------------------------------------| | ||
60 | * |Shift | Z| X| C| V| B| K| M| ,| .| /|Shift | | ||
61 | * |-----------------------------------------------------------| | ||
62 | * |Ctrl|Gui |Alt | Space |Alt |Gui |Fn |Ctrl | | ||
63 | * `-----------------------------------------------------------' | ||
64 | */ | ||
65 | [_COLEMAK] = KEYMAP_ANSI( | ||
66 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ | ||
67 | HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN,KC_LBRC, KC_RBRC,KC_BSLS, \ | ||
68 | CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O ,KC_QUOT, KC_ENT, \ | ||
69 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM,KC_DOT, KC_SLSH, SFT_ENT, \ | ||
70 | KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,MO(_FUNC),KC_RCTL), | ||
71 | |||
72 | /* Keymap _DVORAK: (Base Layer) Default Layer | ||
73 | * ,-----------------------------------------------------------. | ||
74 | * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backsp | | ||
75 | * |-----------------------------------------------------------| | ||
76 | * |HypTb| '| ,| .| P| Y| F| G| C| R| L| /| =| \ | | ||
77 | * |-----------------------------------------------------------| | ||
78 | * |CtrlEsc| A| O| E| U| I| D| H| T| N| S| -|Return | | ||
79 | * |-----------------------------------------------------------| | ||
80 | * |Shift | ;| Q| J| K| X| B| M| W| V| Z|ShiftEnter| | ||
81 | * |-----------------------------------------------------------| | ||
82 | * |Ctrl|Gui |Alt | Space |Alt |Gui |Fn |Ctrl | | ||
83 | * `-----------------------------------------------------------' | ||
84 | */ | ||
85 | [_DVORAK] = KEYMAP_ANSI( | ||
86 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC,KC_BSPC, \ | ||
87 | HPR_TAB, KC_QUOT,KC_COMM,KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, \ | ||
88 | CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, \ | ||
89 | KC_LSFT, KC_SCLN,KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, \ | ||
90 | KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,MO(_FUNC),KC_RCTL), | ||
91 | |||
92 | /* Keymap _FUNC: Function Layer | ||
93 | * ,-----------------------------------------------------------. | ||
94 | * | | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | | ||
95 | * |-----------------------------------------------------------| | ||
96 | * | |Hom| UP|End| | | |Qwt|Cmk|Dvk| |BL-|BL+|BL | | ||
97 | * |-----------------------------------------------------------| | ||
98 | * | |LFT| DN| RT| | |LFT| DN| UP| RT|Vo+|Pg+| | | ||
99 | * |-----------------------------------------------------------| | ||
100 | * | | | |Prv|Ply|Nxt| | | |Vo-|Pg-| | | ||
101 | * |-----------------------------------------------------------| | ||
102 | * |RESET| | | | | | | | | ||
103 | * `-----------------------------------------------------------' | ||
104 | */ | ||
105 | [_FUNC] = KEYMAP_ANSI( | ||
106 | _______,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_DEL, \ | ||
107 | _______,KC_HOME,KC_UP ,KC_END ,_______,_______,_______,QWERTY ,COLEMAK,DVORAK ,_______,BL_DEC ,BL_INC ,BL_TOGG, \ | ||
108 | _______,KC_LEFT,KC_DOWN,KC_RGHT,_______,_______,KC_LEFT,KC_DOWN,KC_UP ,KC_RGHT,KC_VOLU,KC_PGUP ,_______, \ | ||
109 | _______ ,_______,_______,KC_MPRV,KC_MPLY,KC_MNXT,_______,_______,_______,KC_VOLD,KC_PGDN ,_______, \ | ||
110 | RESET ,_______,_______ ,_______ ,_______,_______,_______,_______ | ||
111 | ) | ||
112 | }; | ||
113 | |||
114 | void persistant_default_layer_set(uint16_t default_layer) { | ||
115 | eeconfig_update_default_layer(default_layer); | ||
116 | default_layer_set(default_layer); | ||
117 | } | ||
118 | |||
119 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
120 | switch (keycode) { | ||
121 | case QWERTY: | ||
122 | if (record->event.pressed) { | ||
123 | persistant_default_layer_set(1UL<<_QWERTY); | ||
124 | } | ||
125 | return false; | ||
126 | break; | ||
127 | case COLEMAK: | ||
128 | if (record->event.pressed) { | ||
129 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
130 | } | ||
131 | return false; | ||
132 | break; | ||
133 | case DVORAK: | ||
134 | if (record->event.pressed) { | ||
135 | persistant_default_layer_set(1UL<<_DVORAK); | ||
136 | } | ||
137 | return false; | ||
138 | break; | ||
139 | } | ||
140 | return true; | ||
141 | } | ||
diff --git a/keyboards/satan/keymaps/smt/readme.md b/keyboards/satan/keymaps/smt/readme.md new file mode 100644 index 000000000..7b706d601 --- /dev/null +++ b/keyboards/satan/keymaps/smt/readme.md | |||
@@ -0,0 +1 @@ | |||
# smt's Satan GH60 layout | |||
diff --git a/keyboards/subatomic/keymaps/default/config.h b/keyboards/subatomic/keymaps/default/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/subatomic/keymaps/default/config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef CONFIG_USER_H | ||
2 | #define CONFIG_USER_H | ||
3 | |||
4 | #include "../../config.h" | ||
5 | |||
6 | /* | ||
7 | * MIDI options | ||
8 | */ | ||
9 | |||
10 | /* Prevent use of disabled MIDI features in the keymap */ | ||
11 | //#define MIDI_ENABLE_STRICT 1 | ||
12 | |||
13 | /* enable basic MIDI features: | ||
14 | - MIDI notes can be sent when in Music mode is on | ||
15 | */ | ||
16 | #define MIDI_BASIC | ||
17 | |||
18 | /* enable advanced MIDI features: | ||
19 | - MIDI notes can be added to the keymap | ||
20 | - Octave shift and transpose | ||
21 | - Virtual sustain, portamento, and modulation wheel | ||
22 | - etc. | ||
23 | */ | ||
24 | //#define MIDI_ADVANCED | ||
25 | |||
26 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
27 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
28 | |||
29 | #endif \ No newline at end of file | ||
diff --git a/keyboards/tada68/keymaps/default/keymap.c b/keyboards/tada68/keymaps/default/keymap.c index da57c0343..f28116e0a 100644 --- a/keyboards/tada68/keymaps/default/keymap.c +++ b/keyboards/tada68/keymaps/default/keymap.c | |||
@@ -1,9 +1,5 @@ | |||
1 | #include "tada68.h" | 1 | #include "tada68.h" |
2 | 2 | ||
3 | |||
4 | // Used for SHIFT_ESC | ||
5 | #define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) | ||
6 | |||
7 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 3 | // Each layer gets a name for readability, which is then used in the keymap matrix below. |
8 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | 4 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. |
9 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | 5 | // Layer names don't all need to be of the same length, obviously, and you can also skip them |
@@ -36,63 +32,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
36 | 32 | ||
37 | /* Keymap _FL: Function Layer | 33 | /* Keymap _FL: Function Layer |
38 | * ,----------------------------------------------------------------. | 34 | * ,----------------------------------------------------------------. |
39 | * | | | | | | | | | | | | | | RESET| | | 35 | * | | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Del |Ins | |
40 | * |----------------------------------------------------------------| | 36 | * |----------------------------------------------------------------| |
41 | * | | | | | | | | | | | |BL-|BL+|BL | | | 37 | * | | |Up | | | | | | | | | | | |Hme | |
42 | * |----------------------------------------------------------------| | 38 | * |----------------------------------------------------------------| |
43 | * | | | | | | | | | | | | | | | 39 | * | |<- |Dn | ->| | | | | | | | | |End | |
44 | * |----------------------------------------------------------------| | 40 | * |----------------------------------------------------------------| |
45 | * | | F1|F2 | F3|F4 | F5| F6| F7| F8| | | | | | | 41 | * | | | |Bl-|BL |BL+| |VU-|VU+|MUT| |MouseL|MsU|Rck | |
46 | * |----------------------------------------------------------------| | 42 | * |----------------------------------------------------------------| |
47 | * | | | | | | | | | | | | 43 | * | | | | | | | |MsL|MsD|MsR | |
48 | * `----------------------------------------------------------------' | 44 | * `----------------------------------------------------------------' |
49 | */ | 45 | */ |
50 | [_FL] = KEYMAP_ANSI( | 46 | [_FL] = KEYMAP_ANSI( |
51 | #ifdef RGBLIGHT_ENABLE | 47 | _______, KC_F1 ,KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS , \ |
52 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,RESET,_______, \ | 48 | _______,_______,KC_UP, _______,_______,_______,_______,_______,_______,_______,_______, BL_DEC,BL_INC, BL_TOGG,KC_HOME, \ |
53 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, BL_DEC,BL_INC, BL_TOGG,_______, \ | 49 | _______,KC_LEFT,KC_DOWN,KC_RIGHT,_______,_______,_______,_______,_______,_______,_______,_______, _______,KC_END, \ |
54 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______, \ | 50 | _______,_______,_______,BL_DEC, BL_TOGG,BL_INC, _______,KC_VOLD,KC_VOLU,KC_MUTE,_______,KC_BTN1, KC_MS_U, KC_BTN2, \ |
55 | _______,RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD,_______,_______,_______,_______,_______, \ | 51 | _______,_______,_______, _______, _______,_______,_______,KC_MS_L,KC_MS_D, KC_MS_R), |
56 | _______,_______,_______, _______, _______,_______,_______,_______,_______, _______), | ||
57 | #else | ||
58 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,RESET,_______, \ | ||
59 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, BL_DEC,BL_INC, BL_TOGG,_______, \ | ||
60 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______, \ | ||
61 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ | ||
62 | _______,_______,_______, _______, _______,_______,_______,_______,_______, _______), | ||
63 | #endif | ||
64 | }; | ||
65 | |||
66 | /*enum function_id { | ||
67 | //SHIFT_ESC, | ||
68 | }; | 52 | }; |
69 | |||
70 | const uint16_t PROGMEM fn_actions[] = { | ||
71 | //[0] = ACTION_FUNCTION(SHIFT_ESC), | ||
72 | }; | ||
73 | |||
74 | void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { | ||
75 | static uint8_t shift_esc_shift_mask; | ||
76 | switch (id) { | ||
77 | case SHIFT_ESC: | ||
78 | shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; | ||
79 | if (record->event.pressed) { | ||
80 | if (shift_esc_shift_mask) { | ||
81 | add_key(KC_GRV); | ||
82 | send_keyboard_report(); | ||
83 | } else { | ||
84 | add_key(KC_ESC); | ||
85 | send_keyboard_report(); | ||
86 | } | ||
87 | } else { | ||
88 | if (shift_esc_shift_mask) { | ||
89 | del_key(KC_GRV); | ||
90 | send_keyboard_report(); | ||
91 | } else { | ||
92 | del_key(KC_ESC); | ||
93 | send_keyboard_report(); | ||
94 | } | ||
95 | } | ||
96 | break; | ||
97 | } | ||
98 | }*/ | ||
diff --git a/keyboards/tada68/keymaps/default/readme.md b/keyboards/tada68/keymaps/default/readme.md index 36760d6b9..53412d7c2 100644 --- a/keyboards/tada68/keymaps/default/readme.md +++ b/keyboards/tada68/keymaps/default/readme.md | |||
@@ -1 +1,3 @@ | |||
1 | # default TADA68 layout | 1 | # default TADA68 layout |
2 | |||
3 | This layout replicates the default factory layout of the TADA68. | ||
diff --git a/keyboards/tada68/readme.md b/keyboards/tada68/readme.md index 552fdea52..dbe2fdca1 100644 --- a/keyboards/tada68/readme.md +++ b/keyboards/tada68/readme.md | |||
@@ -1,4 +1,15 @@ | |||
1 | TADA68 keyboard firmware | 1 | TADA68 keyboard firmware |
2 | ====================== | 2 | ======================== |
3 | 3 | ||
4 | TODO: to be updated. | 4 | 1) from the keyboards/tada68 directory run: |
5 | ``` | ||
6 | $ make flashbin | ||
7 | ``` | ||
8 | |||
9 | 2) hit the reset button on the TADA, the lights will start flashing. | ||
10 | |||
11 | 3) You'll see a new drive on your computer called TADA68. Backup the original factory `FLASH.BIN` file thats inside it. | ||
12 | |||
13 | 4) Delete `FLASH.BIN` from the TADA drive and copy `tada68_default.bin` that was generated at the root of the qmk directory into the TADA drive. | ||
14 | |||
15 | 5) Hit ESC on the keyboard. The lights will stop flashing and your firmware is loaded! \ No newline at end of file | ||
diff --git a/keyboards/xd60/keymaps/cheese/README.md b/keyboards/xd60/keymaps/cheese/README.md new file mode 100644 index 000000000..8a5b97c03 --- /dev/null +++ b/keyboards/xd60/keymaps/cheese/README.md | |||
@@ -0,0 +1,13 @@ | |||
1 | # cheese's Layout | ||
2 | Customized xd60 keymap | ||
3 | |||
4 |  | ||
5 |  | ||
6 | |||
7 | ## Programming Instructions: | ||
8 | `cd` into keymap directory, `make dfu` | ||
9 | |||
10 | ## Features | ||
11 | - Media keys and movement keys setup like on the pok3r | ||
12 | - Lower right movement keys setup like on the fc660m (fn+direction for home/end/page up and down) | ||
13 | - Caps lock can be triggered by pressing both shift keys at the same time (and deactivated the same way) | ||
diff --git a/keyboards/xd60/keymaps/cheese/base_layout.png b/keyboards/xd60/keymaps/cheese/base_layout.png new file mode 100644 index 000000000..211c4c731 --- /dev/null +++ b/keyboards/xd60/keymaps/cheese/base_layout.png | |||
Binary files differ | |||
diff --git a/keyboards/xd60/keymaps/cheese/fn_layout.png b/keyboards/xd60/keymaps/cheese/fn_layout.png new file mode 100644 index 000000000..fe5ae99e0 --- /dev/null +++ b/keyboards/xd60/keymaps/cheese/fn_layout.png | |||
Binary files differ | |||
diff --git a/keyboards/xd60/keymaps/cheese/keymap.c b/keyboards/xd60/keymaps/cheese/keymap.c new file mode 100644 index 000000000..25919a41f --- /dev/null +++ b/keyboards/xd60/keymaps/cheese/keymap.c | |||
@@ -0,0 +1,67 @@ | |||
1 | #include "xd60.h" | ||
2 | #include "action_layer.h" | ||
3 | |||
4 | // Each layer gets a name for readability. | ||
5 | // The underscores don't mean anything - you can | ||
6 | // have a layer called STUFF or any other name. | ||
7 | // Layer names don't all need to be of the same | ||
8 | // length, and you can also skip them entirely | ||
9 | // and just use numbers. | ||
10 | #define _BL 0 | ||
11 | #define _FL 1 | ||
12 | #define _LS 2 | ||
13 | #define _RS 3 | ||
14 | |||
15 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
16 | |||
17 | /* (Base Layer) Default Layer | ||
18 | * ,-----------------------------------------------------------. | ||
19 | * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | | ||
20 | * |-----------------------------------------------------------| | ||
21 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | | ||
22 | * |-----------------------------------------------------------| | ||
23 | * |FUNCTION| A| S| D| F| G| H| J| K| L| ;| '|Return| | ||
24 | * |-----------------------------------------------------------| | ||
25 | * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | ||
26 | * |-----------------------------------------------------------| | ||
27 | * |Ctrl|Gui |Alt | Space |FN|Left|Up|Down|Right| | ||
28 | * `-----------------------------------------------------------' | ||
29 | */ | ||
30 | [_BL] = KEYMAP( | ||
31 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, \ | ||
32 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ | ||
33 | MO(_FL), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \ | ||
34 | F(0), KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, F(1), F(1), F(1), \ | ||
35 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FL), KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT), | ||
36 | |||
37 | // Function Layer | ||
38 | [_FL] = KEYMAP( | ||
39 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_DEL, \ | ||
40 | KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_CALC, KC_INS, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, \ | ||
41 | KC_TRNS, KC_VOLD, KC_MUTE, KC_VOLU, KC_TRNS, KC_TRNS, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
42 | KC_TRNS, KC_TRNS, KC_APP, KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
43 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_PGDN, KC_END), | ||
44 | |||
45 | // Left Shift Layer | ||
46 | [_LS] = KEYMAP( | ||
47 | KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
48 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
49 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
50 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CAPS, KC_CAPS, KC_CAPS, \ | ||
51 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
52 | |||
53 | // Right Shift Layer | ||
54 | [_RS] = KEYMAP( | ||
55 | KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
56 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
57 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
58 | KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ | ||
59 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
60 | |||
61 | }; | ||
62 | |||
63 | // Custom Actions | ||
64 | const uint16_t PROGMEM fn_actions[] = { | ||
65 | [0] = ACTION_LAYER_MODS(_LS, MOD_LSFT), | ||
66 | [1] = ACTION_LAYER_MODS(_RS, MOD_RSFT), | ||
67 | }; | ||
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index 2a315fd16..e1e81fd2b 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c | |||
@@ -89,15 +89,15 @@ void audio_init() | |||
89 | } | 89 | } |
90 | audio_config.raw = eeconfig_read_audio(); | 90 | audio_config.raw = eeconfig_read_audio(); |
91 | 91 | ||
92 | // Set port PC6 (OC3A and /OC4A) as output | 92 | // Set port PC6 (OC3A and /OC4A) as output |
93 | DDRC |= _BV(PORTC6); | 93 | DDRC |= _BV(PORTC6); |
94 | 94 | ||
95 | DISABLE_AUDIO_COUNTER_3_ISR; | 95 | DISABLE_AUDIO_COUNTER_3_ISR; |
96 | 96 | ||
97 | // TCCR3A / TCCR3B: Timer/Counter #3 Control Registers | 97 | // TCCR3A / TCCR3B: Timer/Counter #3 Control Registers |
98 | // Compare Output Mode (COM3An) = 0b00 = Normal port operation, OC3A disconnected from PC6 | 98 | // Compare Output Mode (COM3An) = 0b00 = Normal port operation, OC3A disconnected from PC6 |
99 | // Waveform Generation Mode (WGM3n) = 0b1110 = Fast PWM Mode 14 (Period = ICR3, Duty Cycle = OCR3A) | 99 | // Waveform Generation Mode (WGM3n) = 0b1110 = Fast PWM Mode 14 (Period = ICR3, Duty Cycle = OCR3A) |
100 | // Clock Select (CS3n) = 0b010 = Clock / 8 | 100 | // Clock Select (CS3n) = 0b010 = Clock / 8 |
101 | TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30); | 101 | TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30); |
102 | TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30); | 102 | TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30); |
103 | 103 | ||
@@ -106,6 +106,8 @@ void audio_init() | |||
106 | 106 | ||
107 | void stop_all_notes() | 107 | void stop_all_notes() |
108 | { | 108 | { |
109 | dprintf("audio stop all notes"); | ||
110 | |||
109 | if (!audio_initialized) { | 111 | if (!audio_initialized) { |
110 | audio_init(); | 112 | audio_init(); |
111 | } | 113 | } |
@@ -128,6 +130,8 @@ void stop_all_notes() | |||
128 | 130 | ||
129 | void stop_note(float freq) | 131 | void stop_note(float freq) |
130 | { | 132 | { |
133 | dprintf("audio stop note freq=%d", (int)freq); | ||
134 | |||
131 | if (playing_note) { | 135 | if (playing_note) { |
132 | if (!audio_initialized) { | 136 | if (!audio_initialized) { |
133 | audio_init(); | 137 | audio_init(); |
@@ -183,159 +187,161 @@ float vibrato(float average_freq) { | |||
183 | 187 | ||
184 | ISR(TIMER3_COMPA_vect) | 188 | ISR(TIMER3_COMPA_vect) |
185 | { | 189 | { |
186 | float freq; | 190 | float freq; |
187 | 191 | ||
188 | if (playing_note) { | 192 | if (playing_note) { |
189 | if (voices > 0) { | 193 | if (voices > 0) { |
190 | if (polyphony_rate > 0) { | 194 | if (polyphony_rate > 0) { |
191 | if (voices > 1) { | 195 | if (voices > 1) { |
192 | voice_place %= voices; | 196 | voice_place %= voices; |
193 | if (place++ > (frequencies[voice_place] / polyphony_rate / CPU_PRESCALER)) { | 197 | if (place++ > (frequencies[voice_place] / polyphony_rate / CPU_PRESCALER)) { |
194 | voice_place = (voice_place + 1) % voices; | 198 | voice_place = (voice_place + 1) % voices; |
195 | place = 0.0; | 199 | place = 0.0; |
196 | } | 200 | } |
197 | } | 201 | } |
198 | 202 | ||
199 | #ifdef VIBRATO_ENABLE | 203 | #ifdef VIBRATO_ENABLE |
200 | if (vibrato_strength > 0) { | 204 | if (vibrato_strength > 0) { |
201 | freq = vibrato(frequencies[voice_place]); | 205 | freq = vibrato(frequencies[voice_place]); |
202 | } else { | 206 | } else { |
203 | freq = frequencies[voice_place]; | 207 | freq = frequencies[voice_place]; |
204 | } | 208 | } |
205 | #else | 209 | #else |
206 | freq = frequencies[voice_place]; | 210 | freq = frequencies[voice_place]; |
207 | #endif | 211 | #endif |
208 | } else { | 212 | } else { |
209 | if (glissando) { | 213 | if (glissando) { |
210 | if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) { | 214 | if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) { |
211 | frequency = frequency * pow(2, 440/frequency/12/2); | 215 | frequency = frequency * pow(2, 440/frequency/12/2); |
212 | } else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) { | 216 | } else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) { |
213 | frequency = frequency * pow(2, -440/frequency/12/2); | 217 | frequency = frequency * pow(2, -440/frequency/12/2); |
214 | } else { | 218 | } else { |
215 | frequency = frequencies[voices - 1]; | 219 | frequency = frequencies[voices - 1]; |
216 | } | 220 | } |
217 | } else { | 221 | } else { |
218 | frequency = frequencies[voices - 1]; | 222 | frequency = frequencies[voices - 1]; |
219 | } | 223 | } |
220 | 224 | ||
221 | #ifdef VIBRATO_ENABLE | 225 | #ifdef VIBRATO_ENABLE |
222 | if (vibrato_strength > 0) { | 226 | if (vibrato_strength > 0) { |
223 | freq = vibrato(frequency); | 227 | freq = vibrato(frequency); |
224 | } else { | 228 | } else { |
225 | freq = frequency; | 229 | freq = frequency; |
226 | } | 230 | } |
227 | #else | 231 | #else |
228 | freq = frequency; | 232 | freq = frequency; |
229 | #endif | 233 | #endif |
230 | } | 234 | } |
231 | 235 | ||
232 | if (envelope_index < 65535) { | 236 | if (envelope_index < 65535) { |
233 | envelope_index++; | 237 | envelope_index++; |
234 | } | 238 | } |
235 | 239 | ||
236 | freq = voice_envelope(freq); | 240 | freq = voice_envelope(freq); |
237 | 241 | ||
238 | if (freq < 30.517578125) { | 242 | if (freq < 30.517578125) { |
239 | freq = 30.52; | 243 | freq = 30.52; |
240 | } | 244 | } |
241 | 245 | ||
242 | TIMER_3_PERIOD = (uint16_t)(((float)F_CPU) / (freq * CPU_PRESCALER)); | 246 | TIMER_3_PERIOD = (uint16_t)(((float)F_CPU) / (freq * CPU_PRESCALER)); |
243 | TIMER_3_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); | 247 | TIMER_3_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); |
244 | } | 248 | } |
245 | } | 249 | } |
246 | 250 | ||
247 | if (playing_notes) { | 251 | if (playing_notes) { |
248 | if (note_frequency > 0) { | 252 | if (note_frequency > 0) { |
249 | #ifdef VIBRATO_ENABLE | 253 | #ifdef VIBRATO_ENABLE |
250 | if (vibrato_strength > 0) { | 254 | if (vibrato_strength > 0) { |
251 | freq = vibrato(note_frequency); | 255 | freq = vibrato(note_frequency); |
252 | } else { | 256 | } else { |
253 | freq = note_frequency; | 257 | freq = note_frequency; |
254 | } | 258 | } |
255 | #else | 259 | #else |
256 | freq = note_frequency; | 260 | freq = note_frequency; |
257 | #endif | 261 | #endif |
258 | 262 | ||
259 | if (envelope_index < 65535) { | 263 | if (envelope_index < 65535) { |
260 | envelope_index++; | 264 | envelope_index++; |
261 | } | 265 | } |
262 | freq = voice_envelope(freq); | 266 | freq = voice_envelope(freq); |
263 | 267 | ||
264 | TIMER_3_PERIOD = (uint16_t)(((float)F_CPU) / (freq * CPU_PRESCALER)); | 268 | TIMER_3_PERIOD = (uint16_t)(((float)F_CPU) / (freq * CPU_PRESCALER)); |
265 | TIMER_3_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); | 269 | TIMER_3_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); |
266 | } else { | 270 | } else { |
267 | TIMER_3_PERIOD = 0; | 271 | TIMER_3_PERIOD = 0; |
268 | TIMER_3_DUTY_CYCLE = 0; | 272 | TIMER_3_DUTY_CYCLE = 0; |
269 | } | 273 | } |
270 | 274 | ||
271 | note_position++; | 275 | note_position++; |
272 | bool end_of_note = false; | 276 | bool end_of_note = false; |
273 | if (TIMER_3_PERIOD > 0) { | 277 | if (TIMER_3_PERIOD > 0) { |
274 | end_of_note = (note_position >= (note_length / TIMER_3_PERIOD * 0xFFFF)); | 278 | end_of_note = (note_position >= (note_length / TIMER_3_PERIOD * 0xFFFF)); |
275 | } else { | 279 | } else { |
276 | end_of_note = (note_position >= (note_length * 0x7FF)); | 280 | end_of_note = (note_position >= (note_length * 0x7FF)); |
277 | } | 281 | } |
278 | 282 | ||
279 | if (end_of_note) { | 283 | if (end_of_note) { |
280 | current_note++; | 284 | current_note++; |
281 | if (current_note >= notes_count) { | 285 | if (current_note >= notes_count) { |
282 | if (notes_repeat) { | 286 | if (notes_repeat) { |
283 | current_note = 0; | 287 | current_note = 0; |
284 | } else { | 288 | } else { |
285 | DISABLE_AUDIO_COUNTER_3_ISR; | 289 | DISABLE_AUDIO_COUNTER_3_ISR; |
286 | DISABLE_AUDIO_COUNTER_3_OUTPUT; | 290 | DISABLE_AUDIO_COUNTER_3_OUTPUT; |
287 | playing_notes = false; | 291 | playing_notes = false; |
288 | return; | 292 | return; |
289 | } | 293 | } |
290 | } | 294 | } |
291 | if (!note_resting && (notes_rest > 0)) { | 295 | if (!note_resting && (notes_rest > 0)) { |
292 | note_resting = true; | 296 | note_resting = true; |
293 | note_frequency = 0; | 297 | note_frequency = 0; |
294 | note_length = notes_rest; | 298 | note_length = notes_rest; |
295 | current_note--; | 299 | current_note--; |
296 | } else { | 300 | } else { |
297 | note_resting = false; | 301 | note_resting = false; |
298 | envelope_index = 0; | 302 | envelope_index = 0; |
299 | note_frequency = (*notes_pointer)[current_note][0]; | 303 | note_frequency = (*notes_pointer)[current_note][0]; |
300 | note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100); | 304 | note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100); |
301 | } | 305 | } |
302 | 306 | ||
303 | note_position = 0; | 307 | note_position = 0; |
304 | } | 308 | } |
305 | } | 309 | } |
306 | 310 | ||
307 | if (!audio_config.enable) { | 311 | if (!audio_config.enable) { |
308 | playing_notes = false; | 312 | playing_notes = false; |
309 | playing_note = false; | 313 | playing_note = false; |
310 | } | 314 | } |
311 | } | 315 | } |
312 | 316 | ||
313 | void play_note(float freq, int vol) { | 317 | void play_note(float freq, int vol) { |
314 | 318 | ||
319 | dprintf("audio play note freq=%d vol=%d", (int)freq, vol); | ||
320 | |||
315 | if (!audio_initialized) { | 321 | if (!audio_initialized) { |
316 | audio_init(); | 322 | audio_init(); |
317 | } | 323 | } |
318 | 324 | ||
319 | if (audio_config.enable && voices < 8) { | 325 | if (audio_config.enable && voices < 8) { |
320 | DISABLE_AUDIO_COUNTER_3_ISR; | 326 | DISABLE_AUDIO_COUNTER_3_ISR; |
321 | 327 | ||
322 | // Cancel notes if notes are playing | 328 | // Cancel notes if notes are playing |
323 | if (playing_notes) | 329 | if (playing_notes) |
324 | stop_all_notes(); | 330 | stop_all_notes(); |
325 | 331 | ||
326 | playing_note = true; | 332 | playing_note = true; |
327 | 333 | ||
328 | envelope_index = 0; | 334 | envelope_index = 0; |
329 | 335 | ||
330 | if (freq > 0) { | 336 | if (freq > 0) { |
331 | frequencies[voices] = freq; | 337 | frequencies[voices] = freq; |
332 | volumes[voices] = vol; | 338 | volumes[voices] = vol; |
333 | voices++; | 339 | voices++; |
334 | } | 340 | } |
335 | 341 | ||
336 | ENABLE_AUDIO_COUNTER_3_ISR; | 342 | ENABLE_AUDIO_COUNTER_3_ISR; |
337 | ENABLE_AUDIO_COUNTER_3_OUTPUT; | 343 | ENABLE_AUDIO_COUNTER_3_OUTPUT; |
338 | } | 344 | } |
339 | 345 | ||
340 | } | 346 | } |
341 | 347 | ||
@@ -346,37 +352,37 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest) | |||
346 | audio_init(); | 352 | audio_init(); |
347 | } | 353 | } |
348 | 354 | ||
349 | if (audio_config.enable) { | 355 | if (audio_config.enable) { |
350 | 356 | ||
351 | DISABLE_AUDIO_COUNTER_3_ISR; | 357 | DISABLE_AUDIO_COUNTER_3_ISR; |
352 | 358 | ||
353 | // Cancel note if a note is playing | 359 | // Cancel note if a note is playing |
354 | if (playing_note) | 360 | if (playing_note) |
355 | stop_all_notes(); | 361 | stop_all_notes(); |
356 | 362 | ||
357 | playing_notes = true; | 363 | playing_notes = true; |
358 | 364 | ||
359 | notes_pointer = np; | 365 | notes_pointer = np; |
360 | notes_count = n_count; | 366 | notes_count = n_count; |
361 | notes_repeat = n_repeat; | 367 | notes_repeat = n_repeat; |
362 | notes_rest = n_rest; | 368 | notes_rest = n_rest; |
363 | 369 | ||
364 | place = 0; | 370 | place = 0; |
365 | current_note = 0; | 371 | current_note = 0; |
366 | 372 | ||
367 | note_frequency = (*notes_pointer)[current_note][0]; | 373 | note_frequency = (*notes_pointer)[current_note][0]; |
368 | note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100); | 374 | note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100); |
369 | note_position = 0; | 375 | note_position = 0; |
370 | 376 | ||
371 | 377 | ||
372 | ENABLE_AUDIO_COUNTER_3_ISR; | 378 | ENABLE_AUDIO_COUNTER_3_ISR; |
373 | ENABLE_AUDIO_COUNTER_3_OUTPUT; | 379 | ENABLE_AUDIO_COUNTER_3_OUTPUT; |
374 | } | 380 | } |
375 | 381 | ||
376 | } | 382 | } |
377 | 383 | ||
378 | bool is_playing_notes(void) { | 384 | bool is_playing_notes(void) { |
379 | return playing_notes; | 385 | return playing_notes; |
380 | } | 386 | } |
381 | 387 | ||
382 | bool is_audio_on(void) { | 388 | bool is_audio_on(void) { |
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 8022ca672..400915db9 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h | |||
@@ -122,4 +122,31 @@ | |||
122 | E__NOTE(_E5), \ | 122 | E__NOTE(_E5), \ |
123 | E__NOTE(_D5), | 123 | E__NOTE(_D5), |
124 | 124 | ||
125 | #define COIN_SOUND \ | ||
126 | E__NOTE(_A5 ), \ | ||
127 | HD_NOTE(_E6 ), | ||
128 | |||
129 | #define ONE_UP_SOUND \ | ||
130 | Q__NOTE(_E6 ), \ | ||
131 | Q__NOTE(_G6 ), \ | ||
132 | Q__NOTE(_E7 ), \ | ||
133 | Q__NOTE(_C7 ), \ | ||
134 | Q__NOTE(_D7 ), \ | ||
135 | Q__NOTE(_G7 ), | ||
136 | |||
137 | #define SONIC_RING \ | ||
138 | E__NOTE(_E6), \ | ||
139 | E__NOTE(_G6), \ | ||
140 | HD_NOTE(_C7), | ||
141 | |||
142 | #define ZELDA_PUZZLE \ | ||
143 | Q__NOTE(_G5), \ | ||
144 | Q__NOTE(_FS5), \ | ||
145 | Q__NOTE(_DS5), \ | ||
146 | Q__NOTE(_A4), \ | ||
147 | Q__NOTE(_GS4), \ | ||
148 | Q__NOTE(_E5), \ | ||
149 | Q__NOTE(_GS5), \ | ||
150 | HD_NOTE(_C6), | ||
151 | |||
125 | #endif | 152 | #endif |
diff --git a/quantum/process_keycode/process_audio.c b/quantum/process_keycode/process_audio.c new file mode 100644 index 000000000..0b6380ed3 --- /dev/null +++ b/quantum/process_keycode/process_audio.c | |||
@@ -0,0 +1,62 @@ | |||
1 | #include "audio.h" | ||
2 | #include "process_audio.h" | ||
3 | |||
4 | static float compute_freq_for_midi_note(uint8_t note) | ||
5 | { | ||
6 | // https://en.wikipedia.org/wiki/MIDI_tuning_standard | ||
7 | return pow(2.0, (note - 69) / 12.0) * 440.0f; | ||
8 | } | ||
9 | |||
10 | bool process_audio(uint16_t keycode, keyrecord_t *record) { | ||
11 | |||
12 | if (keycode == AU_ON && record->event.pressed) { | ||
13 | audio_on(); | ||
14 | return false; | ||
15 | } | ||
16 | |||
17 | if (keycode == AU_OFF && record->event.pressed) { | ||
18 | audio_off(); | ||
19 | return false; | ||
20 | } | ||
21 | |||
22 | if (keycode == AU_TOG && record->event.pressed) { | ||
23 | if (is_audio_on()) | ||
24 | { | ||
25 | audio_off(); | ||
26 | } | ||
27 | else | ||
28 | { | ||
29 | audio_on(); | ||
30 | } | ||
31 | return false; | ||
32 | } | ||
33 | |||
34 | if (keycode == MUV_IN && record->event.pressed) { | ||
35 | voice_iterate(); | ||
36 | music_scale_user(); | ||
37 | return false; | ||
38 | } | ||
39 | |||
40 | if (keycode == MUV_DE && record->event.pressed) { | ||
41 | voice_deiterate(); | ||
42 | music_scale_user(); | ||
43 | return false; | ||
44 | } | ||
45 | |||
46 | return true; | ||
47 | } | ||
48 | |||
49 | void process_audio_noteon(uint8_t note) { | ||
50 | play_note(compute_freq_for_midi_note(note), 0xF); | ||
51 | } | ||
52 | |||
53 | void process_audio_noteoff(uint8_t note) { | ||
54 | stop_note(compute_freq_for_midi_note(note)); | ||
55 | } | ||
56 | |||
57 | void process_audio_all_notes_off(void) { | ||
58 | stop_all_notes(); | ||
59 | } | ||
60 | |||
61 | __attribute__ ((weak)) | ||
62 | void audio_on_user() {} \ No newline at end of file | ||
diff --git a/quantum/process_keycode/process_audio.h b/quantum/process_keycode/process_audio.h new file mode 100644 index 000000000..7ac15b733 --- /dev/null +++ b/quantum/process_keycode/process_audio.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef PROCESS_AUDIO_H | ||
2 | #define PROCESS_AUDIO_H | ||
3 | |||
4 | bool process_audio(uint16_t keycode, keyrecord_t *record); | ||
5 | void process_audio_noteon(uint8_t note); | ||
6 | void process_audio_noteoff(uint8_t note); | ||
7 | void process_audio_all_notes_off(void); | ||
8 | |||
9 | void audio_on_user(void); | ||
10 | |||
11 | #endif \ No newline at end of file | ||
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c index 577dad43a..700c6ce8e 100644 --- a/quantum/process_keycode/process_midi.c +++ b/quantum/process_keycode/process_midi.c | |||
@@ -1,68 +1,238 @@ | |||
1 | #include "process_midi.h" | 1 | #include "process_midi.h" |
2 | 2 | ||
3 | bool midi_activated = false; | 3 | #ifdef MIDI_ENABLE |
4 | uint8_t midi_starting_note = 0x0C; | 4 | #include "midi.h" |
5 | int midi_offset = 7; | 5 | |
6 | 6 | #ifdef MIDI_BASIC | |
7 | bool process_midi(uint16_t keycode, keyrecord_t *record) { | 7 | |
8 | if (keycode == MI_ON && record->event.pressed) { | 8 | void process_midi_basic_noteon(uint8_t note) |
9 | midi_activated = true; | 9 | { |
10 | #ifdef AUDIO_ENABLE | 10 | midi_send_noteon(&midi_device, 0, note, 128); |
11 | music_scale_user(); | 11 | } |
12 | #endif | 12 | |
13 | return false; | 13 | void process_midi_basic_noteoff(uint8_t note) |
14 | } | 14 | { |
15 | midi_send_noteoff(&midi_device, 0, note, 0); | ||
16 | } | ||
17 | |||
18 | void process_midi_all_notes_off(void) | ||
19 | { | ||
20 | midi_send_cc(&midi_device, 0, 0x7B, 0); | ||
21 | } | ||
22 | |||
23 | #endif // MIDI_BASIC | ||
24 | |||
25 | #ifdef MIDI_ADVANCED | ||
26 | |||
27 | #include "timer.h" | ||
28 | |||
29 | static uint8_t tone_status[MIDI_TONE_COUNT]; | ||
30 | |||
31 | static uint8_t midi_modulation; | ||
32 | static int8_t midi_modulation_step; | ||
33 | static uint16_t midi_modulation_timer; | ||
34 | |||
35 | inline uint8_t compute_velocity(uint8_t setting) | ||
36 | { | ||
37 | return (setting + 1) * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN + 1)); | ||
38 | } | ||
15 | 39 | ||
16 | if (keycode == MI_OFF && record->event.pressed) { | 40 | void midi_init(void) |
17 | midi_activated = false; | 41 | { |
18 | midi_send_cc(&midi_device, 0, 0x7B, 0); | 42 | midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN; |
19 | return false; | 43 | midi_config.transpose = 0; |
44 | midi_config.velocity = (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN); | ||
45 | midi_config.channel = 0; | ||
46 | midi_config.modulation_interval = 8; | ||
47 | |||
48 | for (uint8_t i = 0; i < MIDI_TONE_COUNT; i++) | ||
49 | { | ||
50 | tone_status[i] = MIDI_INVALID_NOTE; | ||
20 | } | 51 | } |
21 | 52 | ||
22 | if (midi_activated) { | 53 | midi_modulation = 0; |
23 | if (record->event.key.col == (MATRIX_COLS - 1) && record->event.key.row == (MATRIX_ROWS - 1)) { | 54 | midi_modulation_step = 0; |
24 | if (record->event.pressed) { | 55 | midi_modulation_timer = 0; |
25 | midi_starting_note++; // Change key | 56 | } |
26 | midi_send_cc(&midi_device, 0, 0x7B, 0); | 57 | |
27 | } | 58 | void midi_task(void) |
28 | return false; | 59 | { |
29 | } | 60 | if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval) |
30 | if (record->event.key.col == (MATRIX_COLS - 2) && record->event.key.row == (MATRIX_ROWS - 1)) { | 61 | return; |
31 | if (record->event.pressed) { | 62 | midi_modulation_timer = timer_read(); |
32 | midi_starting_note--; // Change key | 63 | |
33 | midi_send_cc(&midi_device, 0, 0x7B, 0); | 64 | if (midi_modulation_step != 0) |
34 | } | 65 | { |
35 | return false; | 66 | dprintf("midi modulation %d\n", midi_modulation); |
36 | } | 67 | midi_send_cc(&midi_device, midi_config.channel, 0x1, midi_modulation); |
37 | if (record->event.key.col == (MATRIX_COLS - 3) && record->event.key.row == (MATRIX_ROWS - 1) && record->event.pressed) { | 68 | |
38 | midi_offset++; // Change scale | 69 | if (midi_modulation_step < 0 && midi_modulation < -midi_modulation_step) { |
39 | midi_send_cc(&midi_device, 0, 0x7B, 0); | 70 | midi_modulation = 0; |
40 | return false; | 71 | midi_modulation_step = 0; |
41 | } | 72 | return; |
42 | if (record->event.key.col == (MATRIX_COLS - 4) && record->event.key.row == (MATRIX_ROWS - 1) && record->event.pressed) { | 73 | } |
43 | midi_offset--; // Change scale | 74 | |
44 | midi_send_cc(&midi_device, 0, 0x7B, 0); | 75 | midi_modulation += midi_modulation_step; |
45 | return false; | 76 | |
46 | } | 77 | if (midi_modulation > 127) |
47 | // basic | 78 | midi_modulation = 127; |
48 | // uint8_t note = (midi_starting_note + SCALE[record->event.key.col + midi_offset])+12*(MATRIX_ROWS - record->event.key.row); | ||
49 | // advanced | ||
50 | // uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+12*(MATRIX_ROWS - record->event.key.row); | ||
51 | // guitar | ||
52 | uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+5*(MATRIX_ROWS - record->event.key.row); | ||
53 | // violin | ||
54 | // uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+7*(MATRIX_ROWS - record->event.key.row); | ||
55 | |||
56 | if (record->event.pressed) { | ||
57 | // midi_send_noteon(&midi_device, record->event.key.row, midi_starting_note + SCALE[record->event.key.col], 127); | ||
58 | midi_send_noteon(&midi_device, 0, note, 127); | ||
59 | } else { | ||
60 | // midi_send_noteoff(&midi_device, record->event.key.row, midi_starting_note + SCALE[record->event.key.col], 127); | ||
61 | midi_send_noteoff(&midi_device, 0, note, 127); | ||
62 | } | ||
63 | |||
64 | if (keycode < 0xFF) // ignores all normal keycodes, but lets RAISE, LOWER, etc through | ||
65 | return false; | ||
66 | } | 79 | } |
67 | return true; | ||
68 | } | 80 | } |
81 | |||
82 | uint8_t midi_compute_note(uint16_t keycode) | ||
83 | { | ||
84 | return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose; | ||
85 | } | ||
86 | |||
87 | bool process_midi(uint16_t keycode, keyrecord_t *record) | ||
88 | { | ||
89 | switch (keycode) { | ||
90 | case MIDI_TONE_MIN ... MIDI_TONE_MAX: | ||
91 | { | ||
92 | uint8_t channel = midi_config.channel; | ||
93 | uint8_t tone = keycode - MIDI_TONE_MIN; | ||
94 | uint8_t velocity = compute_velocity(midi_config.velocity); | ||
95 | if (record->event.pressed) { | ||
96 | uint8_t note = midi_compute_note(keycode); | ||
97 | midi_send_noteon(&midi_device, channel, note, velocity); | ||
98 | dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity); | ||
99 | tone_status[tone] = note; | ||
100 | } | ||
101 | else { | ||
102 | uint8_t note = tone_status[tone]; | ||
103 | if (note != MIDI_INVALID_NOTE) | ||
104 | { | ||
105 | midi_send_noteoff(&midi_device, channel, note, velocity); | ||
106 | dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity); | ||
107 | } | ||
108 | tone_status[tone] = MIDI_INVALID_NOTE; | ||
109 | } | ||
110 | return false; | ||
111 | } | ||
112 | case MIDI_OCTAVE_MIN ... MIDI_OCTAVE_MAX: | ||
113 | if (record->event.pressed) { | ||
114 | midi_config.octave = keycode - MIDI_OCTAVE_MIN; | ||
115 | dprintf("midi octave %d\n", midi_config.octave); | ||
116 | } | ||
117 | return false; | ||
118 | case MI_OCTD: | ||
119 | if (record->event.pressed && midi_config.octave > 0) { | ||
120 | midi_config.octave--; | ||
121 | dprintf("midi octave %d\n", midi_config.octave); | ||
122 | } | ||
123 | return false; | ||
124 | case MI_OCTU: | ||
125 | if (record->event.pressed && midi_config.octave < (MIDI_OCTAVE_MAX - MIDI_OCTAVE_MIN)) { | ||
126 | midi_config.octave++; | ||
127 | dprintf("midi octave %d\n", midi_config.octave); | ||
128 | } | ||
129 | return false; | ||
130 | case MIDI_TRANSPOSE_MIN ... MIDI_TRANSPOSE_MAX: | ||
131 | if (record->event.pressed) { | ||
132 | midi_config.transpose = keycode - MI_TRNS_0; | ||
133 | dprintf("midi transpose %d\n", midi_config.transpose); | ||
134 | } | ||
135 | return false; | ||
136 | case MI_TRNSD: | ||
137 | if (record->event.pressed && midi_config.transpose > (MIDI_TRANSPOSE_MIN - MI_TRNS_0)) { | ||
138 | midi_config.transpose--; | ||
139 | dprintf("midi transpose %d\n", midi_config.transpose); | ||
140 | } | ||
141 | return false; | ||
142 | case MI_TRNSU: | ||
143 | if (record->event.pressed && midi_config.transpose < (MIDI_TRANSPOSE_MAX - MI_TRNS_0)) { | ||
144 | const bool positive = midi_config.transpose > 0; | ||
145 | midi_config.transpose++; | ||
146 | if (positive && midi_config.transpose < 0) | ||
147 | midi_config.transpose--; | ||
148 | dprintf("midi transpose %d\n", midi_config.transpose); | ||
149 | } | ||
150 | return false; | ||
151 | case MIDI_VELOCITY_MIN ... MIDI_VELOCITY_MAX: | ||
152 | if (record->event.pressed) { | ||
153 | midi_config.velocity = keycode - MIDI_VELOCITY_MIN; | ||
154 | dprintf("midi velocity %d\n", midi_config.velocity); | ||
155 | } | ||
156 | return false; | ||
157 | case MI_VELD: | ||
158 | if (record->event.pressed && midi_config.velocity > 0) { | ||
159 | midi_config.velocity--; | ||
160 | dprintf("midi velocity %d\n", midi_config.velocity); | ||
161 | } | ||
162 | return false; | ||
163 | case MI_VELU: | ||
164 | if (record->event.pressed) { | ||
165 | midi_config.velocity++; | ||
166 | dprintf("midi velocity %d\n", midi_config.velocity); | ||
167 | } | ||
168 | return false; | ||
169 | case MIDI_CHANNEL_MIN ... MIDI_CHANNEL_MAX: | ||
170 | if (record->event.pressed) { | ||
171 | midi_config.channel = keycode - MIDI_CHANNEL_MIN; | ||
172 | dprintf("midi channel %d\n", midi_config.channel); | ||
173 | } | ||
174 | return false; | ||
175 | case MI_CHD: | ||
176 | if (record->event.pressed) { | ||
177 | midi_config.channel--; | ||
178 | dprintf("midi channel %d\n", midi_config.channel); | ||
179 | } | ||
180 | return false; | ||
181 | case MI_CHU: | ||
182 | if (record->event.pressed) { | ||
183 | midi_config.channel++; | ||
184 | dprintf("midi channel %d\n", midi_config.channel); | ||
185 | } | ||
186 | return false; | ||
187 | case MI_ALLOFF: | ||
188 | if (record->event.pressed) { | ||
189 | midi_send_cc(&midi_device, midi_config.channel, 0x7B, 0); | ||
190 | dprintf("midi all notes off\n"); | ||
191 | } | ||
192 | return false; | ||
193 | case MI_SUS: | ||
194 | midi_send_cc(&midi_device, midi_config.channel, 0x40, record->event.pressed ? 127 : 0); | ||
195 | dprintf("midi sustain %d\n", record->event.pressed); | ||
196 | return false; | ||
197 | case MI_PORT: | ||
198 | midi_send_cc(&midi_device, midi_config.channel, 0x41, record->event.pressed ? 127 : 0); | ||
199 | dprintf("midi portamento %d\n", record->event.pressed); | ||
200 | return false; | ||
201 | case MI_SOST: | ||
202 | midi_send_cc(&midi_device, midi_config.channel, 0x42, record->event.pressed ? 127 : 0); | ||
203 | dprintf("midi sostenuto %d\n", record->event.pressed); | ||
204 | return false; | ||
205 | case MI_SOFT: | ||
206 | midi_send_cc(&midi_device, midi_config.channel, 0x43, record->event.pressed ? 127 : 0); | ||
207 | dprintf("midi soft %d\n", record->event.pressed); | ||
208 | return false; | ||
209 | case MI_LEG: | ||
210 | midi_send_cc(&midi_device, midi_config.channel, 0x43, record->event.pressed ? 127 : 0); | ||
211 | dprintf("midi legato %d\n", record->event.pressed); | ||
212 | return false; | ||
213 | case MI_MOD: | ||
214 | midi_modulation_step = record->event.pressed ? 1 : -1; | ||
215 | return false; | ||
216 | case MI_MODSD: | ||
217 | if (record->event.pressed) { | ||
218 | midi_config.modulation_interval++; | ||
219 | // prevent overflow | ||
220 | if (midi_config.modulation_interval == 0) | ||
221 | midi_config.modulation_interval--; | ||
222 | dprintf("midi modulation interval %d\n", midi_config.modulation_interval); | ||
223 | } | ||
224 | return false; | ||
225 | case MI_MODSU: | ||
226 | if (record->event.pressed && midi_config.modulation_interval > 0) { | ||
227 | midi_config.modulation_interval--; | ||
228 | dprintf("midi modulation interval %d\n", midi_config.modulation_interval); | ||
229 | } | ||
230 | return false; | ||
231 | }; | ||
232 | |||
233 | return true; | ||
234 | } | ||
235 | |||
236 | #endif // MIDI_ADVANCED | ||
237 | |||
238 | #endif // MIDI_ENABLE | ||
diff --git a/quantum/process_keycode/process_midi.h b/quantum/process_keycode/process_midi.h index acd4fc1b1..58b7650c6 100644 --- a/quantum/process_keycode/process_midi.h +++ b/quantum/process_keycode/process_midi.h | |||
@@ -3,205 +3,38 @@ | |||
3 | 3 | ||
4 | #include "quantum.h" | 4 | #include "quantum.h" |
5 | 5 | ||
6 | bool process_midi(uint16_t keycode, keyrecord_t *record); | 6 | #ifdef MIDI_ENABLE |
7 | |||
8 | #ifdef MIDI_BASIC | ||
9 | void process_midi_basic_noteon(uint8_t note); | ||
10 | void process_midi_basic_noteoff(uint8_t note); | ||
11 | void process_midi_all_notes_off(void); | ||
12 | #endif | ||
13 | |||
14 | #ifdef MIDI_ADVANCED | ||
15 | typedef union { | ||
16 | uint32_t raw; | ||
17 | struct { | ||
18 | uint8_t octave :4; | ||
19 | int8_t transpose :4; | ||
20 | uint8_t velocity :4; | ||
21 | uint8_t channel :4; | ||
22 | uint8_t modulation_interval :4; | ||
23 | }; | ||
24 | } midi_config_t; | ||
7 | 25 | ||
8 | #define MIDI(n) ((n) | 0x6000) | 26 | midi_config_t midi_config; |
9 | #define MIDI12 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000 | 27 | |
28 | void midi_init(void); | ||
29 | void midi_task(void); | ||
30 | bool process_midi(uint16_t keycode, keyrecord_t *record); | ||
10 | 31 | ||
11 | #define CHNL(note, channel) (note + (channel << 8)) | 32 | #define MIDI_INVALID_NOTE 0xFF |
33 | #define MIDI_TONE_COUNT (MIDI_TONE_MAX - MIDI_TONE_MIN + 1) | ||
12 | 34 | ||
13 | #define SCALE (int8_t []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \ | 35 | uint8_t midi_compute_note(uint16_t keycode); |
14 | 0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \ | 36 | #endif // MIDI_ADVANCED |
15 | 0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \ | ||
16 | 0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \ | ||
17 | 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), } | ||
18 | 37 | ||
19 | #define N_CN1 (0x600C + (12 * -1) + 0 ) | 38 | #endif // MIDI_ENABLE |
20 | #define N_CN1S (0x600C + (12 * -1) + 1 ) | ||
21 | #define N_DN1F (0x600C + (12 * -1) + 1 ) | ||
22 | #define N_DN1 (0x600C + (12 * -1) + 2 ) | ||
23 | #define N_DN1S (0x600C + (12 * -1) + 3 ) | ||
24 | #define N_EN1F (0x600C + (12 * -1) + 3 ) | ||
25 | #define N_EN1 (0x600C + (12 * -1) + 4 ) | ||
26 | #define N_FN1 (0x600C + (12 * -1) + 5 ) | ||
27 | #define N_FN1S (0x600C + (12 * -1) + 6 ) | ||
28 | #define N_GN1F (0x600C + (12 * -1) + 6 ) | ||
29 | #define N_GN1 (0x600C + (12 * -1) + 7 ) | ||
30 | #define N_GN1S (0x600C + (12 * -1) + 8 ) | ||
31 | #define N_AN1F (0x600C + (12 * -1) + 8 ) | ||
32 | #define N_AN1 (0x600C + (12 * -1) + 9 ) | ||
33 | #define N_AN1S (0x600C + (12 * -1) + 10) | ||
34 | #define N_BN1F (0x600C + (12 * -1) + 10) | ||
35 | #define N_BN1 (0x600C + (12 * -1) + 11) | ||
36 | #define N_C0 (0x600C + (12 * 0) + 0 ) | ||
37 | #define N_C0S (0x600C + (12 * 0) + 1 ) | ||
38 | #define N_D0F (0x600C + (12 * 0) + 1 ) | ||
39 | #define N_D0 (0x600C + (12 * 0) + 2 ) | ||
40 | #define N_D0S (0x600C + (12 * 0) + 3 ) | ||
41 | #define N_E0F (0x600C + (12 * 0) + 3 ) | ||
42 | #define N_E0 (0x600C + (12 * 0) + 4 ) | ||
43 | #define N_F0 (0x600C + (12 * 0) + 5 ) | ||
44 | #define N_F0S (0x600C + (12 * 0) + 6 ) | ||
45 | #define N_G0F (0x600C + (12 * 0) + 6 ) | ||
46 | #define N_G0 (0x600C + (12 * 0) + 7 ) | ||
47 | #define N_G0S (0x600C + (12 * 0) + 8 ) | ||
48 | #define N_A0F (0x600C + (12 * 0) + 8 ) | ||
49 | #define N_A0 (0x600C + (12 * 0) + 9 ) | ||
50 | #define N_A0S (0x600C + (12 * 0) + 10) | ||
51 | #define N_B0F (0x600C + (12 * 0) + 10) | ||
52 | #define N_B0 (0x600C + (12 * 0) + 11) | ||
53 | #define N_C1 (0x600C + (12 * 1) + 0 ) | ||
54 | #define N_C1S (0x600C + (12 * 1) + 1 ) | ||
55 | #define N_D1F (0x600C + (12 * 1) + 1 ) | ||
56 | #define N_D1 (0x600C + (12 * 1) + 2 ) | ||
57 | #define N_D1S (0x600C + (12 * 1) + 3 ) | ||
58 | #define N_E1F (0x600C + (12 * 1) + 3 ) | ||
59 | #define N_E1 (0x600C + (12 * 1) + 4 ) | ||
60 | #define N_F1 (0x600C + (12 * 1) + 5 ) | ||
61 | #define N_F1S (0x600C + (12 * 1) + 6 ) | ||
62 | #define N_G1F (0x600C + (12 * 1) + 6 ) | ||
63 | #define N_G1 (0x600C + (12 * 1) + 7 ) | ||
64 | #define N_G1S (0x600C + (12 * 1) + 8 ) | ||
65 | #define N_A1F (0x600C + (12 * 1) + 8 ) | ||
66 | #define N_A1 (0x600C + (12 * 1) + 9 ) | ||
67 | #define N_A1S (0x600C + (12 * 1) + 10) | ||
68 | #define N_B1F (0x600C + (12 * 1) + 10) | ||
69 | #define N_B1 (0x600C + (12 * 1) + 11) | ||
70 | #define N_C2 (0x600C + (12 * 2) + 0 ) | ||
71 | #define N_C2S (0x600C + (12 * 2) + 1 ) | ||
72 | #define N_D2F (0x600C + (12 * 2) + 1 ) | ||
73 | #define N_D2 (0x600C + (12 * 2) + 2 ) | ||
74 | #define N_D2S (0x600C + (12 * 2) + 3 ) | ||
75 | #define N_E2F (0x600C + (12 * 2) + 3 ) | ||
76 | #define N_E2 (0x600C + (12 * 2) + 4 ) | ||
77 | #define N_F2 (0x600C + (12 * 2) + 5 ) | ||
78 | #define N_F2S (0x600C + (12 * 2) + 6 ) | ||
79 | #define N_G2F (0x600C + (12 * 2) + 6 ) | ||
80 | #define N_G2 (0x600C + (12 * 2) + 7 ) | ||
81 | #define N_G2S (0x600C + (12 * 2) + 8 ) | ||
82 | #define N_A2F (0x600C + (12 * 2) + 8 ) | ||
83 | #define N_A2 (0x600C + (12 * 2) + 9 ) | ||
84 | #define N_A2S (0x600C + (12 * 2) + 10) | ||
85 | #define N_B2F (0x600C + (12 * 2) + 10) | ||
86 | #define N_B2 (0x600C + (12 * 2) + 11) | ||
87 | #define N_C3 (0x600C + (12 * 3) + 0 ) | ||
88 | #define N_C3S (0x600C + (12 * 3) + 1 ) | ||
89 | #define N_D3F (0x600C + (12 * 3) + 1 ) | ||
90 | #define N_D3 (0x600C + (12 * 3) + 2 ) | ||
91 | #define N_D3S (0x600C + (12 * 3) + 3 ) | ||
92 | #define N_E3F (0x600C + (12 * 3) + 3 ) | ||
93 | #define N_E3 (0x600C + (12 * 3) + 4 ) | ||
94 | #define N_F3 (0x600C + (12 * 3) + 5 ) | ||
95 | #define N_F3S (0x600C + (12 * 3) + 6 ) | ||
96 | #define N_G3F (0x600C + (12 * 3) + 6 ) | ||
97 | #define N_G3 (0x600C + (12 * 3) + 7 ) | ||
98 | #define N_G3S (0x600C + (12 * 3) + 8 ) | ||
99 | #define N_A3F (0x600C + (12 * 3) + 8 ) | ||
100 | #define N_A3 (0x600C + (12 * 3) + 9 ) | ||
101 | #define N_A3S (0x600C + (12 * 3) + 10) | ||
102 | #define N_B3F (0x600C + (12 * 3) + 10) | ||
103 | #define N_B3 (0x600C + (12 * 3) + 11) | ||
104 | #define N_C4 (0x600C + (12 * 4) + 0 ) | ||
105 | #define N_C4S (0x600C + (12 * 4) + 1 ) | ||
106 | #define N_D4F (0x600C + (12 * 4) + 1 ) | ||
107 | #define N_D4 (0x600C + (12 * 4) + 2 ) | ||
108 | #define N_D4S (0x600C + (12 * 4) + 3 ) | ||
109 | #define N_E4F (0x600C + (12 * 4) + 3 ) | ||
110 | #define N_E4 (0x600C + (12 * 4) + 4 ) | ||
111 | #define N_F4 (0x600C + (12 * 4) + 5 ) | ||
112 | #define N_F4S (0x600C + (12 * 4) + 6 ) | ||
113 | #define N_G4F (0x600C + (12 * 4) + 6 ) | ||
114 | #define N_G4 (0x600C + (12 * 4) + 7 ) | ||
115 | #define N_G4S (0x600C + (12 * 4) + 8 ) | ||
116 | #define N_A4F (0x600C + (12 * 4) + 8 ) | ||
117 | #define N_A4 (0x600C + (12 * 4) + 9 ) | ||
118 | #define N_A4S (0x600C + (12 * 4) + 10) | ||
119 | #define N_B4F (0x600C + (12 * 4) + 10) | ||
120 | #define N_B4 (0x600C + (12 * 4) + 11) | ||
121 | #define N_C5 (0x600C + (12 * 5) + 0 ) | ||
122 | #define N_C5S (0x600C + (12 * 5) + 1 ) | ||
123 | #define N_D5F (0x600C + (12 * 5) + 1 ) | ||
124 | #define N_D5 (0x600C + (12 * 5) + 2 ) | ||
125 | #define N_D5S (0x600C + (12 * 5) + 3 ) | ||
126 | #define N_E5F (0x600C + (12 * 5) + 3 ) | ||
127 | #define N_E5 (0x600C + (12 * 5) + 4 ) | ||
128 | #define N_F5 (0x600C + (12 * 5) + 5 ) | ||
129 | #define N_F5S (0x600C + (12 * 5) + 6 ) | ||
130 | #define N_G5F (0x600C + (12 * 5) + 6 ) | ||
131 | #define N_G5 (0x600C + (12 * 5) + 7 ) | ||
132 | #define N_G5S (0x600C + (12 * 5) + 8 ) | ||
133 | #define N_A5F (0x600C + (12 * 5) + 8 ) | ||
134 | #define N_A5 (0x600C + (12 * 5) + 9 ) | ||
135 | #define N_A5S (0x600C + (12 * 5) + 10) | ||
136 | #define N_B5F (0x600C + (12 * 5) + 10) | ||
137 | #define N_B5 (0x600C + (12 * 5) + 11) | ||
138 | #define N_C6 (0x600C + (12 * 6) + 0 ) | ||
139 | #define N_C6S (0x600C + (12 * 6) + 1 ) | ||
140 | #define N_D6F (0x600C + (12 * 6) + 1 ) | ||
141 | #define N_D6 (0x600C + (12 * 6) + 2 ) | ||
142 | #define N_D6S (0x600C + (12 * 6) + 3 ) | ||
143 | #define N_E6F (0x600C + (12 * 6) + 3 ) | ||
144 | #define N_E6 (0x600C + (12 * 6) + 4 ) | ||
145 | #define N_F6 (0x600C + (12 * 6) + 5 ) | ||
146 | #define N_F6S (0x600C + (12 * 6) + 6 ) | ||
147 | #define N_G6F (0x600C + (12 * 6) + 6 ) | ||
148 | #define N_G6 (0x600C + (12 * 6) + 7 ) | ||
149 | #define N_G6S (0x600C + (12 * 6) + 8 ) | ||
150 | #define N_A6F (0x600C + (12 * 6) + 8 ) | ||
151 | #define N_A6 (0x600C + (12 * 6) + 9 ) | ||
152 | #define N_A6S (0x600C + (12 * 6) + 10) | ||
153 | #define N_B6F (0x600C + (12 * 6) + 10) | ||
154 | #define N_B6 (0x600C + (12 * 6) + 11) | ||
155 | #define N_C7 (0x600C + (12 * 7) + 0 ) | ||
156 | #define N_C7S (0x600C + (12 * 7) + 1 ) | ||
157 | #define N_D7F (0x600C + (12 * 7) + 1 ) | ||
158 | #define N_D7 (0x600C + (12 * 7) + 2 ) | ||
159 | #define N_D7S (0x600C + (12 * 7) + 3 ) | ||
160 | #define N_E7F (0x600C + (12 * 7) + 3 ) | ||
161 | #define N_E7 (0x600C + (12 * 7) + 4 ) | ||
162 | #define N_F7 (0x600C + (12 * 7) + 5 ) | ||
163 | #define N_F7S (0x600C + (12 * 7) + 6 ) | ||
164 | #define N_G7F (0x600C + (12 * 7) + 6 ) | ||
165 | #define N_G7 (0x600C + (12 * 7) + 7 ) | ||
166 | #define N_G7S (0x600C + (12 * 7) + 8 ) | ||
167 | #define N_A7F (0x600C + (12 * 7) + 8 ) | ||
168 | #define N_A7 (0x600C + (12 * 7) + 9 ) | ||
169 | #define N_A7S (0x600C + (12 * 7) + 10) | ||
170 | #define N_B7F (0x600C + (12 * 7) + 10) | ||
171 | #define N_B7 (0x600C + (12 * 7) + 11) | ||
172 | #define N_C8 (0x600C + (12 * 8) + 0 ) | ||
173 | #define N_C8S (0x600C + (12 * 8) + 1 ) | ||
174 | #define N_D8F (0x600C + (12 * 8) + 1 ) | ||
175 | #define N_D8 (0x600C + (12 * 8) + 2 ) | ||
176 | #define N_D8S (0x600C + (12 * 8) + 3 ) | ||
177 | #define N_E8F (0x600C + (12 * 8) + 3 ) | ||
178 | #define N_E8 (0x600C + (12 * 8) + 4 ) | ||
179 | #define N_F8 (0x600C + (12 * 8) + 5 ) | ||
180 | #define N_F8S (0x600C + (12 * 8) + 6 ) | ||
181 | #define N_G8F (0x600C + (12 * 8) + 6 ) | ||
182 | #define N_G8 (0x600C + (12 * 8) + 7 ) | ||
183 | #define N_G8S (0x600C + (12 * 8) + 8 ) | ||
184 | #define N_A8F (0x600C + (12 * 8) + 8 ) | ||
185 | #define N_A8 (0x600C + (12 * 8) + 9 ) | ||
186 | #define N_A8S (0x600C + (12 * 8) + 10) | ||
187 | #define N_B8F (0x600C + (12 * 8) + 10) | ||
188 | #define N_B8 (0x600C + (12 * 8) + 11) | ||
189 | #define N_C8 (0x600C + (12 * 8) + 0 ) | ||
190 | #define N_C8S (0x600C + (12 * 8) + 1 ) | ||
191 | #define N_D8F (0x600C + (12 * 8) + 1 ) | ||
192 | #define N_D8 (0x600C + (12 * 8) + 2 ) | ||
193 | #define N_D8S (0x600C + (12 * 8) + 3 ) | ||
194 | #define N_E8F (0x600C + (12 * 8) + 3 ) | ||
195 | #define N_E8 (0x600C + (12 * 8) + 4 ) | ||
196 | #define N_F8 (0x600C + (12 * 8) + 5 ) | ||
197 | #define N_F8S (0x600C + (12 * 8) + 6 ) | ||
198 | #define N_G8F (0x600C + (12 * 8) + 6 ) | ||
199 | #define N_G8 (0x600C + (12 * 8) + 7 ) | ||
200 | #define N_G8S (0x600C + (12 * 8) + 8 ) | ||
201 | #define N_A8F (0x600C + (12 * 8) + 8 ) | ||
202 | #define N_A8 (0x600C + (12 * 8) + 9 ) | ||
203 | #define N_A8S (0x600C + (12 * 8) + 10) | ||
204 | #define N_B8F (0x600C + (12 * 8) + 10) | ||
205 | #define N_B8 (0x600C + (12 * 8) + 11) | ||
206 | 39 | ||
207 | #endif \ No newline at end of file | 40 | #endif \ No newline at end of file |
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c index 1e2648bff..f89a04ee3 100644 --- a/quantum/process_keycode/process_music.c +++ b/quantum/process_keycode/process_music.c | |||
@@ -1,5 +1,14 @@ | |||
1 | #include "process_music.h" | 1 | #include "process_music.h" |
2 | 2 | ||
3 | #ifdef AUDIO_ENABLE | ||
4 | #include "process_audio.h" | ||
5 | #endif | ||
6 | #if defined(MIDI_ENABLE) && defined(MIDI_BASIC) | ||
7 | #include "process_midi.h" | ||
8 | #endif | ||
9 | |||
10 | #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) | ||
11 | |||
3 | bool music_activated = false; | 12 | bool music_activated = false; |
4 | uint8_t music_starting_note = 0x0C; | 13 | uint8_t music_starting_note = 0x0C; |
5 | int music_offset = 7; | 14 | int music_offset = 7; |
@@ -8,36 +17,41 @@ int music_offset = 7; | |||
8 | static bool music_sequence_recording = false; | 17 | static bool music_sequence_recording = false; |
9 | static bool music_sequence_recorded = false; | 18 | static bool music_sequence_recorded = false; |
10 | static bool music_sequence_playing = false; | 19 | static bool music_sequence_playing = false; |
11 | static float music_sequence[16] = {0}; | 20 | static uint8_t music_sequence[16] = {0}; |
12 | static uint8_t music_sequence_count = 0; | 21 | static uint8_t music_sequence_count = 0; |
13 | static uint8_t music_sequence_position = 0; | 22 | static uint8_t music_sequence_position = 0; |
14 | 23 | ||
15 | static uint16_t music_sequence_timer = 0; | 24 | static uint16_t music_sequence_timer = 0; |
16 | static uint16_t music_sequence_interval = 100; | 25 | static uint16_t music_sequence_interval = 100; |
17 | 26 | ||
18 | bool process_music(uint16_t keycode, keyrecord_t *record) { | 27 | static void music_noteon(uint8_t note) { |
28 | #ifdef AUDIO_ENABLE | ||
29 | process_audio_noteon(note); | ||
30 | #endif | ||
31 | #if defined(MIDI_ENABLE) && defined(MIDI_BASIC) | ||
32 | process_midi_basic_noteon(note); | ||
33 | #endif | ||
34 | } | ||
19 | 35 | ||
20 | if (keycode == AU_ON && record->event.pressed) { | 36 | static void music_noteoff(uint8_t note) { |
21 | audio_on(); | 37 | #ifdef AUDIO_ENABLE |
22 | return false; | 38 | process_audio_noteoff(note); |
23 | } | 39 | #endif |
40 | #if defined(MIDI_ENABLE) && defined(MIDI_BASIC) | ||
41 | process_midi_basic_noteoff(note); | ||
42 | #endif | ||
43 | } | ||
24 | 44 | ||
25 | if (keycode == AU_OFF && record->event.pressed) { | 45 | void music_all_notes_off(void) { |
26 | audio_off(); | 46 | #ifdef AUDIO_ENABLE |
27 | return false; | 47 | process_audio_all_notes_off(); |
28 | } | 48 | #endif |
49 | #if defined(MIDI_ENABLE) && defined(MIDI_BASIC) | ||
50 | process_midi_all_notes_off(); | ||
51 | #endif | ||
52 | } | ||
29 | 53 | ||
30 | if (keycode == AU_TOG && record->event.pressed) { | 54 | bool process_music(uint16_t keycode, keyrecord_t *record) { |
31 | if (is_audio_on()) | ||
32 | { | ||
33 | audio_off(); | ||
34 | } | ||
35 | else | ||
36 | { | ||
37 | audio_on(); | ||
38 | } | ||
39 | return false; | ||
40 | } | ||
41 | 55 | ||
42 | if (keycode == MU_ON && record->event.pressed) { | 56 | if (keycode == MU_ON && record->event.pressed) { |
43 | music_on(); | 57 | music_on(); |
@@ -61,22 +75,10 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { | |||
61 | return false; | 75 | return false; |
62 | } | 76 | } |
63 | 77 | ||
64 | if (keycode == MUV_IN && record->event.pressed) { | ||
65 | voice_iterate(); | ||
66 | music_scale_user(); | ||
67 | return false; | ||
68 | } | ||
69 | |||
70 | if (keycode == MUV_DE && record->event.pressed) { | ||
71 | voice_deiterate(); | ||
72 | music_scale_user(); | ||
73 | return false; | ||
74 | } | ||
75 | |||
76 | if (music_activated) { | 78 | if (music_activated) { |
77 | 79 | ||
78 | if (keycode == KC_LCTL && record->event.pressed) { // Start recording | 80 | if (keycode == KC_LCTL && record->event.pressed) { // Start recording |
79 | stop_all_notes(); | 81 | music_all_notes_off(); |
80 | music_sequence_recording = true; | 82 | music_sequence_recording = true; |
81 | music_sequence_recorded = false; | 83 | music_sequence_recorded = false; |
82 | music_sequence_playing = false; | 84 | music_sequence_playing = false; |
@@ -85,7 +87,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { | |||
85 | } | 87 | } |
86 | 88 | ||
87 | if (keycode == KC_LALT && record->event.pressed) { // Stop recording/playing | 89 | if (keycode == KC_LALT && record->event.pressed) { // Stop recording/playing |
88 | stop_all_notes(); | 90 | music_all_notes_off(); |
89 | if (music_sequence_recording) { // was recording | 91 | if (music_sequence_recording) { // was recording |
90 | music_sequence_recorded = true; | 92 | music_sequence_recorded = true; |
91 | } | 93 | } |
@@ -95,7 +97,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { | |||
95 | } | 97 | } |
96 | 98 | ||
97 | if (keycode == KC_LGUI && record->event.pressed && music_sequence_recorded) { // Start playing | 99 | if (keycode == KC_LGUI && record->event.pressed && music_sequence_recorded) { // Start playing |
98 | stop_all_notes(); | 100 | music_all_notes_off(); |
99 | music_sequence_recording = false; | 101 | music_sequence_recording = false; |
100 | music_sequence_playing = true; | 102 | music_sequence_playing = true; |
101 | music_sequence_position = 0; | 103 | music_sequence_position = 0; |
@@ -114,32 +116,34 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { | |||
114 | music_sequence_interval+=10; | 116 | music_sequence_interval+=10; |
115 | return false; | 117 | return false; |
116 | } | 118 | } |
119 | |||
117 | #define MUSIC_MODE_GUITAR | 120 | #define MUSIC_MODE_GUITAR |
118 | 121 | ||
119 | #ifdef MUSIC_MODE_CHROMATIC | 122 | #ifdef MUSIC_MODE_CHROMATIC |
120 | float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(MATRIX_ROWS - record->event.key.row)); | 123 | uint8_t note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row); |
121 | #elif defined(MUSIC_MODE_GUITAR) | 124 | #elif defined(MUSIC_MODE_GUITAR) |
122 | float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(float)(MATRIX_ROWS - record->event.key.row + 7)*5.0/12); | 125 | uint8_t note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row); |
123 | #elif defined(MUSIC_MODE_VIOLIN) | 126 | #elif defined(MUSIC_MODE_VIOLIN) |
124 | float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(float)(MATRIX_ROWS - record->event.key.row + 5)*7.0/12); | 127 | uint8_t note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row); |
125 | #else | 128 | #else |
126 | float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + SCALE[record->event.key.col + music_offset])/12.0+(MATRIX_ROWS - record->event.key.row)); | 129 | uint8_t note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row); |
127 | #endif | 130 | #endif |
128 | 131 | ||
129 | if (record->event.pressed) { | 132 | if (record->event.pressed) { |
130 | play_note(freq, 0xF); | 133 | music_noteon(note); |
131 | if (music_sequence_recording) { | 134 | if (music_sequence_recording) { |
132 | music_sequence[music_sequence_count] = freq; | 135 | music_sequence[music_sequence_count] = note; |
133 | music_sequence_count++; | 136 | music_sequence_count++; |
134 | } | 137 | } |
135 | } else { | 138 | } else { |
136 | stop_note(freq); | 139 | music_noteoff(note); |
137 | } | 140 | } |
138 | 141 | ||
139 | if (keycode < 0xFF) // ignores all normal keycodes, but lets RAISE, LOWER, etc through | 142 | if (keycode < 0xFF) // ignores all normal keycodes, but lets RAISE, LOWER, etc through |
140 | return false; | 143 | return false; |
141 | } | 144 | } |
142 | return true; | 145 | |
146 | return true; | ||
143 | } | 147 | } |
144 | 148 | ||
145 | bool is_music_on(void) { | 149 | bool is_music_on(void) { |
@@ -161,26 +165,26 @@ void music_on(void) { | |||
161 | 165 | ||
162 | void music_off(void) { | 166 | void music_off(void) { |
163 | music_activated = 0; | 167 | music_activated = 0; |
164 | stop_all_notes(); | 168 | music_all_notes_off(); |
165 | } | 169 | } |
166 | 170 | ||
167 | |||
168 | __attribute__ ((weak)) | ||
169 | void music_on_user() {} | ||
170 | |||
171 | __attribute__ ((weak)) | ||
172 | void audio_on_user() {} | ||
173 | |||
174 | __attribute__ ((weak)) | ||
175 | void music_scale_user() {} | ||
176 | |||
177 | void matrix_scan_music(void) { | 171 | void matrix_scan_music(void) { |
178 | if (music_sequence_playing) { | 172 | if (music_sequence_playing) { |
179 | if ((music_sequence_timer == 0) || (timer_elapsed(music_sequence_timer) > music_sequence_interval)) { | 173 | if ((music_sequence_timer == 0) || (timer_elapsed(music_sequence_timer) > music_sequence_interval)) { |
180 | music_sequence_timer = timer_read(); | 174 | music_sequence_timer = timer_read(); |
181 | stop_note(music_sequence[(music_sequence_position - 1 < 0)?(music_sequence_position - 1 + music_sequence_count):(music_sequence_position - 1)]); | 175 | uint8_t prev_note = music_sequence[(music_sequence_position - 1 < 0)?(music_sequence_position - 1 + music_sequence_count):(music_sequence_position - 1)]; |
182 | play_note(music_sequence[music_sequence_position], 0xF); | 176 | uint8_t next_note = music_sequence[music_sequence_position]; |
177 | music_noteoff(prev_note); | ||
178 | music_noteon(next_note); | ||
183 | music_sequence_position = (music_sequence_position + 1) % music_sequence_count; | 179 | music_sequence_position = (music_sequence_position + 1) % music_sequence_count; |
184 | } | 180 | } |
185 | } | 181 | } |
186 | } | 182 | } |
183 | |||
184 | __attribute__ ((weak)) | ||
185 | void music_on_user() {} | ||
186 | |||
187 | __attribute__ ((weak)) | ||
188 | void music_scale_user() {} | ||
189 | |||
190 | #endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) \ No newline at end of file | ||
diff --git a/quantum/process_keycode/process_music.h b/quantum/process_keycode/process_music.h index 318b3e387..a36514a44 100644 --- a/quantum/process_keycode/process_music.h +++ b/quantum/process_keycode/process_music.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include "quantum.h" | 4 | #include "quantum.h" |
5 | 5 | ||
6 | #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) | ||
7 | |||
6 | bool process_music(uint16_t keycode, keyrecord_t *record); | 8 | bool process_music(uint16_t keycode, keyrecord_t *record); |
7 | 9 | ||
8 | bool is_music_on(void); | 10 | bool is_music_on(void); |
@@ -10,9 +12,9 @@ void music_toggle(void); | |||
10 | void music_on(void); | 12 | void music_on(void); |
11 | void music_off(void); | 13 | void music_off(void); |
12 | 14 | ||
13 | void audio_on_user(void); | ||
14 | void music_on_user(void); | 15 | void music_on_user(void); |
15 | void music_scale_user(void); | 16 | void music_scale_user(void); |
17 | void music_all_notes_off(void); | ||
16 | 18 | ||
17 | void matrix_scan_music(void); | 19 | void matrix_scan_music(void); |
18 | 20 | ||
@@ -24,4 +26,6 @@ void matrix_scan_music(void); | |||
24 | 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), } | 26 | 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), } |
25 | #endif | 27 | #endif |
26 | 28 | ||
29 | #endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) | ||
30 | |||
27 | #endif \ No newline at end of file | 31 | #endif \ No newline at end of file |
diff --git a/quantum/quantum.c b/quantum/quantum.c index 582f8920b..5a9e771a9 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
@@ -98,8 +98,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
98 | 98 | ||
99 | void reset_keyboard(void) { | 99 | void reset_keyboard(void) { |
100 | clear_keyboard(); | 100 | clear_keyboard(); |
101 | #ifdef AUDIO_ENABLE | 101 | #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_ENABLE_BASIC)) |
102 | stop_all_notes(); | 102 | music_all_notes_off(); |
103 | shutdown_user(); | 103 | shutdown_user(); |
104 | #endif | 104 | #endif |
105 | wait_ms(250); | 105 | wait_ms(250); |
@@ -153,10 +153,13 @@ bool process_record_quantum(keyrecord_t *record) { | |||
153 | 153 | ||
154 | if (!( | 154 | if (!( |
155 | process_record_kb(keycode, record) && | 155 | process_record_kb(keycode, record) && |
156 | #ifdef MIDI_ENABLE | 156 | #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) |
157 | process_midi(keycode, record) && | 157 | process_midi(keycode, record) && |
158 | #endif | 158 | #endif |
159 | #ifdef AUDIO_ENABLE | 159 | #ifdef AUDIO_ENABLE |
160 | process_audio(keycode, record) && | ||
161 | #endif | ||
162 | #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) | ||
160 | process_music(keycode, record) && | 163 | process_music(keycode, record) && |
161 | #endif | 164 | #endif |
162 | #ifdef TAP_DANCE_ENABLE | 165 | #ifdef TAP_DANCE_ENABLE |
@@ -294,14 +297,6 @@ bool process_record_quantum(keyrecord_t *record) { | |||
294 | return false; | 297 | return false; |
295 | break; | 298 | break; |
296 | #endif | 299 | #endif |
297 | #ifdef ADAFRUIT_BLE_ENABLE | ||
298 | case OUT_BLE: | ||
299 | if (record->event.pressed) { | ||
300 | set_output(OUTPUT_ADAFRUIT_BLE); | ||
301 | } | ||
302 | return false; | ||
303 | break; | ||
304 | #endif | ||
305 | #endif | 300 | #endif |
306 | case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO: | 301 | case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO: |
307 | if (record->event.pressed) { | 302 | if (record->event.pressed) { |
diff --git a/quantum/quantum.h b/quantum/quantum.h index 259bac369..1f1bb0afd 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
@@ -35,11 +35,16 @@ extern uint32_t default_layer_state; | |||
35 | 35 | ||
36 | #ifdef MIDI_ENABLE | 36 | #ifdef MIDI_ENABLE |
37 | #include <lufa.h> | 37 | #include <lufa.h> |
38 | #ifdef MIDI_ADVANCED | ||
38 | #include "process_midi.h" | 39 | #include "process_midi.h" |
39 | #endif | 40 | #endif |
41 | #endif // MIDI_ENABLE | ||
40 | 42 | ||
41 | #ifdef AUDIO_ENABLE | 43 | #ifdef AUDIO_ENABLE |
42 | #include "audio.h" | 44 | #include "process_audio.h" |
45 | #endif | ||
46 | |||
47 | #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) | ||
43 | #include "process_music.h" | 48 | #include "process_music.h" |
44 | #endif | 49 | #endif |
45 | 50 | ||
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 903d57f1e..1e3df9fa6 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h | |||
@@ -1,7 +1,16 @@ | |||
1 | |||
2 | #ifndef QUANTUM_KEYCODES_H | 1 | #ifndef QUANTUM_KEYCODES_H |
3 | #define QUANTUM_KEYCODES_H | 2 | #define QUANTUM_KEYCODES_H |
4 | 3 | ||
4 | #ifndef MIDI_ENABLE_STRICT | ||
5 | #define MIDI_ENABLE_STRICT 0 | ||
6 | #endif | ||
7 | |||
8 | #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)) | ||
9 | #ifndef MIDI_TONE_KEYCODE_OCTAVES | ||
10 | #define MIDI_TONE_KEYCODE_OCTAVES 3 | ||
11 | #endif | ||
12 | #endif | ||
13 | |||
5 | enum quantum_keycodes { | 14 | enum quantum_keycodes { |
6 | // Ranges used in shortucuts - not to be used directly | 15 | // Ranges used in shortucuts - not to be used directly |
7 | QK_TMK = 0x0000, | 16 | QK_TMK = 0x0000, |
@@ -107,9 +116,230 @@ enum quantum_keycodes { | |||
107 | MUV_IN, | 116 | MUV_IN, |
108 | MUV_DE, | 117 | MUV_DE, |
109 | 118 | ||
110 | // Midi mode on/off | 119 | // Midi |
111 | MIDI_ON, | 120 | #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) |
112 | MIDI_OFF, | 121 | MI_ON, // send midi notes when music mode is enabled |
122 | MI_OFF, // don't send midi notes when music mode is enabled | ||
123 | #endif | ||
124 | |||
125 | #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)) | ||
126 | MIDI_TONE_MIN, | ||
127 | |||
128 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 0 | ||
129 | MI_C = MIDI_TONE_MIN, | ||
130 | MI_Cs, | ||
131 | MI_Db = MI_Cs, | ||
132 | MI_D, | ||
133 | MI_Ds, | ||
134 | MI_Eb = MI_Ds, | ||
135 | MI_E, | ||
136 | MI_F, | ||
137 | MI_Fs, | ||
138 | MI_Gb = MI_Fs, | ||
139 | MI_G, | ||
140 | MI_Gs, | ||
141 | MI_Ab = MI_Gs, | ||
142 | MI_A, | ||
143 | MI_As, | ||
144 | MI_Bb = MI_As, | ||
145 | MI_B, | ||
146 | #endif | ||
147 | |||
148 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 1 | ||
149 | MI_C_1, | ||
150 | MI_Cs_1, | ||
151 | MI_Db_1 = MI_Cs_1, | ||
152 | MI_D_1, | ||
153 | MI_Ds_1, | ||
154 | MI_Eb_1 = MI_Ds_1, | ||
155 | MI_E_1, | ||
156 | MI_F_1, | ||
157 | MI_Fs_1, | ||
158 | MI_Gb_1 = MI_Fs_1, | ||
159 | MI_G_1, | ||
160 | MI_Gs_1, | ||
161 | MI_Ab_1 = MI_Gs_1, | ||
162 | MI_A_1, | ||
163 | MI_As_1, | ||
164 | MI_Bb_1 = MI_As_1, | ||
165 | MI_B_1, | ||
166 | #endif | ||
167 | |||
168 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 2 | ||
169 | MI_C_2, | ||
170 | MI_Cs_2, | ||
171 | MI_Db_2 = MI_Cs_2, | ||
172 | MI_D_2, | ||
173 | MI_Ds_2, | ||
174 | MI_Eb_2 = MI_Ds_2, | ||
175 | MI_E_2, | ||
176 | MI_F_2, | ||
177 | MI_Fs_2, | ||
178 | MI_Gb_2 = MI_Fs_2, | ||
179 | MI_G_2, | ||
180 | MI_Gs_2, | ||
181 | MI_Ab_2 = MI_Gs_2, | ||
182 | MI_A_2, | ||
183 | MI_As_2, | ||
184 | MI_Bb_2 = MI_As_2, | ||
185 | MI_B_2, | ||
186 | #endif | ||
187 | |||
188 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 3 | ||
189 | MI_C_3, | ||
190 | MI_Cs_3, | ||
191 | MI_Db_3 = MI_Cs_3, | ||
192 | MI_D_3, | ||
193 | MI_Ds_3, | ||
194 | MI_Eb_3 = MI_Ds_3, | ||
195 | MI_E_3, | ||
196 | MI_F_3, | ||
197 | MI_Fs_3, | ||
198 | MI_Gb_3 = MI_Fs_3, | ||
199 | MI_G_3, | ||
200 | MI_Gs_3, | ||
201 | MI_Ab_3 = MI_Gs_3, | ||
202 | MI_A_3, | ||
203 | MI_As_3, | ||
204 | MI_Bb_3 = MI_As_3, | ||
205 | MI_B_3, | ||
206 | #endif | ||
207 | |||
208 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 4 | ||
209 | MI_C_4, | ||
210 | MI_Cs_4, | ||
211 | MI_Db_4 = MI_Cs_4, | ||
212 | MI_D_4, | ||
213 | MI_Ds_4, | ||
214 | MI_Eb_4 = MI_Ds_4, | ||
215 | MI_E_4, | ||
216 | MI_F_4, | ||
217 | MI_Fs_4, | ||
218 | MI_Gb_4 = MI_Fs_4, | ||
219 | MI_G_4, | ||
220 | MI_Gs_4, | ||
221 | MI_Ab_4 = MI_Gs_4, | ||
222 | MI_A_4, | ||
223 | MI_As_4, | ||
224 | MI_Bb_4 = MI_As_4, | ||
225 | MI_B_4, | ||
226 | #endif | ||
227 | |||
228 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5 | ||
229 | MI_C_5, | ||
230 | MI_Cs_5, | ||
231 | MI_Db_5 = MI_Cs_5, | ||
232 | MI_D_5, | ||
233 | MI_Ds_5, | ||
234 | MI_Eb_5 = MI_Ds_5, | ||
235 | MI_E_5, | ||
236 | MI_F_5, | ||
237 | MI_Fs_5, | ||
238 | MI_Gb_5 = MI_Fs_5, | ||
239 | MI_G_5, | ||
240 | MI_Gs_5, | ||
241 | MI_Ab_5 = MI_Gs_5, | ||
242 | MI_A_5, | ||
243 | MI_As_5, | ||
244 | MI_Bb_5 = MI_As_5, | ||
245 | MI_B_5, | ||
246 | #endif | ||
247 | |||
248 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5 | ||
249 | MIDI_TONE_MAX = MI_B_5, | ||
250 | #elif MIDI_TONE_KEYCODE_OCTAVES > 4 | ||
251 | MIDI_TONE_MAX = MI_B_4, | ||
252 | #elif MIDI_TONE_KEYCODE_OCTAVES > 3 | ||
253 | MIDI_TONE_MAX = MI_B_3, | ||
254 | #elif MIDI_TONE_KEYCODE_OCTAVES > 2 | ||
255 | MIDI_TONE_MAX = MI_B_2, | ||
256 | #elif MIDI_TONE_KEYCODE_OCTAVES > 1 | ||
257 | MIDI_TONE_MAX = MI_B_1, | ||
258 | #elif MIDI_TONE_KEYCODE_OCTAVES > 0 | ||
259 | MIDI_TONE_MAX = MI_B, | ||
260 | #endif | ||
261 | |||
262 | MIDI_OCTAVE_MIN, | ||
263 | MI_OCT_N2 = MIDI_OCTAVE_MIN, | ||
264 | MI_OCT_N1, | ||
265 | MI_OCT_0, | ||
266 | MI_OCT_1, | ||
267 | MI_OCT_2, | ||
268 | MI_OCT_3, | ||
269 | MI_OCT_4, | ||
270 | MI_OCT_5, | ||
271 | MI_OCT_6, | ||
272 | MI_OCT_7, | ||
273 | MIDI_OCTAVE_MAX = MI_OCT_7, | ||
274 | MI_OCTD, // octave down | ||
275 | MI_OCTU, // octave up | ||
276 | |||
277 | MIDI_TRANSPOSE_MIN, | ||
278 | MI_TRNS_N6 = MIDI_TRANSPOSE_MIN, | ||
279 | MI_TRNS_N5, | ||
280 | MI_TRNS_N4, | ||
281 | MI_TRNS_N3, | ||
282 | MI_TRNS_N2, | ||
283 | MI_TRNS_N1, | ||
284 | MI_TRNS_0, | ||
285 | MI_TRNS_1, | ||
286 | MI_TRNS_2, | ||
287 | MI_TRNS_3, | ||
288 | MI_TRNS_4, | ||
289 | MI_TRNS_5, | ||
290 | MI_TRNS_6, | ||
291 | MIDI_TRANSPOSE_MAX = MI_TRNS_6, | ||
292 | MI_TRNSD, // transpose down | ||
293 | MI_TRNSU, // transpose up | ||
294 | |||
295 | MIDI_VELOCITY_MIN, | ||
296 | MI_VEL_1 = MIDI_VELOCITY_MIN, | ||
297 | MI_VEL_2, | ||
298 | MI_VEL_3, | ||
299 | MI_VEL_4, | ||
300 | MI_VEL_5, | ||
301 | MI_VEL_6, | ||
302 | MI_VEL_7, | ||
303 | MI_VEL_8, | ||
304 | MI_VEL_9, | ||
305 | MI_VEL_10, | ||
306 | MIDI_VELOCITY_MAX = MI_VEL_10, | ||
307 | MI_VELD, // velocity down | ||
308 | MI_VELU, // velocity up | ||
309 | |||
310 | MIDI_CHANNEL_MIN, | ||
311 | MI_CH1 = MIDI_CHANNEL_MIN, | ||
312 | MI_CH2, | ||
313 | MI_CH3, | ||
314 | MI_CH4, | ||
315 | MI_CH5, | ||
316 | MI_CH6, | ||
317 | MI_CH7, | ||
318 | MI_CH8, | ||
319 | MI_CH9, | ||
320 | MI_CH10, | ||
321 | MI_CH11, | ||
322 | MI_CH12, | ||
323 | MI_CH13, | ||
324 | MI_CH14, | ||
325 | MI_CH15, | ||
326 | MI_CH16, | ||
327 | MIDI_CHANNEL_MAX = MI_CH16, | ||
328 | MI_CHD, // previous channel | ||
329 | MI_CHU, // next channel | ||
330 | |||
331 | MI_ALLOFF, // all notes off | ||
332 | |||
333 | MI_SUS, // sustain | ||
334 | MI_PORT, // portamento | ||
335 | MI_SOST, // sostenuto | ||
336 | MI_SOFT, // soft pedal | ||
337 | MI_LEG, // legato | ||
338 | |||
339 | MI_MOD, // modulation | ||
340 | MI_MODSD, // decrease modulation speed | ||
341 | MI_MODSU, // increase modulation speed | ||
342 | #endif // MIDI_ADVANCED | ||
113 | 343 | ||
114 | // Backlight functionality | 344 | // Backlight functionality |
115 | BL_0, | 345 | BL_0, |
@@ -159,9 +389,6 @@ enum quantum_keycodes { | |||
159 | #ifdef BLUETOOTH_ENABLE | 389 | #ifdef BLUETOOTH_ENABLE |
160 | OUT_BT, | 390 | OUT_BT, |
161 | #endif | 391 | #endif |
162 | #ifdef ADAFRUIT_BLE_ENABLE | ||
163 | OUT_BLE, | ||
164 | #endif | ||
165 | 392 | ||
166 | // always leave at the end | 393 | // always leave at the end |
167 | SAFE_RANGE | 394 | SAFE_RANGE |
@@ -282,9 +509,6 @@ enum quantum_keycodes { | |||
282 | #define BL_ON BL_9 | 509 | #define BL_ON BL_9 |
283 | #define BL_OFF BL_0 | 510 | #define BL_OFF BL_0 |
284 | 511 | ||
285 | #define MI_ON MIDI_ON | ||
286 | #define MI_OFF MIDI_OFF | ||
287 | |||
288 | // GOTO layer - 16 layers max | 512 | // GOTO layer - 16 layers max |
289 | // when: | 513 | // when: |
290 | // ON_PRESS = 1 | 514 | // ON_PRESS = 1 |
diff --git a/quantum/template/config.h b/quantum/template/config.h index c61c4a618..7393097e1 100644 --- a/quantum/template/config.h +++ b/quantum/template/config.h | |||
@@ -159,4 +159,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
159 | //#define NO_ACTION_MACRO | 159 | //#define NO_ACTION_MACRO |
160 | //#define NO_ACTION_FUNCTION | 160 | //#define NO_ACTION_FUNCTION |
161 | 161 | ||
162 | /* | ||
163 | * MIDI options | ||
164 | */ | ||
165 | |||
166 | /* Prevent use of disabled MIDI features in the keymap */ | ||
167 | //#define MIDI_ENABLE_STRICT 1 | ||
168 | |||
169 | /* enable basic MIDI features: | ||
170 | - MIDI notes can be sent when in Music mode is on | ||
171 | */ | ||
172 | //#define MIDI_BASIC | ||
173 | |||
174 | /* enable advanced MIDI features: | ||
175 | - MIDI notes can be added to the keymap | ||
176 | - Octave shift and transpose | ||
177 | - Virtual sustain, portamento, and modulation wheel | ||
178 | - etc. | ||
179 | */ | ||
180 | //#define MIDI_ADVANCED | ||
181 | |||
182 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
183 | //#define MIDI_TONE_KEYCODE_OCTAVES 1 | ||
184 | |||
162 | #endif | 185 | #endif |
diff --git a/quantum/template/keymaps/default/Makefile b/quantum/template/keymaps/default/Makefile index f4671a9d1..29f11bbc7 100644 --- a/quantum/template/keymaps/default/Makefile +++ b/quantum/template/keymaps/default/Makefile | |||
@@ -9,7 +9,7 @@ CONSOLE_ENABLE = no # Console for debug(+400) | |||
9 | COMMAND_ENABLE = yes # Commands for debug and configuration | 9 | COMMAND_ENABLE = yes # Commands for debug and configuration |
10 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 10 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
11 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | 11 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality |
12 | MIDI_ENABLE = no # MIDI controls | 12 | MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) |
13 | AUDIO_ENABLE = no # Audio output on port C6 | 13 | AUDIO_ENABLE = no # Audio output on port C6 |
14 | UNICODE_ENABLE = no # Unicode | 14 | UNICODE_ENABLE = no # Unicode |
15 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | 15 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID |
diff --git a/quantum/template/rules.mk b/quantum/template/rules.mk index bad3387bf..a1f9377d8 100644 --- a/quantum/template/rules.mk +++ b/quantum/template/rules.mk | |||
@@ -61,7 +61,7 @@ SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | |||
61 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 61 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
62 | NKRO_ENABLE ?= no # USB Nkey Rollover | 62 | NKRO_ENABLE ?= no # USB Nkey Rollover |
63 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default | 63 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default |
64 | MIDI_ENABLE ?= no # MIDI controls | 64 | MIDI_ENABLE ?= no # MIDI support (+2400 to 4200, depending on config) |
65 | UNICODE_ENABLE ?= no # Unicode | 65 | UNICODE_ENABLE ?= no # Unicode |
66 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | 66 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID |
67 | AUDIO_ENABLE ?= no # Audio output on port C6 | 67 | AUDIO_ENABLE ?= no # Audio output on port C6 |
diff --git a/tmk_core/common.mk b/tmk_core/common.mk index a86dccc61..47f6fc571 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk | |||
@@ -93,14 +93,20 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) | |||
93 | TMK_COMMON_DEFS += -DBACKLIGHT_ENABLE | 93 | TMK_COMMON_DEFS += -DBACKLIGHT_ENABLE |
94 | endif | 94 | endif |
95 | 95 | ||
96 | ifeq ($(strip $(ADAFRUIT_BLE_ENABLE)), yes) | ||
97 | TMK_COMMON_DEFS += -DADAFRUIT_BLE_ENABLE | ||
98 | endif | ||
99 | |||
100 | ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) | 96 | ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) |
101 | TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE | 97 | TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE |
102 | endif | 98 | endif |
103 | 99 | ||
100 | ifeq ($(strip $(BLUETOOTH)), AdafruitBLE) | ||
101 | TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE | ||
102 | TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_BLE | ||
103 | endif | ||
104 | |||
105 | ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey) | ||
106 | TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE | ||
107 | TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_EZKEY | ||
108 | endif | ||
109 | |||
104 | ifeq ($(strip $(ONEHAND_ENABLE)), yes) | 110 | ifeq ($(strip $(ONEHAND_ENABLE)), yes) |
105 | TMK_COMMON_DEFS += -DONEHAND_ENABLE | 111 | TMK_COMMON_DEFS += -DONEHAND_ENABLE |
106 | endif | 112 | endif |
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index ff78d7f2a..bd9a69ae0 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c | |||
@@ -228,6 +228,7 @@ bool process_tapping(keyrecord_t *keyp) | |||
228 | if (WITHIN_TAPPING_TERM(event)) { | 228 | if (WITHIN_TAPPING_TERM(event)) { |
229 | if (event.pressed) { | 229 | if (event.pressed) { |
230 | if (IS_TAPPING_KEY(event.key)) { | 230 | if (IS_TAPPING_KEY(event.key)) { |
231 | #ifndef TAPPING_FORCE_HOLD | ||
231 | if (!tapping_key.tap.interrupted && tapping_key.tap.count > 0) { | 232 | if (!tapping_key.tap.interrupted && tapping_key.tap.count > 0) { |
232 | // sequential tap. | 233 | // sequential tap. |
233 | keyp->tap = tapping_key.tap; | 234 | keyp->tap = tapping_key.tap; |
@@ -237,11 +238,11 @@ bool process_tapping(keyrecord_t *keyp) | |||
237 | tapping_key = *keyp; | 238 | tapping_key = *keyp; |
238 | debug_tapping_key(); | 239 | debug_tapping_key(); |
239 | return true; | 240 | return true; |
240 | } else { | ||
241 | // FIX: start new tap again | ||
242 | tapping_key = *keyp; | ||
243 | return true; | ||
244 | } | 241 | } |
242 | #endif | ||
243 | // FIX: start new tap again | ||
244 | tapping_key = *keyp; | ||
245 | return true; | ||
245 | } else if (is_tap_key(event.key)) { | 246 | } else if (is_tap_key(event.key)) { |
246 | // Sequential tap can be interfered with other tap key. | 247 | // Sequential tap can be interfered with other tap key. |
247 | debug("Tapping: Start with interfering other tap.\n"); | 248 | debug("Tapping: Start with interfering other tap.\n"); |
diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk index de0cc795f..5b1577972 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa.mk | |||
@@ -22,11 +22,16 @@ ifeq ($(strip $(MIDI_ENABLE)), yes) | |||
22 | include $(TMK_PATH)/protocol/midi.mk | 22 | include $(TMK_PATH)/protocol/midi.mk |
23 | endif | 23 | endif |
24 | 24 | ||
25 | ifeq ($(strip $(ADAFRUIT_BLE_ENABLE)), yes) | 25 | ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) |
26 | LUFA_SRC += $(LUFA_DIR)/adafruit_ble.cpp | 26 | LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ |
27 | $(TMK_DIR)/protocol/serial_uart.c | ||
27 | endif | 28 | endif |
28 | 29 | ||
29 | ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) | 30 | ifeq ($(strip $(BLUETOOTH)), AdafruitBLE) |
31 | LUFA_SRC += $(LUFA_DIR)/adafruit_ble.cpp | ||
32 | endif | ||
33 | |||
34 | ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey) | ||
30 | LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ | 35 | LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ |
31 | $(TMK_DIR)/protocol/serial_uart.c | 36 | $(TMK_DIR)/protocol/serial_uart.c |
32 | endif | 37 | endif |
@@ -54,6 +59,7 @@ LUFA_OPTS += -DUSE_FLASH_DESCRIPTORS | |||
54 | LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" | 59 | LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" |
55 | #LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT | 60 | #LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT |
56 | LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 | 61 | LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 |
62 | LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 | ||
57 | LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1 | 63 | LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1 |
58 | 64 | ||
59 | # Remote wakeup fix for ATmega32U2 https://github.com/tmk/tmk_keyboard/issues/361 | 65 | # Remote wakeup fix for ATmega32U2 https://github.com/tmk/tmk_keyboard/issues/361 |
diff --git a/tmk_core/protocol/lufa/adafruit_ble.h b/tmk_core/protocol/lufa/adafruit_ble.h index 351fd55ae..b3bab3ca0 100644 --- a/tmk_core/protocol/lufa/adafruit_ble.h +++ b/tmk_core/protocol/lufa/adafruit_ble.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * Supports the Adafruit BLE board built around the nRF51822 chip. | 3 | * Supports the Adafruit BLE board built around the nRF51822 chip. |
4 | */ | 4 | */ |
5 | #pragma once | 5 | #pragma once |
6 | #ifdef ADAFRUIT_BLE_ENABLE | 6 | #ifdef MODULE_ADAFRUIT_BLE |
7 | #include <stdbool.h> | 7 | #include <stdbool.h> |
8 | #include <stdint.h> | 8 | #include <stdint.h> |
9 | #include <string.h> | 9 | #include <string.h> |
@@ -57,4 +57,4 @@ extern bool adafruit_ble_set_power_level(int8_t level); | |||
57 | } | 57 | } |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #endif // ADAFRUIT_BLE_ENABLE | 60 | #endif // MODULE_ADAFRUIT_BLE |
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index ba49284c9..60cba8d2a 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
@@ -67,10 +67,11 @@ | |||
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | #ifdef BLUETOOTH_ENABLE | 69 | #ifdef BLUETOOTH_ENABLE |
70 | #include "bluetooth.h" | 70 | #ifdef MODULE_ADAFRUIT_BLE |
71 | #endif | ||
72 | #ifdef ADAFRUIT_BLE_ENABLE | ||
73 | #include "adafruit_ble.h" | 71 | #include "adafruit_ble.h" |
72 | #else | ||
73 | #include "bluetooth.h" | ||
74 | #endif | ||
74 | #endif | 75 | #endif |
75 | 76 | ||
76 | #ifdef VIRTSER_ENABLE | 77 | #ifdef VIRTSER_ENABLE |
@@ -602,18 +603,16 @@ static void send_keyboard(report_keyboard_t *report) | |||
602 | uint8_t where = where_to_send(); | 603 | uint8_t where = where_to_send(); |
603 | 604 | ||
604 | #ifdef BLUETOOTH_ENABLE | 605 | #ifdef BLUETOOTH_ENABLE |
605 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { | 606 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { |
606 | bluefruit_serial_send(0xFD); | 607 | #ifdef MODULE_ADAFRUIT_BLE |
607 | for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { | ||
608 | bluefruit_serial_send(report->raw[i]); | ||
609 | } | ||
610 | } | ||
611 | #endif | ||
612 | |||
613 | #ifdef ADAFRUIT_BLE_ENABLE | ||
614 | if (where == OUTPUT_ADAFRUIT_BLE) { | ||
615 | adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys)); | 608 | adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys)); |
616 | } | 609 | #else |
610 | bluefruit_serial_send(0xFD); | ||
611 | for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { | ||
612 | bluefruit_serial_send(report->raw[i]); | ||
613 | } | ||
614 | #endif | ||
615 | } | ||
617 | #endif | 616 | #endif |
618 | 617 | ||
619 | if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) { | 618 | if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) { |
@@ -660,24 +659,22 @@ static void send_mouse(report_mouse_t *report) | |||
660 | uint8_t where = where_to_send(); | 659 | uint8_t where = where_to_send(); |
661 | 660 | ||
662 | #ifdef BLUETOOTH_ENABLE | 661 | #ifdef BLUETOOTH_ENABLE |
663 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { | 662 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { |
664 | bluefruit_serial_send(0xFD); | 663 | #ifdef MODULE_ADAFRUIT_BLE |
665 | bluefruit_serial_send(0x00); | ||
666 | bluefruit_serial_send(0x03); | ||
667 | bluefruit_serial_send(report->buttons); | ||
668 | bluefruit_serial_send(report->x); | ||
669 | bluefruit_serial_send(report->y); | ||
670 | bluefruit_serial_send(report->v); // should try sending the wheel v here | ||
671 | bluefruit_serial_send(report->h); // should try sending the wheel h here | ||
672 | bluefruit_serial_send(0x00); | ||
673 | } | ||
674 | #endif | ||
675 | |||
676 | #ifdef ADAFRUIT_BLE_ENABLE | ||
677 | if (where == OUTPUT_ADAFRUIT_BLE) { | ||
678 | // FIXME: mouse buttons | 664 | // FIXME: mouse buttons |
679 | adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h); | 665 | adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h); |
680 | } | 666 | #else |
667 | bluefruit_serial_send(0xFD); | ||
668 | bluefruit_serial_send(0x00); | ||
669 | bluefruit_serial_send(0x03); | ||
670 | bluefruit_serial_send(report->buttons); | ||
671 | bluefruit_serial_send(report->x); | ||
672 | bluefruit_serial_send(report->y); | ||
673 | bluefruit_serial_send(report->v); // should try sending the wheel v here | ||
674 | bluefruit_serial_send(report->h); // should try sending the wheel h here | ||
675 | bluefruit_serial_send(0x00); | ||
676 | #endif | ||
677 | } | ||
681 | #endif | 678 | #endif |
682 | 679 | ||
683 | if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) { | 680 | if (where != OUTPUT_USB && where != OUTPUT_USB_AND_BT) { |
@@ -727,6 +724,9 @@ static void send_consumer(uint16_t data) | |||
727 | 724 | ||
728 | #ifdef BLUETOOTH_ENABLE | 725 | #ifdef BLUETOOTH_ENABLE |
729 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { | 726 | if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { |
727 | #ifdef MODULE_ADAFRUIT_BLE | ||
728 | adafruit_ble_send_consumer_key(data, 0); | ||
729 | #else | ||
730 | static uint16_t last_data = 0; | 730 | static uint16_t last_data = 0; |
731 | if (data == last_data) return; | 731 | if (data == last_data) return; |
732 | last_data = data; | 732 | last_data = data; |
@@ -740,12 +740,7 @@ static void send_consumer(uint16_t data) | |||
740 | bluefruit_serial_send(0x00); | 740 | bluefruit_serial_send(0x00); |
741 | bluefruit_serial_send(0x00); | 741 | bluefruit_serial_send(0x00); |
742 | bluefruit_serial_send(0x00); | 742 | bluefruit_serial_send(0x00); |
743 | } | 743 | #endif |
744 | #endif | ||
745 | |||
746 | #ifdef ADAFRUIT_BLE_ENABLE | ||
747 | if (where == OUTPUT_ADAFRUIT_BLE) { | ||
748 | adafruit_ble_send_consumer_key(data, 0); | ||
749 | } | 744 | } |
750 | #endif | 745 | #endif |
751 | 746 | ||
@@ -1101,16 +1096,23 @@ void cc_callback(MidiDevice * device, | |||
1101 | uint8_t chan, uint8_t num, uint8_t val); | 1096 | uint8_t chan, uint8_t num, uint8_t val); |
1102 | void sysex_callback(MidiDevice * device, | 1097 | void sysex_callback(MidiDevice * device, |
1103 | uint16_t start, uint8_t length, uint8_t * data); | 1098 | uint16_t start, uint8_t length, uint8_t * data); |
1099 | |||
1100 | void setup_midi(void) | ||
1101 | { | ||
1102 | #ifdef MIDI_ADVANCED | ||
1103 | midi_init(); | ||
1104 | #endif | ||
1105 | midi_device_init(&midi_device); | ||
1106 | midi_device_set_send_func(&midi_device, usb_send_func); | ||
1107 | midi_device_set_pre_input_process_func(&midi_device, usb_get_midi); | ||
1108 | } | ||
1104 | #endif | 1109 | #endif |
1105 | 1110 | ||
1106 | int main(void) __attribute__ ((weak)); | 1111 | int main(void) __attribute__ ((weak)); |
1107 | int main(void) | 1112 | int main(void) |
1108 | { | 1113 | { |
1109 | |||
1110 | #ifdef MIDI_ENABLE | 1114 | #ifdef MIDI_ENABLE |
1111 | midi_device_init(&midi_device); | 1115 | setup_midi(); |
1112 | midi_device_set_send_func(&midi_device, usb_send_func); | ||
1113 | midi_device_set_pre_input_process_func(&midi_device, usb_get_midi); | ||
1114 | #endif | 1116 | #endif |
1115 | 1117 | ||
1116 | setup_mcu(); | 1118 | setup_mcu(); |
@@ -1130,7 +1132,7 @@ int main(void) | |||
1130 | // midi_send_noteoff(&midi_device, 0, 64, 127); | 1132 | // midi_send_noteoff(&midi_device, 0, 64, 127); |
1131 | #endif | 1133 | #endif |
1132 | 1134 | ||
1133 | #ifdef BLUETOOTH_ENABLE | 1135 | #ifdef MODULE_ADAFRUIT_EZKEY |
1134 | serial_init(); | 1136 | serial_init(); |
1135 | #endif | 1137 | #endif |
1136 | 1138 | ||
@@ -1161,7 +1163,7 @@ int main(void) | |||
1161 | 1163 | ||
1162 | print("Keyboard start.\n"); | 1164 | print("Keyboard start.\n"); |
1163 | while (1) { | 1165 | while (1) { |
1164 | #if !defined(BLUETOOTH_ENABLE) && !defined(ADAFRUIT_BLE_ENABLE) | 1166 | #if !defined(BLUETOOTH_ENABLE) |
1165 | while (USB_DeviceState == DEVICE_STATE_Suspended) { | 1167 | while (USB_DeviceState == DEVICE_STATE_Suspended) { |
1166 | print("[s]"); | 1168 | print("[s]"); |
1167 | suspend_power_down(); | 1169 | suspend_power_down(); |
@@ -1175,14 +1177,16 @@ int main(void) | |||
1175 | 1177 | ||
1176 | #ifdef MIDI_ENABLE | 1178 | #ifdef MIDI_ENABLE |
1177 | midi_device_process(&midi_device); | 1179 | midi_device_process(&midi_device); |
1178 | // MIDI_Task(); | 1180 | #ifdef MIDI_ADVANCED |
1181 | midi_task(); | ||
1182 | #endif | ||
1179 | #endif | 1183 | #endif |
1180 | 1184 | ||
1181 | #if defined(RGBLIGHT_ANIMATIONS) & defined(RGBLIGHT_ENABLE) | 1185 | #if defined(RGBLIGHT_ANIMATIONS) & defined(RGBLIGHT_ENABLE) |
1182 | rgblight_task(); | 1186 | rgblight_task(); |
1183 | #endif | 1187 | #endif |
1184 | 1188 | ||
1185 | #ifdef ADAFRUIT_BLE_ENABLE | 1189 | #ifdef MODULE_ADAFRUIT_BLE |
1186 | adafruit_ble_task(); | 1190 | adafruit_ble_task(); |
1187 | #endif | 1191 | #endif |
1188 | 1192 | ||
diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index a049fd43c..a51573786 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h | |||
@@ -49,7 +49,7 @@ | |||
49 | #include <LUFA/Drivers/USB/USB.h> | 49 | #include <LUFA/Drivers/USB/USB.h> |
50 | #include "host.h" | 50 | #include "host.h" |
51 | #ifdef MIDI_ENABLE | 51 | #ifdef MIDI_ENABLE |
52 | #include "midi.h" | 52 | #include "process_midi.h" |
53 | #endif | 53 | #endif |
54 | #ifdef __cplusplus | 54 | #ifdef __cplusplus |
55 | extern "C" { | 55 | extern "C" { |
diff --git a/tmk_core/protocol/lufa/outputselect.c b/tmk_core/protocol/lufa/outputselect.c index 5d2457bff..0df5d3b75 100644 --- a/tmk_core/protocol/lufa/outputselect.c +++ b/tmk_core/protocol/lufa/outputselect.c | |||
@@ -14,7 +14,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
14 | 14 | ||
15 | #include "lufa.h" | 15 | #include "lufa.h" |
16 | #include "outputselect.h" | 16 | #include "outputselect.h" |
17 | #ifdef ADAFRUIT_BLE_ENABLE | 17 | #ifdef MODULE_ADAFRUIT_BLE |
18 | #include "adafruit_ble.h" | 18 | #include "adafruit_ble.h" |
19 | #endif | 19 | #endif |
20 | 20 | ||
@@ -34,9 +34,9 @@ uint8_t auto_detect_output(void) { | |||
34 | return OUTPUT_USB; | 34 | return OUTPUT_USB; |
35 | } | 35 | } |
36 | 36 | ||
37 | #ifdef ADAFRUIT_BLE_ENABLE | 37 | #ifdef MODULE_ADAFRUIT_BLE |
38 | if (adafruit_ble_is_connected()) { | 38 | if (adafruit_ble_is_connected()) { |
39 | return OUTPUT_ADAFRUIT_BLE; | 39 | return OUTPUT_BLUETOOTH; |
40 | } | 40 | } |
41 | #endif | 41 | #endif |
42 | 42 | ||
diff --git a/tmk_core/protocol/lufa/outputselect.h b/tmk_core/protocol/lufa/outputselect.h index 79b4dd35d..28cc3298e 100644 --- a/tmk_core/protocol/lufa/outputselect.h +++ b/tmk_core/protocol/lufa/outputselect.h | |||
@@ -18,7 +18,6 @@ enum outputs { | |||
18 | OUTPUT_NONE, | 18 | OUTPUT_NONE, |
19 | OUTPUT_USB, | 19 | OUTPUT_USB, |
20 | OUTPUT_BLUETOOTH, | 20 | OUTPUT_BLUETOOTH, |
21 | OUTPUT_ADAFRUIT_BLE, | ||
22 | 21 | ||
23 | // backward compatibility | 22 | // backward compatibility |
24 | OUTPUT_USB_AND_BT | 23 | OUTPUT_USB_AND_BT |