aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile3
-rw-r--r--build_keyboard.mk15
-rw-r--r--common.mk1
-rw-r--r--keyboards/amj60/config.h2
-rw-r--r--keyboards/atreus62/Makefile3
-rw-r--r--keyboards/atreus62/atreus62.c1
-rw-r--r--keyboards/atreus62/atreus62.h26
-rw-r--r--keyboards/atreus62/config.h83
-rw-r--r--keyboards/atreus62/keymaps/default/keymap.c71
-rw-r--r--keyboards/atreus62/pro_micro.h362
-rw-r--r--keyboards/atreus62/readme.md10
-rw-r--r--keyboards/atreus62/rules.mk66
-rw-r--r--keyboards/clueboard/rev1/config.h2
-rw-r--r--keyboards/clueboard/rev2/config.h2
-rw-r--r--keyboards/cluecard/config.h2
-rw-r--r--keyboards/cluecard/keymaps/rgb_effects/config.h2
-rw-r--r--keyboards/cluepad/config.h2
-rw-r--r--keyboards/ergodox/config.h7
-rw-r--r--keyboards/ergodox/ez/Makefile7
-rw-r--r--keyboards/ergodox/ez/config.h13
-rw-r--r--keyboards/ergodox/ez/ez.c10
-rw-r--r--keyboards/ergodox/ez/matrix.c2
-rw-r--r--keyboards/ergodox/ez/rules.mk2
-rw-r--r--keyboards/ergodox/infinity/infinity.c6
-rw-r--r--keyboards/ergodox/infinity/led.c25
-rw-r--r--keyboards/ergodox/infinity/rules.mk2
-rw-r--r--keyboards/ergodox/keymaps/bepo/Makefile9
-rw-r--r--keyboards/ergodox/keymaps/bepo/bepo.pngbin79747 -> 80249 bytes
-rw-r--r--keyboards/ergodox/keymaps/bepo/keymap.c335
-rw-r--r--keyboards/ergodox/keymaps/bepo/readme.md6
-rw-r--r--keyboards/ergodox/keymaps/default/keymap.c84
-rwxr-xr-xkeyboards/ergodox/keymaps/dvorak_emacs/keymap.c165
-rw-r--r--keyboards/ergodox/keymaps/dvorak_emacs/readme.md70
-rw-r--r--keyboards/ergodox/keymaps/erez_experimental/Makefile2
-rw-r--r--keyboards/ergodox/keymaps/erez_experimental/config.h1
-rw-r--r--keyboards/ergodox/keymaps/erez_experimental/keymap.c42
-rw-r--r--keyboards/ergodox/keymaps/galson/Makefile2
-rw-r--r--keyboards/ergodox/keymaps/galson/keymap.c183
-rw-r--r--keyboards/ergodox/keymaps/galson/readme.md11
-rw-r--r--keyboards/ergodox/keymaps/jack/Makefile6
-rw-r--r--keyboards/ergodox/keymaps/jack/config.h17
-rw-r--r--keyboards/ergodox/keymaps/jack/keymap.c22
-rw-r--r--keyboards/ergodox/keymaps/kristian/keymap.c79
-rw-r--r--keyboards/ergodox/keymaps/robot_test_layout/keymap.c151
-rw-r--r--keyboards/ergodox/keymaps/robot_test_layout/readme.md5
-rw-r--r--keyboards/ergodox/rules.mk1
-rw-r--r--keyboards/gh60/gh60.h43
-rw-r--r--keyboards/gh60/keymaps/default/keymap.c36
-rw-r--r--keyboards/gh60/keymaps/robotmaxtron/config.h2
-rw-r--r--keyboards/gh60/keymaps/robotmaxtron/keymap.c58
-rw-r--r--keyboards/gh60/keymaps/sethbc/Makefile3
-rw-r--r--keyboards/gh60/keymaps/sethbc/keymap.c76
-rw-r--r--keyboards/handwired/minorca/keymaps/rgb/config.h2
-rw-r--r--keyboards/handwired/promethium/Makefile3
-rw-r--r--keyboards/handwired/promethium/config.h162
-rw-r--r--keyboards/handwired/promethium/keymaps/priyadi/Makefile29
-rw-r--r--keyboards/handwired/promethium/keymaps/priyadi/config.h17
-rwxr-xr-xkeyboards/handwired/promethium/keymaps/priyadi/flash.sh4
-rw-r--r--keyboards/handwired/promethium/keymaps/priyadi/keymap.c841
-rw-r--r--keyboards/handwired/promethium/keymaps/priyadi/readme.md0
-rw-r--r--keyboards/handwired/promethium/keymaps/readme.md22
-rw-r--r--keyboards/handwired/promethium/promethium.c6
-rw-r--r--keyboards/handwired/promethium/promethium.h101
-rw-r--r--keyboards/handwired/promethium/readme.md13
-rw-r--r--keyboards/handwired/promethium/rgbsps.c24
-rw-r--r--keyboards/handwired/promethium/rgbsps.h4
-rw-r--r--keyboards/handwired/promethium/rules.mk74
-rw-r--r--keyboards/hhkb/keymaps/sh_jp/Makefile1
-rw-r--r--keyboards/hhkb/keymaps/sh_jp/README.md86
-rw-r--r--keyboards/hhkb/keymaps/sh_jp/keymap.c60
-rw-r--r--keyboards/jd40/config.h2
-rw-r--r--keyboards/kc60/keymaps/ws2812/config.h2
-rw-r--r--keyboards/lets_split/config.h3
-rw-r--r--keyboards/lets_split/keymaps/i2c/config.h2
-rw-r--r--keyboards/lets_split/keymaps/serial/config.h2
-rw-r--r--keyboards/phantom/config.h2
-rw-r--r--keyboards/planck/keymaps/bone2planck/Makefile4
-rw-r--r--keyboards/planck/keymaps/brandon/Makefile4
-rw-r--r--keyboards/planck/keymaps/cbbrowne/Makefile7
-rw-r--r--keyboards/planck/keymaps/cbbrowne/config.h3
-rw-r--r--keyboards/planck/keymaps/cbbrowne/keymap.c10
-rw-r--r--keyboards/planck/keymaps/default/Makefile8
-rw-r--r--keyboards/planck/keymaps/default/keymap.c4
-rw-r--r--keyboards/planck/keymaps/experimental/config.h2
-rw-r--r--keyboards/planck/keymaps/impossible/Makefile4
-rw-r--r--keyboards/planck/keymaps/jeebak/Makefile4
-rw-r--r--keyboards/planck/keymaps/jhenahan/Makefile4
-rw-r--r--keyboards/planck/keymaps/joe/Makefile5
-rw-r--r--keyboards/planck/keymaps/leo/Makefile5
-rw-r--r--keyboards/planck/keymaps/lucas/Makefile5
-rw-r--r--keyboards/planck/keymaps/mollat/Makefile5
-rw-r--r--keyboards/planck/keymaps/nico/Makefile5
-rw-r--r--keyboards/planck/keymaps/premek/Makefile3
-rw-r--r--keyboards/planck/keymaps/priyadi/Makefile3
-rw-r--r--keyboards/planck/keymaps/pvc/Makefile5
-rw-r--r--keyboards/planck/keymaps/sgoodwin/Makefile5
-rw-r--r--keyboards/planck/keymaps/tak3over/Makefile5
-rw-r--r--keyboards/planck/keymaps/thermal_printer/Makefile29
-rw-r--r--keyboards/planck/keymaps/thermal_printer/config.h23
-rw-r--r--keyboards/planck/keymaps/thermal_printer/keymap.c314
-rw-r--r--keyboards/planck/keymaps/thermal_printer/readme.md2
-rw-r--r--keyboards/planck/keymaps/vifon/Makefile3
-rw-r--r--keyboards/planck/keymaps/yang/config.h2
-rw-r--r--keyboards/planck/planck.c2
-rw-r--r--keyboards/planck/rules.mk3
-rw-r--r--keyboards/preonic/config.h2
-rw-r--r--keyboards/preonic/keymaps/default/Makefile22
-rw-r--r--keyboards/preonic/keymaps/kinesis/config.h2
-rw-r--r--keyboards/preonic/rules.mk3
-rw-r--r--keyboards/satan/config.h2
-rw-r--r--keyboards/tada68/config.h2
-rw-r--r--quantum/api.c178
-rw-r--r--quantum/api.h59
-rw-r--r--quantum/api/api_sysex.c29
-rw-r--r--quantum/api/api_sysex.h10
-rw-r--r--quantum/config_common.h147
-rw-r--r--quantum/keymap.h4
-rw-r--r--quantum/keymap_extras/keymap_jp.h62
-rw-r--r--quantum/keymap_extras/keymap_nordic.h2
-rwxr-xr-xquantum/light_ws2812.c151
-rwxr-xr-xquantum/light_ws2812.h21
-rw-r--r--quantum/pincontrol.h37
-rw-r--r--quantum/process_keycode/process_printer.c254
-rw-r--r--quantum/process_keycode/process_printer.h8
-rw-r--r--quantum/process_keycode/process_printer_bb.c260
-rw-r--r--quantum/process_keycode/process_unicode.h1
-rw-r--r--quantum/quantum.c59
-rw-r--r--quantum/quantum.h11
-rw-r--r--quantum/rgblight.c145
-rw-r--r--quantum/rgblight.h15
-rw-r--r--readme.md1274
-rw-r--r--tmk_core/common.mk10
-rw-r--r--tmk_core/common/avr/suspend.c11
-rw-r--r--tmk_core/common/avr/timer.c36
-rw-r--r--tmk_core/common/backlight.c4
-rw-r--r--tmk_core/common/host_driver.h9
-rw-r--r--tmk_core/common/raw_hid.h8
-rw-r--r--tmk_core/protocol/lufa.mk4
-rw-r--r--tmk_core/protocol/lufa/adafruit_ble.cpp805
-rw-r--r--tmk_core/protocol/lufa/adafruit_ble.h60
-rw-r--r--tmk_core/protocol/lufa/descriptor.c87
-rw-r--r--tmk_core/protocol/lufa/descriptor.h35
-rw-r--r--tmk_core/protocol/lufa/lufa.c235
-rw-r--r--tmk_core/protocol/lufa/lufa.h13
-rw-r--r--tmk_core/protocol/lufa/ringbuffer.hpp66
-rw-r--r--tmk_core/protocol/midi.mk1
-rw-r--r--tmk_core/protocol/ps2_mouse.c330
-rw-r--r--tmk_core/protocol/ps2_mouse.h131
-rw-r--r--tmk_core/ring_buffer.h26
149 files changed, 6676 insertions, 2031 deletions
diff --git a/Dockerfile b/Dockerfile
index 744ded857..c42bbeb32 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,5 +25,4 @@ ENV subproject=ez
25ENV keymap=default 25ENV keymap=default
26 26
27VOLUME /qmk 27VOLUME /qmk
28WORKDIR /qmk 28WORKDIR /qmk \ No newline at end of file
29CMD make clean ; make keyboard=${keyboard} subproject=${subproject} keymap=${keymap}
diff --git a/build_keyboard.mk b/build_keyboard.mk
index 61aebf393..ce505de12 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -131,6 +131,14 @@ ifndef CUSTOM_MATRIX
131 SRC += $(QUANTUM_DIR)/matrix.c 131 SRC += $(QUANTUM_DIR)/matrix.c
132endif 132endif
133 133
134ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
135 OPT_DEFS += -DAPI_SYSEX_ENABLE
136 SRC += $(QUANTUM_DIR)/api/api_sysex.c
137 OPT_DEFS += -DAPI_ENABLE
138 SRC += $(QUANTUM_DIR)/api.c
139 MIDI_ENABLE=yes
140endif
141
134ifeq ($(strip $(MIDI_ENABLE)), yes) 142ifeq ($(strip $(MIDI_ENABLE)), yes)
135 OPT_DEFS += -DMIDI_ENABLE 143 OPT_DEFS += -DMIDI_ENABLE
136 SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c 144 SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
@@ -174,6 +182,12 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
174 SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c 182 SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
175endif 183endif
176 184
185ifeq ($(strip $(PRINTING_ENABLE)), yes)
186 OPT_DEFS += -DPRINTING_ENABLE
187 SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
188 SRC += $(TMK_DIR)/protocol/serial_uart.c
189endif
190
177ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) 191ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
178 SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC)) 192 SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
179 OPT_DEFS += $(SERIAL_DEFS) 193 OPT_DEFS += $(SERIAL_DEFS)
@@ -199,6 +213,7 @@ endif
199VPATH += $(KEYBOARD_PATH) 213VPATH += $(KEYBOARD_PATH)
200VPATH += $(COMMON_VPATH) 214VPATH += $(COMMON_VPATH)
201 215
216include $(TMK_PATH)/protocol.mk
202 217
203include $(TMK_PATH)/common.mk 218include $(TMK_PATH)/common.mk
204SRC += $(TMK_COMMON_SRC) 219SRC += $(TMK_COMMON_SRC)
diff --git a/common.mk b/common.mk
index 18751cd5a..c4b9394a2 100644
--- a/common.mk
+++ b/common.mk
@@ -23,4 +23,5 @@ COMMON_VPATH += $(QUANTUM_PATH)
23COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras 23COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras
24COMMON_VPATH += $(QUANTUM_PATH)/audio 24COMMON_VPATH += $(QUANTUM_PATH)/audio
25COMMON_VPATH += $(QUANTUM_PATH)/process_keycode 25COMMON_VPATH += $(QUANTUM_PATH)/process_keycode
26COMMON_VPATH += $(QUANTUM_PATH)/api
26COMMON_VPATH += $(SERIAL_PATH) \ No newline at end of file 27COMMON_VPATH += $(SERIAL_PATH) \ No newline at end of file
diff --git a/keyboards/amj60/config.h b/keyboards/amj60/config.h
index d98e0e9f2..7c06f9a6c 100644
--- a/keyboards/amj60/config.h
+++ b/keyboards/amj60/config.h
@@ -67,7 +67,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
67 */ 67 */
68 68
69#define RGB_DI_PIN E2 69#define RGB_DI_PIN E2
70#define RGBLIGHT_TIMER 70#define RGBLIGHT_ANIMATIONS
71#define RGBLED_NUM 8 // Number of LEDs 71#define RGBLED_NUM 8 // Number of LEDs
72#define RGBLIGHT_HUE_STEP 10 72#define RGBLIGHT_HUE_STEP 10
73#define RGBLIGHT_SAT_STEP 17 73#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/atreus62/Makefile b/keyboards/atreus62/Makefile
new file mode 100644
index 000000000..4e2a6f00f
--- /dev/null
+++ b/keyboards/atreus62/Makefile
@@ -0,0 +1,3 @@
1ifndef MAKEFILE_INCLUDED
2 include ../../Makefile
3endif \ No newline at end of file
diff --git a/keyboards/atreus62/atreus62.c b/keyboards/atreus62/atreus62.c
new file mode 100644
index 000000000..ba5bce989
--- /dev/null
+++ b/keyboards/atreus62/atreus62.c
@@ -0,0 +1 @@
#include "atreus62.h" \ No newline at end of file
diff --git a/keyboards/atreus62/atreus62.h b/keyboards/atreus62/atreus62.h
new file mode 100644
index 000000000..eacf5b451
--- /dev/null
+++ b/keyboards/atreus62/atreus62.h
@@ -0,0 +1,26 @@
1#ifndef ATREUS62_H
2#define ATREUS62_H
3
4#include "quantum.h"
5
6void promicro_bootloader_jmp(bool program);
7
8// This a shortcut to help you visually see your layout.
9// The first section contains all of the arguements
10// The second converts the arguments into a two-dimensional array
11#define KEYMAP( \
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, \
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, \
16 k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, k4d \
17) \
18{ \
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 }, \
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 }, \
23 { k40, k41, k42, k43, k44, k45, k47, k48, k49, k4a, k4b, k4c, k4d } \
24}
25
26#endif \ No newline at end of file
diff --git a/keyboards/atreus62/config.h b/keyboards/atreus62/config.h
new file mode 100644
index 000000000..90a4aa05a
--- /dev/null
+++ b/keyboards/atreus62/config.h
@@ -0,0 +1,83 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along 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
25#define VENDOR_ID 0xFEED
26#define PRODUCT_ID 0x6062
27#define DEVICE_VER 0x0001
28#define MANUFACTURER Profet
29#define PRODUCT Atreus62
30#define DESCRIPTION q.m.k. keyboard firmware for Atreus62
31
32/* key matrix size */
33// Rows are doubled-up
34#define MATRIX_ROWS 5
35#define MATRIX_COLS 13
36
37// wiring of each half
38#define MATRIX_ROW_PINS { D2, D3, D1, D0, D4 }
39#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6, B5, B4, E6, D7, C6 }
40
41#define CATERINA_BOOTLOADER
42
43/* COL2ROW or ROW2COL */
44#define DIODE_DIRECTION ROW2COL
45
46/* define if matrix has ghost */
47//#define MATRIX_HAS_GHOST
48
49/* number of backlight levels */
50// #define BACKLIGHT_LEVELS 3
51
52/* Set 0 if debouncing isn't needed */
53#define DEBOUNCING_DELAY 5
54
55/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
56#define LOCKING_SUPPORT_ENABLE
57/* Locking resynchronize hack */
58#define LOCKING_RESYNC_ENABLE
59
60/* key combination for command */
61#define IS_COMMAND() ( \
62 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
63)
64
65/*
66 * Feature disable options
67 * These options are also useful to firmware size reduction.
68 */
69
70/* disable debug print */
71// #define NO_DEBUG
72
73/* disable print */
74// #define NO_PRINT
75
76/* disable action features */
77//#define NO_ACTION_LAYER
78//#define NO_ACTION_TAPPING
79//#define NO_ACTION_ONESHOT
80//#define NO_ACTION_MACRO
81//#define NO_ACTION_FUNCTION
82
83#endif
diff --git a/keyboards/atreus62/keymaps/default/keymap.c b/keyboards/atreus62/keymaps/default/keymap.c
new file mode 100644
index 000000000..52802c77b
--- /dev/null
+++ b/keyboards/atreus62/keymaps/default/keymap.c
@@ -0,0 +1,71 @@
1// this is the style you want to emulate.
2// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
3
4#include "atreus62.h"
5
6// Each layer gets a name for readability, which is then used in the keymap matrix below.
7// The underscores don't mean anything - you can have a layer called STUFF or any other name.
8// Layer names don't all need to be of the same length, obviously, and you can also skip them
9// entirely and just use numbers.
10#define _DEFAULT 0
11#define _NAV 1
12#define _RESET 2
13
14const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15[_DEFAULT] = { /* qwerty */
16 { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS },
17 { KC_BSLS, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_TRNS, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RBRC },
18 { KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_TRNS, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT },
19 { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_DELT, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LBRC },
20 { KC_LCTL, KC_LGUI, KC_LALT, KC_GRV, MO(_NAV),KC_BSPC, KC_ENT, KC_SPC, KC_EQL, KC_MINS, KC_QUOT, KC_ENT, KC_RGUI }
21},
22
23[_NAV] = {
24 { TO(_DEFAULT), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 },
25 { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F12, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS },
26 { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS },
27 { TO(_RESET), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS },
28 { 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 }
29},
30
31[_RESET] = {
32 { TO(_DEFAULT), KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO },
33 { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO },
34 { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO },
35 { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO },
36 { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , RESET }
37}
38
39
40/*
41[_TRNS] = {
42 { 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 },
43 { 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 },
44 { 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 },
45 { 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 },
46 { 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 }
47},
48*/
49};
50
51
52
53const uint16_t PROGMEM fn_actions[] = {
54
55};
56
57const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
58{
59 // MACRODOWN only works in this function
60 switch (id) {
61 case 0:
62 if (record->event.pressed) {
63 register_code(KC_RSFT);
64 }
65 else {
66 unregister_code(KC_RSFT);
67 }
68 break;
69 }
70 return MACRO_NONE;
71};
diff --git a/keyboards/atreus62/pro_micro.h b/keyboards/atreus62/pro_micro.h
new file mode 100644
index 000000000..f9e7ed75d
--- /dev/null
+++ b/keyboards/atreus62/pro_micro.h
@@ -0,0 +1,362 @@
1/*
2 pins_arduino.h - Pin definition functions for Arduino
3 Part of Arduino - http://www.arduino.cc/
4
5 Copyright (c) 2007 David A. Mellis
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General
18 Public License along with this library; if not, write to the
19 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 Boston, MA 02111-1307 USA
21
22 $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
23*/
24
25#ifndef Pins_Arduino_h
26#define Pins_Arduino_h
27
28#include <avr/pgmspace.h>
29
30// Workaround for wrong definitions in "iom32u4.h".
31// This should be fixed in the AVR toolchain.
32#undef UHCON
33#undef UHINT
34#undef UHIEN
35#undef UHADDR
36#undef UHFNUM
37#undef UHFNUML
38#undef UHFNUMH
39#undef UHFLEN
40#undef UPINRQX
41#undef UPINTX
42#undef UPNUM
43#undef UPRST
44#undef UPCONX
45#undef UPCFG0X
46#undef UPCFG1X
47#undef UPSTAX
48#undef UPCFG2X
49#undef UPIENX
50#undef UPDATX
51#undef TCCR2A
52#undef WGM20
53#undef WGM21
54#undef COM2B0
55#undef COM2B1
56#undef COM2A0
57#undef COM2A1
58#undef TCCR2B
59#undef CS20
60#undef CS21
61#undef CS22
62#undef WGM22
63#undef FOC2B
64#undef FOC2A
65#undef TCNT2
66#undef TCNT2_0
67#undef TCNT2_1
68#undef TCNT2_2
69#undef TCNT2_3
70#undef TCNT2_4
71#undef TCNT2_5
72#undef TCNT2_6
73#undef TCNT2_7
74#undef OCR2A
75#undef OCR2_0
76#undef OCR2_1
77#undef OCR2_2
78#undef OCR2_3
79#undef OCR2_4
80#undef OCR2_5
81#undef OCR2_6
82#undef OCR2_7
83#undef OCR2B
84#undef OCR2_0
85#undef OCR2_1
86#undef OCR2_2
87#undef OCR2_3
88#undef OCR2_4
89#undef OCR2_5
90#undef OCR2_6
91#undef OCR2_7
92
93#define NUM_DIGITAL_PINS 30
94#define NUM_ANALOG_INPUTS 12
95
96#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
97#define TXLED0 PORTD |= (1<<5)
98#define TXLED1 PORTD &= ~(1<<5)
99#define RXLED0 PORTB |= (1<<0)
100#define RXLED1 PORTB &= ~(1<<0)
101
102static const uint8_t SDA = 2;
103static const uint8_t SCL = 3;
104#define LED_BUILTIN 13
105
106// Map SPI port to 'new' pins D14..D17
107static const uint8_t SS = 17;
108static const uint8_t MOSI = 16;
109static const uint8_t MISO = 14;
110static const uint8_t SCK = 15;
111
112// Mapping of analog pins as digital I/O
113// A6-A11 share with digital pins
114static const uint8_t ADC0 = 18;
115static const uint8_t ADC1 = 19;
116static const uint8_t ADC2 = 20;
117static const uint8_t ADC3 = 21;
118static const uint8_t ADC4 = 22;
119static const uint8_t ADC5 = 23;
120static const uint8_t ADC6 = 24; // D4
121static const uint8_t ADC7 = 25; // D6
122static const uint8_t ADC8 = 26; // D8
123static const uint8_t ADC9 = 27; // D9
124static const uint8_t ADC10 = 28; // D10
125static const uint8_t ADC11 = 29; // D12
126
127#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
128#define digitalPinToPCICRbit(p) 0
129#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
130#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
131
132// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
133extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
134#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
135
136#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
137
138#ifdef ARDUINO_MAIN
139
140// On the Arduino board, digital pins are also used
141// for the analog output (software PWM). Analog input
142// pins are a separate set.
143
144// ATMEL ATMEGA32U4 / ARDUINO LEONARDO
145//
146// D0 PD2 RXD1/INT2
147// D1 PD3 TXD1/INT3
148// D2 PD1 SDA SDA/INT1
149// D3# PD0 PWM8/SCL OC0B/SCL/INT0
150// D4 A6 PD4 ADC8
151// D5# PC6 ??? OC3A/#OC4A
152// D6# A7 PD7 FastPWM #OC4D/ADC10
153// D7 PE6 INT6/AIN0
154//
155// D8 A8 PB4 ADC11/PCINT4
156// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5
157// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6
158// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7
159// D12 A11 PD6 T1/#OC4D/ADC9
160// D13# PC7 PWM10 CLK0/OC4A
161//
162// A0 D18 PF7 ADC7
163// A1 D19 PF6 ADC6
164// A2 D20 PF5 ADC5
165// A3 D21 PF4 ADC4
166// A4 D22 PF1 ADC1
167// A5 D23 PF0 ADC0
168//
169// New pins D14..D17 to map SPI port to digital pins
170//
171// MISO D14 PB3 MISO,PCINT3
172// SCK D15 PB1 SCK,PCINT1
173// MOSI D16 PB2 MOSI,PCINT2
174// SS D17 PB0 RXLED,SS/PCINT0
175//
176// Connected LEDs on board for TX and RX
177// TXLED D24 PD5 XCK1
178// RXLED D17 PB0
179// HWB PE2 HWB
180
181// these arrays map port names (e.g. port B) to the
182// appropriate addresses for various functions (e.g. reading
183// and writing)
184const uint16_t PROGMEM port_to_mode_PGM[] = {
185 NOT_A_PORT,
186 NOT_A_PORT,
187 (uint16_t) &DDRB,
188 (uint16_t) &DDRC,
189 (uint16_t) &DDRD,
190 (uint16_t) &DDRE,
191 (uint16_t) &DDRF,
192};
193
194const uint16_t PROGMEM port_to_output_PGM[] = {
195 NOT_A_PORT,
196 NOT_A_PORT,
197 (uint16_t) &PORTB,
198 (uint16_t) &PORTC,
199 (uint16_t) &PORTD,
200 (uint16_t) &PORTE,
201 (uint16_t) &PORTF,
202};
203
204const uint16_t PROGMEM port_to_input_PGM[] = {
205 NOT_A_PORT,
206 NOT_A_PORT,
207 (uint16_t) &PINB,
208 (uint16_t) &PINC,
209 (uint16_t) &PIND,
210 (uint16_t) &PINE,
211 (uint16_t) &PINF,
212};
213
214const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
215 PD, // D0 - PD2
216 PD, // D1 - PD3
217 PD, // D2 - PD1
218 PD, // D3 - PD0
219 PD, // D4 - PD4
220 PC, // D5 - PC6
221 PD, // D6 - PD7
222 PE, // D7 - PE6
223
224 PB, // D8 - PB4
225 PB, // D9 - PB5
226 PB, // D10 - PB6
227 PB, // D11 - PB7
228 PD, // D12 - PD6
229 PC, // D13 - PC7
230
231 PB, // D14 - MISO - PB3
232 PB, // D15 - SCK - PB1
233 PB, // D16 - MOSI - PB2
234 PB, // D17 - SS - PB0
235
236 PF, // D18 - A0 - PF7
237 PF, // D19 - A1 - PF6
238 PF, // D20 - A2 - PF5
239 PF, // D21 - A3 - PF4
240 PF, // D22 - A4 - PF1
241 PF, // D23 - A5 - PF0
242
243 PD, // D24 - PD5
244 PD, // D25 / D6 - A7 - PD7
245 PB, // D26 / D8 - A8 - PB4
246 PB, // D27 / D9 - A9 - PB5
247 PB, // D28 / D10 - A10 - PB6
248 PD, // D29 / D12 - A11 - PD6
249};
250
251const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
252 _BV(2), // D0 - PD2
253 _BV(3), // D1 - PD3
254 _BV(1), // D2 - PD1
255 _BV(0), // D3 - PD0
256 _BV(4), // D4 - PD4
257 _BV(6), // D5 - PC6
258 _BV(7), // D6 - PD7
259 _BV(6), // D7 - PE6
260
261 _BV(4), // D8 - PB4
262 _BV(5), // D9 - PB5
263 _BV(6), // D10 - PB6
264 _BV(7), // D11 - PB7
265 _BV(6), // D12 - PD6
266 _BV(7), // D13 - PC7
267
268 _BV(3), // D14 - MISO - PB3
269 _BV(1), // D15 - SCK - PB1
270 _BV(2), // D16 - MOSI - PB2
271 _BV(0), // D17 - SS - PB0
272
273 _BV(7), // D18 - A0 - PF7
274 _BV(6), // D19 - A1 - PF6
275 _BV(5), // D20 - A2 - PF5
276 _BV(4), // D21 - A3 - PF4
277 _BV(1), // D22 - A4 - PF1
278 _BV(0), // D23 - A5 - PF0
279
280 _BV(5), // D24 - PD5
281 _BV(7), // D25 / D6 - A7 - PD7
282 _BV(4), // D26 / D8 - A8 - PB4
283 _BV(5), // D27 / D9 - A9 - PB5
284 _BV(6), // D28 / D10 - A10 - PB6
285 _BV(6), // D29 / D12 - A11 - PD6
286};
287
288const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
289 NOT_ON_TIMER,
290 NOT_ON_TIMER,
291 NOT_ON_TIMER,
292 TIMER0B, /* 3 */
293 NOT_ON_TIMER,
294 TIMER3A, /* 5 */
295 TIMER4D, /* 6 */
296 NOT_ON_TIMER,
297
298 NOT_ON_TIMER,
299 TIMER1A, /* 9 */
300 TIMER1B, /* 10 */
301 TIMER0A, /* 11 */
302
303 NOT_ON_TIMER,
304 TIMER4A, /* 13 */
305
306 NOT_ON_TIMER,
307 NOT_ON_TIMER,
308 NOT_ON_TIMER,
309 NOT_ON_TIMER,
310 NOT_ON_TIMER,
311 NOT_ON_TIMER,
312
313 NOT_ON_TIMER,
314 NOT_ON_TIMER,
315 NOT_ON_TIMER,
316 NOT_ON_TIMER,
317 NOT_ON_TIMER,
318 NOT_ON_TIMER,
319 NOT_ON_TIMER,
320 NOT_ON_TIMER,
321 NOT_ON_TIMER,
322 NOT_ON_TIMER,
323};
324
325const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
326 7, // A0 PF7 ADC7
327 6, // A1 PF6 ADC6
328 5, // A2 PF5 ADC5
329 4, // A3 PF4 ADC4
330 1, // A4 PF1 ADC1
331 0, // A5 PF0 ADC0
332 8, // A6 D4 PD4 ADC8
333 10, // A7 D6 PD7 ADC10
334 11, // A8 D8 PB4 ADC11
335 12, // A9 D9 PB5 ADC12
336 13, // A10 D10 PB6 ADC13
337 9 // A11 D12 PD6 ADC9
338};
339
340#endif /* ARDUINO_MAIN */
341
342// These serial port names are intended to allow libraries and architecture-neutral
343// sketches to automatically default to the correct port name for a particular type
344// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
345// the first hardware serial port whose RX/TX pins are not dedicated to another use.
346//
347// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
348//
349// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
350//
351// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
352//
353// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
354//
355// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
356// pins are NOT connected to anything by default.
357#define SERIAL_PORT_MONITOR Serial
358#define SERIAL_PORT_USBVIRTUAL Serial
359#define SERIAL_PORT_HARDWARE Serial1
360#define SERIAL_PORT_HARDWARE_OPEN Serial1
361
362#endif /* Pins_Arduino_h */
diff --git a/keyboards/atreus62/readme.md b/keyboards/atreus62/readme.md
new file mode 100644
index 000000000..0245b4f9f
--- /dev/null
+++ b/keyboards/atreus62/readme.md
@@ -0,0 +1,10 @@
1atreus62 keyboard firmware
2======================
3
4This firmware is for the atreus62 keyboard.
5
6This version utilizes a Pro Micro for its controller and has a 62 key layout.
7
8https://github.com/profet23/atreus62
9
10TODO: More information \ No newline at end of file
diff --git a/keyboards/atreus62/rules.mk b/keyboards/atreus62/rules.mk
new file mode 100644
index 000000000..f5d0be23a
--- /dev/null
+++ b/keyboards/atreus62/rules.mk
@@ -0,0 +1,66 @@
1
2# MCU name
3#MCU = at90usb1287
4MCU = atmega32u4
5
6# Processor frequency.
7# This will define a symbol, F_CPU, in all source code files equal to the
8# processor frequency in Hz. You can then use this symbol in your source code to
9# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
10# automatically to create a 32-bit value in your source code.
11#
12# This will be an integer division of F_USB below, as it is sourced by
13# F_USB after it has run through any CPU prescalers. Note that this value
14# does not *change* the processor frequency - it should merely be updated to
15# reflect the processor speed set externally so that the code can use accurate
16# software delays.
17F_CPU = 16000000
18
19#
20# LUFA specific
21#
22# Target architecture (see library "Board Types" documentation).
23ARCH = 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.
36F_USB = $(F_CPU)
37
38# Interrupt driven control endpoint task(+60)
39OPT_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
48OPT_DEFS += -DBOOTLOADER_SIZE=4096
49
50# Build Options
51# change to "no" to disable the options, or define them in the Makefile in
52# the appropriate keymap folder that will get included automatically
53#
54BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
56EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
57CONSOLE_ENABLE ?= yes # Console for debug(+400)
58COMMAND_ENABLE ?= yes # Commands for debug and configuration
59NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
60#BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
61#MIDI_ENABLE ?= no # MIDI controls
62UNICODE_ENABLE ?= yes # Unicode
63#BLUETOOTH_ENABLE ?= yes # Enable Bluetooth with the Adafruit EZ-Key HID
64
65# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
66SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
diff --git a/keyboards/clueboard/rev1/config.h b/keyboards/clueboard/rev1/config.h
index 8c9497232..f40876ffb 100644
--- a/keyboards/clueboard/rev1/config.h
+++ b/keyboards/clueboard/rev1/config.h
@@ -26,7 +26,7 @@
26/* Underlight configuration 26/* Underlight configuration
27 */ 27 */
28#define RGB_DI_PIN B2 28#define RGB_DI_PIN B2
29#define RGBLIGHT_TIMER 29#define RGBLIGHT_ANIMATIONS
30#define RGBLED_NUM 14 // Number of LEDs 30#define RGBLED_NUM 14 // Number of LEDs
31#define RGBLIGHT_HUE_STEP 10 31#define RGBLIGHT_HUE_STEP 10
32#define RGBLIGHT_SAT_STEP 17 32#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/clueboard/rev2/config.h b/keyboards/clueboard/rev2/config.h
index 15ca4ece8..8435fd02b 100644
--- a/keyboards/clueboard/rev2/config.h
+++ b/keyboards/clueboard/rev2/config.h
@@ -30,7 +30,7 @@
30/* Underlight configuration 30/* Underlight configuration
31 */ 31 */
32#define RGB_DI_PIN D7 32#define RGB_DI_PIN D7
33#define RGBLIGHT_TIMER 33#define RGBLIGHT_ANIMATIONS
34#define RGBLED_NUM 14 // Number of LEDs 34#define RGBLED_NUM 14 // Number of LEDs
35#define RGBLIGHT_HUE_STEP 10 35#define RGBLIGHT_HUE_STEP 10
36#define RGBLIGHT_SAT_STEP 17 36#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/cluecard/config.h b/keyboards/cluecard/config.h
index 765347b13..6520eb557 100644
--- a/keyboards/cluecard/config.h
+++ b/keyboards/cluecard/config.h
@@ -140,7 +140,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
140/* Underlight configuration 140/* Underlight configuration
141 */ 141 */
142#define RGB_DI_PIN E6 142#define RGB_DI_PIN E6
143//#define RGBLIGHT_TIMER 143//#define RGBLIGHT_ANIMATIONS
144#define RGBLED_NUM 4 // Number of LEDs 144#define RGBLED_NUM 4 // Number of LEDs
145#define RGBLIGHT_HUE_STEP 10 145#define RGBLIGHT_HUE_STEP 10
146#define RGBLIGHT_SAT_STEP 17 146#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/cluecard/keymaps/rgb_effects/config.h b/keyboards/cluecard/keymaps/rgb_effects/config.h
index e88847df4..c6c9342c8 100644
--- a/keyboards/cluecard/keymaps/rgb_effects/config.h
+++ b/keyboards/cluecard/keymaps/rgb_effects/config.h
@@ -4,7 +4,7 @@
4#include "../../config.h" 4#include "../../config.h"
5 5
6// place overrides here 6// place overrides here
7#define RGBLIGHT_TIMER 7#define RGBLIGHT_ANIMATIONS
8#define RGBLIGHT_EFFECT_SNAKE_LENGTH 3 8#define RGBLIGHT_EFFECT_SNAKE_LENGTH 3
9#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 9#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
10#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 2 10#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 2
diff --git a/keyboards/cluepad/config.h b/keyboards/cluepad/config.h
index bae05fade..bd64dfd27 100644
--- a/keyboards/cluepad/config.h
+++ b/keyboards/cluepad/config.h
@@ -70,7 +70,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
70/* Underlight configuration 70/* Underlight configuration
71 */ 71 */
72#define RGB_DI_PIN F6 72#define RGB_DI_PIN F6
73#define RGBLIGHT_TIMER 73#define RGBLIGHT_ANIMATIONS
74#define RGBLED_NUM 4 // Number of LEDs 74#define RGBLED_NUM 4 // Number of LEDs
75#define RGBLIGHT_HUE_STEP 10 75#define RGBLIGHT_HUE_STEP 10
76#define RGBLIGHT_SAT_STEP 17 76#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/ergodox/config.h b/keyboards/ergodox/config.h
index edc60caae..994a8c643 100644
--- a/keyboards/ergodox/config.h
+++ b/keyboards/ergodox/config.h
@@ -1,10 +1,11 @@
1#ifndef KEYBOARDS_ERGODOX_CONFIG_H_ 1#ifndef KEYBOARDS_ERGODOX_CONFIG_H_
2#define KEYBOARDS_ERGODOX_CONFIG_H_ 2#define KEYBOARDS_ERGODOX_CONFIG_H_
3 3
4#define MOUSEKEY_DELAY 100
5#define MOUSEKEY_INTERVAL 20 4#define MOUSEKEY_INTERVAL 20
6#define MOUSEKEY_MAX_SPEED 3 5#define MOUSEKEY_DELAY 0
7#define MOUSEKEY_TIME_TO_MAX 10 6#define MOUSEKEY_TIME_TO_MAX 5
7#define MOUSEKEY_MAX_SPEED 2
8#define MOUSEKEY_WHEEL_DELAY 0
8 9
9#define TAPPING_TOGGLE 1 10#define TAPPING_TOGGLE 1
10 11
diff --git a/keyboards/ergodox/ez/Makefile b/keyboards/ergodox/ez/Makefile
index 191c6bb66..9b6121e2c 100644
--- a/keyboards/ergodox/ez/Makefile
+++ b/keyboards/ergodox/ez/Makefile
@@ -1,3 +1,8 @@
1SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
2COMMAND_ENABLE = no # Commands for debug and configuration
3RGBLIGHT_ENABLE ?= yes
4MIDI_ENABLE ?= yes
5
1ifndef MAKEFILE_INCLUDED 6ifndef MAKEFILE_INCLUDED
2 include ../../../Makefile 7 include ../../../Makefile
3endif \ No newline at end of file 8endif
diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h
index 084a044ee..c2750a321 100644
--- a/keyboards/ergodox/ez/config.h
+++ b/keyboards/ergodox/ez/config.h
@@ -21,6 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21 21
22#include "../config.h" 22#include "../config.h"
23 23
24#include "config_common.h"
25
24/* USB Device descriptor parameter */ 26/* USB Device descriptor parameter */
25#define VENDOR_ID 0xFEED 27#define VENDOR_ID 0xFEED
26#define PRODUCT_ID 0x1307 28#define PRODUCT_ID 0x1307
@@ -39,6 +41,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
39#define LED_BRIGHTNESS_LO 15 41#define LED_BRIGHTNESS_LO 15
40#define LED_BRIGHTNESS_HI 255 42#define LED_BRIGHTNESS_HI 255
41 43
44/* ws2812 RGB LED */
45#define RGB_DI_PIN D7
46#define RGBLIGHT_ANIMATIONS
47#define RGBLED_NUM 15 // Number of LEDs
48#define RGBLIGHT_HUE_STEP 12
49#define RGBLIGHT_SAT_STEP 255
50#define RGBLIGHT_VAL_STEP 12
51
52#define RGB_MIDI
53#define RGBW_BB_TWI
54
42 55
43/* Set 0 if debouncing isn't needed */ 56/* Set 0 if debouncing isn't needed */
44#define DEBOUNCE 5 57#define DEBOUNCE 5
diff --git a/keyboards/ergodox/ez/ez.c b/keyboards/ergodox/ez/ez.c
index ddb8ff0cf..039e4c6bb 100644
--- a/keyboards/ergodox/ez/ez.c
+++ b/keyboards/ergodox/ez/ez.c
@@ -16,10 +16,10 @@ void matrix_init_kb(void) {
16 // unused pins - C7, D4, D5, D7, E6 16 // unused pins - C7, D4, D5, D7, E6
17 // set as input with internal pull-ip enabled 17 // set as input with internal pull-ip enabled
18 DDRC &= ~(1<<7); 18 DDRC &= ~(1<<7);
19 DDRD &= ~(1<<7 | 1<<5 | 1<<4); 19 DDRD &= ~(1<<5 | 1<<4);
20 DDRE &= ~(1<<6); 20 DDRE &= ~(1<<6);
21 PORTC |= (1<<7); 21 PORTC |= (1<<7);
22 PORTD |= (1<<7 | 1<<5 | 1<<4); 22 PORTD |= (1<<5 | 1<<4);
23 PORTE |= (1<<6); 23 PORTE |= (1<<6);
24 24
25 ergodox_blink_all_leds(); 25 ergodox_blink_all_leds();
@@ -51,6 +51,10 @@ uint8_t init_mcp23018(void) {
51 mcp23018_status = 0x20; 51 mcp23018_status = 0x20;
52 52
53 // I2C subsystem 53 // I2C subsystem
54
55 uint8_t sreg_prev;
56 sreg_prev=SREG;
57 cli();
54 if (i2c_initialized == 0) { 58 if (i2c_initialized == 0) {
55 i2c_init(); // on pins D(1,0) 59 i2c_init(); // on pins D(1,0)
56 i2c_initialized++; 60 i2c_initialized++;
@@ -79,6 +83,8 @@ uint8_t init_mcp23018(void) {
79out: 83out:
80 i2c_stop(); 84 i2c_stop();
81 85
86 SREG=sreg_prev;
87
82 return mcp23018_status; 88 return mcp23018_status;
83} 89}
84 90
diff --git a/keyboards/ergodox/ez/matrix.c b/keyboards/ergodox/ez/matrix.c
index a19bab90b..43f515259 100644
--- a/keyboards/ergodox/ez/matrix.c
+++ b/keyboards/ergodox/ez/matrix.c
@@ -121,7 +121,7 @@ void matrix_init(void)
121 matrix_scan_count = 0; 121 matrix_scan_count = 0;
122#endif 122#endif
123 123
124 matrix_init_kb(); 124 matrix_init_quantum();
125 125
126} 126}
127 127
diff --git a/keyboards/ergodox/ez/rules.mk b/keyboards/ergodox/ez/rules.mk
index a9715beb8..893cfa7a8 100644
--- a/keyboards/ergodox/ez/rules.mk
+++ b/keyboards/ergodox/ez/rules.mk
@@ -72,6 +72,8 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512
72# 72#
73 73
74SLEEP_LED_ENABLE = no 74SLEEP_LED_ENABLE = no
75API_SYSEX_ENABLE ?= yes
76RGBLIGHT_ENABLE ?= yes
75 77
76ifndef QUANTUM_DIR 78ifndef QUANTUM_DIR
77 include ../../../Makefile 79 include ../../../Makefile
diff --git a/keyboards/ergodox/infinity/infinity.c b/keyboards/ergodox/infinity/infinity.c
index c5793385f..02db67eaf 100644
--- a/keyboards/ergodox/infinity/infinity.c
+++ b/keyboards/ergodox/infinity/infinity.c
@@ -38,7 +38,6 @@ void init_serial_link_hal(void) {
38// Using a higher pre-scalar without flicker is possible but FTM0_MOD will need to be reduced 38// Using a higher pre-scalar without flicker is possible but FTM0_MOD will need to be reduced
39// Which will reduce the brightness range 39// Which will reduce the brightness range
40#define PRESCALAR_DEFINE 0 40#define PRESCALAR_DEFINE 0
41#ifdef VISUALIZER_ENABLE
42void lcd_backlight_hal_init(void) { 41void lcd_backlight_hal_init(void) {
43 // Setup Backlight 42 // Setup Backlight
44 SIM->SCGC6 |= SIM_SCGC6_FTM0; 43 SIM->SCGC6 |= SIM_SCGC6_FTM0;
@@ -76,7 +75,6 @@ void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b) {
76 CHANNEL_GREEN.CnV = g; 75 CHANNEL_GREEN.CnV = g;
77 CHANNEL_BLUE.CnV = b; 76 CHANNEL_BLUE.CnV = b;
78} 77}
79#endif
80 78
81__attribute__ ((weak)) 79__attribute__ ((weak))
82void matrix_init_user(void) { 80void matrix_init_user(void) {
@@ -92,6 +90,10 @@ void matrix_init_kb(void) {
92 // runs once when the firmware starts up 90 // runs once when the firmware starts up
93 91
94 matrix_init_user(); 92 matrix_init_user();
93 // The backlight always has to be initialized, otherwise it will stay lit
94#ifndef VISUALIZER_ENABLE
95 lcd_backlight_hal_init();
96#endif
95} 97}
96 98
97void matrix_scan_kb(void) { 99void matrix_scan_kb(void) {
diff --git a/keyboards/ergodox/infinity/led.c b/keyboards/ergodox/infinity/led.c
index 77195bb35..8175c1c5c 100644
--- a/keyboards/ergodox/infinity/led.c
+++ b/keyboards/ergodox/infinity/led.c
@@ -21,29 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21 21
22 22
23void led_set(uint8_t usb_led) { 23void led_set(uint8_t usb_led) {
24// The LCD backlight functionality conflicts with this simple 24 //TODO: Add led emulation if there's no customized visualization
25// red backlight
26#if !defined(LCD_BACKLIGHT_ENABLE) && defined(STATUS_LED_ENABLE)
27 // PTC1: LCD Backlight Red(0:on/1:off)
28 GPIOC->PDDR |= (1<<1);
29 PORTC->PCR[1] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
30 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
31 GPIOC->PCOR |= (1<<1);
32 } else {
33 GPIOC->PSOR |= (1<<1);
34 }
35#elif !defined(LCD_BACKLIGHT_ENABLE)
36 (void)usb_led; 25 (void)usb_led;
37 GPIOC->PDDR |= (1<<1);
38 PORTC->PCR[1] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
39 GPIOC->PSOR |= (1<<1);
40 GPIOC->PDDR |= (1<<2);
41 PORTC->PCR[2] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
42 GPIOC->PSOR |= (1<<2);
43 GPIOC->PDDR |= (1<<3);
44 PORTC->PCR[3] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
45 GPIOC->PSOR |= (1<<3);
46#else
47 (void)usb_led;
48#endif
49} 26}
diff --git a/keyboards/ergodox/infinity/rules.mk b/keyboards/ergodox/infinity/rules.mk
index ccb735a48..473a6dfec 100644
--- a/keyboards/ergodox/infinity/rules.mk
+++ b/keyboards/ergodox/infinity/rules.mk
@@ -63,6 +63,8 @@ VISUALIZER_ENABLE ?= no #temporarily disabled to make everything compile
63LCD_ENABLE ?= yes 63LCD_ENABLE ?= yes
64LED_ENABLE ?= yes 64LED_ENABLE ?= yes
65LCD_BACKLIGHT_ENABLE ?= yes 65LCD_BACKLIGHT_ENABLE ?= yes
66MIDI_ENABLE = no
67RGBLIGHT_ENABLE = no
66 68
67ifndef QUANTUM_DIR 69ifndef QUANTUM_DIR
68 include ../../../Makefile 70 include ../../../Makefile
diff --git a/keyboards/ergodox/keymaps/bepo/Makefile b/keyboards/ergodox/keymaps/bepo/Makefile
new file mode 100644
index 000000000..b673c5ce5
--- /dev/null
+++ b/keyboards/ergodox/keymaps/bepo/Makefile
@@ -0,0 +1,9 @@
1# Having a file like this allows you to override Makefile definitions
2# for your own particular keymap
3
4SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
5COMMAND_ENABLE = no # Commands for debug and configuration
6
7ifndef QUANTUM_DIR
8 include ../../../../Makefile
9endif
diff --git a/keyboards/ergodox/keymaps/bepo/bepo.png b/keyboards/ergodox/keymaps/bepo/bepo.png
index 3df7aa609..54992f5ae 100644
--- a/keyboards/ergodox/keymaps/bepo/bepo.png
+++ b/keyboards/ergodox/keymaps/bepo/bepo.png
Binary files differ
diff --git a/keyboards/ergodox/keymaps/bepo/keymap.c b/keyboards/ergodox/keymaps/bepo/keymap.c
index 2d88fc10e..05250ee6a 100644
--- a/keyboards/ergodox/keymaps/bepo/keymap.c
+++ b/keyboards/ergodox/keymaps/bepo/keymap.c
@@ -1,21 +1,23 @@
1#include "ergodox.h" 1#include "ergodox.h"
2#include "debug.h"
3#include "action_layer.h"
4#include "keymap_bepo.h" 2#include "keymap_bepo.h"
3#include "keymap_french.h"
5 4
6#define BASE 0 // default layer 5// keymaps
7#define QWER 1 // qwerty compat layer 6#define BEPO 0 // default layer, for bepo compatible systems
8#define SQWER 2 // shifted qwerty compat layer 7#define QW_B 1 // bepo to qwerty base compat layer, for qwerty systems
9#define AQWER 3 // alted qwerty compat layer 8#define QW_A 2 // bepo with altgr key to qwerty compat layer
10#define FNAV 4 // function / navigation keys 9#define QW_S 3 // bepo with shift key to qwerty compat layer
11#define NUM 5 // numeric keypad keys 10#define AZ_B 4 // bepo to azerty base compat layer, for azerty systems
12#define MSE 6 // mouse keys 11#define AZ_A 5 // bepo with altgr key to azerty compat layer
12#define AZ_S 6 // bepo with shift key to azerty compat layer
13#define FNAV 7 // function / navigation / mouse layer
14#define NUMK 8 // numeric keypad layer
13 15
14#define KP_00 0 16// macros
15#define CA_Fx 1 17#define KP_00 0 // keypad "double 0"
16 18
17const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 19const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
18/* Keymap 0: Base layer 20/* Keymap 0: default layer
19 * 21 *
20 * ,--------------------------------------------------. ,--------------------------------------------------. 22 * ,--------------------------------------------------. ,--------------------------------------------------.
21 * | $ | " | < | > | ( | ) |Delete| |ScroLo| @ | + | - | / | * | = | 23 * | $ | " | < | > | ( | ) |Delete| |ScroLo| @ | + | - | / | * | = |
@@ -26,22 +28,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
26 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------| 28 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------|
27 * | E_CIRC |A_GRAV| Y | X | . | K | | | | ' | Q | G | H | F | C_CEDIL| 29 * | E_CIRC |A_GRAV| Y | X | . | K | | | | ' | Q | G | H | F | C_CEDIL|
28 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------' 30 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
29 * |QWERTY| |LSuper| LCtrl| LAlt| |Escape| L_Mse| | |Insert| | AltGr| RCtrl|RSuper|PrntSc| Pause| 31 * |Escape|Insert|LSuper| LCtrl| LAlt| | BEPO |QWERTY| |AZERTY| BEPO | | AltGr| RCtrl|RSuper|PrntSc| Pause|
30 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------' 32 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------'
31 * | | | L_Num| | CA_Fx| | | 33 * | | |L_NumK| |L_NumK| | |
32 * | Space|LShift|------| |------|RShift|Enter | 34 * | Space|LShift|------| |------|RShift|Enter |
33 * | | |L_FNav| |L_FNav| | | 35 * | | |L_FNav| |L_FNav| | |
34 * `--------------------' `--------------------' 36 * `--------------------' `--------------------'
35 */ 37 */
36[BASE] = KEYMAP( 38[BEPO] = KEYMAP(
37// Left hand 39// Left hand
38BP_DOLLAR, BP_DQOT, BP_LGIL, BP_RGIL, BP_LPRN, BP_RPRN, KC_DEL, 40BP_DOLLAR, BP_DQOT, BP_LGIL, BP_RGIL, BP_LPRN, BP_RPRN, KC_DEL,
39BP_PERCENT, BP_B, BP_E_ACUTE, BP_P, BP_O, BP_E_GRAVE, KC_BSPC, 41BP_PERCENT, BP_B, BP_E_ACUTE, BP_P, BP_O, BP_E_GRAVE, KC_BSPC,
40BP_W, BP_A, BP_U, BP_I, BP_E, BP_COMMA, 42BP_W, BP_A, BP_U, BP_I, BP_E, BP_COMMA,
41BP_ECRC, BP_A_GRAVE, BP_Y, BP_X, BP_DOT, BP_K, KC_TAB, 43BP_ECRC, BP_A_GRAVE, BP_Y, BP_X, BP_DOT, BP_K, KC_TAB,
42TG(QWER), KC_NO, KC_LGUI, KC_LCTL, KC_LALT, 44KC_ESC, KC_INS, KC_LGUI, KC_LCTL, KC_LALT,
43 KC_ESC, MO(MSE), 45 DF(BEPO), DF(QW_B),
44 MO(NUM), 46 MO(NUMK),
45 KC_SPC, KC_LSHIFT, MO(FNAV), 47 KC_SPC, KC_LSHIFT, MO(FNAV),
46// Right hand 48// Right hand
47 KC_SLCK, BP_AT, BP_PLUS, BP_MINUS, BP_SLASH, BP_ASTR, BP_EQUAL, 49 KC_SLCK, BP_AT, BP_PLUS, BP_MINUS, BP_SLASH, BP_ASTR, BP_EQUAL,
@@ -49,10 +51,10 @@ TG(QWER), KC_NO, KC_LGUI, KC_LCTL, KC_LALT,
49 BP_C, BP_T, BP_S, BP_R, BP_N, BP_M, 51 BP_C, BP_T, BP_S, BP_R, BP_N, BP_M,
50 KC_NUMLOCK, BP_APOS, BP_Q, BP_G, BP_H, BP_F, BP_CCED, 52 KC_NUMLOCK, BP_APOS, BP_Q, BP_G, BP_H, BP_F, BP_CCED,
51 BP_ALGR, KC_RCTL, KC_RGUI, KC_PSCREEN, KC_PAUSE, 53 BP_ALGR, KC_RCTL, KC_RGUI, KC_PSCREEN, KC_PAUSE,
52KC_NO, KC_INS, 54DF(AZ_B), DF(BEPO),
53M(CA_Fx), 55MO(NUMK),
54MO(FNAV), KC_RSHIFT, KC_ENTER), 56MO(FNAV), KC_RSHIFT, KC_ENTER),
55/* Keymap 1: QWERTY system compatibility layer 57/* Keymap 1: bepo to qwerty base compat layer
56 * 58 *
57 * ,--------------------------------------------------. ,--------------------------------------------------. 59 * ,--------------------------------------------------. ,--------------------------------------------------.
58 * | $ | " | < | > | ( | ) |Delete| |ScroLo| @ | + | - | / | * | = | 60 * | $ | " | < | > | ( | ) |Delete| |ScroLo| @ | + | - | / | * | = |
@@ -63,33 +65,70 @@ MO(FNAV), KC_RSHIFT, KC_ENTER),
63 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------| 65 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------|
64 * | e | a | y | x | . | k | | | | ' | q | g | h | f | c | 66 * | e | a | y | x | . | k | | | | ' | q | g | h | f | c |
65 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------' 67 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
66 * | BEPO | |LSuper| LCtrl| LAlt| |Escape| L_Mse| | |Insert| | AltGr| RCtrl|RSuper|PrntSc| Pause| 68 * |Escape|Insert|LSuper| LCtrl| LAlt| | BEPO |QWERTY| |AZERTY| BEPO | | AltGr| RCtrl|RSuper|PrntSc| Pause|
67 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------' 69 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------'
68 * | | | L_Num| | | | | 70 * | | |L_NumK| |L_NumK| | |
69 * | Space|LShift|------| |------|RShift|Enter | 71 * | Space|LShift|------| |------|RShift|Enter |
70 * | | |L_FNav| |L_FNav| | | 72 * | | |L_FNav| |L_FNav| | |
71 * `--------------------' `--------------------' 73 * `--------------------' `--------------------'
72 */ 74 */
73[QWER] = KEYMAP( 75[QW_B] = KEYMAP(
74// Left hand 76// Left hand
75KC_DOLLAR, S(KC_QUOT), S(KC_COMM), S(KC_DOT), KC_LPRN, KC_RPRN, KC_DEL, 77KC_DOLLAR, S(KC_QUOT), S(KC_COMM), S(KC_DOT), KC_LPRN, KC_RPRN, KC_DEL,
76KC_PERCENT, KC_B, KC_E, KC_P, KC_O, KC_E, KC_BSPC, 78KC_PERCENT, KC_B, KC_E, KC_P, KC_O, KC_E, KC_BSPC,
77KC_W, KC_A, KC_U, KC_I, KC_E, KC_COMMA, 79KC_W, KC_A, KC_U, KC_I, KC_E, KC_COMMA,
78KC_E, KC_A, KC_Y, KC_X, KC_DOT, KC_K, KC_TAB, 80KC_E, KC_A, KC_Y, KC_X, KC_DOT, KC_K, KC_TAB,
79KC_TRNS, KC_NO, KC_LGUI, KC_LCTL, KC_LALT, 81KC_ESC, KC_INS, KC_LGUI, KC_LCTL, KC_LALT,
80 KC_ESC, MO(MSE), 82 KC_TRNS, KC_TRNS,
81 MO(NUM), 83 KC_TRNS,
82 KC_SPC, MO(SQWER), MO(FNAV), 84 KC_SPC, MO(QW_S), KC_TRNS,
83// Right hand 85// Right hand
84 KC_SLCK, KC_AT, KC_PLUS, KC_MINUS, KC_SLASH, KC_ASTR, KC_EQUAL, 86 KC_SLCK, KC_AT, KC_PLUS, KC_MINUS, KC_SLASH, KC_ASTR, KC_EQUAL,
85 KC_CAPSLOCK, KC_CIRC, KC_V, KC_D, KC_L, KC_J, KC_Z, 87 KC_CAPSLOCK, KC_CIRC, KC_V, KC_D, KC_L, KC_J, KC_Z,
86 KC_C, KC_T, KC_S, KC_R, KC_N, KC_M, 88 KC_C, KC_T, KC_S, KC_R, KC_N, KC_M,
87 KC_NUMLOCK, KC_QUOT, KC_Q, KC_G, KC_H, KC_F, KC_C, 89 KC_NUMLOCK, KC_QUOT, KC_Q, KC_G, KC_H, KC_F, KC_C,
88 MO(AQWER), KC_RCTL, KC_RGUI, KC_PSCREEN, KC_PAUSE, 90 MO(QW_A), KC_RCTL, KC_RGUI, KC_PSCREEN, KC_PAUSE,
89KC_NO, KC_INS, 91KC_TRNS, KC_TRNS,
92KC_TRNS,
93KC_TRNS, MO(QW_S), KC_ENTER),
94/* Keymap 2: bepo with altgr key to qwerty compat layer
95 *
96 * ,--------------------------------------------------. ,--------------------------------------------------.
97 * | $ | " | < | > | [ | ] |Delete| |ScroLo| @ | + | - | / | * | = |
98 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
99 * | % | | | e | & | o | e |Backsp| |CapsLo| ^ | v | d | l | j | z |
100 * |--------+------+------+------+------+------| ace | | |------+------+------+------+------+--------|
101 * | w | a | u | i | € | , |------| |------| c | t | s | r | n | m |
102 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------|
103 * | e | \ | { | } | . | ~ | | | | ' | q | g | h | f | c |
104 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
105 * |Escape|Insert|LSuper| LCtrl| LAlt| | BEPO |QWERTY| |AZERTY| BEPO | | AltGr| RCtrl|RSuper|PrntSc| Pause|
106 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------'
107 * | | |L_NumK| |L_NumK| | |
108 * | _ |LShift|------| |------|RShift|Enter |
109 * | | |L_FNav| |L_FNav| | |
110 * `--------------------' `--------------------'
111 */
112[QW_A] = KEYMAP(
113// Left hand
114KC_DOLLAR, S(KC_QUOT), S(KC_COMM), S(KC_DOT), KC_LBRC, KC_RBRC, KC_DEL,
115KC_PERCENT, KC_PIPE, KC_E, KC_AMPR, KC_O, KC_E, KC_BSPC,
116KC_W, KC_A, KC_U, KC_I, RALT(KC_5), KC_COMMA,
117KC_E, KC_BSLASH, KC_LCBR, KC_RCBR, KC_DOT, KC_TILDE, KC_TAB,
118KC_ESC, KC_INS, KC_LGUI, KC_LCTL, KC_LALT,
119 KC_TRNS, KC_TRNS,
120 KC_TRNS,
121 KC_UNDS, MO(QW_S), KC_TRNS,
122// Right hand
123 KC_SLCK, KC_AT, KC_PLUS, KC_MINUS, KC_SLASH, KC_ASTR, KC_EQUAL,
124 KC_CAPSLOCK, KC_CIRC, KC_V, KC_D, KC_L, KC_J, KC_Z,
125 KC_C, KC_T, KC_S, KC_R, KC_N, KC_M,
126 KC_NUMLOCK, KC_QUOT, KC_Q, KC_G, KC_H, KC_F, KC_C,
127 KC_TRNS, KC_RCTL, KC_RGUI, KC_PSCREEN, KC_PAUSE,
128KC_TRNS, KC_TRNS,
90KC_TRNS, 129KC_TRNS,
91MO(FNAV), MO(SQWER), KC_ENTER), 130KC_TRNS, MO(QW_S), KC_ENTER),
92/* Keymap 2: QWERTY shifted system compatibility layer 131/* Keymap 3: bepo with shift key to qwerty compat layer
93 * 132 *
94 * ,--------------------------------------------------. ,--------------------------------------------------. 133 * ,--------------------------------------------------. ,--------------------------------------------------.
95 * | # | 1 | 2 | 3 | 4 | 5 |Delete| |ScroLo| 6 | 7 | 8 | 9 | 0 | = | 134 * | # | 1 | 2 | 3 | 4 | 5 |Delete| |ScroLo| 6 | 7 | 8 | 9 | 0 | = |
@@ -100,20 +139,20 @@ MO(FNAV), MO(SQWER), KC_ENTER),
100 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------| 139 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------|
101 * | E | A | Y | X | : | K | | | | ? | Q | G | H | F | C | 140 * | E | A | Y | X | : | K | | | | ? | Q | G | H | F | C |
102 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------' 141 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
103 * | BEPO | |LSuper| LCtrl| LAlt| |Escape| L_Mse| | |Insert| | AltGr| RCtrl|RSuper|PrntSc| Pause| 142 * |Escape|Insert|LSuper| LCtrl| LAlt| | BEPO |QWERTY| |AZERTY| BEPO | | AltGr| RCtrl|RSuper|PrntSc| Pause|
104 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------' 143 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------'
105 * | | | L_Num| | | | | 144 * | | |L_NumK| |L_NumK| | |
106 * | Space|LShift|------| |------|RShift|Enter | 145 * | Space|LShift|------| |------|RShift|Enter |
107 * | | |L_FNav| |L_FNav| | | 146 * | | |L_FNav| |L_FNav| | |
108 * `--------------------' `--------------------' 147 * `--------------------' `--------------------'
109 */ 148 */
110[SQWER] = KEYMAP( 149[QW_S] = KEYMAP(
111// Left hand 150// Left hand
112KC_HASH, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, 151KC_HASH, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS,
113KC_GRV, S(KC_B), S(KC_E), S(KC_P), S(KC_O), S(KC_E), KC_TRNS, 152KC_GRV, S(KC_B), S(KC_E), S(KC_P), S(KC_O), S(KC_E), KC_TRNS,
114S(KC_W), S(KC_A), S(KC_U), S(KC_I), S(KC_E), KC_SCOLON, 153S(KC_W), S(KC_A), S(KC_U), S(KC_I), S(KC_E), KC_SCOLON,
115S(KC_E), S(KC_A), S(KC_Y), S(KC_X), KC_COLON, S(KC_K), S(KC_TAB), 154S(KC_E), S(KC_A), S(KC_Y), S(KC_X), KC_COLON, S(KC_K), S(KC_TAB),
116KC_TRNS, KC_TRNS, S(KC_LGUI), S(KC_LCTL), S(KC_LALT), 155S(KC_ESC), S(KC_INS), S(KC_LGUI), S(KC_LCTL), S(KC_LALT),
117 KC_TRNS, KC_TRNS, 156 KC_TRNS, KC_TRNS,
118 KC_TRNS, 157 KC_TRNS,
119 KC_TRNS, KC_TRNS, KC_TRNS, 158 KC_TRNS, KC_TRNS, KC_TRNS,
@@ -126,51 +165,125 @@ KC_TRNS, KC_TRNS, S(KC_LGUI), S(KC_LCTL), S(KC_LALT),
126KC_TRNS, KC_TRNS, 165KC_TRNS, KC_TRNS,
127KC_TRNS, 166KC_TRNS,
128KC_TRNS, KC_TRNS, KC_TRNS), 167KC_TRNS, KC_TRNS, KC_TRNS),
129/* Keymap 3: QWERTY alted system compatibility layer 168/* Keymap 4: bepo to azerty base compat layer
169 *
170 * ,--------------------------------------------------. ,--------------------------------------------------.
171 * | $ | " | < | > | ( | ) |Delete| |ScroLo| @ | + | - | / | * | = |
172 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
173 * | % | b |e_acut| p | o |e_grav|Backsp| |CapsLo| ^ | v | d | l | j | z |
174 * |--------+------+------+------+------+------| ace | | |------+------+------+------+------+--------|
175 * | w | a | u | i | e | , |------| |------| c | t | s | r | n | m |
176 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------|
177 * | e |a_grav| y | x | . | k | | | | ' | q | g | h | f | c_cedil|
178 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
179 * |Escape|Insert|LSuper| LCtrl| LAlt| | BEPO |QWERTY| |AZERTY| BEPO | | AltGr| RCtrl|RSuper|PrntSc| Pause|
180 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------'
181 * | | |L_NumK| |L_NumK| | |
182 * | Space|LShift|------| |------|RShift|Enter |
183 * | | |L_FNav| |L_FNav| | |
184 * `--------------------' `--------------------'
185 */
186[AZ_B] = KEYMAP(
187// Left hand
188FR_DLR, FR_QUOT, FR_LESS, FR_GRTR, FR_LPRN, FR_RPRN, KC_DEL,
189FR_PERC, KC_B, FR_EACU, KC_P, KC_O, FR_EGRV, KC_BSPC,
190FR_W, FR_A, KC_U, KC_I, KC_E, FR_COMM,
191KC_E, FR_AGRV, KC_Y, KC_X, FR_DOT, KC_K, KC_TAB,
192KC_ESC, KC_INS, KC_LGUI, KC_LCTL, KC_LALT,
193 KC_TRNS, KC_TRNS,
194 KC_TRNS,
195 KC_SPC, MO(AZ_S), KC_TRNS,
196// Right hand
197 KC_SLCK, FR_AT, FR_PLUS, FR_MINS, FR_SLSH, FR_ASTR, FR_EQL,
198 KC_CAPSLOCK, KC_LBRC, KC_V, KC_D, KC_L, KC_J, FR_Z,
199 KC_C, KC_T, KC_S, KC_R, KC_N, FR_M,
200 KC_NUMLOCK, FR_APOS, FR_Q, KC_G, KC_H, KC_F, FR_CCED,
201 MO(AZ_A), KC_RCTL, KC_RGUI, KC_PSCREEN, KC_PAUSE,
202KC_TRNS, KC_TRNS,
203KC_TRNS,
204KC_TRNS, MO(AZ_S), KC_ENTER),
205/* Keymap 5: bepo with altgr key to azerty compat layer
130 * 206 *
131 * ,--------------------------------------------------. ,--------------------------------------------------. 207 * ,--------------------------------------------------. ,--------------------------------------------------.
132 * | $ | " | < | > | [ | ] |Delete| |ScroLo| @ | + | - | / | * | = | 208 * | $ | " | < | > | [ | ] |Delete| |ScroLo| @ | + | - | / | * | = |
133 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| 209 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
134 * | % | | | e | & | o | e |Backsp| |CapsLo| ^ | v | d | l | j | z | 210 * | % | | | e | & | o | e |Backsp| |CapsLo| ^ | v | d | l | j | z |
135 * |--------+------+------+------+------+------| ace | | |------+------+------+------+------+--------| 211 * |--------+------+------+------+------+------| ace | | |------+------+------+------+------+--------|
136 * | w | a | u | i | € | , |------| |------| c | t | s | r | n | m | 212 * | w | a |u_grav| trem | € | , |------| |------| c | t | s | r | n | m |
137 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------| 213 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------|
138 * | e | \ | { | } | . | ~ | | | | ' | q | g | h | f | c | 214 * | / | \ | { | } | . | ~ | | | | ' | q | g | h | f | c |
139 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------' 215 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
140 * | BEPO | |LSuper| LCtrl| LAlt| |Escape| L_Mse| | |Insert| | AltGr| RCtrl|RSuper|PrntSc| Pause| 216 * |Escape|Insert|LSuper| LCtrl| LAlt| | BEPO |QWERTY| |AZERTY| BEPO | | AltGr| RCtrl|RSuper|PrntSc| Pause|
141 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------' 217 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------'
142 * | | | L_Num| | | | | 218 * | | |L_NumK| |L_NumK| | |
143 * | _ |LShift|------| |------|RShift|Enter | 219 * | _ |LShift|------| |------|RShift|Enter |
144 * | | |L_FNav| |L_FNav| | | 220 * | | |L_FNav| |L_FNav| | |
145 * `--------------------' `--------------------' 221 * `--------------------' `--------------------'
146 */ 222 */
147[AQWER] = KEYMAP( 223[AZ_A] = KEYMAP(
148// Left hand 224// Left hand
149KC_DOLLAR, S(KC_QUOT), S(KC_COMM), S(KC_DOT), KC_LBRC, KC_RBRC, KC_DEL, 225FR_DLR, FR_QUOT, FR_LESS, FR_GRTR, FR_LBRC, FR_RBRC, KC_DEL,
150KC_PERCENT, KC_PIPE, KC_E, KC_AMPR, KC_O, KC_E, KC_BSPC, 226FR_PERC, FR_PIPE, FR_EACU, FR_AMP, KC_O, FR_EGRV, KC_BSPC,
151KC_W, KC_A, KC_U, KC_I, RALT(KC_5), KC_COMMA, 227FR_W, FR_A, FR_UGRV, S(KC_LBRC), FR_EURO, FR_COMM,
152KC_E, KC_BSLASH, KC_LCBR, KC_RCBR, KC_DOT, KC_TILDE, KC_TAB, 228FR_SLSH, FR_BSLS, FR_LCBR, FR_RCBR, FR_DOT, FR_TILD, KC_TAB,
153KC_TRNS, KC_NO, KC_LGUI, KC_LCTL, KC_LALT, 229KC_ESC, KC_INS, KC_LGUI, KC_LCTL, KC_LALT,
154 KC_ESC, MO(MSE), 230 KC_TRNS, KC_TRNS,
155 MO(NUM), 231 KC_TRNS,
156 KC_UNDS, MO(SQWER), MO(FNAV), 232 FR_UNDS, MO(AZ_S), KC_TRNS,
157// Right hand 233// Right hand
158 KC_SLCK, KC_AT, KC_PLUS, KC_MINUS, KC_SLASH, KC_ASTR, KC_EQUAL, 234 KC_SLCK, FR_AT, FR_PLUS, FR_MINS, FR_SLSH, FR_ASTR, FR_EQL,
159 KC_CAPSLOCK, KC_CIRC, KC_V, KC_D, KC_L, KC_J, KC_Z, 235 KC_CAPSLOCK, KC_LBRC, KC_V, KC_D, KC_L, KC_J, FR_Z,
160 KC_C, KC_T, KC_S, KC_R, KC_N, KC_M, 236 KC_C, KC_T, KC_S, KC_R, KC_N, FR_M,
161 KC_NUMLOCK, KC_QUOT, KC_Q, KC_G, KC_H, KC_F, KC_C, 237 KC_NUMLOCK, FR_APOS, FR_Q, KC_G, KC_H, KC_F, FR_CCED,
162 KC_TRNS, KC_RCTL, KC_RGUI, KC_PSCREEN, KC_PAUSE, 238 KC_TRNS, KC_RCTL, KC_RGUI, KC_PSCREEN, KC_PAUSE,
163KC_NO, KC_INS, 239KC_TRNS, KC_TRNS,
164KC_TRNS, 240KC_TRNS,
165MO(FNAV), MO(SQWER), KC_ENTER), 241KC_TRNS, MO(AZ_S), KC_ENTER),
166/* Keymap 4: function / navigation layer 242/* Keymap 6: bepo with shift key to azerty compat layer
243 *
244 * ,--------------------------------------------------. ,--------------------------------------------------.
245 * | # | 1 | 2 | 3 | 4 | 5 |Delete| |ScroLo| 6 | 7 | 8 | 9 | 0 | ° |
246 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
247 * | ` | B | E | P | O | E |Backsp| |CapsLo| ! | V | D | L | J | Z |
248 * |--------+------+------+------+------+------| ace | | |------+------+------+------+------+--------|
249 * | W | A | U | I | E | ; |------| |------| C | T | S | R | N | M |
250 * |--------+------+------+------+------+------| Tab | | NumLo|------+------+------+------+------+--------|
251 * | E | A | Y | X | : | K | | | | ? | Q | G | H | F | C |
252 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
253 * |Escape|Insert|LSuper| LCtrl| LAlt| | BEPO |QWERTY| |AZERTY| BEPO | | AltGr| RCtrl|RSuper|PrntSc| Pause|
254 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------'
255 * | | |L_NumK| |L_NumK| | |
256 * | Space|LShift|------| |------|RShift|Enter |
257 * | | |L_FNav| |L_FNav| | |
258 * `--------------------' `--------------------'
259 */
260[AZ_S] = KEYMAP(
261// Left hand
262FR_HASH, FR_1, FR_2, FR_3, FR_4, FR_5, KC_TRNS,
263FR_GRV, S(KC_B), S(KC_E), S(KC_P), S(KC_O), S(KC_E), KC_TRNS,
264S(FR_W), S(FR_A), S(KC_U), S(KC_I), S(KC_E), FR_SCLN,
265S(KC_E), S(FR_A), S(KC_Y), S(KC_X), FR_COLN, S(KC_K), S(KC_TAB),
266S(KC_ESC), S(KC_INS), S(KC_LGUI), S(KC_LCTL), S(KC_LALT),
267 KC_TRNS, KC_TRNS,
268 KC_TRNS,
269 KC_TRNS, KC_TRNS, KC_TRNS,
270// Right hand
271 KC_TRNS, FR_6, FR_7, FR_8, FR_9, FR_0, FR_OVRR,
272 KC_TRNS, FR_EXLM, S(KC_V), S(KC_D), S(KC_L), S(KC_J), S(FR_Z),
273 S(KC_C), S(KC_T), S(KC_S), S(KC_R), S(KC_N), S(FR_M),
274 KC_TRNS, FR_QUES, S(FR_Q), S(KC_G), S(KC_H), S(KC_F), S(KC_C),
275 S(KC_RALT), S(KC_RCTL), S(KC_RGUI), KC_TRNS, KC_TRNS,
276KC_TRNS, KC_TRNS,
277KC_TRNS,
278KC_TRNS, KC_TRNS, KC_TRNS),
279/* Keymap 7: function / navigation / mouse layer
167 * 280 *
168 * ,--------------------------------------------------. ,--------------------------------------------------. 281 * ,--------------------------------------------------. ,--------------------------------------------------.
169 * | | F1 | F2 | F3 | F4 | F5 |VolMut| | | F6 | F7 | F8 | F9 | F10 | | 282 * | | F1 | F2 | F3 | F4 | F5 |VolMut| | | F6 | F7 | F8 | F9 | F10 | |
170 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| 283 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
171 * | | | | | | |VolDwn| | | PgUp | Home | Up | End | F11 | | 284 * | | Next |LClick| Up |RClick| WhUp |VolDwn| | | PgUp | Home | Up | End | F11 | |
172 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| 285 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
173 * | | | | | | |------| |------| PgDn | Left | Down | Right| F12 | | 286 * | | Prev | Left | Down | Right|WhDown|------| |------| PgDn | Left | Down | Right| F12 | |
174 * |--------+------+------+------+------+------| VolUp| | |------+------+------+------+------+--------| 287 * |--------+------+------+------+------+------| VolUp| | |------+------+------+------+------+--------|
175 * | | Undo | Cut | Copy | Paste| | | | | | | | | | | 288 * | | Undo | Cut | Copy | Paste| | | | | | | | | | |
176 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------' 289 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
@@ -184,12 +297,12 @@ MO(FNAV), MO(SQWER), KC_ENTER),
184[FNAV] = KEYMAP( 297[FNAV] = KEYMAP(
185// Left hand 298// Left hand
186KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_MUTE, 299KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_MUTE,
187KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLU, 300KC_NO, KC_MS_BTN5, KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2, KC_MS_WH_UP, KC_VOLU,
188KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 301KC_NO, KC_MS_BTN4, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_MS_WH_DOWN,
189KC_NO, KC_UNDO, KC_CUT, KC_COPY, KC_PASTE, KC_NO, KC_VOLD, 302KC_NO, KC_UNDO, KC_CUT, KC_COPY, KC_PASTE, KC_NO, KC_VOLD,
190KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, 303KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS,
191 KC_NO, KC_NO, 304 KC_TRNS, KC_TRNS,
192 KC_NO, 305 KC_TRNS,
193 KC_NO, KC_TRNS, KC_TRNS, 306 KC_NO, KC_TRNS, KC_TRNS,
194// Right hand 307// Right hand
195 KC_NO, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_NO, 308 KC_NO, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_NO,
@@ -197,91 +310,52 @@ KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS,
197 KC_PGDOWN, KC_LEFT, KC_DOWN, KC_RIGHT, KC_F12, KC_NO, 310 KC_PGDOWN, KC_LEFT, KC_DOWN, KC_RIGHT, KC_F12, KC_NO,
198 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 311 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
199 KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, 312 KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO,
200KC_NO, KC_NO, 313KC_TRNS, KC_TRNS,
201KC_TRNS, 314KC_TRNS,
202KC_TRNS, KC_TRNS, KC_NO), 315KC_TRNS, KC_TRNS, KC_NO),
203/* Keymap 5: numeric layer, sends keypad codes 316/* Keymap 8: numeric keypad layer, sends keypad codes
204 * 317 *
205 * ,--------------------------------------------------. ,--------------------------------------------------. 318 * ,--------------------------------------------------. ,--------------------------------------------------.
206 * | | | | | | | | | | | + | - | / | * | | 319 * | | | | | | | | | | | NumLo| / | * | - | |
207 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| 320 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
208 * | | | | | | | | | | | 7 | 8 | 9 | | | 321 * | | | | | | | | | | | 7 | 8 | 9 | + | |
209 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| 322 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
210 * | | | | | | |------| |------| | 4 | 5 | 6 | | | 323 * | | | | | | |------| |------| | 4 | 5 | 6 | + | |
211 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| 324 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
212 * | | | | | | | | | | | 1 | 2 | 3 | | | 325 * | | | | | | | | | | | 1 | 2 | 3 | Enter| |
213 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------' 326 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
214 * | | | | | | | | | | | | | 0 | 00 | . | | | 327 * | | | | | | | | | | | | | 0 | 00 | . | Enter| |
215 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------'
216 * | | | | | | | |
217 * | | |------| |------| | Enter|
218 * | | | | | | | |
219 * `--------------------' `--------------------'
220 */
221[NUM] = KEYMAP(
222// Left hand
223KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
224KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
225KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
226KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
227KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS,
228 KC_NO, KC_NO,
229 KC_TRNS,
230 KC_NO, KC_TRNS, KC_NO,
231// Right hand
232 KC_NO, KC_NO, KC_KP_PLUS, KC_KP_MINUS, KC_KP_SLASH, KC_KP_ASTERISK, KC_NO,
233 KC_NO, KC_NO, KC_KP_7, KC_KP_8, KC_KP_9, KC_NO, KC_NO,
234 KC_NO, KC_KP_4, KC_KP_5, KC_KP_6, KC_NO, KC_NO,
235 KC_NO, KC_NO, KC_KP_1, KC_KP_2, KC_KP_3, KC_NO, KC_NO,
236 KC_KP_0, M(KP_00), KC_KP_COMMA, KC_NO, KC_NO,
237KC_NO, KC_NO,
238KC_NO,
239KC_NO, KC_TRNS, KC_KP_ENTER),
240/* Keymap 6: mouse layer
241 *
242 * ,--------------------------------------------------. ,--------------------------------------------------.
243 * | | | | | | | | | | | | | | | |
244 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
245 * | | | | | | | | | | |LClick| Up |RClick| WhUp | |
246 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
247 * | | | | | | |------| |------| | Left | Down | Right|WhDown| |
248 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
249 * | | | | | | | | | | | | | | | |
250 * `--------+------+------+------+------+-------------,-------------. ,-------------`-------------+------+------+------+------+--------'
251 * | | | | | | | | | | | | | | | | | |
252 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------' 328 * `----------------------------------' ,------|------|------| |------+------+------. `----------------------------------'
253 * | | | | | | | | 329 * | | | | | | | |
254 * | | |------| |------| | | 330 * | | |------| |------| | |
255 * | | | | | | | | 331 * | | | | | | | |
256 * `--------------------' `--------------------' 332 * `--------------------' `--------------------'
257 */ 333 */
258[MSE] = KEYMAP( 334[NUMK] = KEYMAP(
259// Left hand 335// Left hand
260KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 336KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
261KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 337KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
262KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 338KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
263KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 339KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
264KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, 340KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS,
265 KC_NO, KC_TRNS, 341 KC_TRNS, KC_TRNS,
266 KC_NO, 342 KC_TRNS,
267 KC_NO, KC_TRNS, KC_NO, 343 KC_NO, KC_TRNS, KC_TRNS,
268// Right hand 344// Right hand
269 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 345 KC_NO, KC_NO, KC_NUMLOCK, KC_KP_SLASH, KC_KP_ASTERISK, KC_KP_MINUS, KC_NO,
270 KC_NO, KC_NO, KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2, KC_MS_WH_UP, KC_NO, 346 KC_NO, KC_NO, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_PLUS, KC_NO,
271 KC_NO, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_MS_WH_DOWN, KC_NO, 347 KC_NO, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_PLUS, KC_NO,
272 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 348 KC_NO, KC_NO, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_ENTER, KC_NO,
273 KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, 349 KC_KP_0, M(KP_00), KC_KP_COMMA, KC_KP_ENTER, KC_NO,
274KC_NO, KC_NO, 350KC_TRNS, KC_TRNS,
275KC_NO, 351KC_TRNS,
276KC_NO, KC_TRNS, KC_NO) 352KC_TRNS, KC_TRNS, KC_NO)
277};
278
279const uint16_t PROGMEM fn_actions[] = {
280}; 353};
281 354
282const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 355const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
283{ 356{
284 switch(id) { 357 switch(id) {
358 // keypad "double 0"
285 case KP_00: 359 case KP_00:
286 if (record->event.pressed) { 360 if (record->event.pressed) {
287 return MACRO( T(KP_0), D(KP_0), END ); 361 return MACRO( T(KP_0), D(KP_0), END );
@@ -289,23 +363,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
289 return MACRO( U(KP_0), END ); 363 return MACRO( U(KP_0), END );
290 } 364 }
291 break; 365 break;
292 case CA_Fx:
293 if (record->event.pressed) {
294 layer_on(FNAV);
295 return MACRO( D(LALT), D(LCTL), END );
296 } else {
297 layer_off(FNAV);
298 return MACRO( U(LCTL), U(LALT), END );
299 }
300 break;
301 } 366 }
302 return MACRO_NONE; 367 return MACRO_NONE;
303}; 368};
304
305// Runs just one time when the keyboard initializes.
306void matrix_init_user(void) {
307};
308
309// Runs constantly in the background, in a loop.
310void matrix_scan_user(void) {
311};
diff --git a/keyboards/ergodox/keymaps/bepo/readme.md b/keyboards/ergodox/keymaps/bepo/readme.md
index 4a18cd80f..2959ac829 100644
--- a/keyboards/ergodox/keymaps/bepo/readme.md
+++ b/keyboards/ergodox/keymaps/bepo/readme.md
@@ -23,12 +23,12 @@ La touche "Tab" est placée comme sur la TypeMatrix 2020.
23 23
24Meilleure symétrie et accessibilité que la TypeMatrix 2030 : les touches "W" et "%" ont dû être déplacées du côté gauche en raison du nombre de touches de l'ErgoDox, mais l'auriculaire droit ne gère maintenant que deux colonnes de touches au lieu de trois. La touche "Ê" redevient accessible sur la même rangée que les autres lettres, comme sur un clavier classique en disposition bépo. Les lettres, chiffres et symboles sont tous regroupés sur 4 lignes et 6 colonnes pour chaque main, et la première rangée de lettres à la main gauche conserve une identité visuelle "BÉPO". 24Meilleure symétrie et accessibilité que la TypeMatrix 2030 : les touches "W" et "%" ont dû être déplacées du côté gauche en raison du nombre de touches de l'ErgoDox, mais l'auriculaire droit ne gère maintenant que deux colonnes de touches au lieu de trois. La touche "Ê" redevient accessible sur la même rangée que les autres lettres, comme sur un clavier classique en disposition bépo. Les lettres, chiffres et symboles sont tous regroupés sur 4 lignes et 6 colonnes pour chaque main, et la première rangée de lettres à la main gauche conserve une identité visuelle "BÉPO".
25 25
26Touche de fonction permettant de saisir les touches F1 à F12, les touches F1 à F10 sont placées de façon logique par rapport aux chiffres 1 à 0. Cette même touche permet l'accès aux touches directionnelles sans déplacer la main droite. Les touches "Home" et "End" sont placées de la même façon que sur une TypeMatrix 2030 par rapport aux touches directionnelles. Les touches "Page Up" et "Page Down" sont également accessibles facilement sans déplacer la main droite. Les fonctions "VolUp" et "VolDown" sont placées comme sur la TypeMatrix 2030, avec la fonction "Mute" juste au dessus. Les fonctions "Undo", "Cut", "Copy" et "Paste" sont placées côte à côte comme elles le seraient sur un clavier QWERTY en combinaison avec la touche "Ctrl" (à l'emplacement des lettres "Z", "X", "C" et "V"). Par rapport au layout "SpaceFN", l'utilisation d'une touche de fonction dédiée au pouce permet de ne pas ajouter de latence, et la touche espace reste compatible avec les jeux (action au moment de l'appui et possibilité d'appui long). 26Touche de fonction permettant de saisir les touches F1 à F12, les touches F1 à F10 sont placées de façon logique par rapport aux chiffres 1 à 0. Cette même touche permet l'accès aux touches directionnelles sans déplacer la main droite et d'effectuer des actions souris avec uniquement la main gauche. Les touches "Home" et "End" sont placées de la même façon que sur une TypeMatrix 2030 par rapport aux touches directionnelles. Les touches "Page Up" et "Page Down" sont également accessibles facilement sans déplacer la main droite. Les fonctions "VolUp" et "VolDown" sont placées comme sur la TypeMatrix 2030, avec la fonction "Mute" juste au dessus. Les fonctions "Undo", "Cut", "Copy" et "Paste" sont placées côte à côte comme elles le seraient sur un clavier QWERTY en combinaison avec la touche "Ctrl" (à l'emplacement des lettres "Z", "X", "C" et "V"). Par rapport au layout "SpaceFN", l'utilisation d'une touche de fonction dédiée au pouce permet de ne pas ajouter de latence, et la touche espace reste compatible avec les jeux (action au moment de l'appui et possibilité d'appui long).
27 27
28Touche de fonction permettant l'accès au pavé numérique comme sur la TypeMatrix 2030, mais sans avoir à déplacer la main droite : avec les doigts sur la rangée de repos, possibilité de saisir les chiffres "4", "5" et "6" comme sur un pavé numérique classique. Le double "0" de la TypeMatrix a été conservé, et gagne une possibilité de répétition en simples "0". 28Touche de fonction permettant l'accès au pavé numérique comme sur la TypeMatrix 2030, mais sans avoir à déplacer la main droite : avec les doigts sur la rangée de repos, possibilité de saisir les chiffres "4", "5" et "6" comme sur un pavé numérique classique. Le double "0" de la TypeMatrix a été conservé, et gagne une possibilité de répétition en simples "0".
29 29
30L'appui sur une touche permet de basculer en mode BEPO sur un système configuré pour un clavier QWERTY. Cette compatibilité n'est pas parfaite (pas encore de gestion des accents mais ça devrait être faisable avec une disposition en qwerty international, et les combinaisons de touches ne sont pas toutes supportées puisque le clavier traduit déjà certaines touches en combinaisons) mais reste pratique pour une saisie de texte occasionnelle. 30Touche permettant de basculer en mode BEPO sur un système configuré pour un clavier QWERTY. Cette compatibilité n'est pas parfaite (pas encore de gestion des accents mais ça devrait être faisable avec une disposition en qwerty international, et les combinaisons de touches ne sont pas toutes supportées puisque le clavier traduit déjà certaines touches en combinaisons) mais reste pratique pour une saisie de texte occasionnelle et pour des accès BIOS ou console en QWERTY.
31 31
32TODO : couche de compatibilité pour utiliser la disposition BÉPO sur un système configuré pour un clavier AZERTY. 32Touche permettant de basculer en mode BEPO sur un système configuré pour un clavier AZERTY. Cette compatibilité n'est pas parfaite (pas de gestion des caractères non présents sur le clavier AZERTY, et les combinaisons de touches ne sont pas toutes supportées puisque le clavier traduit déjà certaines touches en combinaisons) mais reste pratique pour une saisie de texte occasionnelle et pour faire du bureau à distance vers un système Windows sans BEPO.
33 33
34> Olivier Smedts <olivier@gid0.org> 34> Olivier Smedts <olivier@gid0.org>
diff --git a/keyboards/ergodox/keymaps/default/keymap.c b/keyboards/ergodox/keymaps/default/keymap.c
index 2f399bd18..4eff28085 100644
--- a/keyboards/ergodox/keymaps/default/keymap.c
+++ b/keyboards/ergodox/keymaps/default/keymap.c
@@ -7,7 +7,12 @@
7#define SYMB 1 // symbols 7#define SYMB 1 // symbols
8#define MDIA 2 // media keys 8#define MDIA 2 // media keys
9 9
10#define EPRM M(1) // Macro 1: Reset EEPROM 10enum custom_keycodes {
11 PLACEHOLDER = SAFE_RANGE, // can always be here
12 EPRM,
13 VRSN,
14 RGB_SLD
15};
11 16
12const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 17const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
13/* Keymap 0: Basic layer 18/* Keymap 0: Basic layer
@@ -17,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
17 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| 22 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
18 * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | 23 * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
19 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| 24 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
20 * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd | 25 * | BkSp | A | S | D | F | G |------| |------| H |J/Alt | K | L |; / L2|' / Cmd |
21 * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| 26 * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
22 * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | 27 * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
23 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' 28 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
@@ -44,56 +49,56 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
44 KC_HOME, 49 KC_HOME,
45 KC_SPC,KC_BSPC,KC_END, 50 KC_SPC,KC_BSPC,KC_END,
46 // right hand 51 // right hand
47 KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, 52 KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
48 TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, 53 TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
49 KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT), 54 KC_H, ALT_T(KC_J), KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
50 MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, 55 MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
51 KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, 56 KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
52 KC_LALT, CTL_T(KC_ESC), 57 KC_LALT, CTL_T(KC_ESC),
53 KC_PGUP, 58 KC_PGUP,
54 KC_PGDN,KC_TAB, KC_ENT 59 KC_PGDN,KC_TAB, KC_ENT
55 ), 60 ),
56/* Keymap 1: Symbol Layer 61/* Keymap 1: Symbol Layer
57 * 62 *
58 * ,--------------------------------------------------. ,--------------------------------------------------. 63 * ,---------------------------------------------------. ,--------------------------------------------------.
59 * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | 64 * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
60 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| 65 * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------|
61 * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | 66 * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
62 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| 67 * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
63 * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | 68 * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
64 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| 69 * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
65 * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | 70 * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
66 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' 71 * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
67 * | EPRM | | | | | | | . | 0 | = | | 72 * | EPRM | | | | | | | . | 0 | = | |
68 * `----------------------------------' `----------------------------------' 73 * `-----------------------------------' `----------------------------------'
69 * ,-------------. ,-------------. 74 * ,-------------. ,-------------.
70 * | | | | | | 75 * |Animat| | |Toggle|Solid |
71 * ,------|------|------| |------+------+------. 76 * ,------|------|------| |------+------+------.
72 * | | | | | | | | 77 * |Bright|Bright| | | |Hue- |Hue+ |
73 * | | |------| |------| | | 78 * |ness- |ness+ |------| |------| | |
74 * | | | | | | | | 79 * | | | | | | | |
75 * `--------------------' `--------------------' 80 * `--------------------' `--------------------'
76 */ 81 */
77// SYMBOLS 82// SYMBOLS
78[SYMB] = KEYMAP( 83[SYMB] = KEYMAP(
79 // left hand 84 // left hand
80 M(0), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, 85 VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
81 KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, 86 KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
82 KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, 87 KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV,
83 KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, 88 KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
84 EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, 89 EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
85 KC_TRNS,KC_TRNS, 90 RGB_MOD,KC_TRNS,
86 KC_TRNS, 91 KC_TRNS,
87 KC_TRNS,KC_TRNS,KC_TRNS, 92 RGB_VAD,RGB_VAI,KC_TRNS,
88 // right hand 93 // right hand
89 KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, 94 KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
90 KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, 95 KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
91 KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, 96 KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS,
92 KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, 97 KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS,
93 KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, 98 KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS,
94 KC_TRNS, KC_TRNS, 99 RGB_TOG, RGB_SLD,
95 KC_TRNS, 100 KC_TRNS,
96 KC_TRNS, KC_TRNS, KC_TRNS 101 KC_TRNS, RGB_HUD, RGB_HUI
97), 102),
98/* Keymap 2: Media and mouse keys 103/* Keymap 2: Media and mouse keys
99 * 104 *
@@ -160,6 +165,33 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
160 return MACRO_NONE; 165 return MACRO_NONE;
161}; 166};
162 167
168bool 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
163// Runs just one time when the keyboard initializes. 195// Runs just one time when the keyboard initializes.
164void matrix_init_user(void) { 196void matrix_init_user(void) {
165 197
diff --git a/keyboards/ergodox/keymaps/dvorak_emacs/keymap.c b/keyboards/ergodox/keymaps/dvorak_emacs/keymap.c
new file mode 100755
index 000000000..d33c6e527
--- /dev/null
+++ b/keyboards/ergodox/keymaps/dvorak_emacs/keymap.c
@@ -0,0 +1,165 @@
1#include "ergodox.h"
2#include "debug.h"
3#include "action_layer.h"
4
5/******************************************************************************************
6 * DVORAK LAYOUT (see http://djelibeibi.unex.es/dvorak/)
7 * Layer 1: auxiliary keys
8 * Layer 2: full qwerty layout
9 *****************************************************************************************/
10
11// LAYERS
12#define BASE 0 // dvorak layout (default)
13#define AUX 1 // auxiliary keys
14
15// MACROS
16/* #define OBRACE 0 // key { or shift */
17/* #define CBRACE 1 // key } or shift */
18/* #define OBRACK 2 // key [ or left alt */
19/* #define CBRACK 3 // key ] or left alt */
20/* #define CAPS 4 // caps lock */
21
22// LEDS
23#define USB_LED_NUM_LOCK 0
24#define USB_LED_CAPS_LOCK 1
25#define USB_LED_SCROLL_LOCK 2
26#define USB_LED_COMPOSE 3
27#define USB_LED_KANA 4
28
29// TIMERS
30#define KEY_TAP_FAST 85
31#define KEY_TAP_SLOW 95
32
33const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
34/* Keymap 0: Base layer
35 * Keys with double values (like Esc/Ctrl) correspond to the 'tapped' key and the 'held' key, respectively
36 *
37 * ,--------------------------------------------------. ,--------------------------------------------------.
38 * | | 1 | 2 | 3 | 4 | 5 | Esc | | Esc | 6 | 7 | 8 | 9 | 0 | = / + |
39 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
40 * | ~ |" / ' |, / < |. / > | P | Y | [ | | ] | F | G | C | H | L | / / ? |
41 * |--------+------+------+------+------+------| { | | } |------+------+------+------+------+--------|
42 * | Tab | A | O | E |U/LSft| I/L1 |------| |------| D/L1|R/RSft| T | N | S | - / _ |
43 * |--------+------+------+------+------+------| LGUI | | LGUI |------+------+------+------+------+--------|
44 * | {/LSft |; / : | Q | J | K | X | | | | B | M | W | V | Z | }/RSft |
45 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
46 * | | | | | ~L1 | | ~L1 | | | \ / || |
47 * `----------------------------------' `----------------------------------'
48 * ,-------------. ,-------------.
49 * | HOME | END | | LEFT | RIGHT|
50 * ,------|------|------| |------+--------+------.
51 * | BSPC | DEL | PGUP | | UP | SPACE |RETURN|
52 * | / | / |------| |------| / | / |
53 * | LCTL | LALT |PGDWN | | DOWN | LALT | LCTL |
54 * `--------------------' `----------------------'
55 *
56 */
57[BASE] = KEYMAP(
58 // left hand
59 KC_NO, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC,
60 KC_TILD, KC_QUOTE, KC_COMM,KC_DOT, KC_P, KC_Y, KC_LBRACKET,
61 KC_TAB, KC_A, KC_O, KC_E, SFT_T(KC_U), LT(AUX, KC_I),
62 SFT_T(KC_LBRC), KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_LGUI,
63 KC_NO, KC_NO, KC_NO, KC_NO, MO(AUX),
64 KC_HOME, KC_END,
65 KC_PGUP,
66 CTL_T(KC_BSPC), ALT_T(KC_DEL), KC_PGDN,
67 // right hand
68 KC_ESC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL,
69 KC_RBRACKET, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLASH,
70 LT(AUX, KC_D), SFT_T(KC_H), KC_T, KC_N, KC_S, KC_MINUS,
71 KC_LGUI, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_T(KC_RBRC),
72 MO(AUX), KC_NO, KC_NO, KC_BSLASH, KC_NO,
73 KC_LEFT, KC_RIGHT,
74 KC_UP,
75 KC_DOWN, ALT_T(KC_ENT), CTL_T(KC_SPC)
76 ),
77/* Keymap 1: Aux layer
78 *
79 * ,--------------------------------------------------. ,--------------------------------------------------.
80 * | VolUp | | | | | | SLEEP | PWR | | | | | | |
81 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
82 * | VolDn | F1 | F2 | F3 | F4 | | | | | | 7 | 8 | 9 | * | |
83 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
84 * | | F5 | F6 | F7 | F8 | TRANS|------| |------|TRANS | 4 | 5 | 6 | + | |
85 * |--------+------+------+------+------+------| | |PSCR |------+------+------+------+------+--------|
86 * | TRANS | F9 | F10 | F11 | F12 | | | | | | 1 | 2 | 3 | / | TRANS |
87 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
88 * |CTRL-S|CTRL-Z|CTRL-X|CTRL-C| TRANS| | TRANS| . | 0 | = | |
89 * `----------------------------------' `----------------------------------'
90 * ,-------------. ,-------------.
91 * | TRANS| TRANS| | TRANS| TRANS|
92 * ,------|------|------| |------+------+------.
93 * | | | TRANS| | TRANS| | |
94 * |TRANS |TRANS |------| |------| TRANS| TRANS|
95 * | | | TRANS| | TRANS| | |
96 * `--------------------' `--------------------'
97 */
98[AUX] = KEYMAP(
99 // left hand
100 KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_SLEP,
101 KC_VOLD, KC_F1, KC_F2, KC_F3, KC_F4, KC_NO, KC_NO,
102 KC_NO , KC_F5, KC_F6, KC_F7, KC_F8, KC_TRNS,
103 KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO,
104 LCTL(KC_S), LCTL(KC_Z), LCTL(KC_X), LCTL(KC_C), KC_TRNS,
105 KC_TRNS , KC_TRNS,
106 KC_TRNS,
107 KC_TRNS, KC_TRNS, KC_TRNS,
108 // right hand
109 KC_PWR, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
110 KC_NO, KC_NO, KC_7, KC_8, KC_9, KC_PAST, KC_NO,
111 KC_TRNS, KC_4, KC_5, KC_6, KC_PPLS, KC_NO,
112 KC_PSCR, KC_NO, KC_1, KC_2, KC_3, KC_PSLS, KC_TRNS,
113 KC_TRNS,KC_DOT, KC_0, KC_PEQL, KC_NO,
114 KC_TRNS , KC_TRNS,
115 KC_TRNS,
116 KC_TRNS, KC_TRNS, KC_TRNS
117),
118};
119
120const uint16_t PROGMEM fn_actions[] = {
121 [1] = ACTION_LAYER_TAP_TOGGLE(AUX) // FN1 - Momentary Layer 1 (Aux)
122};
123
124
125const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
126{
127 // MACRODOWN only works in this function
128 switch(id) {
129 case 0:
130 if (record->event.pressed) {
131 register_code(KC_RSFT);
132 } else {
133 unregister_code(KC_RSFT);
134 }
135 break;
136 }
137 return MACRO_NONE;
138};
139
140// Runs just one time when the keyboard initializes.
141void matrix_init_user(void) {
142
143};
144
145// Runs constantly in the background, in a loop.
146void matrix_scan_user(void) {
147
148 uint8_t layer = biton32(layer_state);
149
150 ergodox_board_led_off();
151 ergodox_right_led_1_off();
152 ergodox_right_led_2_off();
153 ergodox_right_led_3_off();
154 switch (layer) {
155 case 1:
156 ergodox_right_led_1_on();
157 break;
158 case 2:
159 ergodox_right_led_2_on();
160 break;
161 default:
162 // none
163 break;
164 }
165}
diff --git a/keyboards/ergodox/keymaps/dvorak_emacs/readme.md b/keyboards/ergodox/keymaps/dvorak_emacs/readme.md
new file mode 100644
index 000000000..a3fc34afe
--- /dev/null
+++ b/keyboards/ergodox/keymaps/dvorak_emacs/readme.md
@@ -0,0 +1,70 @@
1# Ergodox Dvorak Layout with emacs binding in mind
2 * Control & Alt key on the thumbs (activated if pressed with another key).
3 * In the same way, "U" and "R" are the shift modifier if pressed with another key.
4 * "I" and "D" set the layer 1 for the auxiliary keys if pressed with another key.
5 * Software layout set to english.
6
7## Keymap Layers
8 - L0: dvorak with some customizations (see layout below)
9 - L1: auxiliary keys (includes function keys, numpad...)
10
11
12### Keymap 0: Base layer
13Keys with double values (like U/LSft) correspond to the 'tapped' key and the 'held' key, respectively
14
15<pre><code>
16
17,--------------------------------------------------. ,--------------------------------------------------.
18| | 1 | 2 | 3 | 4 | 5 | Esc | | Esc | 6 | 7 | 8 | 9 | 0 | = |
19|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
20| ~ | ' | , | . | P | Y | [ | | ] | F | G | C | H | L | / |
21|--------+------+------+------+------+------| { | | } |------+------+------+------+------+--------|
22| Tab | A | O | E |U/LSft| I/L1 |------| |------| D/L1|R/RSft| T | N | S | - |
23|--------+------+------+------+------+------| LGUI | | LGUI |------+------+------+------+------+--------|
24| {/LSft | ; | Q | J | K | X | | | | B | M | W | V | Z | }/RSft |
25`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
26 | | | | | ~L1 | | ~L1 | | | \ | |
27 `----------------------------------' `----------------------------------'
28 ,-------------. ,-------------.
29 | HOME | END | | LEFT | RIGHT|
30 ,------|------|------| |------+--------+------.
31 | BSPC | DEL | PGUP | | UP | SPACE |RETURN|
32 | / | / |------| |------| / | / |
33 | LCTL | LALT |PGDWN | | DOWN | LALT | LCTL |
34 `--------------------' `----------------------'
35
36</pre></code>
37
38### Keymap 1: Aux layer
39
40<pre><code>
41
42,--------------------------------------------------. ,--------------------------------------------------.
43| VolUp | | | | | | SLEEP | PWR | | | | | | |
44|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
45| VolDn | F1 | F2 | F3 | F4 | | | | | | 7 | 8 | 9 | * | |
46|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
47| | F5 | F6 | F7 | F8 | TRANS|------| |------|TRANS | 4 | 5 | 6 | + | |
48|--------+------+------+------+------+------| | |PSCR |------+------+------+------+------+--------|
49| TRANS | F9 | F10 | F11 | F12 | | | | | | 1 | 2 | 3 | / | TRANS |
50`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
51 |CTRL-S|CTRL-Z|CTRL-X|CTRL-C| TRANS| | TRANS| . | 0 | = | |
52 `----------------------------------' `----------------------------------'
53 ,-------------. ,-------------.
54 | TRANS| TRANS| | TRANS| TRANS|
55 ,------|------|------| |------+------+------.
56 | | | TRANS| | TRANS| | |
57 |TRANS |TRANS |------| |------| TRANS| TRANS|
58 | | | TRANS| | TRANS| | |
59 `--------------------' `--------------------'
60
61</pre></code>
62
63
64
65## Generation of .hex file
66> In the "qmk_firmware/keyboards/ergodox" directory.
67
68> Execute "make dvorak_emacs". Then the hex file "ergodox_ez_dvorak_emacs.hex" is in the root directory : "qmk_firmware".
69
70> Flash with `teensy_loader` binary
diff --git a/keyboards/ergodox/keymaps/erez_experimental/Makefile b/keyboards/ergodox/keymaps/erez_experimental/Makefile
index b673c5ce5..51a0c74c5 100644
--- a/keyboards/ergodox/keymaps/erez_experimental/Makefile
+++ b/keyboards/ergodox/keymaps/erez_experimental/Makefile
@@ -3,6 +3,8 @@
3 3
4SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 4SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
5COMMAND_ENABLE = no # Commands for debug and configuration 5COMMAND_ENABLE = no # Commands for debug and configuration
6RGBLIGHT_ENABLE ?= yes
7MIDI_ENABLE ?= yes
6 8
7ifndef QUANTUM_DIR 9ifndef QUANTUM_DIR
8 include ../../../../Makefile 10 include ../../../../Makefile
diff --git a/keyboards/ergodox/keymaps/erez_experimental/config.h b/keyboards/ergodox/keymaps/erez_experimental/config.h
index e5d7fe188..4da18c65a 100644
--- a/keyboards/ergodox/keymaps/erez_experimental/config.h
+++ b/keyboards/ergodox/keymaps/erez_experimental/config.h
@@ -8,5 +8,6 @@
8 8
9#undef LEADER_TIMEOUT 9#undef LEADER_TIMEOUT
10#define LEADER_TIMEOUT 300 10#define LEADER_TIMEOUT 300
11
11 12
12#endif 13#endif
diff --git a/keyboards/ergodox/keymaps/erez_experimental/keymap.c b/keyboards/ergodox/keymaps/erez_experimental/keymap.c
index 4804959d6..13b8240ce 100644
--- a/keyboards/ergodox/keymaps/erez_experimental/keymap.c
+++ b/keyboards/ergodox/keymaps/erez_experimental/keymap.c
@@ -7,6 +7,12 @@
7#define SYMB 1 // symbols 7#define SYMB 1 // symbols
8#define MDIA 2 // media keys 8#define MDIA 2 // media keys
9 9
10enum custom_keycodes {
11 PLACEHOLDER = SAFE_RANGE, // can always be here
12 RGB_FF00BB // always start with RGB_
13};
14
15
10const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 16const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
11/* Keymap 0: Basic layer 17/* Keymap 0: Basic layer
12 * 18 *
@@ -65,33 +71,33 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
65 * | | | |NxtTab|PrvTab| | | | | | | 71 * | | | |NxtTab|PrvTab| | | | | | |
66 * `----------------------------------' `----------------------------------' 72 * `----------------------------------' `----------------------------------'
67 * ,-------------. ,-------------. 73 * ,-------------. ,-------------.
68 * | | | | | | 74 * | | | |TOG |
69 * ,------|------|------| |------+------+------. 75 * ,------|------|------| |------+------+------.
70 * | | | | | | | | 76 * |VAI |VAD |HUI | |SAI | |MOD |
71 * | | |------| |------| | | 77 * | | |------| |------| | |
72 * | | | | | | | | 78 * | | |HUD | |SAD | | |
73 * `--------------------' `--------------------' 79 * `--------------------' `--------------------'
74 */ 80 */
75// SYMBOLS 81// SYMBOLS
76[SYMB] = KEYMAP( 82[SYMB] = KEYMAP(
77 // left hand 83 // left hand
78 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, 84 RGB_FF00BB, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
79 KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 85 KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
80 KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, 86 KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5,
81 KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS, 87 KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
82 KC_TRNS, KC_TRNS,KC_TRNS,LCTL(KC_PGUP), LCTL(KC_PGDN), 88 KC_TRNS, KC_TRNS,KC_TRNS,LCTL(KC_PGUP), LCTL(KC_PGDN),
83 KC_TRNS,KC_TRNS, 89 KC_TRNS,KC_TRNS,
84 KC_TRNS, 90 RGB_HUI,
85 KC_TRNS,KC_TRNS,KC_TRNS, 91 RGB_VAI,RGB_VAD,RGB_HUD,
86 // right hand 92 // right hand
87 KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, 93 KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
88 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F12, 94 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F12,
89 KC_AMPR, KC_UNDS, KC_MINS, CM_SCLN, KC_PLUS, KC_TRNS, 95 KC_AMPR, KC_UNDS, KC_MINS, CM_SCLN, KC_PLUS, KC_TRNS,
90 KC_TRNS, KC_PIPE, KC_AT, KC_EQL, KC_PERC, KC_TRNS, KC_TRNS, 96 KC_TRNS, KC_PIPE, KC_AT, KC_EQL, KC_PERC, KC_TRNS, KC_TRNS,
91 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 97 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
92 KC_TRNS, KC_TRNS, 98 RGB_TOG, KC_TRNS,
93 KC_TRNS, 99 RGB_SAI,
94 KC_TRNS, KC_TRNS, KC_TRNS 100 RGB_SAD, KC_TRNS, RGB_MOD
95), 101),
96/* Keymap 2: Media and mouse keys 102/* Keymap 2: Media and mouse keys
97 * 103 *
@@ -152,6 +158,24 @@ void matrix_init_user(void) {
152 158
153}; 159};
154 160
161
162bool process_record_user(uint16_t keycode, keyrecord_t *record) {
163 switch (keycode) {
164 // dynamically generate these.
165 case RGB_FF00BB:
166 if (record->event.pressed) {
167 #ifdef RGBLIGHT_ENABLE
168 rgblight_enable();
169 rgblight_mode(1);
170 rgblight_setrgb(0xff,0x00,0xbb);
171 #endif
172 }
173 return false;
174 break;
175 }
176 return true;
177}
178
155LEADER_EXTERNS(); 179LEADER_EXTERNS();
156 180
157// Runs constantly in the background, in a loop. 181// Runs constantly in the background, in a loop.
diff --git a/keyboards/ergodox/keymaps/galson/Makefile b/keyboards/ergodox/keymaps/galson/Makefile
new file mode 100644
index 000000000..f008f5079
--- /dev/null
+++ b/keyboards/ergodox/keymaps/galson/Makefile
@@ -0,0 +1,2 @@
1COMMAND_ENABLE = no # Commands for debug and configuration
2
diff --git a/keyboards/ergodox/keymaps/galson/keymap.c b/keyboards/ergodox/keymaps/galson/keymap.c
new file mode 100644
index 000000000..0d3e7560d
--- /dev/null
+++ b/keyboards/ergodox/keymaps/galson/keymap.c
@@ -0,0 +1,183 @@
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
10const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
11/* Keymap 0: Basic layer
12 *
13 * ,--------------------------------------------------. ,--------------------------------------------------.
14 * | + | 1 | 2 | 3 | 4 | 5 | rclk | | lclk | 6 | 7 | 8 | 9 | 0 | - |
15 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
16 * | = | Q | W | E | R |cmd/T |shift | |shift |cmd/Y | U | I | O | P | \ |
17 * |--------+------+------+------+------+------| ( | | ) |------+------+------+------+------+--------|
18 * | " | A | S | D | F | G |------| |------| H | J | K | L |; / L2| ' |
19 * |--------+------+------+------+------+------| ctrl | | ctrl |------+------+------+------+------+--------|
20 * | { | Z | X | C | V | B | [ | | ] | N | M | , | . | / | } |
21 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
22 * | _ | ` | $ | Left | Right| | Up | Down | : | * | ! |
23 * `----------------------------------' `----------------------------------'
24 * ,-------------. ,-------------.
25 * | < | | | | & | > |
26 * ,------|------|------| |------+--------+------.
27 * | | | # | | @ | | |
28 * | Space|Backsp|------| |------| Tab |Enter |
29 * | |ace | % | | ESC | | |
30 * `--------------------' `----------------------'
31 */
32// If it accepts an argument (i.e, is a function), it doesn't need KC_.
33// Otherwise, it needs KC_*
34[BASE] = KEYMAP( // layer 0 : default
35 // left hand
36 KC_PLUS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_BTN2,
37 KC_EQL, KC_Q, KC_W, KC_E, KC_R, GUI_T(KC_T), KC_LSPO,
38 KC_DQUO, KC_A, KC_S, KC_D, KC_F, KC_G,
39 KC_LCBR, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, CTL_T(KC_LBRC),
40 KC_UNDS, KC_GRV, KC_DLR, KC_LEFT,KC_RGHT,
41 KC_LABK, KC_PIPE,
42 KC_HASH,
43 KC_SPC, KC_BSPC,KC_PERC,
44 // right hand
45 KC_BTN1, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
46 KC_RSPC, GUI_T(KC_Y), KC_U, KC_I, KC_O, KC_P, KC_BSLS,
47 KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), KC_QUOT,
48 CTL_T(KC_RBRC), KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RCBR,
49 KC_UP, KC_DOWN,KC_COLN,KC_ASTR, KC_EXLM,
50 KC_AMPR, KC_RABK,
51 KC_AT,
52 KC_ESC, KC_TAB, KC_ENT
53 ),
54/* Keymap 1: Symbol Layer
55 *
56 * ,--------------------------------------------------.
57 * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
58 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
59 * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
60 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
61 * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
62 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
63 * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
64 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
65 * | | | | | | | | . | 0 | = | |
66 * `----------------------------------' `----------------------------------'
67 * ,-------------. ,-------------.
68 * | | | | | |
69 * ,------|------|------| |------+------+------.
70 * | | | | | | | |
71 * | | |------| |------| | |
72 * | | | | | | | |
73 * `--------------------' `--------------------'
74 */
75// SYMBOLS
76[SYMB] = KEYMAP(
77 // left hand
78 M(0), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
79 KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
80 KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV,
81 KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
82 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
83 KC_TRNS,KC_TRNS,
84 KC_TRNS,
85 KC_TRNS,KC_TRNS,KC_TRNS,
86 // right hand
87 KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
88 KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
89 KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS,
90 KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS,
91 KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS,
92 KC_TRNS, KC_TRNS,
93 KC_TRNS,
94 KC_TRNS, KC_TRNS, KC_TRNS
95),
96/* Keymap 2: Media and mouse keys
97 *
98 * ,--------------------------------------------------. ,--------------------------------------------------.
99 * | | | | | | | | | | | | | | | |
100 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
101 * | | | | MsUp | | | | | | | | | | | |
102 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
103 * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
104 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
105 * | | | | | | | | | | | | Prev | Next | | |
106 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
107 * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
108 * `----------------------------------' `----------------------------------'
109 * ,-------------. ,-------------.
110 * | | | | | |
111 * ,------|------|------| |------+------+------.
112 * | | | | | | |Brwser|
113 * | | |------| |------| |Back |
114 * | | | | | | | |
115 * `--------------------' `--------------------'
116 */
117// MEDIA AND MOUSE
118[MDIA] = KEYMAP(
119 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
120 KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
121 KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
122 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
123 KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
124 KC_TRNS, KC_TRNS,
125 KC_TRNS,
126 KC_TRNS, KC_TRNS, KC_TRNS,
127 // right hand
128 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 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, KC_MPLY,
131 KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
132 KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
133 KC_TRNS, KC_TRNS,
134 KC_TRNS,
135 KC_TRNS, KC_TRNS, KC_WBAK
136),
137};
138
139const uint16_t PROGMEM fn_actions[] = {
140 [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
141};
142
143const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
144{
145 // MACRODOWN only works in this function
146 switch(id) {
147 case 0:
148 if (record->event.pressed) {
149 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
150 }
151 break;
152 }
153 return MACRO_NONE;
154};
155
156// Runs just one time when the keyboard initializes.
157void matrix_init_user(void) {
158
159};
160
161// Runs constantly in the background, in a loop.
162void matrix_scan_user(void) {
163
164 uint8_t layer = biton32(layer_state);
165
166 ergodox_board_led_off();
167 ergodox_right_led_1_off();
168 ergodox_right_led_2_off();
169 ergodox_right_led_3_off();
170 switch (layer) {
171 // TODO: Make this relevant to the ErgoDox EZ.
172 case 1:
173 ergodox_right_led_1_on();
174 break;
175 case 2:
176 ergodox_right_led_2_on();
177 break;
178 default:
179 // none
180 break;
181 }
182
183};
diff --git a/keyboards/ergodox/keymaps/galson/readme.md b/keyboards/ergodox/keymaps/galson/readme.md
new file mode 100644
index 000000000..ebc916725
--- /dev/null
+++ b/keyboards/ergodox/keymaps/galson/readme.md
@@ -0,0 +1,11 @@
1# Galson keymap
2
3
4Sep 26, 2016.
5
6This is an ergonomic layout for programming for those with typing-related injuries. Key features:
7
8- As many symbol keys as possible are accessible without shifting. These should be accessed by moving the entire hand and pressing with a strong finger.
9- Arrow keys and left and right mouse clicks for mouse-free navigation when combined with head mouse or eyetracker.
10- Modifier keys are dual role and relocated to positions convenient for the index finger.
11- Positions are more convenient when the keyboard is vertically mounted (as it should be!) \ No newline at end of file
diff --git a/keyboards/ergodox/keymaps/jack/Makefile b/keyboards/ergodox/keymaps/jack/Makefile
new file mode 100644
index 000000000..3ca69bb92
--- /dev/null
+++ b/keyboards/ergodox/keymaps/jack/Makefile
@@ -0,0 +1,6 @@
1RGBLIGHT_ENABLE ?= yes
2MIDI_ENABLE ?= yes
3
4ifndef QUANTUM_DIR
5 include ../../../../Makefile
6endif
diff --git a/keyboards/ergodox/keymaps/jack/config.h b/keyboards/ergodox/keymaps/jack/config.h
new file mode 100644
index 000000000..5c1165226
--- /dev/null
+++ b/keyboards/ergodox/keymaps/jack/config.h
@@ -0,0 +1,17 @@
1#ifndef CONFIG_USER_H
2#define CONFIG_USER_H
3
4#include "../../config.h"
5
6/* ws2812 RGB LED */
7#define RGB_DI_PIN D7
8#define RGBLIGHT_ANIMATIONS
9#define RGBLED_NUM 15 // Number of LEDs
10#define RGBLIGHT_HUE_STEP 12
11#define RGBLIGHT_SAT_STEP 255
12#define RGBLIGHT_VAL_STEP 12
13
14#define RGB_MIDI
15#define RGBW_BB_TWI
16
17#endif \ No newline at end of file
diff --git a/keyboards/ergodox/keymaps/jack/keymap.c b/keyboards/ergodox/keymaps/jack/keymap.c
index dda253fa4..9cb80c59d 100644
--- a/keyboards/ergodox/keymaps/jack/keymap.c
+++ b/keyboards/ergodox/keymaps/jack/keymap.c
@@ -19,14 +19,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19 KC_HOME, 19 KC_HOME,
20 KC_SPC,KC_SPC,KC_END, 20 KC_SPC,KC_SPC,KC_END,
21 // right hand 21 // right hand
22 KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0, KC_NO, 22 KC_NO, M(1), KC_7, KC_8, KC_9, KC_0, KC_NO,
23 KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, 23 KC_NO, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, KC_P, KC_BSPC,
24 KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, 24 RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_SCLN, KC_QUOT,
25 KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT, 25 KC_NO, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_ENT,
26 MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, 26 MO(1), KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,
27 KC_NO, KC_NO, 27 RGB_TOG, RGB_HUI,
28 KC_PGUP, 28 RGB_MOD,
29 KC_PGDN, KC_SPC,KC_SPC 29 M(2), KC_SPC,KC_SPC
30 ), 30 ),
31[SYMB] = KEYMAP( 31[SYMB] = KEYMAP(
32 // left hand 32 // left hand
@@ -84,6 +84,16 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
84 unregister_code(KC_RSFT); 84 unregister_code(KC_RSFT);
85 } 85 }
86 break; 86 break;
87 case 1:
88 if (record->event.pressed) { // For resetting EEPROM
89 eeconfig_init();
90 }
91 break;
92 case 2:
93 if (record->event.pressed) { // For resetting EEPROM
94 api_send_unicode(0x0CA0);
95 }
96 break;
87 } 97 }
88 return MACRO_NONE; 98 return MACRO_NONE;
89}; 99};
diff --git a/keyboards/ergodox/keymaps/kristian/keymap.c b/keyboards/ergodox/keymaps/kristian/keymap.c
new file mode 100644
index 000000000..e7e424325
--- /dev/null
+++ b/keyboards/ergodox/keymaps/kristian/keymap.c
@@ -0,0 +1,79 @@
1#include "ergodox.h"
2#include "debug.h"
3#include "action_layer.h"
4#include "version.h"
5#include "keymap_fr_ch.h"
6#include "keymap_french.h"
7#include "keymap_german.h"
8#include "keymap_german_ch.h"
9#include "keymap_nordic.h"
10#include "keymap_norwegian.h"
11#include "keymap_spanish.h"
12
13const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
14
15
16[0] = KEYMAP(NO_LESS,KC_1,KC_2,KC_3,KC_4,KC_5,KC_BSPACE,KC_TAB,KC_Q,KC_W,KC_E,KC_R,KC_T,TG(1),KC_BSPACE,KC_A,KC_S,KC_D,KC_F,KC_G,SFT_T(NO_APOS),CTL_T(KC_Z),KC_X,KC_C,KC_V,KC_B,SFT_T(KC_EQUAL),MO(1),CTL_T(KC_GRAVE),KC_LGUI,KC_LEFT,KC_RIGHT,KC_ESCAPE,KC_CAPSLOCK,KC_HOME,KC_SPACE,KC_LGUI,KC_LALT,KC_DELETE,KC_6,KC_7,KC_8,KC_9,KC_0,NO_PLUS,TG(1),KC_Y,KC_U,KC_I,KC_O,KC_P,NO_AM,KC_H,KC_J,KC_K,KC_L,LT(2,NO_OSLH),NO_AE,SFT_T(KC_RBRC),KC_N,KC_M,KC_COMMA,KC_DOT,CTL_T(KC_SLASH),SFT_T(NO_APOS),KC_DOWN,KC_UP,NO_LPRN,NO_RPRN,MO(1),NO_QUOT,CTL_T(KC_ESCAPE),NO_APOS,KC_LALT,KC_LGUI,KC_ENTER),
17
18[1] = KEYMAP(M(0),KC_F1,KC_F2,KC_F3,KC_F4,KC_F5,KC_BSPACE,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_BSPACE,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_LSHIFT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_LCTL,KC_LGUI,KC_LEFT,KC_RIGHT,KC_ESCAPE,KC_TRANSPARENT,KC_HOME,KC_SPACE,KC_LGUI,KC_LALT,KC_DELETE,KC_F6,KC_F7,KC_F8,KC_F9,KC_F10,KC_F11,KC_TRANSPARENT,KC_7,KC_8,KC_9,KC_TRANSPARENT,KC_TRANSPARENT,KC_F12,KC_4,KC_5,KC_6,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_0,KC_1,KC_2,KC_3,NO_LBRC,NO_RBRC,KC_LSHIFT,KC_COMMA,KC_DOT,LSFT(NO_LBRC),LSFT(NO_RBRC),KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_LALT,KC_LGUI,KC_ENTER),
19
20[2] = KEYMAP(KC_ESCAPE,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MS_UP,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MS_LEFT,KC_MS_DOWN,KC_MS_RIGHT,KC_TRANSPARENT,KC_LSHIFT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_LCTL,KC_LALT,KC_LGUI,KC_MS_BTN1,KC_MS_BTN2,KC_ESCAPE,KC_TRANSPARENT,KC_TRANSPARENT,KC_SPACE,KC_LGUI,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MEDIA_PREV_TRACK,KC_MEDIA_PLAY_PAUSE,KC_MEDIA_NEXT_TRACK,KC_TRANSPARENT,KC_TRANSPARENT,KC_AUDIO_VOL_UP,KC_AUDIO_VOL_DOWN,KC_AUDIO_MUTE,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_ESCAPE,KC_MS_WH_UP,KC_MS_WH_DOWN,KC_MS_ACCEL0,KC_MS_ACCEL1),
21
22};
23
24const uint16_t PROGMEM fn_actions[] = {
25 [1] = ACTION_LAYER_TAP_TOGGLE(1)
26};
27
28const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
29{
30 switch(id) {
31 case 0:
32 if (record->event.pressed) {
33 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
34 }
35 break;
36 }
37 return MACRO_NONE;
38};
39
40void matrix_scan_user(void) {
41
42 uint8_t layer = biton32(layer_state);
43
44 ergodox_board_led_off();
45 ergodox_right_led_1_off();
46 ergodox_right_led_2_off();
47 ergodox_right_led_3_off();
48 switch (layer) {
49 case 1:
50 ergodox_right_led_1_on();
51 break;
52 case 2:
53 ergodox_right_led_2_on();
54 break;
55 case 3:
56 ergodox_right_led_3_on();
57 break;
58 case 4:
59 ergodox_right_led_1_on();
60 ergodox_right_led_2_on();
61 break;
62 case 5:
63 ergodox_right_led_1_on();
64 ergodox_right_led_3_on();
65 break;
66 case 6:
67 ergodox_right_led_2_on();
68 ergodox_right_led_3_on();
69 break;
70 case 7:
71 ergodox_right_led_1_on();
72 ergodox_right_led_2_on();
73 ergodox_right_led_3_on();
74 break;
75 default:
76 break;
77 }
78
79};
diff --git a/keyboards/ergodox/keymaps/robot_test_layout/keymap.c b/keyboards/ergodox/keymaps/robot_test_layout/keymap.c
new file mode 100644
index 000000000..480be177f
--- /dev/null
+++ b/keyboards/ergodox/keymaps/robot_test_layout/keymap.c
@@ -0,0 +1,151 @@
1#include "ergodox.h"
2#include "debug.h"
3#include "action_layer.h"
4#include "version.h"
5
6enum custom_keycodes {
7 PLACEHOLDER = SAFE_RANGE, // can always be here
8 RGB_FF0000,
9 RGB_00FF00,
10 RGB_0000FF,
11 RGB_FFFFFF,
12 RGB_TOGGLE,
13 LED1,
14 LED2,
15 LED3
16};
17
18const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19
20[0] = KEYMAP(
21 RGB_TOGGLE, RGB_FF0000, RGB_00FF00, RGB_0000FF, RGB_FFFFFF, KC_5, KC_LPRN,
22 KC_GRAVE, KC_A, KC_B, KC_C, KC_D, KC_E, KC_EXLM,
23 KC_HASH, KC_J, KC_K, KC_L, KC_M, KC_N,
24 KC_AMPR, KC_T, KC_U, KC_V, KC_W, KC_X, KC_DLR,
25 KC_PIPE, KC_R, KC_PLUS, KC_LCBR, KC_RCBR,
26
27 KC_F, KC_G,
28 KC_H,
29 KC_P, KC_O, KC_I,
30
31
32
33 // RIGHT HAND
34 KC_RPRN, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
35 KC_AT, KC_F, KC_G, KC_H, KC_I, KC_COLN, KC_BSLS,
36 KC_O, KC_P, KC_Q, KC_R, KC_S, KC_QUOT,
37 LSFT(KC_COMM), KC_Y, KC_Z, KC_COMM, KC_DOT, KC_SLSH, KC_ASTR,
38 KC_A, KC_B, KC_C, KC_D, KC_PIPE,
39
40 LED1, KC_E,
41 LED2,
42 LED3, KC_J, KC_K
43 )
44};
45
46
47
48const uint16_t PROGMEM fn_actions[] = {
49 [1] = ACTION_LAYER_TAP_TOGGLE(1)
50};
51
52const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
53{
54 switch(id) {
55 case 0:
56 if (record->event.pressed) {
57 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
58 }
59 break;
60 }
61 return MACRO_NONE;
62};
63
64bool status_led1_on = false, status_led2_on = false, status_led3_on = false;
65bool process_record_user(uint16_t keycode, keyrecord_t *record) {
66 switch (keycode) {
67 // dynamically generate these.
68 case RGB_FF0000:
69 if (record->event.pressed) {
70 #ifdef RGBLIGHT_ENABLE
71 EZ_RGB(0xff0000);
72 register_code(KC_1); unregister_code(KC_1);
73 #endif
74 }
75 return false;
76 break;
77 case RGB_00FF00:
78 if (record->event.pressed) {
79 #ifdef RGBLIGHT_ENABLE
80 EZ_RGB(0x00ff00);
81 register_code(KC_2); unregister_code(KC_2);
82 #endif
83 }
84 return false;
85 break;
86 case RGB_0000FF:
87 if (record->event.pressed) {
88 #ifdef RGBLIGHT_ENABLE
89 EZ_RGB(0x0000ff);
90 register_code(KC_3); unregister_code(KC_3);
91 #endif
92 }
93 return false;
94 break;
95 case RGB_FFFFFF:
96 if (record->event.pressed) {
97 #ifdef RGBLIGHT_ENABLE
98 EZ_RGB(0xffffff);
99 register_code(KC_4); unregister_code(KC_4);
100 #endif
101 }
102 return false;
103 break;
104 case RGB_TOGGLE:
105 if (record->event.pressed) {
106 #ifdef RGBLIGHT_ENABLE
107 rgblight_toggle();
108 register_code(KC_EQL); unregister_code(KC_EQL);
109 #endif
110 }
111 return false;
112 break;
113 case LED1:
114 if (record->event.pressed) {
115 if(status_led1_on) {
116 ergodox_right_led_1_off();
117 status_led1_on = false;
118 } else {
119 ergodox_right_led_1_on();
120 status_led1_on = true;
121 }
122 }
123 return false;
124 break;
125 case LED2:
126 if (record->event.pressed) {
127 if(status_led2_on) {
128 ergodox_right_led_2_off();
129 status_led2_on = false;
130 } else {
131 ergodox_right_led_2_on();
132 status_led2_on = true;
133 }
134 }
135 return false;
136 break;
137 case LED3:
138 if (record->event.pressed) {
139 if(status_led3_on) {
140 ergodox_right_led_3_off();
141 status_led3_on = false;
142 } else {
143 ergodox_right_led_3_on();
144 status_led3_on = true;
145 }
146 }
147 return false;
148 break;
149 }
150 return true;
151}
diff --git a/keyboards/ergodox/keymaps/robot_test_layout/readme.md b/keyboards/ergodox/keymaps/robot_test_layout/readme.md
new file mode 100644
index 000000000..45dc2aa76
--- /dev/null
+++ b/keyboards/ergodox/keymaps/robot_test_layout/readme.md
@@ -0,0 +1,5 @@
1# Robot test layout
2
3Use this layout if you like to pretend you're [Norman](https://www.youtube.com/watch?v=-sbxFBay-tg), the ErgoDox EZ manufacturing robot.
4
5It's really meant just for internal use, but we're posting it on GitHub anyway, because hurray to open source. :)
diff --git a/keyboards/ergodox/rules.mk b/keyboards/ergodox/rules.mk
index add64ec76..2e501e81b 100644
--- a/keyboards/ergodox/rules.mk
+++ b/keyboards/ergodox/rules.mk
@@ -24,6 +24,5 @@ COMMAND_ENABLE ?= yes # Commands for debug and configuration
24CUSTOM_MATRIX ?= yes # Custom matrix file for the ErgoDox EZ 24CUSTOM_MATRIX ?= yes # Custom matrix file for the ErgoDox EZ
25SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend 25SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend
26NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 26NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
27MIDI_ENABLE ?= no # MIDI controls
28UNICODE_ENABLE ?= yes # Unicode 27UNICODE_ENABLE ?= yes # Unicode
29ONEHAND_ENABLE ?= yes # Allow swapping hands of keyboard 28ONEHAND_ENABLE ?= yes # Allow swapping hands of keyboard
diff --git a/keyboards/gh60/gh60.h b/keyboards/gh60/gh60.h
index 82624b614..66bc2790d 100644
--- a/keyboards/gh60/gh60.h
+++ b/keyboards/gh60/gh60.h
@@ -4,7 +4,7 @@
4#include "quantum.h" 4#include "quantum.h"
5#include "led.h" 5#include "led.h"
6 6
7/* GH60 LEDs 7/* GH60 LEDs
8 * GPIO pads 8 * GPIO pads
9 * 0 F7 WASD LEDs 9 * 0 F7 WASD LEDs
10 * 1 F6 ESC LED 10 * 1 F6 ESC LED
@@ -35,40 +35,41 @@ inline void gh60_wasd_leds_off(void) { DDRF &= ~(1<<7); PORTF &= ~(1<<7); }
35 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ 35 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
36 K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \ 36 K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \
37) { \ 37) { \
38 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \ 38 { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \
39 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \ 39 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \
40 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \ 40 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \
41 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \ 41 { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \
42 { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \ 42 { K40, K41, K42, KC_NO, KC_NO, K45, KC_NO, KC_NO, KC_NO, K49, K4A, K4B, K4C, K4D } \
43} 43}
44 44
45/* ANSI valiant. No extra keys for ISO */ 45/* ANSI variant. No extra keys for ISO */
46#define KEYMAP_ANSI( \ 46#define KEYMAP_ANSI( \
47 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ 47 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
48 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ 48 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
49 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \ 49 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
50 K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \ 50 K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \
51 K40, K41, K42, K45, K4A, K4B, K4C, K4D \ 51 K40, K41, K42, K45, K4A, K4B, K4C, K4D \
52) KEYMAP( \ 52) { \
53 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ 53 { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \
54 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ 54 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \
55 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \ 55 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO, K2D }, \
56 K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO, K3D, \ 56 { K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, KC_NO, K3D }, \
57 K40, K41, K42, K45, NO, K4A, K4B, K4C, K4D \ 57 { K40, K41, K42, KC_NO, KC_NO, K45, KC_NO, KC_NO, KC_NO, KC_NO, K4A, K4B, K4C, K4D } \
58) 58}
59 59
60/* HHKB Variant */
60#define KEYMAP_HHKB( \ 61#define KEYMAP_HHKB( \
61 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K49,\ 62 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K49,\
62 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ 63 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
63 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \ 64 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
64 K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3C, \ 65 K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3C, \
65 K40, K41, K42, K45, K4A, K4B, K4C, K4D \ 66 K40, K41, K42, K45, K4A, K4B, K4C, K4D \
66) KEYMAP( \ 67) { \
67 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ 68 { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \
68 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ 69 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \
69 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \ 70 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO, K2D }, \
70 K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ 71 { K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \
71 K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \ 72 { K40, K41, K42, KC_NO, KC_NO, K45, KC_NO, KC_NO, KC_NO, K49, K4A, K4B, K4C, K4D } \
72) 73}
73 74
74#endif 75#endif
diff --git a/keyboards/gh60/keymaps/default/keymap.c b/keyboards/gh60/keymaps/default/keymap.c
index 3622be41b..92f545984 100644
--- a/keyboards/gh60/keymaps/default/keymap.c
+++ b/keyboards/gh60/keymaps/default/keymap.c
@@ -4,25 +4,25 @@
4const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 4const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 /* 0: qwerty */ 5 /* 0: qwerty */
6 KEYMAP( 6 KEYMAP(
7 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, GRV, \ 7 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_GRV,\
8 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ 8 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_BSPC,\
9 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NO, ENT, \ 9 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_NO,KC_ENT,\
10 LSFT,FN1, Z, X, C, V, B, N, M, COMM,DOT, SLSH,FN0, RSFT, \ 10 KC_LSFT,F(1),KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT,KC_SLSH,F(0),KC_RSFT,\
11 LCTL,LGUI,LALT, SPC, BSLS,RALT,RGUI,APP, RCTL), 11 KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_BSLS,KC_RALT,KC_RGUI,KC_APP,KC_RCTL),
12 /* 1: fn */ 12 /* 1: fn */
13 KEYMAP( 13 KEYMAP(
14 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ 14 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_TRNS,\
15 TRNS,TRNS,UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 15 KC_TRNS,KC_TRNS,KC_UP,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,\
16 TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 16 KC_TRNS,KC_LEFT,KC_DOWN,KC_RGHT,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,\
17 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 17 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,\
18 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS), 18 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS),
19 /* 2: arrows */ 19 /* 2: arrows */
20 KEYMAP( 20 KEYMAP(
21 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 21 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,\
22 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 22 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,\
23 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 23 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,\
24 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,UP, \ 24 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_UP,\
25 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,LEFT,DOWN,RGHT), 25 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_LEFT,KC_DOWN,KC_RGHT),
26}; 26};
27 27
28const uint16_t PROGMEM fn_actions[] = { 28const uint16_t PROGMEM fn_actions[] = {
@@ -49,7 +49,7 @@ void matrix_scan_user(void) {
49 49
50//Layer LED indicators 50//Layer LED indicators
51 uint32_t layer = layer_state; 51 uint32_t layer = layer_state;
52 52
53 if (layer & (1<<1)) { 53 if (layer & (1<<1)) {
54 gh60_wasd_leds_on(); 54 gh60_wasd_leds_on();
55 gh60_fn_led_on(); 55 gh60_fn_led_on();
@@ -57,7 +57,7 @@ void matrix_scan_user(void) {
57 gh60_wasd_leds_off(); 57 gh60_wasd_leds_off();
58 gh60_fn_led_off(); 58 gh60_fn_led_off();
59 } 59 }
60 60
61 if (layer & (1<<2)) { 61 if (layer & (1<<2)) {
62 gh60_poker_leds_on(); 62 gh60_poker_leds_on();
63 gh60_esc_led_on(); 63 gh60_esc_led_on();
@@ -65,5 +65,5 @@ void matrix_scan_user(void) {
65 gh60_poker_leds_off(); 65 gh60_poker_leds_off();
66 gh60_esc_led_off(); 66 gh60_esc_led_off();
67 } 67 }
68 68
69}; 69};
diff --git a/keyboards/gh60/keymaps/robotmaxtron/config.h b/keyboards/gh60/keymaps/robotmaxtron/config.h
index 6a29e6b8c..bcd753461 100644
--- a/keyboards/gh60/keymaps/robotmaxtron/config.h
+++ b/keyboards/gh60/keymaps/robotmaxtron/config.h
@@ -182,7 +182,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
182#define ws2812_pin PF4 182#define ws2812_pin PF4
183*/ 183*/
184#define RGB_DI_PIN F4 184#define RGB_DI_PIN F4
185#define RGBLIGHT_TIMER 185#define RGBLIGHT_ANIMATIONS
186#define RGBLED_NUM 8 // Number of LEDs 186#define RGBLED_NUM 8 // Number of LEDs
187#define RGBLIGHT_HUE_STEP 8 187#define RGBLIGHT_HUE_STEP 8
188#define RGBLIGHT_SAT_STEP 8 188#define RGBLIGHT_SAT_STEP 8
diff --git a/keyboards/gh60/keymaps/robotmaxtron/keymap.c b/keyboards/gh60/keymaps/robotmaxtron/keymap.c
index 263eec4e5..9acac7cec 100644
--- a/keyboards/gh60/keymaps/robotmaxtron/keymap.c
+++ b/keyboards/gh60/keymaps/robotmaxtron/keymap.c
@@ -8,9 +8,9 @@
8 8
9const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 9const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
10 /* 10 /*
11 * Base layer, pretty standard ANSI layout. 11 * Base layer, pretty standard ANSI layout.
12 * ,-----------------------------------------------------------. 12 * ,-----------------------------------------------------------.
13 * |FN12| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | 13 * |F(12)| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
14 * |-----------------------------------------------------------| 14 * |-----------------------------------------------------------|
15 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| 15 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
16 * |-----------------------------------------------------------| 16 * |-----------------------------------------------------------|
@@ -22,13 +22,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
22 * `-----------------------------------------------------------' 22 * `-----------------------------------------------------------'
23 */ 23 */
24 [_BL] = KEYMAP( 24 [_BL] = KEYMAP(
25 FN12,1,2,3,4,5,6,7,8,9,0,MINS,EQL,BSPC, \ 25 F(12),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, \
26 TAB,Q,W,E,R,T,Y,U,I,O,P,LBRC,RBRC,BSLS, \ 26 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, \
27 FN2,A,S,D,F,G,H,J,K,L,SCLN,QUOT,NO,ENT, \ 27 F(2),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, \
28 LSFT,NO,Z,X,C,V,B,N,M,COMM,DOT,SLSH,NO,RSFT, \ 28 KC_LSFT,KC_NO,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT,KC_SLSH,KC_NO,KC_RSFT, \
29 LCTL,LGUI,LALT, SPC, NO,RALT,FN0,APP, RCTL), 29 KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_NO,KC_RALT,F(0),KC_APP,KC_RCTL),
30 30
31 /* 31 /*
32 * Locking arrow keys to WASD for when you need dedicated arrow keys 32 * Locking arrow keys to WASD for when you need dedicated arrow keys
33 * ,-----------------------------------------------------------. 33 * ,-----------------------------------------------------------.
34 * | | | | | | | | | | | | | | | 34 * | | | | | | | | | | | | | | |
@@ -43,14 +43,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
43 * `-----------------------------------------------------------' 43 * `-----------------------------------------------------------'
44 */ 44 */
45 [_AL] = KEYMAP( 45 [_AL] = KEYMAP(
46 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 46 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, \
47 TRNS,TRNS,UP,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 47 KC_TRNS,KC_TRNS,KC_UP,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, \
48 TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 48 KC_TRNS,KC_LEFT,KC_DOWN,KC_RGHT,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, \
49 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,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 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS), 50 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS),
51 51
52 52
53 /* 53 /*
54 * Primary function layer, mostly the same as the traditional Pok3r layout. 54 * Primary function layer, mostly the same as the traditional Pok3r layout.
55 * ,-------------------------------------------------------------. 55 * ,-------------------------------------------------------------.
56 * |`~ | F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12|DEL | 56 * |`~ | F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12|DEL |
@@ -65,15 +65,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
65 * `-------------------------------------------------------------' 65 * `-------------------------------------------------------------'
66 */ 66 */
67 [_FL] = KEYMAP( 67 [_FL] = KEYMAP(
68 GRAVE,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12, DELETE, \ 68 KC_GRAVE,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_DELETE, \
69 TRNS,FN1,TRNS,TRNS,TRNS,TRNS,CALC,PGUP,UP,PGDN,PSCR,SLCK,PAUS,TRNS, \ 69 KC_TRNS,F(1),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_CALC,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR,KC_SLCK,KC_PAUS,KC_TRNS, \
70 TRNS,MUTE,_VOLDOWN,_VOLUP,TRNS,TRNS,HOME,LEFT,DOWN,RGHT,INS,TRNS,TRNS,TRNS, \ 70 KC_TRNS,KC_MUTE,KC__VOLDOWN,KC__VOLUP,KC_TRNS,KC_TRNS,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_INS,KC_TRNS,KC_TRNS,KC_TRNS, \
71 TRNS,TRNS,FN3,TRNS,TRNS,TRNS,TRNS,END,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 71 KC_TRNS,KC_TRNS,F(3),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_END,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, \
72 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS), 72 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS),
73 73
74 /* 74 /*
75 * Locking layer for controlling the underglow. 75 * Locking layer for controlling the underglow.
76 * 76 *
77 * ,-----------------------------------------------------------. 77 * ,-----------------------------------------------------------.
78 * | | | | | | | | | | | | | | | 78 * | | | | | | | | | | | | | | |
79 * |-----------------------------------------------------------| 79 * |-----------------------------------------------------------|
@@ -87,11 +87,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
87 * `-----------------------------------------------------------' 87 * `-----------------------------------------------------------'
88 */ 88 */
89 [_UL] = KEYMAP( 89 [_UL] = KEYMAP(
90 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 90 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, \
91 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 91 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, \
92 TRNS,FN4,FN5,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 92 KC_TRNS,F(4),F(5),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, \
93 TRNS,TRNS,TRNS,FN6,FN7,FN8,FN9,FN10,FN11,TRNS,TRNS,TRNS,TRNS,TRNS, \ 93 KC_TRNS,KC_TRNS,KC_TRNS,F(6),F(7),F(8),F(9),F(10),F(11),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, \
94 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS), 94 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS),
95}; 95};
96 96
97enum function_id { 97enum function_id {
@@ -124,7 +124,7 @@ const uint16_t PROGMEM fn_actions[] = {
124 124
125const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 125const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
126{ 126{
127 // MACRODOWN only works in this function 127 // MACRODOWN only works in this function
128 switch(id) { 128 switch(id) {
129 case 0: 129 case 0:
130 if (record->event.pressed) { 130 if (record->event.pressed) {
diff --git a/keyboards/gh60/keymaps/sethbc/Makefile b/keyboards/gh60/keymaps/sethbc/Makefile
new file mode 100644
index 000000000..457a3d01d
--- /dev/null
+++ b/keyboards/gh60/keymaps/sethbc/Makefile
@@ -0,0 +1,3 @@
1ifndef QUANTUM_DIR
2 include ../../../../Makefile
3endif
diff --git a/keyboards/gh60/keymaps/sethbc/keymap.c b/keyboards/gh60/keymaps/sethbc/keymap.c
new file mode 100644
index 000000000..599e664e2
--- /dev/null
+++ b/keyboards/gh60/keymaps/sethbc/keymap.c
@@ -0,0 +1,76 @@
1#include "gh60.h"
2#include "action_layer.h"
3
4#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
5
6
7const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
8 /* 0: qwerty */
9 KEYMAP_HHKB(
10 F(0),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_BSLS,KC_GRV,\
11 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_BSPC,\
12 KC_LCTL,KC_A,KC_S,KC_D,KC_F,KC_G,KC_H,KC_J,KC_K,KC_L,KC_SCLN,KC_QUOT,KC_ENT,\
13 KC_LSFT,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT,KC_SLSH,KC_RSFT,F(1),\
14 KC_LCTL,KC_LALT,KC_LGUI, KC_SPC, KC_RGUI,KC_RALT,KC_APP,KC_RCTL),
15 /* 1: fn */
16 KEYMAP_HHKB(
17 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_TRNS,KC_TRNS,\
18 KC_CAPS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_UP,KC_TRNS,KC_TRNS,\
19 KC_TRNS,KC_VOLD,KC_VOLU,KC_MUTE,KC_TRNS,KC_TRNS,KC_PAST,KC_PSLS,KC_HOME,KC_PGUP,KC_LEFT,KC_RIGHT,KC_PENT,\
20 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PPLS,KC_PMNS,KC_END,KC_PGDN,KC_DOWN,KC_TRNS,KC_TRNS,\
21 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS),
22};
23
24enum function_id {
25 SHIFT_ESC,
26};
27
28const uint16_t PROGMEM fn_actions[] = {
29 [0] = ACTION_FUNCTION(SHIFT_ESC),
30 [1] = ACTION_LAYER_MOMENTARY(1), // to Fn overlay
31};
32
33const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
34{
35 // MACRODOWN only works in this function
36 switch(id) {
37 case 0:
38 if (record->event.pressed) {
39 register_code(KC_RSFT);
40 } else {
41 unregister_code(KC_RSFT);
42 }
43 break;
44 }
45 return MACRO_NONE;
46};
47
48void matrix_scan_user(void) {
49
50}
51
52void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
53 static uint8_t shift_esc_shift_mask;
54 switch (id) {
55 case SHIFT_ESC:
56 shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
57 if (record->event.pressed) {
58 if (shift_esc_shift_mask) {
59 add_key(KC_GRV);
60 send_keyboard_report();
61 } else {
62 add_key(KC_ESC);
63 send_keyboard_report();
64 }
65 } else {
66 if (shift_esc_shift_mask) {
67 del_key(KC_GRV);
68 send_keyboard_report();
69 } else {
70 del_key(KC_ESC);
71 send_keyboard_report();
72 }
73 }
74 break;
75 }
76}
diff --git a/keyboards/handwired/minorca/keymaps/rgb/config.h b/keyboards/handwired/minorca/keymaps/rgb/config.h
index deaac2e26..43b3c5911 100644
--- a/keyboards/handwired/minorca/keymaps/rgb/config.h
+++ b/keyboards/handwired/minorca/keymaps/rgb/config.h
@@ -11,7 +11,7 @@
11 11
12/* ws2812 RGB LED */ 12/* ws2812 RGB LED */
13#define RGB_DI_PIN D5 13#define RGB_DI_PIN D5
14#define RGBLIGHT_TIMER 14#define RGBLIGHT_ANIMATIONS
15#define RGBLED_NUM 13 // Number of LEDs 15#define RGBLED_NUM 13 // Number of LEDs
16#define RGBLIGHT_HUE_STEP 10 16#define RGBLIGHT_HUE_STEP 10
17#define RGBLIGHT_SAT_STEP 17 17#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/handwired/promethium/Makefile b/keyboards/handwired/promethium/Makefile
new file mode 100644
index 000000000..191c6bb66
--- /dev/null
+++ b/keyboards/handwired/promethium/Makefile
@@ -0,0 +1,3 @@
1ifndef MAKEFILE_INCLUDED
2 include ../../../Makefile
3endif \ No newline at end of file
diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h
new file mode 100644
index 000000000..473af67d3
--- /dev/null
+++ b/keyboards/handwired/promethium/config.h
@@ -0,0 +1,162 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along 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 0x6660
26#define DEVICE_VER 0x0001
27#define MANUFACTURER Priyadi
28#define PRODUCT Promethium Keyboard
29#define DESCRIPTION Promethium Keyboard
30
31/* key matrix size */
32#define MATRIX_ROWS 8
33#define MATRIX_COLS 6
34
35/* default pin-out */
36#define MATRIX_COL_PINS { B6, B7, D6, C7, F6, F7 }
37#define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 }
38#define UNUSED_PINS
39
40/* COL2ROW or ROW2COL */
41#define DIODE_DIRECTION COL2ROW
42
43/* define if matrix has ghost */
44//#define MATRIX_HAS_GHOST
45
46/* number of backlight levels */
47#define BACKLIGHT_LEVELS 3
48
49/* Set 0 if debouncing isn't needed */
50#define DEBOUNCING_DELAY 5
51
52/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
53#define LOCKING_SUPPORT_ENABLE
54/* Locking resynchronize hack */
55#define LOCKING_RESYNC_ENABLE
56
57/* key combination for command */
58#define IS_COMMAND() ( \
59 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \
60)
61
62/*
63 * Feature disable options
64 * These options are also useful to firmware size reduction.
65 */
66
67/* disable debug print */
68//#define NO_DEBUG
69
70/* disable print */
71//#define NO_PRINT
72
73/* disable action features */
74//#define NO_ACTION_LAYER
75//#define NO_ACTION_TAPPING
76//#define NO_ACTION_ONESHOT
77//#define NO_ACTION_MACRO
78//#define NO_ACTION_FUNCTION
79
80/* PS/2 mouse */
81#ifdef PS2_USE_BUSYWAIT
82# define PS2_CLOCK_PORT PORTD
83# define PS2_CLOCK_PIN PIND
84# define PS2_CLOCK_DDR DDRD
85# define PS2_CLOCK_BIT 1
86# define PS2_DATA_PORT PORTD
87# define PS2_DATA_PIN PIND
88# define PS2_DATA_DDR DDRD
89# define PS2_DATA_BIT 2
90#endif
91
92/* PS/2 mouse interrupt version */
93#ifdef PS2_USE_INT
94/* uses INT1 for clock line(ATMega32U4) */
95#define PS2_CLOCK_PORT PORTD
96#define PS2_CLOCK_PIN PIND
97#define PS2_CLOCK_DDR DDRD
98#define PS2_CLOCK_BIT 3
99#define PS2_DATA_PORT PORTD
100#define PS2_DATA_PIN PIND
101#define PS2_DATA_DDR DDRD
102#define PS2_DATA_BIT 2
103
104#define PS2_INT_INIT() do { \
105 EICRA |= ((1<<ISC31) | \
106 (0<<ISC30)); \
107} while (0)
108#define PS2_INT_ON() do { \
109 EIMSK |= (1<<INT3); \
110} while (0)
111#define PS2_INT_OFF() do { \
112 EIMSK &= ~(1<<INT3); \
113} while (0)
114#define PS2_INT_VECT INT3_vect
115#endif
116
117/* PS/2 mouse USART version */
118#ifdef PS2_USE_USART
119/* XCK for clock line and RXD for data line */
120#define PS2_CLOCK_PORT PORTD
121#define PS2_CLOCK_PIN PIND
122#define PS2_CLOCK_DDR DDRD
123#define PS2_CLOCK_BIT 5
124#define PS2_DATA_PORT PORTD
125#define PS2_DATA_PIN PIND
126#define PS2_DATA_DDR DDRD
127#define PS2_DATA_BIT 2
128
129/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
130/* set DDR of CLOCK as input to be slave */
131#define PS2_USART_INIT() do { \
132 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
133 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
134 UCSR1C = ((1 << UMSEL10) | \
135 (3 << UPM10) | \
136 (0 << USBS1) | \
137 (3 << UCSZ10) | \
138 (0 << UCPOL1)); \
139 UCSR1A = 0; \
140 UBRR1H = 0; \
141 UBRR1L = 0; \
142} while (0)
143#define PS2_USART_RX_INT_ON() do { \
144 UCSR1B = ((1 << RXCIE1) | \
145 (1 << RXEN1)); \
146} while (0)
147#define PS2_USART_RX_POLL_ON() do { \
148 UCSR1B = (1 << RXEN1); \
149} while (0)
150#define PS2_USART_OFF() do { \
151 UCSR1C = 0; \
152 UCSR1B &= ~((1 << RXEN1) | \
153 (1 << TXEN1)); \
154} while (0)
155#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
156#define PS2_USART_RX_DATA UDR1
157#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
158#define PS2_USART_RX_VECT USART1_RX_vect
159#endif
160
161
162#endif
diff --git a/keyboards/handwired/promethium/keymaps/priyadi/Makefile b/keyboards/handwired/promethium/keymaps/priyadi/Makefile
new file mode 100644
index 000000000..46fdfa011
--- /dev/null
+++ b/keyboards/handwired/promethium/keymaps/priyadi/Makefile
@@ -0,0 +1,29 @@
1
2
3# Build Options
4# change to "no" to disable the options, or define them in the Makefile in
5# the appropriate keymap folder that will get included automatically
6#
7BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
8MOUSEKEY_ENABLE = no # Mouse keys(+4700)
9EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
10CONSOLE_ENABLE = no # Console for debug(+400)
11COMMAND_ENABLE = no # Commands for debug and configuration
12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
13BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
14MIDI_ENABLE = no # MIDI controls
15AUDIO_ENABLE = no # Audio output on port C6
16UNICODE_ENABLE = no # Unicode
17UNICODEMAP_ENABLE = yes
18BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
19RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
20PS2_MOUSE_ENABLE = yes
21PS2_USE_INT = yes
22
23# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
24SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
25
26ifndef QUANTUM_DIR
27 include ../../../../../Makefile
28endif
29
diff --git a/keyboards/handwired/promethium/keymaps/priyadi/config.h b/keyboards/handwired/promethium/keymaps/priyadi/config.h
new file mode 100644
index 000000000..8b78c0dc4
--- /dev/null
+++ b/keyboards/handwired/promethium/keymaps/priyadi/config.h
@@ -0,0 +1,17 @@
1#ifndef CONFIG_USER_H
2#define CONFIG_USER_H
3
4#include "../../config.h"
5
6/* bootmagic salt key */
7#define BOOTMAGIC_KEY_SALT KC_ESC
8
9/* skip bootmagic and eeconfig */
10#define BOOTMAGIC_KEY_SKIP KC_SPACE
11
12#define PREVENT_STUCK_MODIFIERS
13
14#define RGB_DI_PIN B5
15#define RGBSPS_NUM 57
16
17#endif
diff --git a/keyboards/handwired/promethium/keymaps/priyadi/flash.sh b/keyboards/handwired/promethium/keymaps/priyadi/flash.sh
new file mode 100755
index 000000000..14a3b4378
--- /dev/null
+++ b/keyboards/handwired/promethium/keymaps/priyadi/flash.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2
3sleep 10
4avrdude -p m32u4 -P /dev/ttyACM0 -c avr109 -U flash:w:../../../../../.build/handwired_promethium_priyadi.hex
diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c
new file mode 100644
index 000000000..bf797a749
--- /dev/null
+++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c
@@ -0,0 +1,841 @@
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 "promethium.h"
5#include "action_layer.h"
6#ifdef AUDIO_ENABLE
7 #include "audio.h"
8 #include "musical_notes.h"
9#endif
10#include "eeconfig.h"
11#include "process_unicode.h"
12#include "quantum.h"
13#include "rgbsps.h"
14#include "ps2_mouse.h"
15#include "ps2.h"
16#define COUNT(x) (sizeof (x) / sizeof (*(x)))
17
18// #define RGBLED_NUM 5
19// struct cRGB led[RGBLED_NUM];
20
21
22extern keymap_config_t keymap_config;
23
24enum layers {
25 _QWERTY,
26 _COLEMAK,
27 _WORKMAN,
28 _PUNC,
29 _NUM,
30 _FUNC,
31 _EMOJI,
32 _GUI,
33};
34
35enum planck_keycodes {
36 // layouts
37 QWERTY = SAFE_RANGE,
38 COLEMAK,
39 WORKMAN,
40
41 // layer switchers
42 PUNC,
43 NUM,
44 FUNC,
45 EMOJI,
46 GUI,
47
48 // os switchers
49 LINUX,
50 WIN,
51 OSX,
52};
53
54// Fillers to make layering clearer
55
56#define _______ KC_TRNS
57#define XXXXXXX KC_NO
58
59// unicode map
60
61enum unicode_name {
62 GRIN, // grinning face 😊
63 TJOY, // tears of joy 😂
64 SMILE, // grining face with smiling eyes 😁
65 HEART, // heart ❤
66 EYERT, // smiling face with heart shaped eyes 😍
67 CRY, // crying face 😭
68 SMEYE, // smiling face with smiling eyes 😊
69 UNAMU, // unamused 😒
70 KISS, // kiss 😘
71 HART2, // two hearts 💕
72 WEARY, // weary 😩
73 OKHND, // ok hand sign 👌
74 PENSV, // pensive 😔
75 SMIRK, // smirk 😏
76 RECYC, // recycle ♻
77 WINK, // wink 😉
78 THMUP, // thumb up 👍
79 THMDN, // thumb down 👎
80 PRAY, // pray 🙏
81 PHEW, // relieved 😌
82 MUSIC, // musical notes
83 FLUSH, // flushed 😳
84 CELEB, // celebration 🙌
85 CRY2, // crying face 😢
86 COOL, // smile with sunglasses 😎
87 NOEVS, // see no evil
88 NOEVH, // hear no evil
89 NOEVK, // speak no evil
90 POO, // pile of poo
91 EYES, // eyes
92 VIC, // victory hand
93 BHART, // broken heart
94 SLEEP, // sleeping face
95 SMIL2, // smiling face with open mouth & sweat
96 HUNRD, // 100
97 CONFU, // confused
98 TONGU, // face with tongue & winking eye
99 DISAP, // disappointed
100 YUMMY, // face savoring delicious food
101 CLAP, // hand clapping
102 FEAR, // face screaming in fear
103 HORNS, // smiling face with horns
104 HALO, // smiling face with halo
105 BYE, // waving hand
106 SUN, // sun
107 MOON, // moon
108 SKULL, // skull
109};
110
111const uint32_t PROGMEM unicode_map[] = {
112 [GRIN] = 0x1F600,
113 [TJOY] = 0x1F602,
114 [SMILE] = 0x1F601,
115 [HEART] = 0x2764,
116 [EYERT] = 0x1f60d,
117 [CRY] = 0x1f62d,
118 [SMEYE] = 0x1F60A,
119 [UNAMU] = 0x1F612,
120 [KISS] = 0x1F618,
121 [HART2] = 0x1F495,
122 [WEARY] = 0x1F629,
123 [OKHND] = 0x1F44C,
124 [PENSV] = 0x1F614,
125 [SMIRK] = 0x1F60F,
126 [RECYC] = 0x267B,
127 [WINK] = 0x1F609,
128 [THMUP] = 0x1F44D,
129 [THMDN] = 0x1F44E,
130 [PRAY] = 0x1F64F,
131 [PHEW] = 0x1F60C,
132 [MUSIC] = 0x1F3B6,
133 [FLUSH] = 0x1F633,
134 [CELEB] = 0x1F64C,
135 [CRY2] = 0x1F622,
136 [COOL] = 0x1F60E,
137 [NOEVS] = 0x1F648,
138 [NOEVH] = 0x1F649,
139 [NOEVK] = 0x1F64A,
140 [POO] = 0x1F4A9,
141 [EYES] = 0x1F440,
142 [VIC] = 0x270C,
143 [BHART] = 0x1F494,
144 [SLEEP] = 0x1F634,
145 [SMIL2] = 0x1F605,
146 [HUNRD] = 0x1F4AF,
147 [CONFU] = 0x1F615,
148 [TONGU] = 0x1F61C,
149 [DISAP] = 0x1F61E,
150 [YUMMY] = 0x1F60B,
151 [CLAP] = 0x1F44F,
152 [FEAR] = 0x1F631,
153 [HORNS] = 0x1F608,
154 [HALO] = 0x1F607,
155 [BYE] = 0x1F44B,
156 [SUN] = 0x2600,
157 [MOON] = 0x1F314,
158 [SKULL] = 0x1F480,
159};
160
161
162// hybrid shift - =
163// #undef KC_LSFT
164// #define KC_LSFT MT(MOD_LSFT, KC_MINS)
165// #undef KC_RSFT
166// #define KC_RSFT MT(MOD_LSFT, KC_EQL)
167
168
169// hybrid right-gui & scroll lock (mapped to Compose in OS)
170#undef KC_RCTL
171#define KC_RCTL MT(MOD_LCTL, KC_SLCK)
172
173// RGBSPS
174
175const uint8_t PROGMEM LED_ALNUM[] = {
176 LED_Z,
177 LED_A,
178 LED_Q,
179 LED_W,
180 LED_S,
181 LED_X,
182 LED_C,
183 LED_D,
184 LED_E,
185 LED_R,
186 LED_F,
187 LED_V,
188 LED_B,
189 LED_G,
190 LED_T,
191 LED_N,
192 LED_HH,
193 LED_Y,
194 LED_U,
195 LED_J,
196 LED_M,
197 LED_COMM,
198 LED_K,
199 LED_I,
200 LED_O,
201 LED_L,
202 LED_DOT,
203 LED_SLSH,
204 LED_SCLN,
205 LED_P,
206 LED_LSPC,
207 LED_RSPC
208};
209
210const uint8_t PROGMEM LED_MODS[] = {
211 LED_TAB,
212 LED_ESC,
213 LED_LSFT,
214 LED_LCTL,
215 LED_LGUI,
216 LED_LALT,
217 LED_RALT,
218 LED_RGUI,
219 LED_BKSP,
220 LED_ENT,
221 LED_RSFT,
222 LED_RCTL
223};
224
225const uint8_t PROGMEM LED_FN[] = {
226 LED_PUNC,
227 LED_NUM,
228 LED_FUNC,
229 LED_EMOJI
230};
231
232const uint8_t PROGMEM LED_INDICATORS[] = {
233 LED_IND_EMOJI,
234 LED_IND_NUM,
235 LED_IND_FUNC,
236 LED_IND_BATTERY,
237 LED_IND_USB,
238 LED_IND_BLUETOOTH,
239};
240
241const uint8_t PROGMEM LED_TRACKPOINT[] = {
242 LED_TRACKPOINT1,
243 LED_TRACKPOINT2,
244 LED_TRACKPOINT3,
245};
246
247void led_reset(void) {
248 for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
249 rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 15, 6, 0);
250 }
251
252 for(uint8_t i = 0; i < COUNT(LED_MODS); i++) {
253 rgbsps_set(pgm_read_byte(&LED_MODS[i]), 15, 0, 0);
254 }
255
256 for(uint8_t i = 0; i < COUNT(LED_FN); i++) {
257 rgbsps_set(pgm_read_byte(&LED_FN[i]), 15, 15, 15);
258 }
259}
260
261void led_layer_normal(void) {
262 rgbsps_set(LED_IND_FUNC, 0, 0, 0);
263 rgbsps_set(LED_IND_NUM, 0, 0, 0);
264 rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
265
266 led_reset();
267
268 rgbsps_send();
269}
270
271void led_layer_func(void) {
272 rgbsps_set(LED_IND_FUNC, 0, 15, 0);
273 rgbsps_set(LED_IND_NUM, 0, 0, 0);
274 rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
275
276 led_reset();
277
278 for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
279 rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0);
280 }
281
282 rgbsps_set(LED_I, 15, 0, 15);
283 rgbsps_set(LED_J, 15, 0, 15);
284 rgbsps_set(LED_K, 15, 0, 15);
285 rgbsps_set(LED_L, 15, 0, 15);
286
287 rgbsps_set(LED_U, 15, 0, 0);
288 rgbsps_set(LED_O, 15, 0, 0);
289 rgbsps_set(LED_COMM, 15, 0, 0);
290 rgbsps_set(LED_DOT, 15, 0, 0);
291 rgbsps_set(LED_SCLN, 15, 0, 0);
292 rgbsps_set(LED_P, 15, 0, 0);
293
294 rgbsps_set(LED_Q, 0, 15, 0);
295 rgbsps_set(LED_W, 0, 15, 0);
296 rgbsps_set(LED_E, 0, 15, 0);
297 rgbsps_set(LED_R, 0, 15, 0);
298 rgbsps_set(LED_A, 0, 15, 0);
299 rgbsps_set(LED_S, 0, 15, 0);
300 rgbsps_set(LED_D, 0, 15, 0);
301 rgbsps_set(LED_F, 0, 15, 0);
302 rgbsps_set(LED_Z, 0, 15, 0);
303 rgbsps_set(LED_X, 0, 15, 0);
304 rgbsps_set(LED_C, 0, 15, 0);
305 rgbsps_set(LED_V, 0, 15, 0);
306
307 rgbsps_send();
308}
309
310void led_layer_punc(void) {
311 rgbsps_set(LED_IND_FUNC, 0, 15, 0);
312 rgbsps_set(LED_IND_NUM, 0, 0, 15);
313 rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
314
315 led_reset();
316
317 rgbsps_send();
318}
319
320void led_layer_num(void) {
321 rgbsps_set(LED_IND_FUNC, 0, 0, 0);
322 rgbsps_set(LED_IND_NUM, 0, 0, 15);
323 rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
324
325 led_reset();
326
327 for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
328 rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0);
329 }
330
331 rgbsps_set(LED_U, 0, 5, 15);
332 rgbsps_set(LED_I, 0, 5, 15);
333 rgbsps_set(LED_O, 0, 5, 15);
334 rgbsps_set(LED_J, 0, 5, 15);
335 rgbsps_set(LED_K, 0, 5, 15);
336 rgbsps_set(LED_L, 0, 5, 15);
337 rgbsps_set(LED_M, 0, 5, 15);
338 rgbsps_set(LED_COMM, 0, 5, 15);
339 rgbsps_set(LED_DOT, 0, 5, 15);
340 rgbsps_set(LED_FUNC, 0, 5, 15);
341
342 rgbsps_set(LED_EMOJI, 0, 10, 15);
343 rgbsps_set(LED_RALT, 0, 10, 15);
344
345 rgbsps_set(LED_Q, 0, 10, 15);
346 rgbsps_set(LED_W, 0, 10, 15);
347 rgbsps_set(LED_E, 0, 10, 15);
348 rgbsps_set(LED_R, 0, 10, 15);
349 rgbsps_set(LED_T, 0, 10, 15);
350 rgbsps_set(LED_Y, 0, 10, 15);
351 rgbsps_set(LED_P, 0, 10, 15);
352
353 rgbsps_set(LED_A, 0, 15, 15);
354 rgbsps_set(LED_S, 0, 15, 15);
355 rgbsps_set(LED_D, 0, 15, 15);
356 rgbsps_set(LED_F, 0, 15, 15);
357 rgbsps_set(LED_Z, 0, 15, 15);
358 rgbsps_set(LED_X, 0, 15, 15);
359 rgbsps_set(LED_C, 0, 15, 15);
360 rgbsps_set(LED_V, 0, 15, 15);
361
362 rgbsps_send();
363}
364
365void led_layer_emoji(void) {
366 for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
367 rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 15, 15, 0);
368 }
369 for(uint8_t i = 0; i < COUNT(LED_MODS); i++) {
370 rgbsps_set(pgm_read_byte(&LED_MODS[i]), 15, 15, 0);
371 }
372 for(uint8_t i = 0; i < COUNT(LED_FN); i++) {
373 rgbsps_set(pgm_read_byte(&LED_FN[i]), 15, 15, 0);
374 }
375
376 rgbsps_set(LED_IND_FUNC, 0, 0, 0);
377 rgbsps_set(LED_IND_NUM, 0, 0, 0);
378 rgbsps_set(LED_IND_EMOJI, 15, 15, 0);
379
380 rgbsps_set(LED_PUNC, 15, 15, 15);
381 rgbsps_set(LED_EMOJI, 15, 15, 15);
382
383 rgbsps_send();
384}
385
386void led_layer_gui(void) {
387 rgbsps_set(LED_IND_FUNC, 15, 10, 15);
388 rgbsps_set(LED_IND_NUM, 15, 10, 15);
389 rgbsps_set(LED_IND_EMOJI, 15, 10, 15);
390 rgbsps_send();
391}
392
393void led_init(void) {
394 // turn off all
395 rgbsps_turnoff();
396
397 // set trackpoint color
398 rgbsps_set(LED_TRACKPOINT1, 15, 0, 0);
399 rgbsps_set(LED_TRACKPOINT2, 0, 0, 15);
400 rgbsps_set(LED_TRACKPOINT3, 15, 0, 0);
401
402 // // hardcode indicator for now
403 rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15);
404 rgbsps_set(LED_IND_USB, 15, 15, 15);
405 rgbsps_set(LED_IND_BATTERY, 0, 15, 0);
406
407 led_layer_normal();
408}
409
410
411// keymaps
412
413const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
414
415/* Qwerty
416 * ,-----------------------------------------------------------------------------------.
417 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
418 * |------+------+------+------+------+-------------+------+------+------+------+------|
419 * | Esc | A | S | D | F | G | H | J | K | L | ; |Enter |
420 * |------+------+------+------+------+------|------+------+------+------+------+------|
421 * | Shift| Z | X | C | V | B | N | M | , | . | / |Shift |
422 * |------+------+------+------+------+------+------+------+------+------+------+------|
423 * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
424 * `-----------------------------------------------------------------------------------'
425 */
426[_QWERTY] = KEYMAP(
427 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
428 KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT ,
429 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
430 KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL
431),
432
433/* Colemak
434 * ,-----------------------------------------------------------------------------------.
435 * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
436 * |------+------+------+------+------+-------------+------+------+------+------+------|
437 * | Esc | A | R | S | T | D | H | N | E | I | O |Enter |
438 * |------+------+------+------+------+------|------+------+------+------+------+------|
439 * | Shift| Z | X | C | V | B | K | M | , | . | / |Shift |
440 * |------+------+------+------+------+------+------+------+------+------+------+------|
441 * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
442 * `-----------------------------------------------------------------------------------'
443 */
444[_COLEMAK] = KEYMAP(
445 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
446 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT ,
447 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
448 KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL
449),
450
451/* Workman
452 * ,-----------------------------------------------------------------------------------.
453 * | Tab | Q | D | R | W | B | J | F | U | P | ; | Bksp |
454 * |------+------+------+------+------+-------------+------+------+------+------+------|
455 * | Esc | A | S | H | T | G | Y | N | E | O | I |Enter |
456 * |------+------+------+------+------+------|------+------+------+------+------+------|
457 * | Shift| Z | X | M | C | V | K | K | , | . | / |Shift |
458 * |------+------+------+------+------+------+------+------+------+------+------+------|
459 * | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
460 * `-----------------------------------------------------------------------------------'
461 */
462[_WORKMAN] = KEYMAP(
463 KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSPC,
464 KC_ESC, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_ENT ,
465 KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
466 KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL
467),
468
469/* Punc
470 * ,-----------------------------------------------------------------------------------.
471 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | ` |
472 * |------+------+------+------+------+-------------+------+------+------+------+------|
473 * | | | \ | - | = | < | > | ( | ) | ' | | |
474 * |------+------+------+------+------+------|------+------+------+------+------+------|
475 * | | | | | _ | + | { | } | [ | ] | " | | |
476 * |------+------+------+------+------+------+------+------+------+------+------+------|
477 * | | | | | | | | | | | |
478 * `-----------------------------------------------------------------------------------'
479 */
480[_PUNC] = KEYMAP(
481 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_GRV ,
482 XXXXXXX, XXXXXXX, KC_BSLS, KC_MINS, KC_EQL, KC_LABK, KC_RABK, KC_LPRN, KC_RPRN, KC_QUOT, XXXXXXX, XXXXXXX,
483 XXXXXXX, XXXXXXX, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_DQUO, XXXXXXX, XXXXXXX,
484 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
485),
486
487/* Num
488 * ,-----------------------------------------------------------------------------------.
489 * | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
490 * |------+------+------+------+------+-------------+------+------+------+------+------|
491 * | Esc | @ | A | B | C | ( | ) | 4 | 5 | 6 | : |Enter |
492 * |------+------+------+------+------+------|------+------+------+------+------+------|
493 * | & | # | D | E | F | [ | ] | 1 | 2 | 3 | / | * |
494 * |------+------+------+------+------+------+------+------+------+------+------+------|
495 * | | | | x | | | 0 | , | . | + | - |
496 * `-----------------------------------------------------------------------------------'
497 */
498[_NUM] = KEYMAP(
499 KC_CIRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
500 KC_ESC, KC_AT, S(KC_A), S(KC_B), S(KC_C), KC_LPRN, KC_RPRN, KC_4, KC_5, KC_6, KC_COLN, KC_ENT,
501 KC_AMPR, KC_HASH, S(KC_D), S(KC_E), S(KC_F), KC_LBRC, KC_RBRC, KC_1, KC_2, KC_3, KC_SLSH, KC_ASTR,
502 _______, _______, _______, KC_X, _______, KC_SPC, KC_SPC, KC_0, KC_COMM, KC_DOT, KC_PLUS, KC_MINS
503),
504
505/* Func
506 * ,-----------------------------------------------------------------------------------.
507 * | | F1 | F2 | F3 | F4 | | | PgUp | Up | PgDn | PgUp | Del |
508 * |------+------+------+------+------+-------------+------+------+------+------+------|
509 * | | F5 | F6 | F7 | F8 |PrtSc | | Left | Down | Right| PgDn | Ins |
510 * |------+------+------+------+------+------|------+------+------+------+------+------|
511 * | | F9 | F10 | F11 | F12 | | | | Home | End | | |
512 * |------+------+------+------+------+------+------+------+------+------+------+------|
513 * | | | | | | | | | | | |
514 * `-----------------------------------------------------------------------------------'
515 */
516[_FUNC] = KEYMAP(
517 XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL,
518 XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8,KC_PSCREEN,XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_INS,
519 _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______,
520 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
521),
522
523/* Emoji
524 * ,-----------------------------------------------------------------------------------.
525 * | | | | | | | | | | | | |
526 * |------+------+------+------+------+-------------+------+------+------+------+------|
527 * | | | | | | | | | | | | |
528 * |------+------+------+------+------+------+------+------+------+------+------+------|
529 * | | | | | | | | | | | | |
530 * |------+------+------+------+------+------+------+------+------+------+------+------|
531 * | | | | | | | | | | | | |
532 * `-----------------------------------------------------------------------------------'
533 */
534[_EMOJI] = KEYMAP(
535 X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW),
536 X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS),
537 X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH),
538 X(POO), X(EYES),X(HUNRD), _______,X(SKULL),X(HORNS), X(HALO), X(FEAR), _______,X(YUMMY),X(DISAP),X(NOEVK)
539),
540
541/* GUI
542 * ,-----------------------------------------------------------------------------------.
543 * | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | |
544 * |------+------+------+------+------+-------------+------+------+------+------+------|
545 * |Linux | | Vol- | Mute | Vol+ | | | D- | | D+ | |Qwerty|
546 * |------+------+------+------+------+------+------+------+------+------+------+------|
547 * | Win | | Prev | Play | Next | | | | | | |Colmak|
548 * |------+------+------+------+------+------+------+------+------+------+------+------|
549 * | OSX | | | | | BL- | BL+ | | | | |Workmn|
550 * `-----------------------------------------------------------------------------------'
551 */
552[_GUI] = KEYMAP(
553 _______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______,
554 LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,_______, QWERTY,
555 WIN, _______, KC_MPRV, KC_MPLY, KC_MNXT, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, COLEMAK,
556 OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, RGB_VAI, RGB_VAD, WORKMAN
557),
558
559};
560
561#ifdef AUDIO_ENABLE
562float tone_startup[][2] = SONG(STARTUP_SOUND);
563float tone_qwerty[][2] = SONG(QWERTY_SOUND);
564float tone_colemak[][2] = SONG(COLEMAK_SOUND);
565float tone_workman[][2] = SONG(DVORAK_SOUND);
566float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
567float tone_linux[][2] = SONG(CAPS_LOCK_ON_SOUND);
568float tone_windows[][2] = SONG(SCROLL_LOCK_ON_SOUND);
569float tone_osx[][2] = SONG(NUM_LOCK_ON_SOUND);
570float tone_click[][2] = SONG(MUSICAL_NOTE(_F3, 2));
571#endif
572
573void persistant_default_layer_set(uint16_t default_layer) {
574 eeconfig_update_default_layer(default_layer);
575 default_layer_set(default_layer);
576}
577
578bool process_record_user(uint16_t keycode, keyrecord_t *record) {
579 #ifdef AUDIO_ENABLE
580 // faux clicky
581 if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0);
582 #endif
583
584 switch (keycode) {
585 case QWERTY:
586 if (record->event.pressed) {
587 #ifdef AUDIO_ENABLE
588 PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
589 #endif
590 persistant_default_layer_set(1UL<<_QWERTY);
591 }
592 return false;
593 break;
594 case COLEMAK:
595 if (record->event.pressed) {
596 #ifdef AUDIO_ENABLE
597 PLAY_NOTE_ARRAY(tone_colemak, false, 0);
598 #endif
599 persistant_default_layer_set(1UL<<_COLEMAK);
600 }
601 return false;
602 break;
603 case WORKMAN:
604 if (record->event.pressed) {
605 #ifdef AUDIO_ENABLE
606 PLAY_NOTE_ARRAY(tone_workman, false, 0);
607 #endif
608 persistant_default_layer_set(1UL<<_WORKMAN);
609 }
610 return false;
611 break;
612
613
614
615 case PUNC:
616 if (record->event.pressed) {
617 layer_on(_PUNC);
618 update_tri_layer(_PUNC, _EMOJI, _GUI);
619 if (IS_LAYER_ON(_GUI)) {
620 led_layer_gui();
621 } else {
622 led_layer_punc();;
623 }
624 } else {
625 layer_off(_PUNC);
626 update_tri_layer(_PUNC, _EMOJI, _GUI);
627 if (IS_LAYER_ON(_EMOJI)) {
628 led_layer_emoji();
629 } else {
630 led_layer_normal();;
631 }
632 }
633 return false;
634 break;
635 case EMOJI:
636 if (record->event.pressed) {
637 layer_on(_EMOJI);
638 update_tri_layer(_PUNC, _EMOJI, _GUI);
639 if (IS_LAYER_ON(_GUI)) {
640 led_layer_gui();
641 } else {
642 led_layer_emoji();;
643 }
644 } else {
645 layer_off(_EMOJI);
646 update_tri_layer(_PUNC, _EMOJI, _GUI);
647 if (IS_LAYER_ON(_PUNC)) {
648 led_layer_punc();
649 } else {
650 led_layer_normal();;
651 }
652 }
653 return false;
654 break;
655 case NUM:
656 if (record->event.pressed) {
657 layer_on(_NUM);
658 led_layer_num();
659 } else {
660 layer_off(_NUM);
661 led_layer_normal();
662 }
663 return false;
664 break;
665 case FUNC:
666 if (record->event.pressed) {
667 layer_on(_FUNC);
668 led_layer_func();
669 } else {
670 layer_off(_FUNC);
671 led_layer_normal();
672 }
673 return false;
674 break;
675
676
677 case LINUX:
678 set_unicode_input_mode(UC_LNX);
679 #ifdef AUDIO_ENABLE
680 PLAY_NOTE_ARRAY(tone_linux, false, 0);
681 #endif
682 return false;
683 break;
684 case WIN:
685 set_unicode_input_mode(UC_WINC);
686 #ifdef AUDIO_ENABLE
687 PLAY_NOTE_ARRAY(tone_windows, false, 0);
688 #endif
689 return false;
690 break;
691 case OSX:
692 set_unicode_input_mode(UC_OSX);
693 #ifdef AUDIO_ENABLE
694 PLAY_NOTE_ARRAY(tone_osx, false, 0);
695 #endif
696 return false;
697 break;
698 }
699 return true;
700}
701
702void matrix_init_user(void) {
703 #ifdef AUDIO_ENABLE
704 startup_user();
705 #endif
706 set_unicode_input_mode(UC_LNX);
707 led_init();
708}
709
710// void init_rgblight(void) {
711// for (uint8_t i = 0; i < RGBLED_NUM; i++) {
712// led[i].r = 255;
713// led[i].g = 85;
714// led[i].b = 0;
715// }
716// ws2812_setleds(led, RGBLED_NUM);
717// }
718
719
720#ifdef AUDIO_ENABLE
721
722void startup_user()
723{
724 _delay_ms(20); // gets rid of tick
725 PLAY_NOTE_ARRAY(tone_startup, false, 0);
726}
727
728void shutdown_user()
729{
730 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
731 _delay_ms(150);
732 stop_all_notes();
733}
734
735#endif
736
737
738void ps2_mouse_init_user() {
739 // set TrackPoint sensitivity
740 PS2_MOUSE_SEND(0xE2, "set trackpoint sensitivity: 0xE2");
741 PS2_MOUSE_SEND(0x81, "set trackpoint sensitivity: 0x81");
742 PS2_MOUSE_SEND(0x4A, "set trackpoint sensitivity: 0x4A");
743 PS2_MOUSE_SEND(0x60, "set trackpoint sensitivity: 0x60");
744
745 // set TrackPoint speed
746 // (transfer function upper plateau speed)
747 PS2_MOUSE_SEND(0xE2, "set trackpoint speed: 0xE2");
748 PS2_MOUSE_SEND(0x81, "set trackpoint speed: 0x81");
749 PS2_MOUSE_SEND(0x60, "set trackpoint speed: 0x60");
750 PS2_MOUSE_SEND(0x90, "set trackpoint speed: 0x90");
751
752 // set TrackPoint Negative Inertia factor
753 PS2_MOUSE_SEND(0xE2, "set negative inertia factor: 0xE2");
754 PS2_MOUSE_SEND(0x81, "set negative inertia factor: 0x81");
755 PS2_MOUSE_SEND(0x4D, "set negative inertia factor: 0x4D");
756 PS2_MOUSE_SEND(0x03, "set negative inertia factor: 0x03");
757
758 // disable up threshold (click)
759 PS2_MOUSE_SEND(0xE2, "set disable up threshold: 0xE2");
760 PS2_MOUSE_SEND(0x47, "set disable up threshold: 0x47");
761 PS2_MOUSE_SEND(0x2C, "set disable up threshold: 0x2C");
762 PS2_MOUSE_SEND(0x01, "set disable up threshold: 0x01");
763
764 // enable TrackPoint Press to Select (PtS)
765 // print("ps2_mouse_init: send 0xE2: ");
766 // rcv = ps2_host_send(0xE2);
767 // phex(rcv); phex(ps2_error); print("\n");
768 // print("ps2_mouse_init: send 0x47: ");
769 // rcv = ps2_host_send(0x47);
770 // phex(rcv); phex(ps2_error); print("\n");
771 // print("ps2_mouse_init: send 0x2C: ");
772 // rcv = ps2_host_send(0x2C);
773 // phex(rcv); phex(ps2_error); print("\n");
774 // print("ps2_mouse_init: send 0x00: ");
775 // rcv = ps2_host_send(0x00);
776 // phex(rcv); phex(ps2_error); print("\n");
777
778 // set TrackPoint Press to Select threshold
779 // print("ps2_mouse_init: send 0xE2: ");
780 // rcv = ps2_host_send(0xE2);
781 // phex(rcv); phex(ps2_error); print("\n");
782 // print("ps2_mouse_init: send 0x81: ");
783 // rcv = ps2_host_send(0x81);
784 // phex(rcv); phex(ps2_error); print("\n");
785 // print("ps2_mouse_init: send 0x5C: ");
786 // rcv = ps2_host_send(0x5C);
787 // phex(rcv); phex(ps2_error); print("\n");
788 // // default PtS threshold is 0x08
789 // print("ps2_mouse_init: send 0x04: ");
790 // rcv = ps2_host_send(0x04);
791 // phex(rcv); phex(ps2_error); print("\n");
792
793 // set TrackPoint Press to Select time constant (zTc)
794 // print("ps2_mouse_init: send 0xE2: ");
795 // rcv = ps2_host_send(0xE2);
796 // phex(rcv); phex(ps2_error); print("\n");
797 // print("ps2_mouse_init: send 0x81: ");
798 // rcv = ps2_host_send(0x81);
799 // phex(rcv); phex(ps2_error); print("\n");
800 // print("ps2_mouse_init: send 0x5E: ");
801 // rcv = ps2_host_send(0x5E);
802 // phex(rcv); phex(ps2_error); print("\n");
803 // // default zTc is 0x26
804 // print("ps2_mouse_init: send 0x45: ");
805 // rcv = ps2_host_send(0x45);
806 // phex(rcv); phex(ps2_error); print("\n");
807
808 /*
809 // set TrackPoint Press to Select Jenks Curvature (jkcur)
810 print("ps2_mouse_init: send 0xE2: ");
811 rcv = ps2_host_send(0xE2);
812 phex(rcv); phex(ps2_error); print("\n");
813 print("ps2_mouse_init: send 0x81: ");
814 rcv = ps2_host_send(0x81);
815 phex(rcv); phex(ps2_error); print("\n");
816 print("ps2_mouse_init: send 0x5D: ");
817 rcv = ps2_host_send(0x5D);
818 phex(rcv); phex(ps2_error); print("\n");
819 // default jkcur is 0x87
820 print("ps2_mouse_init: send 0x87: ");
821 rcv = ps2_host_send(0x87);
822 phex(rcv); phex(ps2_error); print("\n");
823 */
824
825 /*
826 // set TrackPoint Minimum Drag (mindrag)
827 print("ps2_mouse_init: send 0xE2: ");
828 rcv = ps2_host_send(0xE2);
829 phex(rcv); phex(ps2_error); print("\n");
830 print("ps2_mouse_init: send 0x81: ");
831 rcv = ps2_host_send(0x81);
832 phex(rcv); phex(ps2_error); print("\n");
833 print("ps2_mouse_init: send 0x59: ");
834 rcv = ps2_host_send(0x59);
835 phex(rcv); phex(ps2_error); print("\n");
836 // default PtS mindrag is 0x14
837 print("ps2_mouse_init: send 0x14: ");
838 rcv = ps2_host_send(0x14);
839 phex(rcv); phex(ps2_error); print("\n");
840 */
841} \ No newline at end of file
diff --git a/keyboards/handwired/promethium/keymaps/priyadi/readme.md b/keyboards/handwired/promethium/keymaps/priyadi/readme.md
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/keyboards/handwired/promethium/keymaps/priyadi/readme.md
diff --git a/keyboards/handwired/promethium/keymaps/readme.md b/keyboards/handwired/promethium/keymaps/readme.md
new file mode 100644
index 000000000..527691389
--- /dev/null
+++ b/keyboards/handwired/promethium/keymaps/readme.md
@@ -0,0 +1,22 @@
1# How to add your own keymap
2
3Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`:
4
5 _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author]
6
7\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements
8
9and contain the following files:
10
11* `keymap.c`
12* `readme.md` *recommended*
13* `config.h` *optional*, found automatically when compiling
14* `Makefile` *optional*, found automatically when compling
15
16When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format:
17
18 * **folder_name** description
19
20# List of Promethium keymaps
21
22
diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c
new file mode 100644
index 000000000..a0035cce1
--- /dev/null
+++ b/keyboards/handwired/promethium/promethium.c
@@ -0,0 +1,6 @@
1#include "promethium.h"
2
3void matrix_init_kb(void) {
4
5 matrix_init_user();
6} \ No newline at end of file
diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h
new file mode 100644
index 000000000..662eeab99
--- /dev/null
+++ b/keyboards/handwired/promethium/promethium.h
@@ -0,0 +1,101 @@
1#ifndef PROMETHIUM_H
2#define PROMETHIUM_H
3
4#include "quantum.h"
5
6#define PS2_INIT_DELAY 2000
7
8#define KEYMAP( \
9 k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
10 k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
11 k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
12 k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \
13) \
14{ \
15 {k11, k12, k13, k14, k15, k16}, \
16 {k21, k22, k23, k24, k25, k26}, \
17 {k31, k32, k33, k34, k35, k36}, \
18 {k41, k42, k43, k44, k45, k46}, \
19 {k17, k18, k19, k1a, k1b, k1c}, \
20 {k27, k28, k29, k2a, k2b, k2c}, \
21 {k37, k38, k39, k3a, k3b, k3c}, \
22 {k47, k48, k49, k4a, k4b, k4c} \
23}
24
25enum led_sequence {
26 LED_IND_BLUETOOTH,
27 LED_IND_USB,
28 LED_IND_BATTERY,
29
30 LED_IND_FUNC,
31 LED_IND_NUM,
32 LED_IND_EMOJI,
33
34 LED_BKSP,
35 LED_ENT,
36 LED_RSFT,
37 LED_RCTL,
38
39 LED_RGUI,
40 LED_SLSH,
41 LED_SCLN,
42 LED_P,
43
44 LED_O,
45 LED_L,
46 LED_DOT,
47 LED_RALT,
48
49 LED_EMOJI,
50 LED_COMM,
51 LED_K,
52 LED_I,
53
54 LED_U,
55 LED_J,
56 LED_M,
57 LED_FUNC,
58
59 LED_RSPC,
60 LED_N,
61 LED_HH,
62 LED_Y,
63
64 LED_TRACKPOINT3,
65 LED_TRACKPOINT2,
66 LED_TRACKPOINT1,
67
68 LED_LSPC,
69 LED_B,
70 LED_G,
71 LED_T,
72
73 LED_R,
74 LED_F,
75 LED_V,
76 LED_NUM,
77
78 LED_PUNC,
79 LED_C,
80 LED_D,
81 LED_E,
82
83 LED_W,
84 LED_S,
85 LED_X,
86 LED_LALT,
87
88 LED_LGUI,
89 LED_Z,
90 LED_A,
91 LED_Q,
92
93 LED_TAB,
94 LED_ESC,
95 LED_LSFT,
96 LED_LCTL,
97};
98
99#endif
100
101
diff --git a/keyboards/handwired/promethium/readme.md b/keyboards/handwired/promethium/readme.md
new file mode 100644
index 000000000..e63d2f1ad
--- /dev/null
+++ b/keyboards/handwired/promethium/readme.md
@@ -0,0 +1,13 @@
1Promethium Keyboard Firmware
2============================
3A handwired Planck based keyboard using the Adafruit Feather 32u4 Bluefruit LE controller.
4
5Features:
6
7* Single piece split form factor
8* Columnar stagger
9* Trackpoint
10* Bluetooth LE *TBD*
11* Battery
12* Per switch RGB LED
13* Proximity sensor for energy conservation *TBD* \ No newline at end of file
diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c
new file mode 100644
index 000000000..ea922ec3f
--- /dev/null
+++ b/keyboards/handwired/promethium/rgbsps.c
@@ -0,0 +1,24 @@
1#include "light_ws2812.h"
2#include "rgbsps.h"
3
4struct cRGB led[RGBSPS_NUM];
5
6void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b) {
7 led[index].r = r;
8 led[index].g = g;
9 led[index].b = b;
10}
11
12void rgbsps_setall(uint8_t r, uint8_t g, uint8_t b) {
13 for (uint16_t i = 0; i < RGBSPS_NUM; i++) {
14 rgbsps_set(i, r, g, b);
15 }
16}
17
18void rgbsps_turnoff(void) {
19 rgbsps_setall(0, 0, 0);
20}
21
22void rgbsps_send(void) {
23 ws2812_setleds(led, RGBSPS_NUM);
24} \ No newline at end of file
diff --git a/keyboards/handwired/promethium/rgbsps.h b/keyboards/handwired/promethium/rgbsps.h
new file mode 100644
index 000000000..6da197f75
--- /dev/null
+++ b/keyboards/handwired/promethium/rgbsps.h
@@ -0,0 +1,4 @@
1void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b);
2void rgbsps_setall(uint8_t r, uint8_t g, uint8_t b);
3void rgbsps_turnoff(void);
4void rgbsps_send(void); \ No newline at end of file
diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk
new file mode 100644
index 000000000..891f523c2
--- /dev/null
+++ b/keyboards/handwired/promethium/rules.mk
@@ -0,0 +1,74 @@
1
2# MCU name
3#MCU = at90usb1287
4MCU = atmega32u4
5
6# Processor frequency.
7# This will define a symbol, F_CPU, in all source code files equal to the
8# processor frequency in Hz. You can then use this symbol in your source code to
9# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
10# automatically to create a 32-bit value in your source code.
11#
12# This will be an integer division of F_USB below, as it is sourced by
13# F_USB after it has run through any CPU prescalers. Note that this value
14# does not *change* the processor frequency - it should merely be updated to
15# reflect the processor speed set externally so that the code can use accurate
16# software delays.
17F_CPU = 8000000
18
19#
20# LUFA specific
21#
22# Target architecture (see library "Board Types" documentation).
23ARCH = 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.
36F_USB = $(F_CPU)
37
38# Interrupt driven control endpoint task(+60)
39OPT_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
48OPT_DEFS += -DBOOTLOADER_SIZE=4096
49
50# Build Options
51# change to "no" to disable the options, or define them in the Makefile in
52# the appropriate keymap folder that will get included automatically
53#
54BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE ?= no # Mouse keys(+4700)
56EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
57CONSOLE_ENABLE ?= no # Console for debug(+400)
58COMMAND_ENABLE ?= no # Commands for debug and configuration
59NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
60BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
61MIDI_ENABLE ?= no # MIDI controls
62AUDIO_ENABLE ?= no # Audio output on port C6
63UNICODE_ENABLE ?= no # Unicode
64UNICODEMAP_ENABLE ?= yes
65BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
66RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
67PS2_MOUSE_ENABLE ?= yes
68PS2_USE_INT ?= yes
69
70# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
71SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
72
73SRC += $(QUANTUM_DIR)/light_ws2812.c
74SRC += rgbsps.c \ No newline at end of file
diff --git a/keyboards/hhkb/keymaps/sh_jp/Makefile b/keyboards/hhkb/keymaps/sh_jp/Makefile
new file mode 100644
index 000000000..a7f700f01
--- /dev/null
+++ b/keyboards/hhkb/keymaps/sh_jp/Makefile
@@ -0,0 +1 @@
OPT_DEFS += -DHHKB_JP
diff --git a/keyboards/hhkb/keymaps/sh_jp/README.md b/keyboards/hhkb/keymaps/sh_jp/README.md
new file mode 100644
index 000000000..4f82f2f4e
--- /dev/null
+++ b/keyboards/hhkb/keymaps/sh_jp/README.md
@@ -0,0 +1,86 @@
1###Keymaps with both Dvorak layout and QWER layout for HHKB JP.
2
31. The default layout is Dvorak.
42. Use `Tog` to toggle between Dvorak and QWER
53. Holding `NewCmd`, the original `LftCmd`, will activate the `NewCmd` layer which means `NewCmd+key` is the same as `Cmd+key` in normal QWER layout.<sup>[1](#cmdTab)</sup>
6 - For example, no matter you are in Dvorak layout or QWER layout, you can use `Cmd+s` to save a currently editing file.
74. `Symb` makes type symbols easier
8 - for example: `Symb+a` is `!`.
95. `Spc+key` equals to `Shft+key` while using `Spc` alone will yield a space as usual.
106. There's an extra `Tab` in the last line.
11
12```
13Layer DVOR:
14,-----------------------------------------------------------.
15|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| |Bsp|
16|-----------------------------------------------------------|
17|Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| |
18|------------------------------------------------------` Ent|
19|Ctrl | A| O| E| U| I| D| H| T| N| S| -| \| |
20|-----------------------------------------------------------|
21|Shft | ;| Q| J| K| X| B| M| W| V| Z| | Up| |
22|-----------------------------------------------------------|
23|FN| `| Alt|NewCmd|Symb| Spc |Symb|Tab|RCmd|Tog|Lft|Dwn|Rgh|
24`-----------------------------------------------------------'
25```
26
27```
28Layer QWER:
29,-----------------------------------------------------------.
30|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =| |Bsp|
31|-----------------------------------------------------------|
32|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
33|------------------------------------------------------` Ent|
34|Ctrl | A| S| D| F| G| H| J| K| L| ;| '| \| |
35|-----------------------------------------------------------|
36|Shft | Z| X| C| V| B| N| M| ,| .| /| | Up| |
37|-----------------------------------------------------------|
38|FN| `| Alt|NewCmd|Symb| Spc |Symb|Tab|Cmd|Tog|Lft|Dwn|Rgh|
39`-----------------------------------------------------------'
40```
41
42```
43Layer Symb:
44,-----------------------------------------------------------.
45| | | | | | | | | | | | | | | |
46|-----------------------------------------------------------|
47| | | | [| ]| | | {| }| | | | | |
48|------------------------------------------------------` |
49| | !| @| #| $| %| ^| &| *| (| )| '| \| |
50|-----------------------------------------------------------|
51| | | | | | | | | | | | | | |
52|-----------------------------------------------------------|
53| | | | | | | | | | | | | |
54`-----------------------------------------------------------'
55```
56
57```
58Layer FUNC: HHKB mode (HHKB Fn)
59,-----------------------------------------------------------.
60|Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
61|-----------------------------------------------------------|
62|Caps | | | | | | | |Psc|Slk|Pus|Up | | |
63|------------------------------------------------------` |
64| |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
65|-----------------------------------------------------------|
66| | | | | | | +| -|End|PgD|Dow| | | |
67|-----------------------------------------------------------|
68| || | | | | | | | | || | | |
69`-----------------------------------------------------------'
70```
71
72```
73Empty Layer:
74,-----------------------------------------------------------.
75| | | | | | | | | | | | | | | |
76|-----------------------------------------------------------|
77| | | | | | | | | | | | | | |
78|------------------------------------------------------` |
79| | | | | | | | | | | | | | |
80|-----------------------------------------------------------|
81| | | | | | | | | | | | | | |
82|-----------------------------------------------------------|
83| | | | | | | | | | | | | |
84`-----------------------------------------------------------'
85```
86<a name="cmdTab">1</a>: `NewCmd + Tab` does not work, you can use `RCmd+Tab` to switch among applications.
diff --git a/keyboards/hhkb/keymaps/sh_jp/keymap.c b/keyboards/hhkb/keymaps/sh_jp/keymap.c
new file mode 100644
index 000000000..d4cb3b041
--- /dev/null
+++ b/keyboards/hhkb/keymaps/sh_jp/keymap.c
@@ -0,0 +1,60 @@
1#include "hhkb.h"
2
3#define _______ KC_TRNS
4
5enum {
6 DVOR,
7 QWER,
8 NEW_CMD,
9 SYMB,
10 FUNC
11};
12
13const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
14 [DVOR] = KEYMAP_JP(
15 KC_ESC, 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_JYEN, KC_BSPC,
16 KC_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,
17 KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_BSLS, KC_ENT,
18 KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RO, KC_UP, KC_RSFT,
19 MO(FUNC), KC_ZKHK, KC_LALT, MO(NEW_CMD), MO(SYMB), MT(MOD_LSFT, KC_SPC), MO(SYMB), KC_TAB, KC_RGUI, TG(QWER), KC_LEFT, KC_DOWN, KC_RGHT
20 ),
21 [QWER] = KEYMAP_JP(
22 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_JYEN, KC_BSPC,
23 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,
24 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT,
25 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_UP, KC_RSFT,
26 MO(FUNC), KC_ZKHK, KC_LALT, MO(NEW_CMD), MO(SYMB), MT(MOD_LSFT, KC_SPC), MO(SYMB), KC_TAB, KC_RGUI, _______, KC_LEFT, KC_DOWN, KC_RGHT
27 ),
28
29 [NEW_CMD] = KEYMAP_JP(
30 _______, LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), LGUI(KC_6), LGUI(KC_7), LGUI(KC_8), LGUI(KC_9), LGUI(KC_0), _______, _______, _______, LGUI(KC_BSPC),
31 _______, LGUI(KC_Q), LGUI(KC_W), LGUI(KC_E), LGUI(KC_R), LGUI(KC_T), LGUI(KC_Y), LGUI(KC_U), LGUI(KC_I), LGUI(KC_O), LGUI(KC_P), LGUI(KC_LBRC), LGUI(KC_RBRC),
32 _______, LGUI(KC_A), LGUI(KC_S), LGUI(KC_D), LGUI(KC_F), LGUI(KC_G), LGUI(KC_H), LGUI(KC_J), LGUI(KC_K), LGUI(KC_L), _______, _______, _______, _______,
33 LGUI(KC_LSFT), LGUI(KC_Z), LGUI(KC_X), LGUI(KC_C), LGUI(KC_V), LGUI(KC_B), LGUI(KC_N), LGUI(KC_M), LGUI(KC_COMM), LGUI(KC_DOT), LGUI(KC_SLSH), _______, _______, _______,
34 _______, _______, _______, _______, _______, LGUI(KC_SPC), _______, _______, _______, _______, LGUI(KC_LEFT), LGUI(KC_DOWN), LGUI(KC_RGHT)
35 ),
36
37 [SYMB] = KEYMAP_JP(
38 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
39 _______, _______, _______, KC_LBRC, KC_RBRC, _______, _______, LSFT(KC_LBRC), LSFT(KC_RBRC), _______, _______,_______, _______,
40 _______, LSFT(KC_1),LSFT(KC_2),LSFT(KC_3),LSFT(KC_4), LSFT(KC_5), LSFT(KC_6), LSFT(KC_7), LSFT(KC_8), LSFT(KC_9), LSFT(KC_0), _______, _______, _______,
41 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
42 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
43 ),
44
45 [FUNC] = KEYMAP_JP(
46 KC_PWR, 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_INS, KC_DEL,
47 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
48 _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
49 _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
50 _______, _______, _______, _______, _______, _______ , _______, _______, _______, _______, _______, _______, _______
51 )
52};
53
54const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt) {
55 return MACRO_NONE;
56}
57
58const uint16_t PROGMEM fn_actions[] = {
59
60};
diff --git a/keyboards/jd40/config.h b/keyboards/jd40/config.h
index e2594f4b3..047be5707 100644
--- a/keyboards/jd40/config.h
+++ b/keyboards/jd40/config.h
@@ -70,7 +70,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
70) 70)
71 71
72#define RGB_DI_PIN D3 72#define RGB_DI_PIN D3
73#define RGBLIGHT_TIMER 73#define RGBLIGHT_ANIMATIONS
74#define RGBLED_NUM 12 // Number of LEDs 74#define RGBLED_NUM 12 // Number of LEDs
75#define RGBLIGHT_HUE_STEP 8 75#define RGBLIGHT_HUE_STEP 8
76#define RGBLIGHT_SAT_STEP 8 76#define RGBLIGHT_SAT_STEP 8
diff --git a/keyboards/kc60/keymaps/ws2812/config.h b/keyboards/kc60/keymaps/ws2812/config.h
index 2f39ea8e5..43abf6228 100644
--- a/keyboards/kc60/keymaps/ws2812/config.h
+++ b/keyboards/kc60/keymaps/ws2812/config.h
@@ -2,7 +2,7 @@
2 2
3/* WS2812B RGB Underglow LED */ 3/* WS2812B RGB Underglow LED */
4#define RGB_DI_PIN F5 // Based on wiring depicted in ws2812_wiring.jpg 4#define RGB_DI_PIN F5 // Based on wiring depicted in ws2812_wiring.jpg
5#define RGBLIGHT_TIMER 5#define RGBLIGHT_ANIMATIONS
6#define RGBLED_NUM 16 // Number of LEDs. Change this to match your use case. 6#define RGBLED_NUM 16 // Number of LEDs. Change this to match your use case.
7#define RGBLIGHT_HUE_STEP 8 7#define RGBLIGHT_HUE_STEP 8
8#define RGBLIGHT_SAT_STEP 8 8#define RGBLIGHT_SAT_STEP 8
diff --git a/keyboards/lets_split/config.h b/keyboards/lets_split/config.h
index 1b7bbcbbb..4db45ab0b 100644
--- a/keyboards/lets_split/config.h
+++ b/keyboards/lets_split/config.h
@@ -49,6 +49,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
49#define IS_COMMAND() ( \ 49#define IS_COMMAND() ( \
50 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ 50 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
51) 51)
52
52/* disable debug print */ 53/* disable debug print */
53//#define NO_DEBUG 54//#define NO_DEBUG
54 55
@@ -68,4 +69,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
68#ifdef SUBPROJECT_rev2 69#ifdef SUBPROJECT_rev2
69 #include "rev2/config.h" 70 #include "rev2/config.h"
70#endif 71#endif
71#endif \ No newline at end of file 72#endif
diff --git a/keyboards/lets_split/keymaps/i2c/config.h b/keyboards/lets_split/keymaps/i2c/config.h
index 2671fabf6..72e5ae66b 100644
--- a/keyboards/lets_split/keymaps/i2c/config.h
+++ b/keyboards/lets_split/keymaps/i2c/config.h
@@ -75,7 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
75 75
76/* ws2812 RGB LED */ 76/* ws2812 RGB LED */
77#define RGB_DI_PIN D4 77#define RGB_DI_PIN D4
78#define RGBLIGHT_TIMER 78#define RGBLIGHT_ANIMATIONS
79#define RGBLED_NUM 8 // Number of LEDs 79#define RGBLED_NUM 8 // Number of LEDs
80#define RGBLIGHT_HUE_STEP 10 80#define RGBLIGHT_HUE_STEP 10
81#define RGBLIGHT_SAT_STEP 17 81#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/lets_split/keymaps/serial/config.h b/keyboards/lets_split/keymaps/serial/config.h
index f4d900acc..b0ad522fc 100644
--- a/keyboards/lets_split/keymaps/serial/config.h
+++ b/keyboards/lets_split/keymaps/serial/config.h
@@ -75,7 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
75 75
76/* ws2812 RGB LED */ 76/* ws2812 RGB LED */
77#define RGB_DI_PIN D4 77#define RGB_DI_PIN D4
78#define RGBLIGHT_TIMER 78#define RGBLIGHT_ANIMATIONS
79#define RGBLED_NUM 8 // Number of LEDs 79#define RGBLED_NUM 8 // Number of LEDs
80#define RGBLIGHT_HUE_STEP 10 80#define RGBLIGHT_HUE_STEP 10
81#define RGBLIGHT_SAT_STEP 17 81#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/phantom/config.h b/keyboards/phantom/config.h
index 983a1d73f..71a33498b 100644
--- a/keyboards/phantom/config.h
+++ b/keyboards/phantom/config.h
@@ -63,7 +63,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
63/* Underlight configuration 63/* Underlight configuration
64 */ 64 */
65#define RGB_DI_PIN E2 65#define RGB_DI_PIN E2
66#define RGBLIGHT_TIMER 66#define RGBLIGHT_ANIMATIONS
67#define RGBLED_NUM 20 // Number of LEDs 67#define RGBLED_NUM 20 // Number of LEDs
68#define RGBLIGHT_HUE_STEP 10 68#define RGBLIGHT_HUE_STEP 10
69#define RGBLIGHT_SAT_STEP 17 69#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/planck/keymaps/bone2planck/Makefile b/keyboards/planck/keymaps/bone2planck/Makefile
index 581e08cd0..cf2c31f0f 100644
--- a/keyboards/planck/keymaps/bone2planck/Makefile
+++ b/keyboards/planck/keymaps/bone2planck/Makefile
@@ -1,4 +1,6 @@
1 1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
2 4
3# Build Options 5# Build Options
4# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
diff --git a/keyboards/planck/keymaps/brandon/Makefile b/keyboards/planck/keymaps/brandon/Makefile
index 581e08cd0..cf2c31f0f 100644
--- a/keyboards/planck/keymaps/brandon/Makefile
+++ b/keyboards/planck/keymaps/brandon/Makefile
@@ -1,4 +1,6 @@
1 1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
2 4
3# Build Options 5# Build Options
4# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
diff --git a/keyboards/planck/keymaps/cbbrowne/Makefile b/keyboards/planck/keymaps/cbbrowne/Makefile
index 581e08cd0..b1c70ace7 100644
--- a/keyboards/planck/keymaps/cbbrowne/Makefile
+++ b/keyboards/planck/keymaps/cbbrowne/Makefile
@@ -5,8 +5,8 @@
5# the appropriate keymap folder that will get included automatically 5# the appropriate keymap folder that will get included automatically
6# 6#
7BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 7BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
8MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 8MOUSEKEY_ENABLE = no # Mouse keys(+4700)
9EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 9EXTRAKEY_ENABLE = no # Audio control and System control(+450)
10CONSOLE_ENABLE = no # Console for debug(+400) 10CONSOLE_ENABLE = no # Console for debug(+400)
11COMMAND_ENABLE = yes # Commands for debug and configuration 11COMMAND_ENABLE = yes # Commands for debug and configuration
12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
@@ -16,10 +16,11 @@ AUDIO_ENABLE = yes # Audio output on port C6
16UNICODE_ENABLE = no # Unicode 16UNICODE_ENABLE = no # Unicode
17BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 17BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
18RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. 18RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
19API_SYSEX_ENABLE = yes # Enable SYSEX API (+5390)
19 20
20# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 21# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
21SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 22SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22 23
23ifndef QUANTUM_DIR 24ifndef QUANTUM_DIR
24 include ../../../../Makefile 25 include ../../../../Makefile
25endif \ No newline at end of file 26endif
diff --git a/keyboards/planck/keymaps/cbbrowne/config.h b/keyboards/planck/keymaps/cbbrowne/config.h
index 1e04ba61d..bd15fd5a2 100644
--- a/keyboards/planck/keymaps/cbbrowne/config.h
+++ b/keyboards/planck/keymaps/cbbrowne/config.h
@@ -1,6 +1,9 @@
1#ifndef CONFIG_USER_H 1#ifndef CONFIG_USER_H
2#define CONFIG_USER_H 2#define CONFIG_USER_H
3 3
4#define NO_DEBUG
5#define NO_PRINT
6
4#include "../../config.h" 7#include "../../config.h"
5 8
6#define LEADER_TIMEOUT 300 9#define LEADER_TIMEOUT 300
diff --git a/keyboards/planck/keymaps/cbbrowne/keymap.c b/keyboards/planck/keymaps/cbbrowne/keymap.c
index 7f1601af7..2be4dab4b 100644
--- a/keyboards/planck/keymaps/cbbrowne/keymap.c
+++ b/keyboards/planck/keymaps/cbbrowne/keymap.c
@@ -62,6 +62,7 @@
62 - How about Alt-F1 thru Alt-F8? 62 - How about Alt-F1 thru Alt-F8?
63 - What's the keystroke to get from X to console these days? 63 - What's the keystroke to get from X to console these days?
64 - A layer for doing console switching would not be a bad idea 64 - A layer for doing console switching would not be a bad idea
65 - I haven't got page-up/page-down, let's have that...
65*/ 66*/
66 67
67enum layers { 68enum layers {
@@ -94,6 +95,7 @@ enum macro_id {
94#define SHIFTQUOTE MT(MOD_RSFT, KC_QUOT) 95#define SHIFTQUOTE MT(MOD_RSFT, KC_QUOT)
95#define ALTRIGHT MT(MOD_LALT, KC_RGHT) 96#define ALTRIGHT MT(MOD_LALT, KC_RGHT)
96#define MVERSION M(M_VERSION) 97#define MVERSION M(M_VERSION)
98#define ALTSLASH LALT(KC_SLSH)
97 99
98 100
99/* Note that Planck has dimensions 4 rows x 12 columns */ 101/* Note that Planck has dimensions 4 rows x 12 columns */
@@ -109,14 +111,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
109[_RAISE] = { /* RAISE */ 111[_RAISE] = { /* RAISE */
110 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, 112 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
111 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, 113 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
112 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QWERTY, KEYPAD, KEYPAD, RESET, _______}, 114 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QWERTY, KEYPAD, KEYPAD, ALTSLASH,_______},
113 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 115 {_______, _______, _______, _______, _______, _______, _______, _______, KC_PGDN, KC_VOLD, KC_VOLU, KC_PGUP}
114}, 116},
115[_LOWER] = { /* LOWER */ 117[_LOWER] = { /* LOWER */
116 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, 118 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
117 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, 119 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
118 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QWERTY, KEYPAD, KEYPAD, RESET, _______}, 120 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QWERTY, KEYPAD, KEYPAD, ALTSLASH, _______},
119 {_______, KEYPAD, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 121 {_______, KEYPAD, _______, _______, _______, _______, _______, _______, KC_PGDN, KC_VOLD, KC_VOLU, KC_PGUP}
120 }, 122 },
121[_KEYPAD] = { /* Key Pad */ 123[_KEYPAD] = { /* Key Pad */
122 {KC_ESC, USERNAME, MVERSION, KC_F10, KC_F11, KC_F12, KC_PGUP, KC_KP_ENTER, KC_7, KC_8, KC_9, KC_BSPC}, 124 {KC_ESC, USERNAME, MVERSION, KC_F10, KC_F11, KC_F12, KC_PGUP, KC_KP_ENTER, KC_7, KC_8, KC_9, KC_BSPC},
diff --git a/keyboards/planck/keymaps/default/Makefile b/keyboards/planck/keymaps/default/Makefile
index 0f4953888..267a087ea 100644
--- a/keyboards/planck/keymaps/default/Makefile
+++ b/keyboards/planck/keymaps/default/Makefile
@@ -5,17 +5,17 @@
5# the appropriate keymap folder that will get included automatically 5# the appropriate keymap folder that will get included automatically
6# 6#
7BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 7BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
8MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 8MOUSEKEY_ENABLE = no # Mouse keys(+4700)
9EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 9EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
10CONSOLE_ENABLE = no # Console for debug(+400) 10CONSOLE_ENABLE = no # Console for debug(+400)
11COMMAND_ENABLE = yes # Commands for debug and configuration 11COMMAND_ENABLE = no # Commands for debug and configuration
12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
13BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 13BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
14MIDI_ENABLE = no # MIDI controls 14MIDI_ENABLE = yes # MIDI controls
15AUDIO_ENABLE = yes # Audio output on port C6 15AUDIO_ENABLE = yes # Audio output on port C6
16UNICODE_ENABLE = no # Unicode 16UNICODE_ENABLE = no # Unicode
17BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 17BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
18RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. 18RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight
19 19
20# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 20# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
21SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 21SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c
index 5f71ae7d1..ddbe4d7b2 100644
--- a/keyboards/planck/keymaps/default/keymap.c
+++ b/keyboards/planck/keymaps/default/keymap.c
@@ -107,7 +107,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
107[_LOWER] = { 107[_LOWER] = {
108 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, 108 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
109 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, 109 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
110 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______}, 110 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),KC_HOME, KC_END, _______},
111 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 111 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
112}, 112},
113 113
@@ -125,7 +125,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
125[_RAISE] = { 125[_RAISE] = {
126 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, 126 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
127 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, 127 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
128 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______}, 128 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______},
129 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 129 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
130}, 130},
131 131
diff --git a/keyboards/planck/keymaps/experimental/config.h b/keyboards/planck/keymaps/experimental/config.h
index 52acd1905..cc093bee4 100644
--- a/keyboards/planck/keymaps/experimental/config.h
+++ b/keyboards/planck/keymaps/experimental/config.h
@@ -9,7 +9,7 @@
9 9
10/* ws2812 RGB LED */ 10/* ws2812 RGB LED */
11#define RGB_DI_PIN B1 11#define RGB_DI_PIN B1
12#define RGBLIGHT_TIMER 12#define RGBLIGHT_ANIMATIONS
13#define RGBLED_NUM 8 // Number of LEDs 13#define RGBLED_NUM 8 // Number of LEDs
14#define RGBLIGHT_HUE_STEP 10 14#define RGBLIGHT_HUE_STEP 10
15#define RGBLIGHT_SAT_STEP 17 15#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/planck/keymaps/impossible/Makefile b/keyboards/planck/keymaps/impossible/Makefile
index 581e08cd0..cf2c31f0f 100644
--- a/keyboards/planck/keymaps/impossible/Makefile
+++ b/keyboards/planck/keymaps/impossible/Makefile
@@ -1,4 +1,6 @@
1 1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
2 4
3# Build Options 5# Build Options
4# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
diff --git a/keyboards/planck/keymaps/jeebak/Makefile b/keyboards/planck/keymaps/jeebak/Makefile
index 581e08cd0..cf2c31f0f 100644
--- a/keyboards/planck/keymaps/jeebak/Makefile
+++ b/keyboards/planck/keymaps/jeebak/Makefile
@@ -1,4 +1,6 @@
1 1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
2 4
3# Build Options 5# Build Options
4# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
diff --git a/keyboards/planck/keymaps/jhenahan/Makefile b/keyboards/planck/keymaps/jhenahan/Makefile
index de01ad240..83da2a7f8 100644
--- a/keyboards/planck/keymaps/jhenahan/Makefile
+++ b/keyboards/planck/keymaps/jhenahan/Makefile
@@ -1,4 +1,6 @@
1 1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
2 4
3# Build Options 5# Build Options
4# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
diff --git a/keyboards/planck/keymaps/joe/Makefile b/keyboards/planck/keymaps/joe/Makefile
index 581e08cd0..b2ca41944 100644
--- a/keyboards/planck/keymaps/joe/Makefile
+++ b/keyboards/planck/keymaps/joe/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
@@ -22,4 +25,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22 25
23ifndef QUANTUM_DIR 26ifndef QUANTUM_DIR
24 include ../../../../Makefile 27 include ../../../../Makefile
25endif \ No newline at end of file 28endif
diff --git a/keyboards/planck/keymaps/leo/Makefile b/keyboards/planck/keymaps/leo/Makefile
index 581e08cd0..b2ca41944 100644
--- a/keyboards/planck/keymaps/leo/Makefile
+++ b/keyboards/planck/keymaps/leo/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
@@ -22,4 +25,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22 25
23ifndef QUANTUM_DIR 26ifndef QUANTUM_DIR
24 include ../../../../Makefile 27 include ../../../../Makefile
25endif \ No newline at end of file 28endif
diff --git a/keyboards/planck/keymaps/lucas/Makefile b/keyboards/planck/keymaps/lucas/Makefile
index 581e08cd0..b2ca41944 100644
--- a/keyboards/planck/keymaps/lucas/Makefile
+++ b/keyboards/planck/keymaps/lucas/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
@@ -22,4 +25,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22 25
23ifndef QUANTUM_DIR 26ifndef QUANTUM_DIR
24 include ../../../../Makefile 27 include ../../../../Makefile
25endif \ No newline at end of file 28endif
diff --git a/keyboards/planck/keymaps/mollat/Makefile b/keyboards/planck/keymaps/mollat/Makefile
index 581e08cd0..b2ca41944 100644
--- a/keyboards/planck/keymaps/mollat/Makefile
+++ b/keyboards/planck/keymaps/mollat/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
@@ -22,4 +25,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22 25
23ifndef QUANTUM_DIR 26ifndef QUANTUM_DIR
24 include ../../../../Makefile 27 include ../../../../Makefile
25endif \ No newline at end of file 28endif
diff --git a/keyboards/planck/keymaps/nico/Makefile b/keyboards/planck/keymaps/nico/Makefile
index 581e08cd0..b2ca41944 100644
--- a/keyboards/planck/keymaps/nico/Makefile
+++ b/keyboards/planck/keymaps/nico/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
@@ -22,4 +25,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22 25
23ifndef QUANTUM_DIR 26ifndef QUANTUM_DIR
24 include ../../../../Makefile 27 include ../../../../Makefile
25endif \ No newline at end of file 28endif
diff --git a/keyboards/planck/keymaps/premek/Makefile b/keyboards/planck/keymaps/premek/Makefile
index 0f4953888..b2ca41944 100644
--- a/keyboards/planck/keymaps/premek/Makefile
+++ b/keyboards/planck/keymaps/premek/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
diff --git a/keyboards/planck/keymaps/priyadi/Makefile b/keyboards/planck/keymaps/priyadi/Makefile
index aa211d2f0..f113f496c 100644
--- a/keyboards/planck/keymaps/priyadi/Makefile
+++ b/keyboards/planck/keymaps/priyadi/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
diff --git a/keyboards/planck/keymaps/pvc/Makefile b/keyboards/planck/keymaps/pvc/Makefile
index b2ff961fa..c92ca1bff 100644
--- a/keyboards/planck/keymaps/pvc/Makefile
+++ b/keyboards/planck/keymaps/pvc/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2# Build Options 5# Build Options
3# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
@@ -21,4 +24,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
21 24
22ifndef QUANTUM_DIR 25ifndef QUANTUM_DIR
23 include ../../../../Makefile 26 include ../../../../Makefile
24endif \ No newline at end of file 27endif
diff --git a/keyboards/planck/keymaps/sgoodwin/Makefile b/keyboards/planck/keymaps/sgoodwin/Makefile
index 581e08cd0..b2ca41944 100644
--- a/keyboards/planck/keymaps/sgoodwin/Makefile
+++ b/keyboards/planck/keymaps/sgoodwin/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
@@ -22,4 +25,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22 25
23ifndef QUANTUM_DIR 26ifndef QUANTUM_DIR
24 include ../../../../Makefile 27 include ../../../../Makefile
25endif \ No newline at end of file 28endif
diff --git a/keyboards/planck/keymaps/tak3over/Makefile b/keyboards/planck/keymaps/tak3over/Makefile
index 581e08cd0..b2ca41944 100644
--- a/keyboards/planck/keymaps/tak3over/Makefile
+++ b/keyboards/planck/keymaps/tak3over/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
@@ -22,4 +25,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22 25
23ifndef QUANTUM_DIR 26ifndef QUANTUM_DIR
24 include ../../../../Makefile 27 include ../../../../Makefile
25endif \ No newline at end of file 28endif
diff --git a/keyboards/planck/keymaps/thermal_printer/Makefile b/keyboards/planck/keymaps/thermal_printer/Makefile
new file mode 100644
index 000000000..9477d1179
--- /dev/null
+++ b/keyboards/planck/keymaps/thermal_printer/Makefile
@@ -0,0 +1,29 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
4
5
6# Build Options
7# change to "no" to disable the options, or define them in the Makefile in
8# the appropriate keymap folder that will get included automatically
9#
10BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
11MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
12EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
13CONSOLE_ENABLE = no # Console for debug(+400)
14COMMAND_ENABLE = yes # Commands for debug and configuration
15NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
16BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
17MIDI_ENABLE = no # MIDI controls
18AUDIO_ENABLE = yes # Audio output on port C6
19UNICODE_ENABLE = no # Unicode
20BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
21RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
22PRINTING_ENABLE = yes
23
24# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
25SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
26
27ifndef QUANTUM_DIR
28 include ../../../../Makefile
29endif
diff --git a/keyboards/planck/keymaps/thermal_printer/config.h b/keyboards/planck/keymaps/thermal_printer/config.h
new file mode 100644
index 000000000..430b6493c
--- /dev/null
+++ b/keyboards/planck/keymaps/thermal_printer/config.h
@@ -0,0 +1,23 @@
1#ifndef CONFIG_USER_H
2#define CONFIG_USER_H
3
4#include "../../config.h"
5
6# define SERIAL_UART_BAUD 19200
7# define SERIAL_UART_DATA UDR1
8# define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
9# define SERIAL_UART_RXD_VECT USART1_RX_vect
10# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
11# define SERIAL_UART_INIT() do { \
12 /* baud rate */ \
13 UBRR1L = SERIAL_UART_UBRR; \
14 /* baud rate */ \
15 UBRR1H = SERIAL_UART_UBRR >> 8; \
16 /* enable TX */ \
17 UCSR1B = _BV(TXEN1); \
18 /* 8-bit data */ \
19 UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
20 sei(); \
21 } while(0)
22
23 #endif \ No newline at end of file
diff --git a/keyboards/planck/keymaps/thermal_printer/keymap.c b/keyboards/planck/keymaps/thermal_printer/keymap.c
new file mode 100644
index 000000000..e88059731
--- /dev/null
+++ b/keyboards/planck/keymaps/thermal_printer/keymap.c
@@ -0,0 +1,314 @@
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
11extern 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
25enum 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
40const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
41
42/* Qwerty
43 * ,-----------------------------------------------------------------------------------.
44 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
45 * |------+------+------+------+------+-------------+------+------+------+------+------|
46 * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
47 * |------+------+------+------+------+------|------+------+------+------+------+------|
48 * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
49 * |------+------+------+------+------+------+------+------+------+------+------+------|
50 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
51 * `-----------------------------------------------------------------------------------'
52 */
53[_QWERTY] = {
54 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
55 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
56 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
57 {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
58},
59
60/* Colemak
61 * ,-----------------------------------------------------------------------------------.
62 * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
63 * |------+------+------+------+------+-------------+------+------+------+------+------|
64 * | Esc | A | R | S | T | D | H | N | E | I | O | " |
65 * |------+------+------+------+------+------|------+------+------+------+------+------|
66 * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
67 * |------+------+------+------+------+------+------+------+------+------+------+------|
68 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
69 * `-----------------------------------------------------------------------------------'
70 */
71[_COLEMAK] = {
72 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
73 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
74 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
75 {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
76},
77
78/* Dvorak
79 * ,-----------------------------------------------------------------------------------.
80 * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
81 * |------+------+------+------+------+-------------+------+------+------+------+------|
82 * | Esc | A | O | E | U | I | D | H | T | N | S | / |
83 * |------+------+------+------+------+------|------+------+------+------+------+------|
84 * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
85 * |------+------+------+------+------+------+------+------+------+------+------+------|
86 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
87 * `-----------------------------------------------------------------------------------'
88 */
89[_DVORAK] = {
90 {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
91 {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
92 {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
93 {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
94},
95
96/* Lower
97 * ,-----------------------------------------------------------------------------------.
98 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
99 * |------+------+------+------+------+-------------+------+------+------+------+------|
100 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
101 * |------+------+------+------+------+------|------+------+------+------+------+------|
102 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter |
103 * |------+------+------+------+------+------+------+------+------+------+------+------|
104 * | | | | | | | | Next | Vol- | Vol+ | Play |
105 * `-----------------------------------------------------------------------------------'
106 */
107[_LOWER] = {
108 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
109 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
110 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______},
111 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
112},
113
114/* Raise
115 * ,-----------------------------------------------------------------------------------.
116 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
117 * |------+------+------+------+------+-------------+------+------+------+------+------|
118 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
119 * |------+------+------+------+------+------|------+------+------+------+------+------|
120 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter |
121 * |------+------+------+------+------+------+------+------+------+------+------+------|
122 * | | | | | | | | Next | Vol- | Vol+ | Play |
123 * `-----------------------------------------------------------------------------------'
124 */
125[_RAISE] = {
126 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
127 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
128 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______},
129 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
130},
131
132/* Plover layer (http://opensteno.org)
133 * ,-----------------------------------------------------------------------------------.
134 * | # | # | # | # | # | # | # | # | # | # | # | # |
135 * |------+------+------+------+------+-------------+------+------+------+------+------|
136 * | | S | T | P | H | * | * | F | P | L | T | D |
137 * |------+------+------+------+------+------|------+------+------+------+------+------|
138 * |TogOut| S | K | W | R | * | * | R | B | G | S | Z |
139 * |------+------+------+------+------+------+------+------+------+------+------+------|
140 * | Exit | | | A | O | | E | U | | | |
141 * `-----------------------------------------------------------------------------------'
142 */
143
144[_PLOVER] = {
145 {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 },
146 {XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC},
147 {XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
148 {EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX}
149},
150
151/* Adjust (Lower + Raise)
152 * ,-----------------------------------------------------------------------------------.
153 * | | Reset| | Print|no prnt | | | | | | | Del |
154 * |------+------+------+------+------+-------------+------+------+------+------+------|
155 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| |
156 * |------+------+------+------+------+------|------+------+------+------+------+------|
157 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
158 * |------+------+------+------+------+------+------+------+------+------+------+------|
159 * | | | | | | | | | | | |
160 * `-----------------------------------------------------------------------------------'
161 */
162[_ADJUST] = {
163 {_______, RESET, _______, PRINT_ON, PRINT_OFF, _______, _______, _______, _______, _______, _______, KC_DEL},
164 {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______},
165 {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______},
166 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
167}
168
169
170};
171
172#ifdef AUDIO_ENABLE
173
174float tone_startup[][2] = SONG(STARTUP_SOUND);
175float tone_qwerty[][2] = SONG(QWERTY_SOUND);
176float tone_dvorak[][2] = SONG(DVORAK_SOUND);
177float tone_colemak[][2] = SONG(COLEMAK_SOUND);
178float tone_plover[][2] = SONG(PLOVER_SOUND);
179float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
180float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
181
182float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
183#endif
184
185
186void persistant_default_layer_set(uint16_t default_layer) {
187 eeconfig_update_default_layer(default_layer);
188 default_layer_set(default_layer);
189}
190
191bool process_record_user(uint16_t keycode, keyrecord_t *record) {
192 switch (keycode) {
193 case QWERTY:
194 if (record->event.pressed) {
195 #ifdef AUDIO_ENABLE
196 PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
197 #endif
198 persistant_default_layer_set(1UL<<_QWERTY);
199 }
200 return false;
201 break;
202 case COLEMAK:
203 if (record->event.pressed) {
204 #ifdef AUDIO_ENABLE
205 PLAY_NOTE_ARRAY(tone_colemak, false, 0);
206 #endif
207 persistant_default_layer_set(1UL<<_COLEMAK);
208 }
209 return false;
210 break;
211 case DVORAK:
212 if (record->event.pressed) {
213 #ifdef AUDIO_ENABLE
214 PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
215 #endif
216 persistant_default_layer_set(1UL<<_DVORAK);
217 }
218 return false;
219 break;
220 case LOWER:
221 if (record->event.pressed) {
222 layer_on(_LOWER);
223 update_tri_layer(_LOWER, _RAISE, _ADJUST);
224 } else {
225 layer_off(_LOWER);
226 update_tri_layer(_LOWER, _RAISE, _ADJUST);
227 }
228 return false;
229 break;
230 case RAISE:
231 if (record->event.pressed) {
232 layer_on(_RAISE);
233 update_tri_layer(_LOWER, _RAISE, _ADJUST);
234 } else {
235 layer_off(_RAISE);
236 update_tri_layer(_LOWER, _RAISE, _ADJUST);
237 }
238 return false;
239 break;
240 case BACKLIT:
241 if (record->event.pressed) {
242 register_code(KC_RSFT);
243 #ifdef BACKLIGHT_ENABLE
244 backlight_step();
245 #endif
246 } else {
247 unregister_code(KC_RSFT);
248 }
249 return false;
250 break;
251 case PLOVER:
252 if (record->event.pressed) {
253 #ifdef AUDIO_ENABLE
254 stop_all_notes();
255 PLAY_NOTE_ARRAY(tone_plover, false, 0);
256 #endif
257 layer_off(_RAISE);
258 layer_off(_LOWER);
259 layer_off(_ADJUST);
260 layer_on(_PLOVER);
261 if (!eeconfig_is_enabled()) {
262 eeconfig_init();
263 }
264 keymap_config.raw = eeconfig_read_keymap();
265 keymap_config.nkro = 1;
266 eeconfig_update_keymap(keymap_config.raw);
267 }
268 return false;
269 break;
270 case EXT_PLV:
271 if (record->event.pressed) {
272 #ifdef AUDIO_ENABLE
273 PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
274 #endif
275 layer_off(_PLOVER);
276 }
277 return false;
278 break;
279 }
280 return true;
281}
282
283void matrix_init_user(void) {
284 #ifdef AUDIO_ENABLE
285 startup_user();
286 #endif
287}
288
289#ifdef AUDIO_ENABLE
290
291void startup_user()
292{
293 _delay_ms(20); // gets rid of tick
294 PLAY_NOTE_ARRAY(tone_startup, false, 0);
295}
296
297void shutdown_user()
298{
299 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
300 _delay_ms(150);
301 stop_all_notes();
302}
303
304void music_on_user(void)
305{
306 music_scale_user();
307}
308
309void music_scale_user(void)
310{
311 PLAY_NOTE_ARRAY(music_scale, false, 0);
312}
313
314#endif
diff --git a/keyboards/planck/keymaps/thermal_printer/readme.md b/keyboards/planck/keymaps/thermal_printer/readme.md
new file mode 100644
index 000000000..de9680b49
--- /dev/null
+++ b/keyboards/planck/keymaps/thermal_printer/readme.md
@@ -0,0 +1,2 @@
1# The Default Planck Layout
2
diff --git a/keyboards/planck/keymaps/vifon/Makefile b/keyboards/planck/keymaps/vifon/Makefile
index 838cb4e88..53660a2e7 100644
--- a/keyboards/planck/keymaps/vifon/Makefile
+++ b/keyboards/planck/keymaps/vifon/Makefile
@@ -1,3 +1,6 @@
1# Please remove if no longer applicable
2$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
3$(warning Please disable some options in the Makefile to resolve)
1 4
2 5
3# Build Options 6# Build Options
diff --git a/keyboards/planck/keymaps/yang/config.h b/keyboards/planck/keymaps/yang/config.h
index feb5a1190..4ed19d76f 100644
--- a/keyboards/planck/keymaps/yang/config.h
+++ b/keyboards/planck/keymaps/yang/config.h
@@ -5,7 +5,7 @@
5 5
6/* ws2812 RGB LED */ 6/* ws2812 RGB LED */
7#define RGB_DI_PIN D1 7#define RGB_DI_PIN D1
8#define RGBLIGHT_TIMER 8#define RGBLIGHT_ANIMATIONS
9#define RGBLED_NUM 28 // Number of LEDs 9#define RGBLED_NUM 28 // Number of LEDs
10#define RGBLIGHT_HUE_STEP 10 10#define RGBLIGHT_HUE_STEP 10
11#define RGBLIGHT_SAT_STEP 17 11#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/planck/planck.c b/keyboards/planck/planck.c
index 645b450d1..3980b02f5 100644
--- a/keyboards/planck/planck.c
+++ b/keyboards/planck/planck.c
@@ -16,4 +16,4 @@ void matrix_init_kb(void) {
16 PORTE |= (1<<6); 16 PORTE |= (1<<6);
17 17
18 matrix_init_user(); 18 matrix_init_user();
19} \ No newline at end of file 19}
diff --git a/keyboards/planck/rules.mk b/keyboards/planck/rules.mk
index 25db53a31..fb24e8235 100644
--- a/keyboards/planck/rules.mk
+++ b/keyboards/planck/rules.mk
@@ -62,6 +62,7 @@ AUDIO_ENABLE ?= no # Audio output on port C6
62UNICODE_ENABLE ?= no # Unicode 62UNICODE_ENABLE ?= no # Unicode
63BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID 63BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
64RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. 64RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
65API_SYSEX_ENABLE = yes
65 66
66# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 67# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
67SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend \ No newline at end of file 68SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
diff --git a/keyboards/preonic/config.h b/keyboards/preonic/config.h
index 3fb978c2f..f88acf211 100644
--- a/keyboards/preonic/config.h
+++ b/keyboards/preonic/config.h
@@ -63,7 +63,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
63 63
64/* ws2812 RGB LED */ 64/* ws2812 RGB LED */
65#define RGB_DI_PIN D1 65#define RGB_DI_PIN D1
66#define RGBLIGHT_TIMER 66#define RGBLIGHT_ANIMATIONS
67#define RGBLED_NUM 28 // Number of LEDs 67#define RGBLED_NUM 28 // Number of LEDs
68#define RGBLIGHT_HUE_STEP 10 68#define RGBLIGHT_HUE_STEP 10
69#define RGBLIGHT_SAT_STEP 17 69#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/preonic/keymaps/default/Makefile b/keyboards/preonic/keymaps/default/Makefile
index 581e08cd0..3d4659ceb 100644
--- a/keyboards/preonic/keymaps/default/Makefile
+++ b/keyboards/preonic/keymaps/default/Makefile
@@ -1,25 +1,3 @@
1
2
3# Build Options
4# change to "no" to disable the options, or define them in the Makefile in
5# the appropriate keymap folder that will get included automatically
6#
7BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
8MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
9EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
10CONSOLE_ENABLE = no # Console for debug(+400)
11COMMAND_ENABLE = yes # Commands for debug and configuration
12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
13BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
14MIDI_ENABLE = no # MIDI controls
15AUDIO_ENABLE = yes # Audio output on port C6
16UNICODE_ENABLE = no # Unicode
17BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
18RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
19
20# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
21SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22
23ifndef QUANTUM_DIR 1ifndef QUANTUM_DIR
24 include ../../../../Makefile 2 include ../../../../Makefile
25endif \ No newline at end of file 3endif \ No newline at end of file
diff --git a/keyboards/preonic/keymaps/kinesis/config.h b/keyboards/preonic/keymaps/kinesis/config.h
index 086baa84f..e6099ceb8 100644
--- a/keyboards/preonic/keymaps/kinesis/config.h
+++ b/keyboards/preonic/keymaps/kinesis/config.h
@@ -63,7 +63,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
63 63
64/* ws2812 RGB LED */ 64/* ws2812 RGB LED */
65#define RGB_DI_PIN D1 65#define RGB_DI_PIN D1
66#define RGBLIGHT_TIMER 66#define RGBLIGHT_ANIMATIONS
67#define RGBLED_NUM 28 // Number of LEDs 67#define RGBLED_NUM 28 // Number of LEDs
68#define RGBLIGHT_HUE_STEP 10 68#define RGBLIGHT_HUE_STEP 10
69#define RGBLIGHT_SAT_STEP 17 69#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/preonic/rules.mk b/keyboards/preonic/rules.mk
index d0f3a3a1c..c4ce2aacc 100644
--- a/keyboards/preonic/rules.mk
+++ b/keyboards/preonic/rules.mk
@@ -53,7 +53,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
53# the appropriate keymap folder that will get included automatically 53# the appropriate keymap folder that will get included automatically
54# 54#
55BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) 55BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
56MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) 56MOUSEKEY_ENABLE ?= no # Mouse keys(+4700)
57EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) 57EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
58CONSOLE_ENABLE ?= no # Console for debug(+400) 58CONSOLE_ENABLE ?= no # Console for debug(+400)
59COMMAND_ENABLE ?= yes # Commands for debug and configuration 59COMMAND_ENABLE ?= yes # Commands for debug and configuration
@@ -64,6 +64,7 @@ AUDIO_ENABLE ?= no # Audio output on port C6
64UNICODE_ENABLE ?= no # Unicode 64UNICODE_ENABLE ?= no # Unicode
65BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID 65BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
66RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. 66RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
67API_SYSEX_ENABLE ?= yes
67 68
68# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 69# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
69SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend \ No newline at end of file 70SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend \ No newline at end of file
diff --git a/keyboards/satan/config.h b/keyboards/satan/config.h
index 7e9f91cc8..eb357b39e 100644
--- a/keyboards/satan/config.h
+++ b/keyboards/satan/config.h
@@ -67,7 +67,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
67 */ 67 */
68 68
69#define RGB_DI_PIN E2 69#define RGB_DI_PIN E2
70#define RGBLIGHT_TIMER 70#define RGBLIGHT_ANIMATIONS
71#define RGBLED_NUM 8 // Number of LEDs 71#define RGBLED_NUM 8 // Number of LEDs
72#define RGBLIGHT_HUE_STEP 10 72#define RGBLIGHT_HUE_STEP 10
73#define RGBLIGHT_SAT_STEP 17 73#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/tada68/config.h b/keyboards/tada68/config.h
index 5d8757936..19cf9c9b3 100644
--- a/keyboards/tada68/config.h
+++ b/keyboards/tada68/config.h
@@ -67,7 +67,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
67 */ 67 */
68 68
69/*#define RGB_DI_PIN E2 69/*#define RGB_DI_PIN E2
70#define RGBLIGHT_TIMER 70#define RGBLIGHT_ANIMATIONS
71#define RGBLED_NUM 2 // Number of LEDs 71#define RGBLED_NUM 2 // Number of LEDs
72#define RGBLIGHT_HUE_STEP 10 72#define RGBLIGHT_HUE_STEP 10
73#define RGBLIGHT_SAT_STEP 17 73#define RGBLIGHT_SAT_STEP 17
diff --git a/quantum/api.c b/quantum/api.c
new file mode 100644
index 000000000..4ca3b9676
--- /dev/null
+++ b/quantum/api.c
@@ -0,0 +1,178 @@
1#include "api.h"
2#include "quantum.h"
3
4void dword_to_bytes(uint32_t dword, uint8_t * bytes) {
5 bytes[0] = (dword >> 24) & 0xFF;
6 bytes[1] = (dword >> 16) & 0xFF;
7 bytes[2] = (dword >> 8) & 0xFF;
8 bytes[3] = (dword >> 0) & 0xFF;
9}
10
11uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index) {
12 return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3];
13}
14
15__attribute__ ((weak))
16bool process_api_quantum(uint8_t length, uint8_t * data) {
17 return process_api_keyboard(length, data);
18}
19
20__attribute__ ((weak))
21bool process_api_keyboard(uint8_t length, uint8_t * data) {
22 return process_api_user(length, data);
23}
24
25__attribute__ ((weak))
26bool process_api_user(uint8_t length, uint8_t * data) {
27 return true;
28}
29
30void process_api(uint16_t length, uint8_t * data) {
31 // SEND_STRING("\nRX: ");
32 // for (uint8_t i = 0; i < length; i++) {
33 // send_byte(data[i]);
34 // SEND_STRING(" ");
35 // }
36 if (!process_api_quantum(length, data))
37 return;
38
39 switch (data[0]) {
40 case MT_SET_DATA:
41 switch (data[1]) {
42 case DT_DEFAULT_LAYER: {
43 eeconfig_update_default_layer(data[2]);
44 default_layer_set((uint32_t)(data[2]));
45 break;
46 }
47 case DT_KEYMAP_OPTIONS: {
48 eeconfig_update_keymap(data[2]);
49 break;
50 }
51 case DT_RGBLIGHT: {
52 #ifdef RGBLIGHT_ENABLE
53 uint32_t rgblight = bytes_to_dword(data, 2);
54 rgblight_update_dword(rgblight);
55 #endif
56 break;
57 }
58 }
59 case MT_GET_DATA:
60 switch (data[1]) {
61 case DT_HANDSHAKE: {
62 MT_GET_DATA_ACK(DT_HANDSHAKE, NULL, 0);
63 break;
64 }
65 case DT_DEBUG: {
66 uint8_t debug_bytes[1] = { eeprom_read_byte(EECONFIG_DEBUG) };
67 MT_GET_DATA_ACK(DT_DEBUG, debug_bytes, 1);
68 break;
69 }
70 case DT_DEFAULT_LAYER: {
71 uint8_t default_bytes[1] = { eeprom_read_byte(EECONFIG_DEFAULT_LAYER) };
72 MT_GET_DATA_ACK(DT_DEFAULT_LAYER, default_bytes, 1);
73 break;
74 }
75 case DT_CURRENT_LAYER: {
76 uint8_t layer_state_bytes[4];
77 dword_to_bytes(layer_state, layer_state_bytes);
78 MT_GET_DATA_ACK(DT_CURRENT_LAYER, layer_state_bytes, 4);
79 break;
80 }
81 case DT_AUDIO: {
82 #ifdef AUDIO_ENABLE
83 uint8_t audio_bytes[1] = { eeprom_read_byte(EECONFIG_AUDIO) };
84 MT_GET_DATA_ACK(DT_AUDIO, audio_bytes, 1);
85 #else
86 MT_GET_DATA_ACK(DT_AUDIO, NULL, 0);
87 #endif
88 break;
89 }
90 case DT_BACKLIGHT: {
91 #ifdef BACKLIGHT_ENABLE
92 uint8_t backlight_bytes[1] = { eeprom_read_byte(EECONFIG_BACKLIGHT) };
93 MT_GET_DATA_ACK(DT_BACKLIGHT, backlight_bytes, 1);
94 #else
95 MT_GET_DATA_ACK(DT_BACKLIGHT, NULL, 0);
96 #endif
97 break;
98 }
99 case DT_RGBLIGHT: {
100 #ifdef RGBLIGHT_ENABLE
101 uint8_t rgblight_bytes[4];
102 dword_to_bytes(eeconfig_read_rgblight(), rgblight_bytes);
103 MT_GET_DATA_ACK(DT_RGBLIGHT, rgblight_bytes, 4);
104 #else
105 MT_GET_DATA_ACK(DT_RGBLIGHT, NULL, 0);
106 #endif
107 break;
108 }
109 case DT_KEYMAP_OPTIONS: {
110 uint8_t keymap_bytes[1] = { eeconfig_read_keymap() };
111 MT_GET_DATA_ACK(DT_KEYMAP_OPTIONS, keymap_bytes, 1);
112 break;
113 }
114 case DT_KEYMAP_SIZE: {
115 uint8_t keymap_size[2] = {MATRIX_ROWS, MATRIX_COLS};
116 MT_GET_DATA_ACK(DT_KEYMAP_SIZE, keymap_size, 2);
117 break;
118 }
119 case DT_KEYMAP: {
120 uint8_t keymap_data[MATRIX_ROWS * MATRIX_COLS * 4 + 3];
121 keymap_data[0] = data[2];
122 keymap_data[1] = MATRIX_ROWS;
123 keymap_data[2] = MATRIX_COLS;
124 for (int i = 0; i < MATRIX_ROWS; i++) {
125 for (int j = 0; j < MATRIX_COLS; j++) {
126 keymap_data[3 + (i*MATRIX_COLS*2) + (j*2)] = pgm_read_word(&keymaps[data[2]][i][j]) >> 8;
127 keymap_data[3 + (i*MATRIX_COLS*2) + (j*2) + 1] = pgm_read_word(&keymaps[data[2]][i][j]) & 0xFF;
128 }
129 }
130 MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, MATRIX_ROWS * MATRIX_COLS * 4 + 3);
131 // uint8_t keymap_data[5];
132 // keymap_data[0] = data[2];
133 // keymap_data[1] = data[3];
134 // keymap_data[2] = data[4];
135 // keymap_data[3] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) >> 8;
136 // keymap_data[4] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) & 0xFF;
137
138 // MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, 5);
139 break;
140 }
141 default:
142 break;
143 }
144 break;
145 case MT_SET_DATA_ACK:
146 case MT_GET_DATA_ACK:
147 break;
148 case MT_SEND_DATA:
149 break;
150 case MT_SEND_DATA_ACK:
151 break;
152 case MT_EXE_ACTION:
153 break;
154 case MT_EXE_ACTION_ACK:
155 break;
156 case MT_TYPE_ERROR:
157 break;
158 default: ; // command not recognised
159 SEND_BYTES(MT_TYPE_ERROR, DT_NONE, data, length);
160 break;
161
162 // #ifdef RGBLIGHT_ENABLE
163 // case 0x27: ; // RGB LED functions
164 // switch (*data++) {
165 // case 0x00: ; // Update HSV
166 // rgblight_sethsv((data[0] << 8 | data[1]) % 360, data[2], data[3]);
167 // break;
168 // case 0x01: ; // Update RGB
169 // break;
170 // case 0x02: ; // Update mode
171 // rgblight_mode(data[0]);
172 // break;
173 // }
174 // break;
175 // #endif
176 }
177
178} \ No newline at end of file
diff --git a/quantum/api.h b/quantum/api.h
new file mode 100644
index 000000000..00dcdb895
--- /dev/null
+++ b/quantum/api.h
@@ -0,0 +1,59 @@
1#ifndef _API_H_
2#define _API_H_
3
4#include "lufa.h"
5
6enum MESSAGE_TYPE {
7 MT_GET_DATA = 0x10, // Get data from keyboard
8 MT_GET_DATA_ACK = 0x11, // returned data to process (ACK)
9 MT_SET_DATA = 0x20, // Set data on keyboard
10 MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK)
11 MT_SEND_DATA = 0x30, // Sending data/action from keyboard
12 MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK)
13 MT_EXE_ACTION = 0x40, // executing actions on keyboard
14 MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK)
15 MT_TYPE_ERROR = 0x80 // type not recofgnised (ACK)
16};
17
18enum DATA_TYPE {
19 DT_NONE = 0x00,
20 DT_HANDSHAKE,
21 DT_DEFAULT_LAYER,
22 DT_CURRENT_LAYER,
23 DT_KEYMAP_OPTIONS,
24 DT_BACKLIGHT,
25 DT_RGBLIGHT,
26 DT_UNICODE,
27 DT_DEBUG,
28 DT_AUDIO,
29 DT_QUANTUM_ACTION,
30 DT_KEYBOARD_ACTION,
31 DT_USER_ACTION,
32 DT_KEYMAP_SIZE,
33 DT_KEYMAP
34};
35
36void dword_to_bytes(uint32_t dword, uint8_t * bytes);
37uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index);
38
39#define MT_GET_DATA(data_type, data, length) SEND_BYTES(MT_GET_DATA, data_type, data, length)
40#define MT_GET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_GET_DATA_ACK, data_type, data, length)
41#define MT_SET_DATA(data_type, data, length) SEND_BYTES(MT_SET_DATA, data_type, data, length)
42#define MT_SET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SET_DATA_ACK, data_type, data, length)
43#define MT_SEND_DATA(data_type, data, length) SEND_BYTES(MT_SEND_DATA, data_type, data, length)
44#define MT_SEND_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SEND_DATA_ACK, data_type, data, length)
45#define MT_EXE_ACTION(data_type, data, length) SEND_BYTES(MT_EXE_ACTION, data_type, data, length)
46#define MT_EXE_ACTION_ACK(data_type, data, length) SEND_BYTES(MT_EXE_ACTION_ACK, data_type, data, length)
47
48void process_api(uint16_t length, uint8_t * data);
49
50__attribute__ ((weak))
51bool process_api_quantum(uint8_t length, uint8_t * data);
52
53__attribute__ ((weak))
54bool process_api_keyboard(uint8_t length, uint8_t * data);
55
56__attribute__ ((weak))
57bool process_api_user(uint8_t length, uint8_t * data);
58
59#endif \ No newline at end of file
diff --git a/quantum/api/api_sysex.c b/quantum/api/api_sysex.c
new file mode 100644
index 000000000..a4a554e76
--- /dev/null
+++ b/quantum/api/api_sysex.c
@@ -0,0 +1,29 @@
1#include "api_sysex.h"
2
3void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length) {
4 // SEND_STRING("\nTX: ");
5 // for (uint8_t i = 0; i < length; i++) {
6 // send_byte(bytes[i]);
7 // SEND_STRING(" ");
8 // }
9 uint8_t * precode = malloc(sizeof(uint8_t) * (length + 2));
10 precode[0] = message_type;
11 precode[1] = data_type;
12 memcpy(precode + 2, bytes, length);
13 uint8_t * encoded = malloc(sizeof(uint8_t) * (sysex_encoded_length(length + 2)));
14 uint16_t encoded_length = sysex_encode(encoded, precode, length + 2);
15 uint8_t * array = malloc(sizeof(uint8_t) * (encoded_length + 5));
16 array[0] = 0xF0;
17 array[1] = 0x00;
18 array[2] = 0x00;
19 array[3] = 0x00;
20 array[encoded_length + 4] = 0xF7;
21 memcpy(array + 4, encoded, encoded_length);
22 midi_send_array(&midi_device, encoded_length + 5, array);
23
24 // SEND_STRING("\nTD: ");
25 // for (uint8_t i = 0; i < encoded_length + 5; i++) {
26 // send_byte(array[i]);
27 // SEND_STRING(" ");
28 // }
29} \ No newline at end of file
diff --git a/quantum/api/api_sysex.h b/quantum/api/api_sysex.h
new file mode 100644
index 000000000..b947b60e5
--- /dev/null
+++ b/quantum/api/api_sysex.h
@@ -0,0 +1,10 @@
1#ifndef _API_SYSEX_H_
2#define _API_SYSEX_H_
3
4#include "api.h"
5
6void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length);
7
8#define SEND_BYTES(mt, dt, b, l) send_bytes_sysex(mt, dt, b, l)
9
10#endif \ No newline at end of file
diff --git a/quantum/config_common.h b/quantum/config_common.h
index 8ed5f4a10..17c11faeb 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -5,55 +5,56 @@
5#define COL2ROW 0 5#define COL2ROW 0
6#define ROW2COL 1 6#define ROW2COL 1
7/* I/O pins */ 7/* I/O pins */
8#define B0 0x30 8#ifndef F0
9#define B1 0x31 9 #define B0 0x30
10#define B2 0x32 10 #define B1 0x31
11#define B3 0x33 11 #define B2 0x32
12#define B4 0x34 12 #define B3 0x33
13#define B5 0x35 13 #define B4 0x34
14#define B6 0x36 14 #define B5 0x35
15#define B7 0x37 15 #define B6 0x36
16#define C0 0x60 16 #define B7 0x37
17#define C1 0x61 17 #define C0 0x60
18#define C2 0x62 18 #define C1 0x61
19#define C3 0x63 19 #define C2 0x62
20#define C4 0x64 20 #define C3 0x63
21#define C5 0x65 21 #define C4 0x64
22#define C6 0x66 22 #define C5 0x65
23#define C7 0x67 23 #define C6 0x66
24#define D0 0x90 24 #define C7 0x67
25#define D1 0x91 25 #define D0 0x90
26#define D2 0x92 26 #define D1 0x91
27#define D3 0x93 27 #define D2 0x92
28#define D4 0x94 28 #define D3 0x93
29#define D5 0x95 29 #define D4 0x94
30#define D6 0x96 30 #define D5 0x95
31#define D7 0x97 31 #define D6 0x96
32#define E0 0xC0 32 #define D7 0x97
33#define E1 0xC1 33 #define E0 0xC0
34#define E2 0xC2 34 #define E1 0xC1
35#define E3 0xC3 35 #define E2 0xC2
36#define E4 0xC4 36 #define E3 0xC3
37#define E5 0xC5 37 #define E4 0xC4
38#define E6 0xC6 38 #define E5 0xC5
39#define E7 0xC7 39 #define E6 0xC6
40#define F0 0xF0 40 #define E7 0xC7
41#define F1 0xF1 41 #define F0 0xF0
42#define F2 0xF2 42 #define F1 0xF1
43#define F3 0xF3 43 #define F2 0xF2
44#define F4 0xF4 44 #define F3 0xF3
45#define F5 0xF5 45 #define F4 0xF4
46#define F6 0xF6 46 #define F5 0xF5
47#define F7 0xF7 47 #define F6 0xF6
48#define A0 0x00 48 #define F7 0xF7
49#define A1 0x01 49 #define A0 0x00
50#define A2 0x02 50 #define A1 0x01
51#define A3 0x03 51 #define A2 0x02
52#define A4 0x04 52 #define A3 0x03
53#define A5 0x05 53 #define A4 0x04
54#define A6 0x06 54 #define A5 0x05
55#define A7 0x07 55 #define A6 0x06
56 56 #define A7 0x07
57#endif
57 58
58/* USART configuration */ 59/* USART configuration */
59#ifdef BLUETOOTH_ENABLE 60#ifdef BLUETOOTH_ENABLE
@@ -76,53 +77,7 @@
76 } while(0) 77 } while(0)
77# else 78# else
78# error "USART configuration is needed." 79# error "USART configuration is needed."
79#endif 80# endif
80
81// I'm fairly sure these aren't needed, but oh well - Jack
82
83/*
84 * PS/2 Interrupt configuration
85 */
86#ifdef PS2_USE_INT
87/* uses INT1 for clock line(ATMega32U4) */
88#define PS2_CLOCK_PORT PORTD
89#define PS2_CLOCK_PIN PIND
90#define PS2_CLOCK_DDR DDRD
91#define PS2_CLOCK_BIT 1
92
93#define PS2_DATA_PORT PORTD
94#define PS2_DATA_PIN PIND
95#define PS2_DATA_DDR DDRD
96#define PS2_DATA_BIT 0
97
98#define PS2_INT_INIT() do { \
99 EICRA |= ((1<<ISC11) | \
100 (0<<ISC10)); \
101} while (0)
102#define PS2_INT_ON() do { \
103 EIMSK |= (1<<INT1); \
104} while (0)
105#define PS2_INT_OFF() do { \
106 EIMSK &= ~(1<<INT1); \
107} while (0)
108#define PS2_INT_VECT INT1_vect
109#endif
110
111/*
112 * PS/2 Busywait configuration
113 */
114#ifdef PS2_USE_BUSYWAIT
115#define PS2_CLOCK_PORT PORTD
116#define PS2_CLOCK_PIN PIND
117#define PS2_CLOCK_DDR DDRD
118#define PS2_CLOCK_BIT 1
119
120#define PS2_DATA_PORT PORTD
121#define PS2_DATA_PIN PIND
122#define PS2_DATA_DDR DDRD
123#define PS2_DATA_BIT 0
124#endif
125
126#endif 81#endif
127 82
128#endif 83#endif
diff --git a/quantum/keymap.h b/quantum/keymap.h
index a01bbfbd1..ae56d16c7 100644
--- a/quantum/keymap.h
+++ b/quantum/keymap.h
@@ -178,6 +178,10 @@ enum quantum_keycodes {
178 // Right shift, close paren 178 // Right shift, close paren
179 KC_RSPC, 179 KC_RSPC,
180 180
181 // Printing
182 PRINT_ON,
183 PRINT_OFF,
184
181 // always leave at the end 185 // always leave at the end
182 SAFE_RANGE 186 SAFE_RANGE
183}; 187};
diff --git a/quantum/keymap_extras/keymap_jp.h b/quantum/keymap_extras/keymap_jp.h
new file mode 100644
index 000000000..e81b5952e
--- /dev/null
+++ b/quantum/keymap_extras/keymap_jp.h
@@ -0,0 +1,62 @@
1/* JP106-layout (Japanese Standard)
2 *
3 * For more information, see
4 * http://www2d.biglobe.ne.jp/~msyk/keyboard/layout/usbkeycode.html
5 * note: This website is written in Japanese.
6 */
7
8
9#ifndef KEYMAP_JP_H
10#define KEYMAP_JP_H
11
12
13#include "keymap.h"
14
15
16#define JP_ZHTG KC_GRV // hankaku/zenkaku|kanzi
17#define JP_YEN KC_INT3 // yen, |
18#define JP_CIRC KC_EQL // ^, ~
19#define JP_AT KC_LBRC // @, `
20#define JP_LBRC KC_RBRC // [, {
21#define JP_COLN KC_QUOT // :, *
22#define JP_RBRC KC_NUHS // ], }
23#define JP_BSLS KC_INT1 // \, _
24#define JP_MHEN KC_INT5 // muhenkan
25#define JP_HENK KC_INT4 // henkan
26#define JP_KANA KC_INT2 // katakana/hiragana|ro-mazi
27
28
29//Aliases for shifted symbols
30#define JP_DQT LSFT(KC_2) // "
31#define JP_AMPR LSFT(KC_6) // &
32#define JP_QUOT LSFT(KC_7) // '
33#define JP_LPRN LSFT(KC_8) // (
34#define JP_RPRN LSFT(KC_9) // )
35#define JP_EQL LSFT(KC_MINS) // =
36#define JP_TILD LSFT(JP_CIRC) // ~
37#define JP_PIPE LSFT(JP_YEN) // |
38#define JP_GRV LSFT(JP_AT) // `
39#define JP_LCBR LSFT(JP_LBRC) // {
40#define JP_PLUS LSFT(KC_SCLN) // +
41#define JP_ASTR LSFT(JP_COLN) // *
42#define JP_RCBR LSFT(JP_RBRC) // }
43#define JP_UNDS LSFT(JP_BSLS) // _
44
45
46// These symbols are correspond to US101-layout.
47#define JP_MINS KC_MINS // -
48#define JP_SCLN KC_SCLN // ;
49#define JP_COMM KC_COMM // ,
50#define JP_DOT KC_DOT // .
51#define JP_SLSH KC_SLSH // /
52// shifted
53#define JP_EXLM KC_EXLM // !
54#define JP_HASH KC_HASH // #
55#define JP_DLR KC_DLR // $
56#define JP_PERC KC_PERC // %
57#define JP_LT KC_LT // <
58#define JP_GT KC_GT // >
59#define JP_QUES KC_QUES // ?
60
61
62#endif
diff --git a/quantum/keymap_extras/keymap_nordic.h b/quantum/keymap_extras/keymap_nordic.h
index da5c82975..9b0ef35ca 100644
--- a/quantum/keymap_extras/keymap_nordic.h
+++ b/quantum/keymap_extras/keymap_nordic.h
@@ -13,7 +13,7 @@
13#define NO_ACUT KC_EQL 13#define NO_ACUT KC_EQL
14 14
15#define NO_AM KC_LBRC 15#define NO_AM KC_LBRC
16#define NO_QUOT KC_RBRC 16#define NO_QUOT KC_RBRC // this is the "umlaut" char on Nordic keyboards, Apple layout
17#define NO_AE KC_SCLN 17#define NO_AE KC_SCLN
18#define NO_OSLH KC_QUOT 18#define NO_OSLH KC_QUOT
19#define NO_APOS KC_NUHS 19#define NO_APOS KC_NUHS
diff --git a/quantum/light_ws2812.c b/quantum/light_ws2812.c
index 401845e85..a883b1388 100755
--- a/quantum/light_ws2812.c
+++ b/quantum/light_ws2812.c
@@ -16,14 +16,128 @@
16#include <util/delay.h> 16#include <util/delay.h>
17#include "debug.h" 17#include "debug.h"
18 18
19#ifdef RGBW_BB_TWI
20
21// Port for the I2C
22#define I2C_DDR DDRD
23#define I2C_PIN PIND
24#define I2C_PORT PORTD
25
26// Pins to be used in the bit banging
27#define I2C_CLK 0
28#define I2C_DAT 1
29
30#define I2C_DATA_HI()\
31I2C_DDR &= ~ (1 << I2C_DAT);\
32I2C_PORT |= (1 << I2C_DAT);
33#define I2C_DATA_LO()\
34I2C_DDR |= (1 << I2C_DAT);\
35I2C_PORT &= ~ (1 << I2C_DAT);
36
37#define I2C_CLOCK_HI()\
38I2C_DDR &= ~ (1 << I2C_CLK);\
39I2C_PORT |= (1 << I2C_CLK);
40#define I2C_CLOCK_LO()\
41I2C_DDR |= (1 << I2C_CLK);\
42I2C_PORT &= ~ (1 << I2C_CLK);
43
44#define I2C_DELAY 1
45
46void I2C_WriteBit(unsigned char c)
47{
48 if (c > 0)
49 {
50 I2C_DATA_HI();
51 }
52 else
53 {
54 I2C_DATA_LO();
55 }
56
57 I2C_CLOCK_HI();
58 _delay_us(I2C_DELAY);
59
60 I2C_CLOCK_LO();
61 _delay_us(I2C_DELAY);
62
63 if (c > 0)
64 {
65 I2C_DATA_LO();
66 }
67
68 _delay_us(I2C_DELAY);
69}
70
71// Inits bitbanging port, must be called before using the functions below
72//
73void I2C_Init()
74{
75 I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));
76
77 I2C_CLOCK_HI();
78 I2C_DATA_HI();
79
80 _delay_us(I2C_DELAY);
81}
82
83// Send a START Condition
84//
85void I2C_Start()
86{
87 // set both to high at the same time
88 I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));
89 _delay_us(I2C_DELAY);
90
91 I2C_DATA_LO();
92 _delay_us(I2C_DELAY);
93
94 I2C_CLOCK_LO();
95 _delay_us(I2C_DELAY);
96}
97
98// Send a STOP Condition
99//
100void I2C_Stop()
101{
102 I2C_CLOCK_HI();
103 _delay_us(I2C_DELAY);
104
105 I2C_DATA_HI();
106 _delay_us(I2C_DELAY);
107}
108
109// write a byte to the I2C slave device
110//
111unsigned char I2C_Write(unsigned char c)
112{
113 for (char i = 0; i < 8; i++)
114 {
115 I2C_WriteBit(c & 128);
116
117 c <<= 1;
118 }
119
120
121 I2C_WriteBit(0);
122 _delay_us(I2C_DELAY);
123 _delay_us(I2C_DELAY);
124
125 // _delay_us(I2C_DELAY);
126 //return I2C_ReadBit();
127 return 0;
128}
129
130
131#endif
132
19// Setleds for standard RGB 133// Setleds for standard RGB
20void inline ws2812_setleds(struct cRGB *ledarray, uint16_t leds) 134void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds)
21{ 135{
22 // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin)); 136 // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin));
23 ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF)); 137 ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF));
24} 138}
25 139
26void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pinmask) 140void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask)
27{ 141{
28 // ws2812_DDRREG |= pinmask; // Enable DDR 142 // ws2812_DDRREG |= pinmask; // Enable DDR
29 // new universal format (DDR) 143 // new universal format (DDR)
@@ -34,14 +148,41 @@ void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pin
34} 148}
35 149
36// Setleds for SK6812RGBW 150// Setleds for SK6812RGBW
37void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds) 151void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds)
38{ 152{
153
154 #ifdef RGBW_BB_TWI
155 uint8_t sreg_prev, twcr_prev;
156 sreg_prev=SREG;
157 twcr_prev=TWCR;
158 cli();
159 TWCR &= ~(1<<TWEN);
160 I2C_Init();
161 I2C_Start();
162 I2C_Write(0x84);
163 uint16_t datlen = leds<<2;
164 uint8_t curbyte;
165 uint8_t * data = (uint8_t*)ledarray;
166 while (datlen--) {
167 curbyte=*data++;
168 I2C_Write(curbyte);
169 }
170 I2C_Stop();
171 SREG=sreg_prev;
172 TWCR=twcr_prev;
173 #endif
174
175
39 // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR 176 // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR
40 // new universal format (DDR) 177 // new universal format (DDR)
41 _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); 178 _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF);
42 179
43 ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF)); 180 ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF));
44 _delay_us(80); 181
182
183 #ifndef RGBW_BB_TWI
184 _delay_us(80);
185 #endif
45} 186}
46 187
47void ws2812_sendarray(uint8_t *data,uint16_t datlen) 188void ws2812_sendarray(uint8_t *data,uint16_t datlen)
@@ -123,7 +264,7 @@ void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi)
123 cli(); 264 cli();
124 265
125 while (datlen--) { 266 while (datlen--) {
126 curbyte=*data++; 267 curbyte=(*data++);
127 268
128 asm volatile( 269 asm volatile(
129 " ldi %0,8 \n\t" 270 " ldi %0,8 \n\t"
diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h
index 54eef22d9..9498e550e 100755
--- a/quantum/light_ws2812.h
+++ b/quantum/light_ws2812.h
@@ -16,6 +16,21 @@
16#include <avr/io.h> 16#include <avr/io.h>
17#include <avr/interrupt.h> 17#include <avr/interrupt.h>
18//#include "ws2812_config.h" 18//#include "ws2812_config.h"
19//#include "i2cmaster.h"
20
21#define LIGHT_I2C 1
22#define LIGHT_I2C_ADDR 0x84
23#define LIGHT_I2C_ADDR_WRITE ( (LIGHT_I2C_ADDR<<1) | I2C_WRITE )
24#define LIGHT_I2C_ADDR_READ ( (LIGHT_I2C_ADDR<<1) | I2C_READ )
25
26#define RGBW 1
27
28#ifdef RGBW
29 #define LED_TYPE struct cRGBW
30#else
31 #define LED_TYPE struct cRGB
32#endif
33
19 34
20/* 35/*
21 * Structure of the LED array 36 * Structure of the LED array
@@ -42,9 +57,9 @@ struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;};
42 * - Wait 50�s to reset the LEDs 57 * - Wait 50�s to reset the LEDs
43 */ 58 */
44 59
45void ws2812_setleds (struct cRGB *ledarray, uint16_t number_of_leds); 60void ws2812_setleds (LED_TYPE *ledarray, uint16_t number_of_leds);
46void ws2812_setleds_pin (struct cRGB *ledarray, uint16_t number_of_leds,uint8_t pinmask); 61void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask);
47void ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t number_of_leds); 62void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
48 63
49/* 64/*
50 * Old interface / Internal functions 65 * Old interface / Internal functions
diff --git a/quantum/pincontrol.h b/quantum/pincontrol.h
new file mode 100644
index 000000000..36ce29ef2
--- /dev/null
+++ b/quantum/pincontrol.h
@@ -0,0 +1,37 @@
1#pragma once
2// Some helpers for controlling gpio pins
3#include <avr/io.h>
4
5enum {
6 PinDirectionInput = 0,
7 PinDirectionOutput = 1,
8 PinLevelHigh = 1,
9 PinLevelLow = 0,
10};
11
12// ex: pinMode(B0, PinDirectionOutput);
13static inline void pinMode(uint8_t pin, int mode) {
14 uint8_t bv = _BV(pin & 0xf);
15 if (mode == PinDirectionOutput) {
16 _SFR_IO8((pin >> 4) + 1) |= bv;
17 } else {
18 _SFR_IO8((pin >> 4) + 1) &= ~bv;
19 _SFR_IO8((pin >> 4) + 2) &= ~bv;
20 }
21}
22
23// ex: digitalWrite(B0, PinLevelHigh);
24static inline void digitalWrite(uint8_t pin, int mode) {
25 uint8_t bv = _BV(pin & 0xf);
26 if (mode == PinLevelHigh) {
27 _SFR_IO8((pin >> 4) + 2) |= bv;
28 } else {
29 _SFR_IO8((pin >> 4) + 2) &= ~bv;
30 }
31}
32
33// Return true if the pin is HIGH
34// digitalRead(B0)
35static inline bool digitalRead(uint8_t pin) {
36 return _SFR_IO8(pin >> 4) & _BV(pin & 0xf);
37}
diff --git a/quantum/process_keycode/process_printer.c b/quantum/process_keycode/process_printer.c
new file mode 100644
index 000000000..2e11dd366
--- /dev/null
+++ b/quantum/process_keycode/process_printer.c
@@ -0,0 +1,254 @@
1#include "process_printer.h"
2#include "action_util.h"
3
4bool printing_enabled = false;
5uint8_t character_shift = 0;
6
7void enabled_printing() {
8 printing_enabled = true;
9 serial_init();
10}
11
12void disable_printing() {
13 printing_enabled = false;
14}
15
16uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29};
17
18// uint8_t keycode_to_ascii[0xFF][2];
19
20// keycode_to_ascii[KC_MINS] = {0x2D, 0x5F};
21
22void print_char(char c) {
23 USB_Disable();
24 serial_send(c);
25 USB_Init();
26}
27
28void print_box_string(uint8_t text[]) {
29 uint8_t len = strlen(text);
30 uint8_t out[len * 3 + 8];
31 out[0] = 0xDA;
32 for (uint8_t i = 0; i < len; i++) {
33 out[i+1] = 0xC4;
34 }
35 out[len + 1] = 0xBF;
36 out[len + 2] = '\n';
37
38 out[len + 3] = 0xB3;
39 for (uint8_t i = 0; i < len; i++) {
40 out[len + 4 + i] = text[i];
41 }
42 out[len * 2 + 4] = 0xB3;
43 out[len * 2 + 5] = '\n';
44
45
46 out[len * 2 + 6] = 0xC0;
47 for (uint8_t i = 0; i < len; i++) {
48 out[len * 2 + 7 + i] = 0xC4;
49 }
50 out[len * 3 + 7] = 0xD9;
51 out[len * 3 + 8] = '\n';
52
53 print_string(out);
54}
55
56void print_string(char c[]) {
57 for(uint8_t i = 0; i < strlen(c); i++)
58 print_char(c[i]);
59}
60
61bool process_printer(uint16_t keycode, keyrecord_t *record) {
62 if (keycode == PRINT_ON) {
63 enabled_printing();
64 return false;
65 }
66 if (keycode == PRINT_OFF) {
67 disable_printing();
68 return false;
69 }
70
71 if (printing_enabled) {
72 switch(keycode) {
73 case KC_EXLM ... KC_RPRN:
74 case KC_UNDS:
75 case KC_PLUS:
76 case KC_LCBR:
77 case KC_RCBR:
78 case KC_PIPE:
79 case KC_TILD:
80 keycode &= 0xFF;
81 case KC_LSFT:
82 case KC_RSFT:
83 if (record->event.pressed) {
84 character_shift++;
85 } else {
86 character_shift--;
87 }
88 return false;
89 break;
90 }
91
92 switch(keycode) {
93 case KC_F1:
94 if (record->event.pressed) {
95 print_box_string("This is a line of text!");
96 }
97 return false;
98 case KC_ESC:
99 if (record->event.pressed) {
100 print_char(0x1B);
101 }
102 return false;
103 break;
104 case KC_SPC:
105 if (record->event.pressed) {
106 print_char(0x20);
107 }
108 return false;
109 break;
110 case KC_A ... KC_Z:
111 if (record->event.pressed) {
112 if (character_shift) {
113 print_char(0x41 + (keycode - KC_A));
114 } else {
115 print_char(0x61 + (keycode - KC_A));
116 }
117 }
118 return false;
119 break;
120 case KC_1 ... KC_0:
121 if (record->event.pressed) {
122 if (character_shift) {
123 print_char(shifted_numbers[keycode - KC_1]);
124 } else {
125 print_char(0x30 + ((keycode - KC_1 + 1) % 10));
126 }
127 }
128 return false;
129 break;
130 case KC_ENT:
131 if (record->event.pressed) {
132 if (character_shift) {
133 print_char(0x0C);
134 } else {
135 print_char(0x0A);
136 }
137 }
138 return false;
139 break;
140 case KC_BSPC:
141 if (record->event.pressed) {
142 if (character_shift) {
143 print_char(0x18);
144 } else {
145 print_char(0x1A);
146 }
147 }
148 return false;
149 break;
150 case KC_DOT:
151 if (record->event.pressed) {
152 if (character_shift) {
153 print_char(0x3E);
154 } else {
155 print_char(0x2E);
156 }
157 }
158 return false;
159 break;
160 case KC_COMM:
161 if (record->event.pressed) {
162 if (character_shift) {
163 print_char(0x3C);
164 } else {
165 print_char(0x2C);
166 }
167 }
168 return false;
169 break;
170 case KC_SLSH:
171 if (record->event.pressed) {
172 if (character_shift) {
173 print_char(0x3F);
174 } else {
175 print_char(0x2F);
176 }
177 }
178 return false;
179 break;
180 case KC_QUOT:
181 if (record->event.pressed) {
182 if (character_shift) {
183 print_char(0x22);
184 } else {
185 print_char(0x27);
186 }
187 }
188 return false;
189 break;
190 case KC_GRV:
191 if (record->event.pressed) {
192 if (character_shift) {
193 print_char(0x7E);
194 } else {
195 print_char(0x60);
196 }
197 }
198 return false;
199 break;
200 case KC_MINS:
201 if (record->event.pressed) {
202 if (character_shift) {
203 print_char(0x5F);
204 } else {
205 print_char(0x2D);
206 }
207 }
208 return false;
209 break;
210 case KC_EQL:
211 if (record->event.pressed) {
212 if (character_shift) {
213 print_char(0x2B);
214 } else {
215 print_char(0x3D);
216 }
217 }
218 return false;
219 break;
220 case KC_LBRC:
221 if (record->event.pressed) {
222 if (character_shift) {
223 print_char(0x7B);
224 } else {
225 print_char(0x5B);
226 }
227 }
228 return false;
229 break;
230 case KC_RBRC:
231 if (record->event.pressed) {
232 if (character_shift) {
233 print_char(0x7D);
234 } else {
235 print_char(0x5D);
236 }
237 }
238 return false;
239 break;
240 case KC_BSLS:
241 if (record->event.pressed) {
242 if (character_shift) {
243 print_char(0x7C);
244 } else {
245 print_char(0x5C);
246 }
247 }
248 return false;
249 break;
250 }
251 }
252 return true;
253
254} \ No newline at end of file
diff --git a/quantum/process_keycode/process_printer.h b/quantum/process_keycode/process_printer.h
new file mode 100644
index 000000000..fdd36d75a
--- /dev/null
+++ b/quantum/process_keycode/process_printer.h
@@ -0,0 +1,8 @@
1#ifndef PROCESS_PRINTER_H
2#define PROCESS_PRINTER_H
3
4#include "quantum.h"
5
6#include "protocol/serial.h"
7
8#endif \ No newline at end of file
diff --git a/quantum/process_keycode/process_printer_bb.c b/quantum/process_keycode/process_printer_bb.c
new file mode 100644
index 000000000..1924d0377
--- /dev/null
+++ b/quantum/process_keycode/process_printer_bb.c
@@ -0,0 +1,260 @@
1#include "process_printer.h"
2#include "action_util.h"
3
4bool printing_enabled = false;
5uint8_t character_shift = 0;
6
7#define SERIAL_PIN_DDR DDRD
8#define SERIAL_PIN_PORT PORTD
9#define SERIAL_PIN_MASK _BV(PD3)
10#define SERIAL_DELAY 52
11
12inline static
13void serial_delay(void) {
14 _delay_us(SERIAL_DELAY);
15}
16
17inline static
18void serial_high(void) {
19 SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
20}
21
22inline static
23void serial_low(void) {
24 SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
25}
26
27inline static
28void serial_output(void) {
29 SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
30}
31
32
33void enabled_printing() {
34 printing_enabled = true;
35 serial_output();
36 serial_high();
37}
38
39void disable_printing() {
40 printing_enabled = false;
41}
42
43uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29};
44
45// uint8_t keycode_to_ascii[0xFF][2];
46
47// keycode_to_ascii[KC_MINS] = {0x2D, 0x5F};
48
49void print_char(char c) {
50 uint8_t b = 8;
51 serial_output();
52 while( b-- ) {
53 if(c & (1 << b)) {
54 serial_high();
55 } else {
56 serial_low();
57 }
58 serial_delay();
59 }
60}
61
62void print_string(char c[]) {
63 for(uint8_t i = 0; i < strlen(c); i++)
64 print_char(c[i]);
65}
66
67bool process_printer(uint16_t keycode, keyrecord_t *record) {
68 if (keycode == PRINT_ON) {
69 enabled_printing();
70 return false;
71 }
72 if (keycode == PRINT_OFF) {
73 disable_printing();
74 return false;
75 }
76
77 if (printing_enabled) {
78 switch(keycode) {
79 case KC_EXLM ... KC_RPRN:
80 case KC_UNDS:
81 case KC_PLUS:
82 case KC_LCBR:
83 case KC_RCBR:
84 case KC_PIPE:
85 case KC_TILD:
86 keycode &= 0xFF;
87 case KC_LSFT:
88 case KC_RSFT:
89 if (record->event.pressed) {
90 character_shift++;
91 } else {
92 character_shift--;
93 }
94 return false;
95 break;
96 }
97
98 switch(keycode) {
99 case KC_F1:
100 if (record->event.pressed) {
101 print_string("This is a line of text!\n\n\n");
102 }
103 return false;
104 case KC_ESC:
105 if (record->event.pressed) {
106 print_char(0x1B);
107 }
108 return false;
109 break;
110 case KC_SPC:
111 if (record->event.pressed) {
112 print_char(0x20);
113 }
114 return false;
115 break;
116 case KC_A ... KC_Z:
117 if (record->event.pressed) {
118 if (character_shift) {
119 print_char(0x41 + (keycode - KC_A));
120 } else {
121 print_char(0x61 + (keycode - KC_A));
122 }
123 }
124 return false;
125 break;
126 case KC_1 ... KC_0:
127 if (record->event.pressed) {
128 if (character_shift) {
129 print_char(shifted_numbers[keycode - KC_1]);
130 } else {
131 print_char(0x30 + ((keycode - KC_1 + 1) % 10));
132 }
133 }
134 return false;
135 break;
136 case KC_ENT:
137 if (record->event.pressed) {
138 if (character_shift) {
139 print_char(0x0C);
140 } else {
141 print_char(0x0A);
142 }
143 }
144 return false;
145 break;
146 case KC_BSPC:
147 if (record->event.pressed) {
148 if (character_shift) {
149 print_char(0x18);
150 } else {
151 print_char(0x1A);
152 }
153 }
154 return false;
155 break;
156 case KC_DOT:
157 if (record->event.pressed) {
158 if (character_shift) {
159 print_char(0x3E);
160 } else {
161 print_char(0x2E);
162 }
163 }
164 return false;
165 break;
166 case KC_COMM:
167 if (record->event.pressed) {
168 if (character_shift) {
169 print_char(0x3C);
170 } else {
171 print_char(0x2C);
172 }
173 }
174 return false;
175 break;
176 case KC_SLSH:
177 if (record->event.pressed) {
178 if (character_shift) {
179 print_char(0x3F);
180 } else {
181 print_char(0x2F);
182 }
183 }
184 return false;
185 break;
186 case KC_QUOT:
187 if (record->event.pressed) {
188 if (character_shift) {
189 print_char(0x22);
190 } else {
191 print_char(0x27);
192 }
193 }
194 return false;
195 break;
196 case KC_GRV:
197 if (record->event.pressed) {
198 if (character_shift) {
199 print_char(0x7E);
200 } else {
201 print_char(0x60);
202 }
203 }
204 return false;
205 break;
206 case KC_MINS:
207 if (record->event.pressed) {
208 if (character_shift) {
209 print_char(0x5F);
210 } else {
211 print_char(0x2D);
212 }
213 }
214 return false;
215 break;
216 case KC_EQL:
217 if (record->event.pressed) {
218 if (character_shift) {
219 print_char(0x2B);
220 } else {
221 print_char(0x3D);
222 }
223 }
224 return false;
225 break;
226 case KC_LBRC:
227 if (record->event.pressed) {
228 if (character_shift) {
229 print_char(0x7B);
230 } else {
231 print_char(0x5B);
232 }
233 }
234 return false;
235 break;
236 case KC_RBRC:
237 if (record->event.pressed) {
238 if (character_shift) {
239 print_char(0x7D);
240 } else {
241 print_char(0x5D);
242 }
243 }
244 return false;
245 break;
246 case KC_BSLS:
247 if (record->event.pressed) {
248 if (character_shift) {
249 print_char(0x7C);
250 } else {
251 print_char(0x5C);
252 }
253 }
254 return false;
255 break;
256 }
257 }
258 return true;
259
260} \ No newline at end of file
diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h
index 065eeb5f6..f17cfa6cf 100644
--- a/quantum/process_keycode/process_unicode.h
+++ b/quantum/process_keycode/process_unicode.h
@@ -22,6 +22,7 @@ void register_hex(uint16_t hex);
22bool process_unicode(uint16_t keycode, keyrecord_t *record); 22bool process_unicode(uint16_t keycode, keyrecord_t *record);
23 23
24#ifdef UNICODEMAP_ENABLE 24#ifdef UNICODEMAP_ENABLE
25void unicode_map_input_error(void);
25bool process_unicode_map(uint16_t keycode, keyrecord_t *record); 26bool process_unicode_map(uint16_t keycode, keyrecord_t *record);
26#endif 27#endif
27 28
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 098312e6e..f653564a6 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -1,5 +1,9 @@
1#include "quantum.h" 1#include "quantum.h"
2 2
3#ifndef TAPPING_TERM
4#define TAPPING_TERM 200
5#endif
6
3static void do_code16 (uint16_t code, void (*f) (uint8_t)) { 7static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
4 switch (code) { 8 switch (code) {
5 case QK_MODS ... QK_MODS_MAX: 9 case QK_MODS ... QK_MODS_MAX:
@@ -75,6 +79,7 @@ void reset_keyboard(void) {
75#endif 79#endif
76 80
77static bool shift_interrupted[2] = {0, 0}; 81static bool shift_interrupted[2] = {0, 0};
82static uint16_t scs_timer = 0;
78 83
79bool process_record_quantum(keyrecord_t *record) { 84bool process_record_quantum(keyrecord_t *record) {
80 85
@@ -129,6 +134,9 @@ bool process_record_quantum(keyrecord_t *record) {
129 #ifdef UCIS_ENABLE 134 #ifdef UCIS_ENABLE
130 process_ucis(keycode, record) && 135 process_ucis(keycode, record) &&
131 #endif 136 #endif
137 #ifdef PRINTING_ENABLE
138 process_printer(keycode, record) &&
139 #endif
132 #ifdef UNICODEMAP_ENABLE 140 #ifdef UNICODEMAP_ENABLE
133 process_unicode_map(keycode, record) && 141 process_unicode_map(keycode, record) &&
134 #endif 142 #endif
@@ -283,6 +291,7 @@ bool process_record_quantum(keyrecord_t *record) {
283 case KC_LSPO: { 291 case KC_LSPO: {
284 if (record->event.pressed) { 292 if (record->event.pressed) {
285 shift_interrupted[0] = false; 293 shift_interrupted[0] = false;
294 scs_timer = timer_read ();
286 register_mods(MOD_BIT(KC_LSFT)); 295 register_mods(MOD_BIT(KC_LSFT));
287 } 296 }
288 else { 297 else {
@@ -292,7 +301,7 @@ bool process_record_quantum(keyrecord_t *record) {
292 shift_interrupted[1] = true; 301 shift_interrupted[1] = true;
293 } 302 }
294 #endif 303 #endif
295 if (!shift_interrupted[0]) { 304 if (!shift_interrupted[0] && timer_elapsed(scs_timer) < TAPPING_TERM) {
296 register_code(LSPO_KEY); 305 register_code(LSPO_KEY);
297 unregister_code(LSPO_KEY); 306 unregister_code(LSPO_KEY);
298 } 307 }
@@ -305,6 +314,7 @@ bool process_record_quantum(keyrecord_t *record) {
305 case KC_RSPC: { 314 case KC_RSPC: {
306 if (record->event.pressed) { 315 if (record->event.pressed) {
307 shift_interrupted[1] = false; 316 shift_interrupted[1] = false;
317 scs_timer = timer_read ();
308 register_mods(MOD_BIT(KC_RSFT)); 318 register_mods(MOD_BIT(KC_RSFT));
309 } 319 }
310 else { 320 else {
@@ -314,7 +324,7 @@ bool process_record_quantum(keyrecord_t *record) {
314 shift_interrupted[1] = true; 324 shift_interrupted[1] = true;
315 } 325 }
316 #endif 326 #endif
317 if (!shift_interrupted[1]) { 327 if (!shift_interrupted[1] && timer_elapsed(scs_timer) < TAPPING_TERM) {
318 register_code(RSPC_KEY); 328 register_code(RSPC_KEY);
319 unregister_code(RSPC_KEY); 329 unregister_code(RSPC_KEY);
320 } 330 }
@@ -799,6 +809,51 @@ void backlight_set(uint8_t level)
799#endif // backlight 809#endif // backlight
800 810
801 811
812// Functions for spitting out values
813//
814
815void send_dword(uint32_t number) { // this might not actually work
816 uint16_t word = (number >> 16);
817 send_word(word);
818 send_word(number & 0xFFFFUL);
819}
820
821void send_word(uint16_t number) {
822 uint8_t byte = number >> 8;
823 send_byte(byte);
824 send_byte(number & 0xFF);
825}
826
827void send_byte(uint8_t number) {
828 uint8_t nibble = number >> 4;
829 send_nibble(nibble);
830 send_nibble(number & 0xF);
831}
832
833void send_nibble(uint8_t number) {
834 switch (number) {
835 case 0:
836 register_code(KC_0);
837 unregister_code(KC_0);
838 break;
839 case 1 ... 9:
840 register_code(KC_1 + (number - 1));
841 unregister_code(KC_1 + (number - 1));
842 break;
843 case 0xA ... 0xF:
844 register_code(KC_A + (number - 0xA));
845 unregister_code(KC_A + (number - 0xA));
846 break;
847 }
848}
849
850void api_send_unicode(uint32_t unicode) {
851#ifdef API_ENABLE
852 uint8_t chunk[4];
853 dword_to_bytes(unicode, chunk);
854 MT_SEND_DATA(DT_UNICODE, chunk, 5);
855#endif
856}
802 857
803__attribute__ ((weak)) 858__attribute__ ((weak))
804void led_set_user(uint8_t usb_led) { 859void led_set_user(uint8_t usb_led) {
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 0c6046649..e6adf974a 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -59,6 +59,10 @@ extern uint32_t default_layer_state;
59 59
60#include "process_tap_dance.h" 60#include "process_tap_dance.h"
61 61
62#ifdef PRINTING_ENABLE
63 #include "process_printer.h"
64#endif
65
62#define SEND_STRING(str) send_string(PSTR(str)) 66#define SEND_STRING(str) send_string(PSTR(str))
63void send_string(const char *str); 67void send_string(const char *str);
64 68
@@ -106,8 +110,15 @@ void breathing_speed_dec(uint8_t value);
106#endif 110#endif
107 111
108#endif 112#endif
113void send_dword(uint32_t number);
114void send_word(uint16_t number);
115void send_byte(uint8_t number);
116void send_nibble(uint8_t number);
117
109 118
110void led_set_user(uint8_t usb_led); 119void led_set_user(uint8_t usb_led);
111void led_set_kb(uint8_t usb_led); 120void led_set_kb(uint8_t usb_led);
112 121
122void api_send_unicode(uint32_t unicode);
123
113#endif 124#endif
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index d550c5866..625971e0f 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -69,11 +69,12 @@ const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {100, 50, 20};
69 69
70rgblight_config_t rgblight_config; 70rgblight_config_t rgblight_config;
71rgblight_config_t inmem_config; 71rgblight_config_t inmem_config;
72struct cRGB led[RGBLED_NUM];
73uint8_t rgblight_inited = 0;
74 72
73LED_TYPE led[RGBLED_NUM];
74uint8_t rgblight_inited = 0;
75bool rgblight_timer_enabled = false;
75 76
76void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) { 77void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
77 uint8_t r = 0, g = 0, b = 0, base, color; 78 uint8_t r = 0, g = 0, b = 0, base, color;
78 79
79 if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. 80 if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
@@ -124,7 +125,7 @@ void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
124 setrgb(r, g, b, led1); 125 setrgb(r, g, b, led1);
125} 126}
126 127
127void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1) { 128void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1) {
128 (*led1).r = r; 129 (*led1).r = r;
129 (*led1).g = g; 130 (*led1).g = g;
130 (*led1).b = b; 131 (*led1).b = b;
@@ -141,9 +142,9 @@ void eeconfig_update_rgblight_default(void) {
141 dprintf("eeconfig_update_rgblight_default\n"); 142 dprintf("eeconfig_update_rgblight_default\n");
142 rgblight_config.enable = 1; 143 rgblight_config.enable = 1;
143 rgblight_config.mode = 1; 144 rgblight_config.mode = 1;
144 rgblight_config.hue = 200; 145 rgblight_config.hue = 0;
145 rgblight_config.sat = 204; 146 rgblight_config.sat = 255;
146 rgblight_config.val = 204; 147 rgblight_config.val = 255;
147 eeconfig_update_rgblight(rgblight_config.raw); 148 eeconfig_update_rgblight(rgblight_config.raw);
148} 149}
149void eeconfig_debug_rgblight(void) { 150void eeconfig_debug_rgblight(void) {
@@ -173,7 +174,7 @@ void rgblight_init(void) {
173 } 174 }
174 eeconfig_debug_rgblight(); // display current eeprom values 175 eeconfig_debug_rgblight(); // display current eeprom values
175 176
176 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) 177 #ifdef RGBLIGHT_ANIMATIONS
177 rgblight_timer_init(); // setup the timer 178 rgblight_timer_init(); // setup the timer
178 #endif 179 #endif
179 180
@@ -182,6 +183,19 @@ void rgblight_init(void) {
182 } 183 }
183} 184}
184 185
186void rgblight_update_dword(uint32_t dword) {
187 rgblight_config.raw = dword;
188 eeconfig_update_rgblight(rgblight_config.raw);
189 if (rgblight_config.enable)
190 rgblight_mode(rgblight_config.mode);
191 else {
192 #ifdef RGBLIGHT_ANIMATIONS
193 rgblight_timer_disable();
194 #endif
195 rgblight_set();
196 }
197}
198
185void rgblight_increase(void) { 199void rgblight_increase(void) {
186 uint8_t mode = 0; 200 uint8_t mode = 0;
187 if (rgblight_config.mode < RGBLIGHT_MODES) { 201 if (rgblight_config.mode < RGBLIGHT_MODES) {
@@ -220,7 +234,7 @@ void rgblight_mode(uint8_t mode) {
220 eeconfig_update_rgblight(rgblight_config.raw); 234 eeconfig_update_rgblight(rgblight_config.raw);
221 xprintf("rgblight mode: %u\n", rgblight_config.mode); 235 xprintf("rgblight mode: %u\n", rgblight_config.mode);
222 if (rgblight_config.mode == 1) { 236 if (rgblight_config.mode == 1) {
223 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) 237 #ifdef RGBLIGHT_ANIMATIONS
224 rgblight_timer_disable(); 238 rgblight_timer_disable();
225 #endif 239 #endif
226 } else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 23) { 240 } else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 23) {
@@ -230,7 +244,7 @@ void rgblight_mode(uint8_t mode) {
230 // MODE 15-20, snake 244 // MODE 15-20, snake
231 // MODE 21-23, knight 245 // MODE 21-23, knight
232 246
233 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) 247 #ifdef RGBLIGHT_ANIMATIONS
234 rgblight_timer_enable(); 248 rgblight_timer_enable();
235 #endif 249 #endif
236 } 250 }
@@ -244,7 +258,7 @@ void rgblight_toggle(void) {
244 if (rgblight_config.enable) { 258 if (rgblight_config.enable) {
245 rgblight_mode(rgblight_config.mode); 259 rgblight_mode(rgblight_config.mode);
246 } else { 260 } else {
247 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) 261 #ifdef RGBLIGHT_ANIMATIONS
248 rgblight_timer_disable(); 262 rgblight_timer_disable();
249 #endif 263 #endif
250 _delay_ms(50); 264 _delay_ms(50);
@@ -252,6 +266,13 @@ void rgblight_toggle(void) {
252 } 266 }
253} 267}
254 268
269void rgblight_enable(void) {
270 rgblight_config.enable = 1;
271 eeconfig_update_rgblight(rgblight_config.raw);
272 xprintf("rgblight enable: rgblight_config.enable = %u\n", rgblight_config.enable);
273 rgblight_mode(rgblight_config.mode);
274}
275
255 276
256void rgblight_increase_hue(void) { 277void rgblight_increase_hue(void) {
257 uint16_t hue; 278 uint16_t hue;
@@ -307,7 +328,7 @@ void rgblight_decrease_val(void) {
307void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { 328void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
308 inmem_config.raw = rgblight_config.raw; 329 inmem_config.raw = rgblight_config.raw;
309 if (rgblight_config.enable) { 330 if (rgblight_config.enable) {
310 struct cRGB tmp_led; 331 LED_TYPE tmp_led;
311 sethsv(hue, sat, val, &tmp_led); 332 sethsv(hue, sat, val, &tmp_led);
312 inmem_config.hue = hue; 333 inmem_config.hue = hue;
313 inmem_config.sat = sat; 334 inmem_config.sat = sat;
@@ -351,66 +372,84 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
351 372
352void rgblight_set(void) { 373void rgblight_set(void) {
353 if (rgblight_config.enable) { 374 if (rgblight_config.enable) {
354 ws2812_setleds(led, RGBLED_NUM); 375 #ifdef RGBW
376 ws2812_setleds_rgbw(led, RGBLED_NUM);
377 #else
378 ws2812_setleds(led, RGBLED_NUM);
379 #endif
355 } else { 380 } else {
356 for (uint8_t i = 0; i < RGBLED_NUM; i++) { 381 for (uint8_t i = 0; i < RGBLED_NUM; i++) {
357 led[i].r = 0; 382 led[i].r = 0;
358 led[i].g = 0; 383 led[i].g = 0;
359 led[i].b = 0; 384 led[i].b = 0;
360 } 385 }
361 ws2812_setleds(led, RGBLED_NUM); 386 #ifdef RGBW
387 ws2812_setleds_rgbw(led, RGBLED_NUM);
388 #else
389 ws2812_setleds(led, RGBLED_NUM);
390 #endif
362 } 391 }
363} 392}
364 393
365#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER) 394#ifdef RGBLIGHT_ANIMATIONS
366 395
367// Animation timer -- AVR Timer3 396// Animation timer -- AVR Timer3
368void rgblight_timer_init(void) { 397void rgblight_timer_init(void) {
369 static uint8_t rgblight_timer_is_init = 0; 398 // static uint8_t rgblight_timer_is_init = 0;
370 if (rgblight_timer_is_init) { 399 // if (rgblight_timer_is_init) {
371 return; 400 // return;
372 } 401 // }
373 rgblight_timer_is_init = 1; 402 // rgblight_timer_is_init = 1;
374 /* Timer 3 setup */ 403 // /* Timer 3 setup */
375 TCCR3B = _BV(WGM32) //CTC mode OCR3A as TOP 404 // TCCR3B = _BV(WGM32) // CTC mode OCR3A as TOP
376 | _BV(CS30); //Clock selelct: clk/1 405 // | _BV(CS30); // Clock selelct: clk/1
377 /* Set TOP value */ 406 // /* Set TOP value */
378 uint8_t sreg = SREG; 407 // uint8_t sreg = SREG;
379 cli(); 408 // cli();
380 OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff; 409 // OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff;
381 OCR3AL = RGBLED_TIMER_TOP & 0xff; 410 // OCR3AL = RGBLED_TIMER_TOP & 0xff;
382 SREG = sreg; 411 // SREG = sreg;
412
413 rgblight_timer_enabled = true;
383} 414}
384void rgblight_timer_enable(void) { 415void rgblight_timer_enable(void) {
385 TIMSK3 |= _BV(OCIE3A); 416 rgblight_timer_enabled = true;
386 dprintf("TIMER3 enabled.\n"); 417 dprintf("TIMER3 enabled.\n");
387} 418}
388void rgblight_timer_disable(void) { 419void rgblight_timer_disable(void) {
389 TIMSK3 &= ~_BV(OCIE3A); 420 rgblight_timer_enabled = false;
390 dprintf("TIMER3 disabled.\n"); 421 dprintf("TIMER3 disabled.\n");
391} 422}
392void rgblight_timer_toggle(void) { 423void rgblight_timer_toggle(void) {
393 TIMSK3 ^= _BV(OCIE3A); 424 rgblight_timer_enabled ^= rgblight_timer_enabled;
394 dprintf("TIMER3 toggled.\n"); 425 dprintf("TIMER3 toggled.\n");
395} 426}
396 427
397ISR(TIMER3_COMPA_vect) { 428void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) {
398 // mode = 1, static light, do nothing here 429 rgblight_enable();
399 if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) { 430 rgblight_mode(1);
400 // mode = 2 to 5, breathing mode 431 rgblight_setrgb(r, g, b);
401 rgblight_effect_breathing(rgblight_config.mode - 2); 432}
402 } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) { 433
403 // mode = 6 to 8, rainbow mood mod 434void rgblight_task(void) {
404 rgblight_effect_rainbow_mood(rgblight_config.mode - 6); 435 if (rgblight_timer_enabled) {
405 } else if (rgblight_config.mode >= 9 && rgblight_config.mode <= 14) { 436 // mode = 1, static light, do nothing here
406 // mode = 9 to 14, rainbow swirl mode 437 if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
407 rgblight_effect_rainbow_swirl(rgblight_config.mode - 9); 438 // mode = 2 to 5, breathing mode
408 } else if (rgblight_config.mode >= 15 && rgblight_config.mode <= 20) { 439 rgblight_effect_breathing(rgblight_config.mode - 2);
409 // mode = 15 to 20, snake mode 440 } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) {
410 rgblight_effect_snake(rgblight_config.mode - 15); 441 // mode = 6 to 8, rainbow mood mod
411 } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { 442 rgblight_effect_rainbow_mood(rgblight_config.mode - 6);
412 // mode = 21 to 23, knight mode 443 } else if (rgblight_config.mode >= 9 && rgblight_config.mode <= 14) {
413 rgblight_effect_knight(rgblight_config.mode - 21); 444 // mode = 9 to 14, rainbow swirl mode
445 rgblight_effect_rainbow_swirl(rgblight_config.mode - 9);
446 } else if (rgblight_config.mode >= 15 && rgblight_config.mode <= 20) {
447 // mode = 15 to 20, snake mode
448 rgblight_effect_snake(rgblight_config.mode - 15);
449 } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) {
450 // mode = 21 to 23, knight mode
451 rgblight_effect_knight(rgblight_config.mode - 21);
452 }
414 } 453 }
415} 454}
416 455
@@ -449,7 +488,7 @@ void rgblight_effect_rainbow_swirl(uint8_t interval) {
449 last_timer = timer_read(); 488 last_timer = timer_read();
450 for (i = 0; i < RGBLED_NUM; i++) { 489 for (i = 0; i < RGBLED_NUM; i++) {
451 hue = (360 / RGBLED_NUM * i + current_hue) % 360; 490 hue = (360 / RGBLED_NUM * i + current_hue) % 360;
452 sethsv(hue, rgblight_config.sat, rgblight_config.val, &led[i]); 491 sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
453 } 492 }
454 rgblight_set(); 493 rgblight_set();
455 494
@@ -486,7 +525,7 @@ void rgblight_effect_snake(uint8_t interval) {
486 k = k + RGBLED_NUM; 525 k = k + RGBLED_NUM;
487 } 526 }
488 if (i == k) { 527 if (i == k) {
489 sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), &led[i]); 528 sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), (LED_TYPE *)&led[i]);
490 } 529 }
491 } 530 }
492 } 531 }
@@ -506,7 +545,7 @@ void rgblight_effect_knight(uint8_t interval) {
506 static uint16_t last_timer = 0; 545 static uint16_t last_timer = 0;
507 uint8_t i, j, cur; 546 uint8_t i, j, cur;
508 int8_t k; 547 int8_t k;
509 struct cRGB preled[RGBLED_NUM]; 548 LED_TYPE preled[RGBLED_NUM];
510 static int8_t increment = -1; 549 static int8_t increment = -1;
511 if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) { 550 if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) {
512 return; 551 return;
@@ -525,7 +564,7 @@ void rgblight_effect_knight(uint8_t interval) {
525 k = RGBLED_NUM - 1; 564 k = RGBLED_NUM - 1;
526 } 565 }
527 if (i == k) { 566 if (i == k) {
528 sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, &preled[i]); 567 sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&preled[i]);
529 } 568 }
530 } 569 }
531 } 570 }
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 17f04ffcf..aa1d026e0 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -1,8 +1,7 @@
1#ifndef RGBLIGHT_H 1#ifndef RGBLIGHT_H
2#define RGBLIGHT_H 2#define RGBLIGHT_H
3 3
4 4#ifdef RGBLIGHT_ANIMATIONS
5#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
6 #define RGBLIGHT_MODES 23 5 #define RGBLIGHT_MODES 23
7#else 6#else
8 #define RGBLIGHT_MODES 1 7 #define RGBLIGHT_MODES 1
@@ -34,6 +33,7 @@
34#endif 33#endif
35 34
36#define RGBLED_TIMER_TOP F_CPU/(256*64) 35#define RGBLED_TIMER_TOP F_CPU/(256*64)
36// #define RGBLED_TIMER_TOP 0xFF10
37 37
38#include <stdint.h> 38#include <stdint.h>
39#include <stdbool.h> 39#include <stdbool.h>
@@ -61,9 +61,11 @@ void rgblight_init(void);
61void rgblight_increase(void); 61void rgblight_increase(void);
62void rgblight_decrease(void); 62void rgblight_decrease(void);
63void rgblight_toggle(void); 63void rgblight_toggle(void);
64void rgblight_enable(void);
64void rgblight_step(void); 65void rgblight_step(void);
65void rgblight_mode(uint8_t mode); 66void rgblight_mode(uint8_t mode);
66void rgblight_set(void); 67void rgblight_set(void);
68void rgblight_update_dword(uint32_t dword);
67void rgblight_increase_hue(void); 69void rgblight_increase_hue(void);
68void rgblight_decrease_hue(void); 70void rgblight_decrease_hue(void);
69void rgblight_increase_sat(void); 71void rgblight_increase_sat(void);
@@ -78,10 +80,15 @@ void eeconfig_update_rgblight(uint32_t val);
78void eeconfig_update_rgblight_default(void); 80void eeconfig_update_rgblight_default(void);
79void eeconfig_debug_rgblight(void); 81void eeconfig_debug_rgblight(void);
80 82
81void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1); 83void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1);
82void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1); 84void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1);
83void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); 85void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
84 86
87#define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF)
88void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b);
89
90void rgblight_task(void);
91
85void rgblight_timer_init(void); 92void rgblight_timer_init(void);
86void rgblight_timer_enable(void); 93void rgblight_timer_enable(void);
87void rgblight_timer_disable(void); 94void rgblight_timer_disable(void);
diff --git a/readme.md b/readme.md
index 8615b48d5..90584cabc 100644
--- a/readme.md
+++ b/readme.md
@@ -4,7 +4,7 @@
4 4
5This is a keyboard firmware based on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). 5This is a keyboard firmware based on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/).
6 6
7## Official website 7## Official website (currently under construction with the move to the wiki)
8 8
9For an easy-to-read version of this document and the repository, check out [http://qmk.fm](http://qmk.fm). Nicely formatted keyboard and keymap listings are also available there, along with the ability to download .hex files instead of having to setup a build environment and compile them. 9For an easy-to-read version of this document and the repository, check out [http://qmk.fm](http://qmk.fm). Nicely formatted keyboard and keymap listings are also available there, along with the ability to download .hex files instead of having to setup a build environment and compile them.
10 10
@@ -31,1279 +31,9 @@ The OLKB product firmwares are maintained by [Jack Humbert](https://github.com/j
31 31
32This is not a tiny project. While this is the main readme, there are many other files you might want to consult. Here are some points of interest: 32This is not a tiny project. While this is the main readme, there are many other files you might want to consult. Here are some points of interest:
33 33
34* [**The Wiki**](https://github.com/jackhumbert/qmk_firmware/wiki) - the entirity of the readme has been moved here
34* The readme for your own keyboard: This is found under `keyboards/<your keyboards's name>/`. So for the ErgoDox EZ, it's [here](keyboards/ergodox/ez/); for the Planck, it's [here](keyboards/planck/) and so on. 35* The readme for your own keyboard: This is found under `keyboards/<your keyboards's name>/`. So for the ErgoDox EZ, it's [here](keyboards/ergodox/ez/); for the Planck, it's [here](keyboards/planck/) and so on.
35* The list of possible keycodes you can use in your keymap is actually spread out in a few different places: 36* The list of possible keycodes you can use in your keymap is actually spread out in a few different places:
36 * [doc/keycode.txt](doc/keycode.txt) - an explanation of those same keycodes. 37 * [doc/keycode.txt](doc/keycode.txt) - an explanation of those same keycodes.
37 * [quantum/keymap.h](quantum/keymap.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap.h` is where they're actually defined. 38 * [quantum/keymap.h](quantum/keymap.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap.h` is where they're actually defined.
38* The [TMK documentation](doc/TMK_README.md). QMK is based on TMK, and this explains how it works internally. 39* The [TMK documentation](doc/TMK_README.md). QMK is based on TMK, and this explains how it works internally.
39
40# Getting started
41
42Before you are able to compile, you'll need to install an environment for AVR development. You'll find the instructions for any OS below. If you find another/better way to set things up from scratch, please consider [making a pull request](https://github.com/jackhumbert/qmk_firmware/pulls) with your changes!
43
44## Build Environment Setup
45
46### Windows 10
47
48It's still recommended to use the method for Vista and later below. The reason for this is that the Windows 10 Subsystem for Linux lacks [USB support](https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13355724-unable-to-access-usb-devices-from-bash), so it's not possible to flash the firmware to the keyboard. Please add your vote to the link!
49
50That said, it's still possible to use it for compilation. And recommended, if you need to compile much, since it's much faster than at least Cygwin (which is also supported, but currently lacking documentation). I haven't tried the method below, so I'm unable to tell.
51
52Here are the steps
53
541. Install the Windows 10 subsystem for Linux, following [these instructions](http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/).
552. If you have previously cloned the repository using the normal Git bash, you will need to clean up the line endings. If you have cloned it after 20th of August 2016, you are likely fine. To clean up the line endings do the following
56 1. Make sure that you have no changes you haven't committed by running `git status`, if you do commit them first
57 2. From within the Git bash run `git rm --cached -r .`
58 3. Followed by `git reset --hard`
593. Start the "Bash On Ubuntu On Windows" from the start menu
604. With the bash open, navigate to your Git checkout. The harddisk can be accessed from `/mnt` for example `/mnt/c` for the `c:\` drive.
615. Run `sudo util/install_dependencies.sh`.
626. After a while the installation will finish, and you are good to go
63
64**Note** From time to time, the dependencies might change, so just run `install_dependencies.sh` again if things are not working.
65
66**Warning:** If you edit Makefiles or shell scripts, make sure you are using an editor that saves the files with Unix line endings. Otherwise the compilation might not work.
67
68
69### Windows (Vista and later)
701. If you have ever installed WinAVR, uninstall it.
712. Install [MHV AVR Tools](https://infernoembedded.com/sites/default/files/project/MHV_AVR_Tools_20131101.exe). Disable smatch, but **be sure to leave the option to add the tools to the PATH checked**.
723. If you are going to flash Infinity based keyboards you will need to install dfu-util, refer to the instructions by [Input Club](https://github.com/kiibohd/controller/wiki/Loading-DFU-Firmware).
734. Install [MinGW](https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download). During installation, uncheck the option to install a graphical user interface. **DO NOT change the default installation folder.** The scripts depend on the default location.
745. Clone this repository. [This link will download it as a zip file, which you'll need to extract.](https://github.com/jackhumbert/qmk_firmware/archive/master.zip) Open the extracted folder in Windows Explorer.
756. Open the `\util` folder.
767. Double-click on the `1-setup-path-win` batch script to run it. You'll need to accept a User Account Control prompt. Press the spacebar to dismiss the success message in the command prompt that pops up.
778. Right-click on the `2-setup-environment-win` batch script, select "Run as administrator", and accept the User Account Control prompt. This part may take a couple of minutes, and you'll need to approve a driver installation, but once it finishes, your environment is complete!
78
79If you have trouble and want to ask for help, it is useful to generate a *Win_Check_Output.txt* file by running `Win_Check.bat` in the `\util` folder.
80
81### Mac
82If you're using [homebrew,](http://brew.sh/) you can use the following commands:
83
84 brew tap osx-cross/avr
85 brew install avr-libc
86 brew install dfu-programmer
87
88This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line.
89
90You can also try these instructions:
91
921. Install Xcode from the App Store.
932. Install the Command Line Tools from `Xcode->Preferences->Downloads`.
943. Install [DFU-Programmer][dfu-prog].
95
96If you are going to flash Infinity based keyboards you will also need dfu-util
97
98 brew install dfu-util
99
100### Linux
101
102To ensure you are always up to date, you can just run `sudo util/install_dependencies.sh`. That should always install all the dependencies needed.
103
104You can also install things manually, but this documentation might not be always up to date with all requirements.
105
106The current requirements are the following, but not all might be needed depending on what you do. Also note that some systems might not have all the dependencies available as packages, or they might be named differently.
107
108```
109build-essential
110gcc
111unzip
112wget
113zip
114gcc-avr
115binutils-avr
116avr-libc
117dfu-programmer
118dfu-util
119gcc-arm-none-eabi
120binutils-arm-none-eabi
121libnewlib-arm-none-eabi
122git
123```
124
125Install the dependencies with your favorite package manager.
126
127Debian/Ubuntu example:
128
129 sudo apt-get update
130 sudo apt-get install gcc unzip wget zip gcc-avr binutils-avr avr-libc dfu-programmer dfu-util gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi
131
132### Docker
133
134If this is a bit complex for you, Docker might be the turn-key solution you need. After installing [Docker](https://www.docker.com/products/docker), run the following command at the root of the QMK folder to build a keyboard/keymap:
135
136```bash
137# You'll run this every time you want to build a keymap
138# modify the keymap and keyboard assigment to compile what you want
139# defaults are ergodox/default
140
141docker run -e keymap=gwen -e keyboard=ergodox --rm -v $('pwd'):/qmk:rw edasque/qmk_firmware
142
143# On windows docker seems to have issue with VOLUME tag in Dockerfile, and $('pwd') won't print a windows compliant path, use full path instead like this
144docker run -e keymap=default -e keyboard=ergobop --rm -v D:/Users/Sacapuces/Documents/Repositories/qmk:/qmk:rw edasque/qmk_firmware
145
146```
147
148This will compile the targetted keyboard/keymap and leave it in your QMK directory for you to flash.
149
150### Vagrant
151If you have any problems building the firmware, you can try using a tool called Vagrant. It will set up a virtual computer with a known configuration that's ready-to-go for firmware building. OLKB does NOT host the files for this virtual computer. Details on how to set up Vagrant are in the [VAGRANT_GUIDE file](doc/VAGRANT_GUIDE.md).
152
153## Verify Your Installation
1541. If you haven't already, obtain this repository ([https://github.com/jackhumbert/qmk_firmware](https://github.com/jackhumbert/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application.
1552. Open up a terminal or command prompt and navigate to the `qmk_firmware` folder using the `cd` command. The command prompt will typically open to your home directory. If, for example, you cloned the repository to your Documents folder, then you would type `cd Documents/qmk_firmware`. If you extracted the file from a zip, then it may be named `qmk_firmware-master` instead.
1563. To confirm that you're in the correct location, you can display the contents of your current folder using the `dir` command on Windows, or the `ls` command on Linux or Mac. You should see several files, including `readme.md` and a `quantum` folder. From here, you need to navigate to the appropriate folder under `keyboards/`. For example, if you're building for a Planck, run `cd keyboards/planck`.
1574. Once you're in the correct keyboard-specific folder, run the `make` command. This should output a lot of information about the build process. More information about the `make` command can be found below.
158
159# Customizing your keymap
160
161In every keymap folder, the following files are recommended:
162
163* `config.h` - the options to configure your keymap
164* `keymap.c` - all of your keymap code, required
165* `Makefile` - the features of QMK that are enabled, required to run `make` in your keymap folder
166* `readme.md` - a description of your keymap, how others might use it, and explanations of features
167
168## The `make` command
169
170The `make` command is how you compile the firmware into a .hex file, which can be loaded by a dfu programmer (like dfu-progammer via `make dfu`) or the [Teensy loader](https://www.pjrc.com/teensy/loader.html) (only used with Teensys).
171
172**NOTE:** To abort a make command press `Ctrl-c`
173
174The following instruction refers to these folders.
175
176* The `root` (`/`) folder is the qmk_firmware folder, in which are `doc`, `keyboard`, `quantum`, etc.
177* The `keyboard` folder is any keyboard project's folder, like `/keyboards/planck`.
178* The `keymap` folder is any keymap's folder, like `/keyboards/planck/keymaps/default`.
179* The `subproject` folder is the subproject folder of a keyboard, like `/keyboards/ergodox/ez`
180
181### Simple instructions for building and uploading a keyboard
182
183**Most keyboards have more specific instructions in the keyboard specific readme.md file, so please check that first**
184
185If the `keymap` folder contains a file name `Makefile`
186
1871. Change the directory to the `keymap` folder
1882. Run `make <subproject>-<programmer>`
189
190Otherwise, if there's no `Makefile` in the `keymap` folder
191
1921. Enter the `keyboard` folder
1932. Run `make <subproject>-<keymap>-<programmer>`
194
195In the above commands, replace:
196
197* `<keymap>` with the name of your keymap
198* `<subproject>` with the name of the subproject (revision or sub-model of your keyboard). For example, for Ergodox it can be `ez` or `infinity`, and for Planck `rev3` or `rev4`.
199 * If the keyboard doesn't have a subproject, or if you are happy with the default (defined in `rules.mk` file of the `keyboard` folder), you can leave it out. But remember to also remove the dash (`-`) from the command.
200* `<programmer>` The programmer to use. Most keyboards use `dfu`, but some use `teensy`. Infinity keyboards use `dfu-util`. Check the readme file in the keyboard folder to find out which programmer to use.
201 * If you don't add `-<programmer` to the command line, the firmware will be still be compiled into a hex file, but the upload will be skipped.
202
203**NOTE:** Some operating systems will refuse to program unless you run the make command as root for example `sudo make dfu`
204
205### More detailed make instruction
206
207The full syntax of the `make` command is the following, but parts of the command can be left out if you run it from other directories than the `root` (as you might already have noticed by reading the simple instructions).
208
209`<keyboard>-<subproject>-<keymap>-<target>`, where:
210
211* `<keyboard>` is the name of the keyboard, for example `planck`
212 * Use `allkb` to compile all keyboards
213* `<subproject>` is the name of the subproject (revision or sub-model of the keyboard). For example, for Ergodox it can be `ez` or `infinity`, and for Planck `rev3` or `rev4`.
214 * If the keyboard doesn't have any subprojects, it can be left out
215 * To compile the default subproject, you can leave it out, or specify `defaultsp`
216 * Use `allsp` to compile all subprojects
217* `<keymap>` is the name of the keymap, for example `algernon`
218 * Use `allkm` to compile all keymaps
219* `<target>` will be explained in more detail below.
220
221**Note:** When you leave some parts of the command out, you should also remove the dash (`-`).
222
223As mentioned above, there are some shortcuts, when you are in a:
224
225* `keyboard` folder, the command will automatically fill the `<keyboard>` part. So you only need to type `<subproject>-<keymap>-<target>`
226* `subproject` folder, it will fill in both `<keyboard>` and `<subproject>`
227* `keymap` folder, then `<keyboard>` and `<keymap>` will be filled in. If you need to specify the `<subproject>` use the following syntax `<subproject>-<target>`
228 * Note in order to support this shortcut, the keymap needs its own Makefile (see the example [here](/doc/keymap_makefile_example.mk))
229* `keymap` folder of a `subproject`, then everything except the `<target>` will be filled in
230
231The `<target>` means the following
232* If no target is given, then it's the same as `all` below
233* `all` compiles the keyboard and generates a `<keyboard>_<keymap>.hex` file in whichever folder you run `make` from. These files are ignored by git, so don't worry about deleting them when committing/creating pull requests.
234* `dfu`, `teensy` or `dfu-util`, compile and upload the firmware to the keyboard. If the compilation fails, then nothing will be uploaded. The programmer to use depends on the keyboard. For most keyboards it's `dfu`, but for Infinity keyboards you should use `dfu-util`, and `teensy` for standard Teensys. To find out which command you should use for your keyboard, check the keyboard specific readme. **Note** that some operating systems needs root access for these commands to work, so in that case you need to run for example `sudo make dfu`.
235* `clean`, cleans the build output folders to make sure that everything is built from scratch. Run this before normal compilation if you have some unexplainable problems.
236
237Some other targets are supported but, but not important enough to be documented here. Check the source code of the make files for more information.
238
239You can also add extra options at the end of the make command line, after the target
240
241* `make COLOR=false` - turns off color output
242* `make SILENT=true` - turns off output besides errors/warnings
243* `make VERBOSE=true` - outputs all of the gcc stuff (not interesting, unless you need to debug)
244* `make EXTRAFLAGS=-E` - Preprocess the code without doing any compiling (useful if you are trying to debug #define commands)
245
246The make command itself also has some additional options, type `make --help` for more information. The most useful is probably `-jx`, which specifies that you want to compile using more than one CPU, the `x` represents the number of CPUs that you want to use. Setting that can greatly reduce the compile times, especially if you are compiling many keyboards/keymaps. I usually set it to one less than the number of CPUs that I have, so that I have some left for doing other things while it's compiling. Note that not all operating systems and make versions supports that option.
247
248Here are some examples commands
249
250* `make allkb-allsp-allkm` builds everything (all keyboards, all subprojects, all keymaps). Running just `make` from the `root` will also run this.
251* `make` from within a `keyboard` directory, is the same as `make keyboard-allsp-allkm`, which compiles all subprojects and keymaps of the keyboard. **NOTE** that this behaviour has changed. Previously it compiled just the default keymap.
252* `make ergodox-infinity-algernon-clean` will clean the build output of the Ergodox Infinity keyboard. This example uses the full syntax and can be run from any folder with a `Makefile`
253* `make dfu COLOR=false` from within a keymap folder, builds and uploads the keymap, but without color output.
254
255## The `Makefile`
256
257There are 5 different `make` and `Makefile` locations:
258
259* root (`/`)
260* keyboard (`/keyboards/<keyboard>/`)
261* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)
262* subproject (`/keyboards/<keyboard>/<subproject>`)
263* subproject keymap (`/keyboards/<keyboard>/<subproject>/keymaps/<keymap>`)
264
265The root contains the code used to automatically figure out which keymap or keymaps to compile based on your current directory and commandline arguments. It's considered stable, and shouldn't be modified. The keyboard one will contain the MCU set-up and default settings for your keyboard, and shouldn't be modified unless you are the producer of that keyboard. The keymap Makefile can be modified by users, and is optional. It is included automatically if it exists. You can see an example [here](/doc/keymap_makefile_example.mk) - the last few lines are the most important. The settings you set here will override any defaults set in the keyboard Makefile. **The file is required if you want to run `make` in the keymap folder.**
266
267For keyboards and subprojects, the make files are split in two parts `Makefile` and `rules.mk`. All settings can be found in the `rules.mk` file, while the `Makefile` is just there for support and including the root `Makefile`. Keymaps contain just one `Makefile` for simplicity.
268
269### Makefile options
270
271Set the variables to `no` to disable them, and `yes` to enable them.
272
273`BOOTMAGIC_ENABLE`
274
275This allows you to hold a key and the salt key (space by default) and have access to a various EEPROM settings that persist over power loss. It's advised you keep this disabled, as the settings are often changed by accident, and produce confusing results that makes it difficult to debug. It's one of the more common problems encountered in help sessions.
276
277`MOUSEKEY_ENABLE`
278
279This gives you control over cursor movements and clicks via keycodes/custom functions.
280
281`EXTRAKEY_ENABLE`
282
283This allows you to use the system and audio control key codes.
284
285`CONSOLE_ENABLE`
286
287This allows you to print messages that can be read using [`hid_listen`](https://www.pjrc.com/teensy/hid_listen.html).
288
289By default, all debug (*dprint*) print (*print*, *xprintf*), and user print (*uprint*) messages will be enabled. This will eat up a significant portion of the flash and may make the keyboard .hex file too big to program.
290
291To disable debug messages (*dprint*) and reduce the .hex file size, include `#define NO_DEBUG` in your `config.h` file.
292
293To disable print messages (*print*, *xprintf*) and user print messages (*uprint*) and reduce the .hex file size, include `#define NO_PRINT` in your `config.h` file.
294
295To disable print messages (*print*, *xprintf*) and **KEEP** user print messages (*uprint*), include `#define USER_PRINT` in your `config.h` file.
296
297To see the text, open `hid_listen` and enjoy looking at your printed messages.
298
299**NOTE:** Do not include *uprint* messages in anything other than your keymap code. It must not be used within the QMK system framework. Otherwise, you will bloat other people's .hex files.
300
301`COMMAND_ENABLE`
302
303This enables magic commands, typically fired with the default magic key combo `LSHIFT+RSHIFT+KEY`. Magic commands include turning on debugging messages (`MAGIC+D`) or temporarily toggling NKRO (`MAGIC+N`).
304
305`SLEEP_LED_ENABLE`
306
307Enables your LED to breath while your computer is sleeping. Timer1 is being used here. This feature is largely unused and untested, and needs updating/abstracting.
308
309`NKRO_ENABLE`
310
311This allows the keyboard to tell the host OS that up to 248 keys are held down at once (default without NKRO is 6). NKRO is off by default, even if `NKRO_ENABLE` is set. NKRO can be forced by adding `#define FORCE_NKRO` to your config.h or by binding `MAGIC_TOGGLE_NKRO` to a key and then hitting the key.
312
313`BACKLIGHT_ENABLE`
314
315This enables your backlight on Timer1 and ports B5, B6, or B7 (for now). You can specify your port by putting this in your `config.h`:
316
317 #define BACKLIGHT_PIN B7
318
319`MIDI_ENABLE`
320
321This enables MIDI sending and receiving with your keyboard. To enter MIDI send mode, you can use the keycode `MI_ON`, and `MI_OFF` to turn it off. This is a largely untested feature, but more information can be found in the `quantum/quantum.c` file.
322
323`UNICODE_ENABLE`
324
325This allows you to send unicode symbols via `UC(<unicode>)` in your keymap. Only codes up to 0x7FFF are currently supported.
326
327`UNICODEMAP_ENABLE`
328
329This allows sending unicode symbols using `X(<unicode>)` in your keymap. Codes
330up to 0xFFFFFFFF are supported, including emojis. You will need to maintain
331a separate mapping table in your keymap file.
332
333Known limitations:
334- Under Mac OS, only codes up to 0xFFFF are supported.
335- Under Linux ibus, only codes up to 0xFFFFF are supported (but anything important is still under this limit for now).
336
337Characters out of range supported by the OS will be ignored.
338
339`BLUETOOTH_ENABLE`
340
341This allows you to interface with a Bluefruit EZ-key to send keycodes wirelessly. It uses the D2 and D3 pins.
342
343`AUDIO_ENABLE`
344
345This allows you output audio on the C6 pin (needs abstracting). See the [audio section](#driving-a-speaker---audio-support) for more information.
346
347`VARIABLE_TRACE`
348
349Use this to debug changes to variable values, see the [tracing variables](#tracing-variables) section for more information.
350
351### Customizing Makefile options on a per-keymap basis
352
353If your keymap directory has a file called `Makefile` (note the filename), any Makefile options you set in that file will take precedence over other Makefile options for your particular keyboard.
354
355So let's say your keyboard's makefile has `BACKLIGHT_ENABLE = yes` (or maybe doesn't even list the `BACKLIGHT_ENABLE` option, which would cause it to be off). You want your particular keymap to not have the debug console, so you make a file called `Makefile` and specify `BACKLIGHT_ENABLE = no`.
356
357You can use the `doc/keymap_makefile_example.md` as a template/starting point.
358
359## The `config.h` file
360
361There are 2 `config.h` locations:
362
363* keyboard (`/keyboards/<keyboard>/`)
364* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)
365
366The keyboard `config.h` is included only if the keymap one doesn't exist. The format to use for your custom one [is here](/doc/keymap_config_h_example.h). If you want to override a setting from the parent `config.h` file, you need to do this:
367
368```c
369#undef MY_SETTING
370#define MY_SETTING 4
371```
372
373For a value of `4` for this imaginary setting. So we `undef` it first, then `define` it.
374
375You can then override any settings, rather than having to copy and paste the whole thing.
376
377# Going beyond the keycodes
378
379Aside from the [basic keycodes](doc/keycode.txt), your keymap can include shortcuts to common operations.
380
381## Quick aliases to common actions
382
383Your keymap can include shortcuts to common operations (called "function actions" in tmk).
384
385These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk `ACTION_*` functions, please see the [TMK documentation](https://github.com/jackhumbert/qmk_firmware/blob/master/doc/keymap.md#2-action).
386
387Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them.
388
389### Switching and toggling layers
390
391`MO(layer)` - momentary switch to *layer*. As soon as you let go of the key, the layer is deactivated and you pop back out to the previous layer. When you apply this to a key, that same key must be set as `KC_TRNS` on the destination layer. Otherwise, you won't make it back to the original layer when you release the key (and you'll get a keycode sent). You can only switch to layers *above* your current layer. If you're on layer 0 and you use `MO(1)`, that will switch to layer 1 just fine. But if you include `MO(3)` on layer 5, that won't do anything for you -- because layer 3 is lower than layer 5 on the stack.
392
393`OSL(layer)` - momentary switch to *layer*, as a one-shot operation. So if you have a key that's defined as `OSL(1)`, and you tap that key, then only the very next keystroke would come from layer 1. You would drop back to layer zero immediately after that one keystroke. That's handy if you have a layer full of custom shortcuts -- for example, a dedicated key for closing a window. So you tap your one-shot layer mod, then tap that magic 'close window' key, and keep typing like a boss. Layer 1 would remain active as long as you hold that key down, too (so you can use it like a momentary toggle-layer key with extra powers).
394
395`LT(layer, kc)` - momentary switch to *layer* when held, and *kc* when tapped. Like `MO()`, this only works upwards in the layer stack (`layer` must be higher than the current layer).
396
397`TG(layer)` - toggles a layer on or off. As with `MO()`, you should set this key as `KC_TRNS` in the destination layer so that tapping it again actually toggles back to the original layer. Only works upwards in the layer stack.
398
399`TO(layer)` - Goes to a layer. This code is special, because it lets you go either up or down the stack -- just goes directly to the layer you want. So while other codes only let you go _up_ the stack (from layer 0 to layer 3, for example), `TO(2)` is going to get you to layer 2, no matter where you activate it from -- even if you're currently on layer 5. This gets activated on keydown (as soon as the key is pressed).
400
401
402### Fun with modifier keys
403
404* `LSFT(kc)` - applies left Shift to *kc* (keycode) - `S(kc)` is an alias
405* `RSFT(kc)` - applies right Shift to *kc*
406* `LCTL(kc)` - applies left Control to *kc*
407* `RCTL(kc)` - applies right Control to *kc*
408* `LALT(kc)` - applies left Alt to *kc*
409* `RALT(kc)` - applies right Alt to *kc*
410* `LGUI(kc)` - applies left GUI (command/win) to *kc*
411* `RGUI(kc)` - applies right GUI (command/win) to *kc*
412* `HYPR(kc)` - applies Hyper (all modifiers) to *kc*
413* `MEH(kc)` - applies Meh (all modifiers except Win/Cmd) to *kc*
414* `LCAG(kc)` - applies CtrlAltGui to *kc*
415
416You can also chain these, like this:
417
418 LALT(LCTL(KC_DEL)) -- this makes a key that sends Alt, Control, and Delete in a single keypress.
419
420The following shortcuts automatically add `LSFT()` to keycodes to get commonly used symbols. Their long names are also available and documented in `/quantum/keymap_common.h`.
421
422 KC_TILD ~
423 KC_EXLM !
424 KC_AT @
425 KC_HASH #
426 KC_DLR $
427 KC_PERC %
428 KC_CIRC ^
429 KC_AMPR &
430 KC_ASTR *
431 KC_LPRN (
432 KC_RPRN )
433 KC_UNDS _
434 KC_PLUS +
435 KC_DQUO "
436 KC_LCBR {
437 KC_RCBR }
438 KC_LABK <
439 KC_RABK >
440 KC_PIPE |
441 KC_COLN :
442
443`OSM(mod)` - this is a "one shot" modifier. So let's say you have your left Shift key defined as `OSM(MOD_LSFT)`. Tap it, let go, and Shift is "on" -- but only for the next character you'll type. So to write "The", you don't need to hold down Shift -- you tap it, tap t, and move on with life. And if you hold down the left Shift key, it just works as a left Shift key, as you would expect (so you could type THE). There's also a magical, secret way to "lock" a modifier by tapping it multiple times. If you want to learn more about that, open an issue. :)
444
445`MT(mod, kc)` - is *mod* (modifier key - MOD_LCTL, MOD_LSFT) when held, and *kc* when tapped. In other words, you can have a key that sends Esc (or the letter O or whatever) when you tap it, but works as a Control key or a Shift key when you hold it down.
446
447These are the values you can use for the `mod` in `MT()` and `OSM()` (right-hand modifiers are not available for `MT()`):
448
449 * MOD_LCTL
450 * MOD_LSFT
451 * MOD_LALT
452 * MOD_LGUI
453 * MOD_HYPR
454 * MOD_MEH
455
456These can also be combined like `MOD_LCTL | MOD_LSFT` e.g. `MT(MOD_LCTL | MOD_LSFT, KC_ESC)` which would activate Control and Shift when held, and send Escape when tapped.
457
458We've added shortcuts to make common modifier/tap (mod-tap) mappings more compact:
459
460 * `CTL_T(kc)` - is LCTL when held and *kc* when tapped
461 * `SFT_T(kc)` - is LSFT when held and *kc* when tapped
462 * `ALT_T(kc)` - is LALT when held and *kc* when tapped
463 * `GUI_T(kc)` - is LGUI when held and *kc* when tapped
464 * `ALL_T(kc)` - is Hyper (all mods) when held and *kc* when tapped. To read more about what you can do with a Hyper key, see [this blog post by Brett Terpstra](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)
465 * `LCAG_T(kc)` - is CtrlAltGui when held and *kc* when tapped
466 * `MEH_T(kc)` - is like Hyper, but not as cool -- does not include the Cmd/Win key, so just sends Alt+Ctrl+Shift.
467
468## Space Cadet Shift: The future, built in
469
470Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds.
471
472To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift.
473
474It's defaulted to work on US keyboards, but if your layout uses different keys for parenthesis, you can define those in your `config.h` like this:
475
476 #define LSPO_KEY KC_9
477 #define RSPC_KEY KC_0
478
479You can also choose between different rollover behaviors of the shift keys by defining:
480
481 #define DISABLE_SPACE_CADET_ROLLOVER
482
483in your `config.h`. Disabling rollover allows you to use the opposite shift key to cancel the space cadet state in the event of an erroneous press instead of emitting a pair of parentheses when the keys are released.
484
485The only other thing you're going to want to do is create a `Makefile` in your keymap directory and set the following:
486
487```
488COMMAND_ENABLE = no # Commands for debug and configuration
489```
490
491This is just to keep the keyboard from going into command mode when you hold both Shift keys at the same time.
492
493## The Leader key: A new kind of modifier
494
495If you've ever used Vim, you know what a Leader key is. If not, you're about to discover a wonderful concept. :) Instead of hitting Alt+Shift+W for example (holding down three keys at the same time), what if you could hit a _sequence_ of keys instead? So you'd hit our special modifier (the Leader key), followed by W and then C (just a rapid succession of keys), and something would happen.
496
497That's what `KC_LEAD` does. Here's an example:
498
4991. Pick a key on your keyboard you want to use as the Leader key. Assign it the keycode `KC_LEAD`. This key would be dedicated just for this -- it's a single action key, can't be used for anything else.
5002. Include the line `#define LEADER_TIMEOUT 300` somewhere in your keymap.c file, probably near the top. The 300 there is 300ms -- that's how long you have for the sequence of keys following the leader. You can tweak this value for comfort, of course.
5013. Within your `matrix_scan_user` function, do something like this:
502
503```
504LEADER_EXTERNS();
505
506void matrix_scan_user(void) {
507 LEADER_DICTIONARY() {
508 leading = false;
509 leader_end();
510
511 SEQ_ONE_KEY(KC_F) {
512 register_code(KC_S);
513 unregister_code(KC_S);
514 }
515 SEQ_TWO_KEYS(KC_A, KC_S) {
516 register_code(KC_H);
517 unregister_code(KC_H);
518 }
519 SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
520 register_code(KC_LGUI);
521 register_code(KC_S);
522 unregister_code(KC_S);
523 unregister_code(KC_LGUI);
524 }
525 }
526}
527```
528
529As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_KEYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.
530
531## Tap Dance: A single key can do 3, 5, or 100 different things
532
533Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. It's one of the nicest community-contributed features in the firmware, conceived and created by [algernon](https://github.com/algernon) in [#451](https://github.com/jackhumbert/qmk_firmware/pull/451). Here's how algernon describes the feature:
534
535With this feature one can specify keys that behave differently, based on the amount of times they have been tapped, and when interrupted, they get handled before the interrupter.
536
537To make it clear how this is different from `ACTION_FUNCTION_TAP`, lets explore a certain setup! We want one key to send `Space` on single tap, but `Enter` on double-tap.
538
539With `ACTION_FUNCTION_TAP`, it is quite a rain-dance to set this up, and has the problem that when the sequence is interrupted, the interrupting key will be send first. Thus, `SPC a` will result in `a SPC` being sent, if they are typed within `TAPPING_TERM`. With the tap dance feature, that'll come out as `SPC a`, correctly.
540
541The implementation hooks into two parts of the system, to achieve this: into `process_record_quantum()`, and the matrix scan. We need the latter to be able to time out a tap sequence even when a key is not being pressed, so `SPC` alone will time out and register after `TAPPING_TERM` time.
542
543But lets start with how to use it, first!
544
545First, you will need `TAP_DANCE_ENABLE=yes` in your `Makefile`, because the feature is disabled by default. This adds a little less than 1k to the firmware size. Next, you will want to define some tap-dance keys, which is easiest to do with the `TD()` macro, that - similar to `F()`, takes a number, which will later be used as an index into the `tap_dance_actions` array.
546
547This array specifies what actions shall be taken when a tap-dance key is in action. Currently, there are three possible options:
548
549* `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held.
550* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action.
551* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function on when the dance action finishes (like the previous option), and the last function when the tap dance action resets.
552
553The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise.
554
555And that's the bulk of it!
556
557And now, on to the explanation of how it works!
558
559The main entry point is `process_tap_dance()`, called from `process_record_quantum()`, which is run for every keypress, and our handler gets to run early. This function checks whether the key pressed is a tap-dance key. If it is not, and a tap-dance was in action, we handle that first, and enqueue the newly pressed key. If it is a tap-dance key, then we check if it is the same as the already active one (if there's one active, that is). If it is not, we fire off the old one first, then register the new one. If it was the same, we increment the counter and the timer.
560
561This means that you have `TAPPING_TERM` time to tap the key again, you do not have to input all the taps within that timeframe. This allows for longer tap counts, with minimal impact on responsiveness.
562
563Our next stop is `matrix_scan_tap_dance()`. This handles the timeout of tap-dance keys.
564
565For the sake of flexibility, tap-dance actions can be either a pair of keycodes, or a user function. The latter allows one to handle higher tap counts, or do extra things, like blink the LEDs, fiddle with the backlighting, and so on. This is accomplished by using an union, and some clever macros.
566
567### Examples
568
569Here's a simple example for a single definition:
570
5711. In your `makefile`, add `TAP_DANCE_ENABLE = yes`
5722. In your `config.h` (which you can copy from `qmk_firmware/keyboards/planck/config.h` to your keymap directory), add `#define TAPPING_TERM 200`
5733. In your `keymap.c` file, define the variables and definitions, then add to your keymap:
574
575```c
576//Tap Dance Declarations
577enum {
578 TD_ESC_CAPS = 0
579};
580
581//Tap Dance Definitions
582qk_tap_dance_action_t tap_dance_actions[] = {
583 //Tap once for Esc, twice for Caps Lock
584 [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS)
585// Other declarations would go here, separated by commas, if you have them
586};
587
588//In Layer declaration, add tap dance item in place of a key code
589TD(TD_ESC_CAPS)
590```
591
592Here's a more complex example involving custom actions:
593
594```c
595enum {
596 CT_SE = 0,
597 CT_CLN,
598 CT_EGG,
599 CT_FLSH,
600};
601
602/* Have the above three on the keymap, TD(CT_SE), etc... */
603
604void dance_cln_finished (qk_tap_dance_state_t *state, void *user_data) {
605 if (state->count == 1) {
606 register_code (KC_RSFT);
607 register_code (KC_SCLN);
608 } else {
609 register_code (KC_SCLN);
610 }
611}
612
613void dance_cln_reset (qk_tap_dance_state_t *state, void *user_data) {
614 if (state->count == 1) {
615 unregister_code (KC_RSFT);
616 unregister_code (KC_SCLN);
617 } else {
618 unregister_code (KC_SCLN);
619 }
620}
621
622void dance_egg (qk_tap_dance_state_t *state, void *user_data) {
623 if (state->count >= 100) {
624 SEND_STRING ("Safety dance!");
625 reset_tap_dance (state);
626 }
627}
628
629// on each tap, light up one led, from right to left
630// on the forth tap, turn them off from right to left
631void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
632 switch (state->count) {
633 case 1:
634 ergodox_right_led_3_on();
635 break;
636 case 2:
637 ergodox_right_led_2_on();
638 break;
639 case 3:
640 ergodox_right_led_1_on();
641 break;
642 case 4:
643 ergodox_right_led_3_off();
644 _delay_ms(50);
645 ergodox_right_led_2_off();
646 _delay_ms(50);
647 ergodox_right_led_1_off();
648 }
649}
650
651// on the fourth tap, set the keyboard on flash state
652void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) {
653 if (state->count >= 4) {
654 reset_keyboard();
655 reset_tap_dance(state);
656 }
657}
658
659// if the flash state didnt happen, then turn off leds, left to right
660void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) {
661 ergodox_right_led_1_off();
662 _delay_ms(50);
663 ergodox_right_led_2_off();
664 _delay_ms(50);
665 ergodox_right_led_3_off();
666}
667
668qk_tap_dance_action_t tap_dance_actions[] = {
669 [CT_SE] = ACTION_TAP_DANCE_DOUBLE (KC_SPC, KC_ENT)
670 ,[CT_CLN] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, dance_cln_finished, dance_cln_reset)
671 ,[CT_EGG] = ACTION_TAP_DANCE_FN (dance_egg)
672 ,[CT_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED (dance_flsh_each, dance_flsh_finished, dance_flsh_reset)
673};
674```
675
676## Temporarily setting the default layer
677
678`DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
679
680## Prevent stuck modifiers
681
682Consider the following scenario:
683
6841. Layer 0 has a key defined as Shift.
6852. The same key is defined on layer 1 as the letter A.
6863. User presses Shift.
6874. User switches to layer 1 for whatever reason.
6885. User releases Shift, or rather the letter A.
6896. User switches back to layer 0.
690
691Shift was actually never released and is still considered pressed.
692
693If such situation bothers you add this to your `config.h`:
694
695 #define PREVENT_STUCK_MODIFIERS
696
697This option uses 5 bytes of memory per every 8 keys on the keyboard
698rounded up (5 bits per key). For example on Planck (48 keys) it uses
699(48/8)\*5 = 30 bytes.
700
701## Macro shortcuts: Send a whole string when pressing just one key
702
703Instead of using the `ACTION_MACRO` function, you can simply use `M(n)` to access macro *n* - *n* will get passed into the `action_get_macro` as the `id`, and you can use a switch statement to trigger it. This gets called on the keydown and keyup, so you'll need to use an if statement testing `record->event.pressed` (see keymap_default.c).
704
705```c
706const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is.
707{
708 switch(id) {
709 case 0: // this would trigger when you hit a key mapped as M(0)
710 if (record->event.pressed) {
711 return MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ); // this sends the string 'hello' when the macro executes
712 }
713 break;
714 }
715 return MACRO_NONE;
716};
717```
718A macro can include the following commands:
719
720* I() change interval of stroke in milliseconds.
721* D() press key.
722* U() release key.
723* T() type key(press and release).
724* W() wait (milliseconds).
725* END end mark.
726
727So above you can see the stroke interval changed to 255ms between each keystroke, then a bunch of keys being typed, waits a while, then the macro ends.
728
729Note: Using macros to have your keyboard send passwords for you is possible, but a bad idea.
730
731### Advanced macro functions
732
733To get more control over the keys/actions your keyboard takes, the following functions are available to you in the `action_get_macro` function block:
734
735* `record->event.pressed`
736
737This is a boolean value that can be tested to see if the switch is being pressed or released. An example of this is
738
739```c
740if (record->event.pressed) {
741 // on keydown
742} else {
743 // on keyup
744}
745```
746
747* `register_code(<kc>);`
748
749This sends the `<kc>` keydown event to the computer. Some examples would be `KC_ESC`, `KC_C`, `KC_4`, and even modifiers such as `KC_LSFT` and `KC_LGUI`.
750
751* `unregister_code(<kc>);`
752
753Parallel to `register_code` function, this sends the `<kc>` keyup event to the computer. If you don't use this, the key will be held down until it's sent.
754
755* `layer_on(<n>);`
756
757This will turn on the layer `<n>` - the higher layer number will always take priority. Make sure you have `KC_TRNS` for the key you're pressing on the layer you're switching to, or you'll get stick there unless you have another plan.
758
759* `layer_off(<n>);`
760
761This will turn off the layer `<n>`.
762
763* `clear_keyboard();`
764
765This will clear all mods and keys currently pressed.
766
767* `clear_mods();`
768
769This will clear all mods currently pressed.
770
771* `clear_keyboard_but_mods();`
772
773This will clear all keys besides the mods currently pressed.
774
775* `update_tri_layer(layer_1, layer_2, layer_3);`
776
777If the user attempts to activate layer 1 AND layer 2 at the same time (for example, by hitting their respective layer keys), layer 3 will be activated. Layers 1 and 2 will _also_ be activated, for the purposes of fallbacks (so a given key will fall back from 3 to 2, to 1 -- and only then to 0).
778
779#### Naming your macros
780
781If you have a bunch of macros you want to refer to from your keymap, while keeping the keymap easily readable, you can just name them like so:
782
783```
784#define AUD_OFF M(6)
785#define AUD_ON M(7)
786#define MUS_OFF M(8)
787#define MUS_ON M(9)
788#define VC_IN M(10)
789#define VC_DE M(11)
790#define PLOVER M(12)
791#define EXT_PLV M(13)
792```
793
794As was done on the [Planck default keymap](/keyboards/planck/keymaps/default/keymap.c#L33-L40)
795
796#### Timer functionality
797
798It's possible to start timers and read values for time-specific events - here's an example:
799
800```c
801static uint16_t key_timer;
802key_timer = timer_read();
803if (timer_elapsed(key_timer) < 100) {
804 // do something if less than 100ms have passed
805} else {
806 // do something if 100ms or more have passed
807}
808```
809
810It's best to declare the `static uint16_t key_timer;` outside of the macro block (top of file, etc).
811
812#### Example: Single-key copy/paste (hold to copy, tap to paste)
813
814With QMK, it's easy to make one key do two things, as long as one of those things is being a modifier. :) So if you want a key to act as Ctrl when held and send the letter R when tapped, that's easy: `CTL_T(KC_R)`. But what do you do when you want that key to send Ctrl-V (paste) when tapped, and Ctrl-C (copy) when held?
815
816Here's what you do:
817
818
819```
820static uint16_t key_timer;
821
822const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
823{
824 switch(id) {
825 case 0: {
826 if (record->event.pressed) {
827 key_timer = timer_read(); // if the key is being pressed, we start the timer.
828 }
829 else { // this means the key was just released, so we can figure out how long it was pressed for (tap or "held down").
830 if (timer_elapsed(key_timer) > 150) { // 150 being 150ms, the threshhold we pick for counting something as a tap.
831 return MACRO( D(LCTL), T(C), U(LCTL), END );
832 }
833 else {
834 return MACRO( D(LCTL), T(V), U(LCTL), END );
835 }
836 }
837 break;
838 }
839 }
840 return MACRO_NONE;
841};
842```
843
844And then, to assign this macro to a key on your keyboard layout, you just use `M(0)` on the key you want to press for copy/paste.
845
846## Dynamic macros: record and replay macros in runtime
847
848In addition to the static macros described above, you may enable the dynamic macros which you may record while writing. They are forgotten as soon as the keyboard is unplugged. Only two such macros may be stored at the same time, with the total length of 64 keypresses (by default).
849
850To enable them, first add a new element to the `planck_keycodes` enum -- `DYNAMIC_MACRO_RANGE`:
851
852 enum planck_keycodes {
853 QWERTY = SAFE_RANGE,
854 COLEMAK,
855 DVORAK,
856 PLOVER,
857 LOWER,
858 RAISE,
859 BACKLIT,
860 EXT_PLV,
861 DYNAMIC_MACRO_RANGE,
862 };
863
864Afterwards create a new layer called `_DYN`:
865
866 #define _DYN 6 /* almost any other free number should be ok */
867
868Below these two modifications include the `dynamic_macro.h` header:
869
870 #include "dynamic_macro.h"`
871
872Then define the `_DYN` layer with the following keys: `DYN_REC_START1`, `DYN_MACRO_PLAY1`,`DYN_REC_START2` and `DYN_MACRO_PLAY2`. It may also contain other keys, it doesn't matter apart from the fact that you won't be able to record these keys in the dynamic macros.
873
874 [_DYN]= {
875 {_______, DYN_REC_START1, DYN_MACRO_PLAY1, _______, _______, _______, _______, _______, _______, _______, _______, _______},
876 {_______, DYN_REC_START2, DYN_MACRO_PLAY2, _______, _______, _______, _______, _______, _______, _______, _______, _______},
877 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
878 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
879 },
880
881Add the following code to the very beginning of your `process_record_user()` function:
882
883 if (!process_record_dynamic_macro(keycode, record)) {
884 return false;
885 }
886
887To start recording the macro, press either `DYN_REC_START1` or `DYN_REC_START2`. To finish the recording, press the `_DYN` layer button. The handler awaits specifically for the `MO(_DYN)` keycode as the "stop signal" so please don't use any fancy ways to access this layer, use the regular `MO()` modifier. To replay the macro, press either `DYN_MACRO_PLAY1` or `DYN_MACRO_PLAY2`.
888
889If the LED-s start blinking during the recording with each keypress, it means there is no more space for the macro in the macro buffer. To fit the macro in, either make the other macro shorter (they share the same buffer) or increase the buffer size by setting the `DYNAMIC_MACRO_SIZE` preprocessor macro (default value: 128; please read the comments for it in the header).
890
891For the details about the internals of the dynamic macros, please read the comments in the `dynamic_macro.h` header.
892
893## Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc)
894
895Everything is assuming you're in Qwerty (in software) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap:
896
897 #include <keymap_colemak.h>
898
899If you use Dvorak, use `keymap_dvorak.h` instead of `keymap_colemak.h` for this line. After including this line, you will get access to:
900
901 * `CM_*` for all of the Colemak-equivalent characters
902 * `DV_*` for all of the Dvorak-equivalent characters
903
904These implementations assume you're using Colemak or Dvorak on your OS, not on your keyboard - this is referred to as a software-implemented layout. If your computer is in Qwerty and your keymap is in Colemak or Dvorak, this is referred to as a firmware-implemented layout, and you won't need these features.
905
906To give an example, if you're using software-implemented Colemak, and want to get an `F`, you would use `CM_F` - `KC_F` under these same circumstances would result in `T`.
907
908## Additional language support
909
910In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware (but it's being worked on - see Unicode support).
911
912## Unicode support
913
914You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout, see [this article](http://www.poynton.com/notes/misc/mac-unicode-hex-input.html) to learn more) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile.
915
916## Backlight Breathing
917
918In order to enable backlight breathing, the following line must be added to your config.h file.
919
920 #define BACKLIGHT_BREATHING
921
922The following function calls are used to control the breathing effect.
923
924* ```breathing_enable()``` - Enable the free-running breathing effect.
925* ```breathing_disable()``` - Disable the free-running breathing effect immediately.
926* ```breathing_self_disable()``` - Disable the free-running breathing effect after the current effect ends.
927* ```breathing_toggle()``` - Toggle the free-running breathing effect.
928* ```breathing_defaults()``` - Reset the speed and brightness settings of the breathing effect.
929
930The following function calls are used to control the maximum brightness of the breathing effect.
931
932* ```breathing_intensity_set(value)``` - Set the brightness of the breathing effect when it is at its max value.
933* ```breathing_intensity_default()``` - Reset the brightness of the breathing effect to the default value based on the current backlight intensity.
934
935The following function calls are used to control the cycling speed of the breathing effect.
936
937* ```breathing_speed_set(value)``` - Set the speed of the breathing effect - how fast it cycles.
938* ```breathing_speed_inc(value)``` - Increase the speed of the breathing effect by a fixed value.
939* ```breathing_speed_dec(value)``` - Decrease the speed of the breathing effect by a fixed value.
940* ```breathing_speed_default()``` - Reset the speed of the breathing effect to the default value.
941
942The following example shows how to enable the backlight breathing effect when the FUNCTION layer macro button is pressed:
943
944 case MACRO_FUNCTION:
945 if (record->event.pressed)
946 {
947 breathing_speed_set(3);
948 breathing_enable();
949 layer_on(LAYER_FUNCTION);
950 }
951 else
952 {
953 breathing_speed_set(1);
954 breathing_self_disable();
955 layer_off(LAYER_FUNCTION);
956 }
957 break;
958
959The following example shows how to pulse the backlight on-off-on when the RAISED layer macro button is pressed:
960
961 case MACRO_RAISED:
962 if (record->event.pressed)
963 {
964 layer_on(LAYER_RAISED);
965 breathing_speed_set(2);
966 breathing_pulse();
967 update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
968 }
969 else
970 {
971 layer_off(LAYER_RAISED);
972 update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
973 }
974 break;
975
976## Other firmware shortcut keycodes
977
978* `RESET` - puts the MCU in DFU mode for flashing new firmware (with `make dfu`)
979* `DEBUG` - the firmware into debug mode - you'll need hid_listen to see things
980* `BL_ON` - turns the backlight on
981* `BL_OFF` - turns the backlight off
982* `BL_<n>` - sets the backlight to level *n*
983* `BL_INC` - increments the backlight level by one
984* `BL_DEC` - decrements the backlight level by one
985* `BL_TOGG` - toggles the backlight
986* `BL_STEP` - steps through the backlight levels
987
988Enable the backlight from the Makefile.
989
990# Custom Quantum functions
991
992All of these functions are available in the `*_kb()` or `*_user()` variety. `kb` ones should only be used in the `<keyboard>/<keyboard>.c` file, and `user` ones should only be used in the `keymap.c`. The keyboard ones call the user ones - it's necessary to keep these calls to allow the keymap functions to work correctly.
993
994## `void matrix_init_*(void)`
995
996This function gets called when the matrix is initiated, and can contain start-up code for your keyboard/keymap.
997
998## `void matrix_scan_*(void)`
999
1000This function gets called at every matrix scan, which is basically as often as the MCU can handle. Be careful what you put here, as it will get run a lot.
1001
1002## `bool process_record_*(uint16_t keycode, keyrecord_t *record)`
1003
1004This function gets called on every keypress/release, and is where you can define custom functionality. The return value is whether or not QMK should continue processing the keycode - returning `false` stops the execution.
1005
1006The `keycode` variable is whatever is defined in your keymap, eg `MO(1)`, `KC_L`, etc. and can be switch-cased to execute code whenever a particular code is pressed.
1007
1008The `record` variable contains infomation about the actual press:
1009
1010```
1011keyrecord_t record {
1012 keyevent_t event {
1013 keypos_t key {
1014 uint8_t col
1015 uint8_t row
1016 }
1017 bool pressed
1018 uint16_t time
1019 }
1020}
1021```
1022
1023The conditional `if (record->event.pressed)` can tell if the key is being pressed or released, and you can execute code based on that.
1024
1025## `void led_set_*(uint8_t usb_led)`
1026
1027This gets called whenever there is a state change on your host LEDs (eg caps lock, scroll lock, etc). The LEDs are defined as:
1028
1029```
1030#define USB_LED_NUM_LOCK 0
1031#define USB_LED_CAPS_LOCK 1
1032#define USB_LED_SCROLL_LOCK 2
1033#define USB_LED_COMPOSE 3
1034#define USB_LED_KANA 4
1035```
1036
1037and can be tested against the `usb_led` with a conditional like `if (usb_led & (1<<USB_LED_CAPS_LOCK))` - if this is true, you can turn your LED one, otherwise turn it off.
1038
1039# Modding your keyboard
1040
1041## Audio output from a speaker
1042
1043Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any keyboard that allows access to the C6 port, you can hook up a simple speaker and make it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes.
1044
1045The audio code lives in [quantum/audio/audio.h](/quantum/audio/audio.h) and in the other files in the audio directory. It's enabled by default on the Planck [stock keymap](/keyboards/planck/keymaps/default/keymap.c). Here are the important bits:
1046
1047```
1048#include "audio.h"
1049```
1050
1051Then, lower down the file:
1052
1053```
1054float tone_startup[][2] = {
1055 ED_NOTE(_E7 ),
1056 E__NOTE(_CS7),
1057 E__NOTE(_E6 ),
1058 E__NOTE(_A6 ),
1059 M__NOTE(_CS7, 20)
1060};
1061```
1062
1063This is how you write a song. Each of these lines is a note, so we have a little ditty composed of five notes here.
1064
1065Then, we have this chunk:
1066
1067```
1068float tone_qwerty[][2] = SONG(QWERTY_SOUND);
1069float tone_dvorak[][2] = SONG(DVORAK_SOUND);
1070float tone_colemak[][2] = SONG(COLEMAK_SOUND);
1071float tone_plover[][2] = SONG(PLOVER_SOUND);
1072float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
1073
1074float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
1075float goodbye[][2] = SONG(GOODBYE_SOUND);
1076```
1077
1078Wherein we bind predefined songs (from [quantum/audio/song_list.h](/quantum/audio/song_list.h)) into named variables. This is one optimization that helps save on memory: These songs only take up memory when you reference them in your keymap, because they're essentially all preprocessor directives.
1079
1080So now you have something called `tone_plover` for example. How do you make it play the Plover tune, then? If you look further down the keymap, you'll see this:
1081
1082```
1083PLAY_NOTE_ARRAY(tone_plover, false, 0); // Signature is: Song name, repeat, rest style
1084```
1085
1086This is inside one of the macros. So when that macro executes, your keyboard plays that particular chime.
1087
1088"Rest style" in the method signature above (the last parameter) specifies if there's a rest (a moment of silence) between the notes.
1089
1090
1091## Recording And Playing back Music
1092* ```Music On``` - Turn music mode on. The default mapping is ```Lower+Upper+C```
1093* ```LCTL``` - start a recording
1094* play some tones
1095* ```LALT``` - stop recording, stop playing
1096* ```LGUI``` - play recording
1097* ```LALT``` - stop playing
1098* ```Music Off``` - Turn music mode off. The default mapping is ```Lower+Upper+V```
1099
1100
1101## MIDI functionalty
1102
1103This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile.
1104
1105## Bluetooth functionality
1106
1107This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will.
1108
1109## International Characters on Windows
1110
1111[AutoHotkey](https://autohotkey.com) allows Windows users to create custom hotkeys among others.
1112
1113The method does not require Unicode support in the keyboard itself but depends instead of AutoHotkey running in the background.
1114
1115First you need to select a modifier combination that is not in use by any of your programs.
1116CtrlAltWin is not used very widely and should therefore be perfect for this.
1117There is a macro defined for a mod-tab combo `LCAG_T`.
1118Add this mod-tab combo to a key on your keyboard, e.g.: `LCAG_T(KC_TAB)`.
1119This makes the key behave like a tab key if pressed and released immediately but changes it to the modifier if used with another key.
1120
1121In the default script of AutoHotkey you can define custom hotkeys.
1122
1123 <^<!<#a::Send, ä
1124 <^<!<#<+a::Send, Ä
1125
1126The hotkeys above are for the combination CtrlAltGui and CtrlAltGuiShift plus the letter a.
1127AutoHotkey inserts the Text right of `Send, ` when this combination is pressed.
1128
1129## RGB Under Glow Mod
1130
1131![Planck with RGB Underglow](https://raw.githubusercontent.com/jackhumbert/qmk_firmware/master/keyboards/planck/keymaps/yang/planck-with-rgb-underglow.jpg)
1132
1133Here is a quick demo on Youtube (with NPKC KC60) (https://www.youtube.com/watch?v=VKrpPAHlisY).
1134
1135For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring the VCC, GND, and DI, you can enable the underglow in your Makefile.
1136
1137 RGBLIGHT_ENABLE = yes
1138
1139In order to use the underglow timer functions, you need to have `#define RGBLIGHT_TIMER` in your `config.h`, and have audio disabled (`AUDIO_ENABLE = no` in your Makefile).
1140
1141Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default:
1142
1143 #define RGB_DI_PIN F4 // The pin your RGB strip is wired to
1144 #define RGBLIGHT_TIMER // Require for fancier stuff (not compatible with audio)
1145 #define RGBLED_NUM 14 // Number of LEDs
1146 #define RGBLIGHT_HUE_STEP 10
1147 #define RGBLIGHT_SAT_STEP 17
1148 #define RGBLIGHT_VAL_STEP 17
1149
1150You'll need to edit `RGB_DI_PIN` to the pin you have your `DI` on your RGB strip wired to.
1151
1152The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects. To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations. For details, please check this keymap. `keyboards/planck/keymaps/yang/keymap.c`
1153
1154### WS2812 Wiring
1155
1156![WS2812 Wiring](https://raw.githubusercontent.com/jackhumbert/qmk_firmware/master/keyboards/planck/keymaps/yang/WS2812-wiring.jpg)
1157
1158Please note the USB port can only supply a limited amount of power to the keyboard (500mA by standard, however, modern computer and most usb hubs can provide 700+mA.). According to the data of NeoPixel from Adafruit, 30 WS2812 LEDs require a 5V 1A power supply, LEDs used in this mod should not more than 20.
1159
1160## Safety Considerations
1161
1162You probably don't want to "brick" your keyboard, making it impossible
1163to rewrite firmware onto it. Here are some of the parameters to show
1164what things are (and likely aren't) too risky.
1165
1166- If a keyboard map does not include RESET, then, to get into DFU
1167 mode, you will need to press the reset button on the PCB, which
1168 requires unscrewing some bits.
1169- Messing with tmk_core / common files might make the keyboard
1170 inoperable
1171- Too large a .hex file is trouble; `make dfu` will erase the block,
1172 test the size (oops, wrong order!), which errors out, failing to
1173 flash the keyboard
1174- DFU tools do /not/ allow you to write into the bootloader (unless
1175 you throw in extra fruitsalad of options), so there is little risk
1176 there.
1177- EEPROM has around a 100000 write cycle. You shouldn't rewrite the
1178 firmware repeatedly and continually; that'll burn the EEPROM
1179 eventually.
1180
1181# Porting your keyboard to QMK
1182
1183If your keyboard is running an Atmega chip (atmega32u4 and others), it's pretty easy to get things setup for compiling your own firmware to flash onto your board. There is a `/util/new_project.sh <keyboard>` script to help get you started - you can simply pass your keyboard's name into the script, and all of the necessary files will be created. The components of each are described below.
1184
1185## `/keyboards/<keyboard>/config.h`
1186
1187The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine.
1188
1189Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward.
1190
1191The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each row/column. Your schematic (if you have one) will have this information on it, and the values will vary depending on your setup. This is one of the most important things to double-check in getting your keyboard setup correctly.
1192
1193For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect.
1194
1195`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported.
1196
1197`BACKLIGHT_BREATHING` is a fancier backlight feature that adds breathing/pulsing/fading effects to the backlight. It uses the same timer as the normal backlight. These breathing effects must be called by code in your keymap.
1198
1199`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number.
1200
1201## `/keyboards/<keyboard>/Makefile`
1202
1203The values at the top likely won't need to be changed, since most boards use the `atmega32u4` chip. The `BOOTLOADER_SIZE` will need to be adjusted based on your MCU type. It's defaulted to the Teensy, since that's the most common controller. Below is quoted from the `Makefile`.
1204
1205```
1206# Boot Section Size in *bytes*
1207# Teensy halfKay 512
1208# Teensy++ halfKay 1024
1209# Atmel DFU loader 4096
1210# LUFA bootloader 4096
1211# USBaspLoader 2048
1212OPT_DEFS += -DBOOTLOADER_SIZE=512
1213```
1214
1215At the bottom of the file, you'll find lots of features to turn on and off - all of these options should be set with `?=` to allow for the keymap overrides. `?=` only assigns if the variable was previously undefined. For the full documenation of these features, see the [Makefile options](#makefile-options).
1216
1217## `/keyboards/<keyboard>/readme.md`
1218
1219This is where you'll describe your keyboard - please write as much as you can about it! Talking about default functionality/features is useful here. Feel free to link to external pages/sites if necessary. Images can be included here as well. This file will be rendered into a webpage at qmk.fm/keyboards/<keyboard>/.
1220
1221## `/keyboards/<keyboard>/<keyboard>.c`
1222
1223This is where all of the custom logic for your keyboard goes - you may not need to put anything in this file, since a lot of things are configured automatically. All of the `*_kb()` functions are defined here. If you modify them, remember to keep the calls to `*_user()`, or things in the keymaps might not work. You can read more about the functions [here](#custom-quantum-functions-for-keyboards-and-keymaps)
1224
1225## `/keyboards/<keyboard>/<keyboard>.h`
1226
1227Here is where you can (optionally) define your `KEYMAP` function to remap your matrix into a more readable format. With ortholinear boards, this isn't always necessary, but it can help to accomodate the dead spots on your matrix, where there are keys that take up more than one space (2u, staggering, 6.25u, etc). The example shows the difference between the physical keys, and the matrix design:
1228
1229```
1230#define KEYMAP( \
1231 k00, k01, k02, \
1232 k10, k11 \
1233) \
1234{ \
1235 { k00, k01, k02 }, \
1236 { k10, KC_NO, k11 }, \
1237}
1238```
1239
1240Each of the `kxx` variables needs to be unique, and usually follows the format `k<row><col>`. You can place `KC_NO` where your dead keys are in your matrix.
1241
1242# Unit Testing
1243
1244If you are new to unit testing, then you can find many good resources on internet. However most of it is scattered around in small pieces here and there, and there's also many different opinions, so I won't give any recommendations.
1245
1246Instead I recommend these two books, explaining two different styles of Unit Testing in detail.
1247
1248* "Test Driven Development: By Example: Kent Beck"
1249* "Growing Object-Oriented Software, Guided By Tests: Steve Freeman, Nat Pryce"
1250
1251If you prefer videos there are Uncle Bob's [Clean Coders Videos](https://cleancoders.com/), which unfortunately cost quite a bit, especially if you want to watch many of them. But James Shore has a free [Let's Play](http://www.jamesshore.com/Blog/Lets-Play) video series.
1252
1253## Google Test and Google Mock
1254It's possible to Unit Test your code using [Google Test](https://github.com/google/googletest). The Google Test framework also includes another component for writing testing mocks and stubs, called "Google Mock". For information how to write the actual tests, please refer to the documentation on that site.
1255
1256## Use of C++
1257
1258Note that Google Test and therefore any test has to be written in C++, even if the rest of the QMK codebases is written in C. This should hopefully not be a problem even if you don't know any C++, since there's quite clear documentation and examples of the required C++ features, and you can write the rest of the test code almost as you would write normal C. Note that some compiler errors which you might get can look quite scary, but just read carefully what it says, and you should be ok.
1259
1260One thing to remember, is that you have to append `extern "C"` around all of your C file includes.
1261
1262## Adding tests for new or existing features
1263
1264If you want to unit test some feature, then take a look at the existing serial_link tests, in the `quantum/serial_link/tests folder`, and follow the steps below to create a similar structure.
1265
12661. If it doesn't already exist, add a test subfolder to the folder containing the feature.
12672. Create a `testlist.mk` and a `rules.mk` file in that folder.
12683. Include those files from the root folder `testlist.mk`and `build_test.mk` respectively.
12694. Add a new name for your testgroup to the `testlist.mk` file. Each group defined there will be a separate executable. And that's how you can support mocking out different parts. Note that it's worth adding some common prefix, just like it's done for the serial_link tests. The reason for that is that the make command allows substring filtering, so this way you can easily run a subset of the tests.
12705. Define the source files and required options in the `rules.mk` file.
1271 * `_SRC` for source files
1272 * `_DEFS` for additional defines
1273 * `_INC` for additional include folders
12746. Write the tests in a new cpp file inside the test folder you created. That file has to be one of the files included from the `rules.mk` file.
1275
1276Note how there's several different tests, each mocking out a separate part. Also note that each of them only compiles the very minimum that's needed for the tests. It's recommend that you try to do the same. For a relevant video check out [Matt Hargett "Advanced Unit Testing in C & C++](https://www.youtube.com/watch?v=Wmy6g-aVgZI)
1277
1278## Running the tests
1279
1280To run all the tests in the codebase, type `make test`. You can also run test matching a substring by typing `make test-matchingsubstring` Note that the tests are always compiled with the native compiler of your platform, so they are also run like any other program on your computer.
1281
1282## Debugging the tests
1283
1284If there are problems with the tests, you can find the executable in the `./build/test` folder. You should be able to run those with GDB or a similar debugger.
1285
1286## Full Integration tests
1287
1288It's not yet possible to do a full integration test, where you would compile the whole firmware and define a keymap that you are going to test. However there are plans for doing that, because writing tests that way would probably be easier, at least for people that are not used to unit testing.
1289
1290In that model you would emulate the input, and expect a certain output from the emulated keyboard.
1291
1292# Tracing variables
1293
1294Sometimes you might wonder why a variable gets changed and where, and this can be quite tricky to track down without having a debugger. It's of course possible to manually add print statements to track it, but you can also enable the variable trace feature. This works for both for variables that are changed by the code, and when the variable is changed by some memory corruption.
1295
1296To take the feature into use add `VARIABLE_TRACE=x` to the end of you make command. `x` represents the number of variables you want to trace, which is usually 1.
1297
1298Then at a suitable place in the code, call `ADD_TRACED_VARIABLE`, to begin the tracing. For example to trace all the layer changes, you can do this
1299```c
1300void matrix_init_user(void) {
1301 ADD_TRACED_VARIABLE("layer", &layer_state, sizeof(layer_state));
1302}
1303```
1304
1305This will add a traced variable named "layer" (the name is just for your information), which tracks the memory location of `layer_state`. It tracks 4 bytes (the size of `layer_state`), so any modification to the variable will be reported. By default you can not specify a size bigger than 4, but you can change it by adding `MAX_VARIABLE_TRACE_SIZE=x` to the end of the make command line.
1306
1307In order to actually detect changes to the variables you should call `VERIFY_TRACED_VARIABLES` around the code that you think that modifies the variable. If a variable is modified it will tell you between which two `VERIFY_TRACED_VARIABLES` calls the modification happened. You can then add more calls to track it down further. I don't recommend spamming the codebase with calls. It's better to start with a few, and then keep adding them in a binary search fashion. You can also delete the ones you don't need, as each call need to store the file name and line number in the ROM, so you can run out of memory if you add too many calls.
1308
1309Also remember to delete all the tracing code ones you have found the bug, as you wouldn't want to create a pull request with tracing code. \ No newline at end of file
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index f826a7b54..3c1373c08 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -50,6 +50,10 @@ ifeq ($(strip $(EXTRAKEY_ENABLE)), yes)
50 TMK_COMMON_DEFS += -DEXTRAKEY_ENABLE 50 TMK_COMMON_DEFS += -DEXTRAKEY_ENABLE
51endif 51endif
52 52
53ifeq ($(strip $(RAW_ENABLE)), yes)
54 TMK_COMMON_DEFS += -DRAW_ENABLE
55endif
56
53ifeq ($(strip $(CONSOLE_ENABLE)), yes) 57ifeq ($(strip $(CONSOLE_ENABLE)), yes)
54 TMK_COMMON_DEFS += -DCONSOLE_ENABLE 58 TMK_COMMON_DEFS += -DCONSOLE_ENABLE
55else 59else
@@ -81,6 +85,10 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
81 TMK_COMMON_DEFS += -DBACKLIGHT_ENABLE 85 TMK_COMMON_DEFS += -DBACKLIGHT_ENABLE
82endif 86endif
83 87
88ifeq ($(strip $(ADAFRUIT_BLE_ENABLE)), yes)
89 TMK_COMMON_DEFS += -DADAFRUIT_BLE_ENABLE
90endif
91
84ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) 92ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
85 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE 93 TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
86endif 94endif
@@ -110,4 +118,4 @@ endif
110VPATH += $(TMK_PATH)/$(COMMON_DIR) 118VPATH += $(TMK_PATH)/$(COMMON_DIR)
111ifeq ($(PLATFORM),CHIBIOS) 119ifeq ($(PLATFORM),CHIBIOS)
112VPATH += $(TMK_PATH)/$(COMMON_DIR)/chibios 120VPATH += $(TMK_PATH)/$(COMMON_DIR)/chibios
113endif \ No newline at end of file 121endif
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 8a7272bbc..0c81e8361 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -47,6 +47,7 @@ void suspend_idle(uint8_t time)
47 sleep_disable(); 47 sleep_disable();
48} 48}
49 49
50#ifndef NO_SUSPEND_POWER_DOWN
50/* Power down MCU with watchdog timer 51/* Power down MCU with watchdog timer
51 * wdto: watchdog timer timeout defined in <avr/wdt.h> 52 * wdto: watchdog timer timeout defined in <avr/wdt.h>
52 * WDTO_15MS 53 * WDTO_15MS
@@ -61,6 +62,7 @@ void suspend_idle(uint8_t time)
61 * WDTO_8S 62 * WDTO_8S
62 */ 63 */
63static uint8_t wdt_timeout = 0; 64static uint8_t wdt_timeout = 0;
65
64static void power_down(uint8_t wdto) 66static void power_down(uint8_t wdto)
65{ 67{
66#ifdef PROTOCOL_LUFA 68#ifdef PROTOCOL_LUFA
@@ -98,19 +100,19 @@ static void power_down(uint8_t wdto)
98 // Disable watchdog after sleep 100 // Disable watchdog after sleep
99 wdt_disable(); 101 wdt_disable();
100} 102}
103#endif
101 104
102void suspend_power_down(void) 105void suspend_power_down(void)
103{ 106{
107#ifndef NO_SUSPEND_POWER_DOWN
104 power_down(WDTO_15MS); 108 power_down(WDTO_15MS);
109#endif
105} 110}
106 111
107__attribute__ ((weak)) void matrix_power_up(void) {} 112__attribute__ ((weak)) void matrix_power_up(void) {}
108__attribute__ ((weak)) void matrix_power_down(void) {} 113__attribute__ ((weak)) void matrix_power_down(void) {}
109bool suspend_wakeup_condition(void) 114bool suspend_wakeup_condition(void)
110{ 115{
111#ifdef BACKLIGHT_ENABLE
112 backlight_set(0);
113#endif
114 matrix_power_up(); 116 matrix_power_up();
115 matrix_scan(); 117 matrix_scan();
116 matrix_power_down(); 118 matrix_power_down();
@@ -126,10 +128,9 @@ void suspend_wakeup_init(void)
126 // clear keyboard state 128 // clear keyboard state
127 clear_keyboard(); 129 clear_keyboard();
128#ifdef BACKLIGHT_ENABLE 130#ifdef BACKLIGHT_ENABLE
129 backlight_set(0);
130 backlight_init(); 131 backlight_init();
131#endif 132#endif
132led_set(host_keyboard_leds()); 133 led_set(host_keyboard_leds());
133} 134}
134 135
135#ifndef NO_SUSPEND_POWER_DOWN 136#ifndef NO_SUSPEND_POWER_DOWN
diff --git a/tmk_core/common/avr/timer.c b/tmk_core/common/avr/timer.c
index 292b41c3a..84af44488 100644
--- a/tmk_core/common/avr/timer.c
+++ b/tmk_core/common/avr/timer.c
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18#include <avr/io.h> 18#include <avr/io.h>
19#include <avr/interrupt.h> 19#include <avr/interrupt.h>
20#include <util/atomic.h>
20#include <stdint.h> 21#include <stdint.h>
21#include "timer_avr.h" 22#include "timer_avr.h"
22#include "timer.h" 23#include "timer.h"
@@ -24,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
24 25
25// counter resolution 1ms 26// counter resolution 1ms
26// NOTE: union { uint32_t timer32; struct { uint16_t dummy; uint16_t timer16; }} 27// NOTE: union { uint32_t timer32; struct { uint16_t dummy; uint16_t timer16; }}
27volatile uint32_t timer_count = 0; 28volatile uint32_t timer_count;
28 29
29void timer_init(void) 30void timer_init(void)
30{ 31{
@@ -52,10 +53,9 @@ void timer_init(void)
52inline 53inline
53void timer_clear(void) 54void timer_clear(void)
54{ 55{
55 uint8_t sreg = SREG; 56 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
56 cli();
57 timer_count = 0; 57 timer_count = 0;
58 SREG = sreg; 58 }
59} 59}
60 60
61inline 61inline
@@ -63,10 +63,9 @@ uint16_t timer_read(void)
63{ 63{
64 uint32_t t; 64 uint32_t t;
65 65
66 uint8_t sreg = SREG; 66 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
67 cli(); 67 t = timer_count;
68 t = timer_count; 68 }
69 SREG = sreg;
70 69
71 return (t & 0xFFFF); 70 return (t & 0xFFFF);
72} 71}
@@ -76,10 +75,9 @@ uint32_t timer_read32(void)
76{ 75{
77 uint32_t t; 76 uint32_t t;
78 77
79 uint8_t sreg = SREG; 78 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
80 cli(); 79 t = timer_count;
81 t = timer_count; 80 }
82 SREG = sreg;
83 81
84 return t; 82 return t;
85} 83}
@@ -89,10 +87,9 @@ uint16_t timer_elapsed(uint16_t last)
89{ 87{
90 uint32_t t; 88 uint32_t t;
91 89
92 uint8_t sreg = SREG; 90 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
93 cli(); 91 t = timer_count;
94 t = timer_count; 92 }
95 SREG = sreg;
96 93
97 return TIMER_DIFF_16((t & 0xFFFF), last); 94 return TIMER_DIFF_16((t & 0xFFFF), last);
98} 95}
@@ -102,10 +99,9 @@ uint32_t timer_elapsed32(uint32_t last)
102{ 99{
103 uint32_t t; 100 uint32_t t;
104 101
105 uint8_t sreg = SREG; 102 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
106 cli(); 103 t = timer_count;
107 t = timer_count; 104 }
108 SREG = sreg;
109 105
110 return TIMER_DIFF_32(t, last); 106 return TIMER_DIFF_32(t, last);
111} 107}
diff --git a/tmk_core/common/backlight.c b/tmk_core/common/backlight.c
index c9e8fd3fd..0e0ad2d15 100644
--- a/tmk_core/common/backlight.c
+++ b/tmk_core/common/backlight.c
@@ -36,9 +36,9 @@ void backlight_increase(void)
36 if(backlight_config.level < BACKLIGHT_LEVELS) 36 if(backlight_config.level < BACKLIGHT_LEVELS)
37 { 37 {
38 backlight_config.level++; 38 backlight_config.level++;
39 backlight_config.enable = 1;
40 eeconfig_update_backlight(backlight_config.raw);
41 } 39 }
40 backlight_config.enable = 1;
41 eeconfig_update_backlight(backlight_config.raw);
42 dprintf("backlight increase: %u\n", backlight_config.level); 42 dprintf("backlight increase: %u\n", backlight_config.level);
43 backlight_set(backlight_config.level); 43 backlight_set(backlight_config.level);
44} 44}
diff --git a/tmk_core/common/host_driver.h b/tmk_core/common/host_driver.h
index edb9e5dd9..588d1c0be 100644
--- a/tmk_core/common/host_driver.h
+++ b/tmk_core/common/host_driver.h
@@ -20,7 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20 20
21#include <stdint.h> 21#include <stdint.h>
22#include "report.h" 22#include "report.h"
23 23#ifdef MIDI_ENABLE
24 #include "midi.h"
25#endif
24 26
25typedef struct { 27typedef struct {
26 uint8_t (*keyboard_leds)(void); 28 uint8_t (*keyboard_leds)(void);
@@ -28,6 +30,11 @@ typedef struct {
28 void (*send_mouse)(report_mouse_t *); 30 void (*send_mouse)(report_mouse_t *);
29 void (*send_system)(uint16_t); 31 void (*send_system)(uint16_t);
30 void (*send_consumer)(uint16_t); 32 void (*send_consumer)(uint16_t);
33#ifdef MIDI_ENABLE
34 void (*usb_send_func)(MidiDevice *, uint16_t, uint8_t, uint8_t, uint8_t);
35 void (*usb_get_midi)(MidiDevice *);
36 void (*midi_usb_init)(MidiDevice *);
37#endif
31} host_driver_t; 38} host_driver_t;
32 39
33#endif 40#endif
diff --git a/tmk_core/common/raw_hid.h b/tmk_core/common/raw_hid.h
new file mode 100644
index 000000000..86da02fd1
--- /dev/null
+++ b/tmk_core/common/raw_hid.h
@@ -0,0 +1,8 @@
1#ifndef _RAW_HID_H_
2#define _RAW_HID_H_
3
4void raw_hid_receive( uint8_t *data, uint8_t length );
5
6void raw_hid_send( uint8_t *data, uint8_t length );
7
8#endif
diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk
index 5b1e3d19d..151d26cbc 100644
--- a/tmk_core/protocol/lufa.mk
+++ b/tmk_core/protocol/lufa.mk
@@ -21,6 +21,10 @@ ifeq ($(strip $(MIDI_ENABLE)), yes)
21 include $(TMK_PATH)/protocol/midi.mk 21 include $(TMK_PATH)/protocol/midi.mk
22endif 22endif
23 23
24ifeq ($(strip $(ADAFRUIT_BLE_ENABLE)), yes)
25 LUFA_SRC += $(LUFA_DIR)/adafruit_ble.cpp
26endif
27
24ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) 28ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
25 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ 29 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
26 $(TMK_DIR)/protocol/serial_uart.c 30 $(TMK_DIR)/protocol/serial_uart.c
diff --git a/tmk_core/protocol/lufa/adafruit_ble.cpp b/tmk_core/protocol/lufa/adafruit_ble.cpp
new file mode 100644
index 000000000..37194e77a
--- /dev/null
+++ b/tmk_core/protocol/lufa/adafruit_ble.cpp
@@ -0,0 +1,805 @@
1#include "adafruit_ble.h"
2#include <stdio.h>
3#include <stdlib.h>
4#include <alloca.h>
5#include <util/delay.h>
6#include <util/atomic.h>
7#include "debug.h"
8#include "pincontrol.h"
9#include "timer.h"
10#include "action_util.h"
11#include "ringbuffer.hpp"
12#include <string.h>
13
14// These are the pin assignments for the 32u4 boards.
15// You may define them to something else in your config.h
16// if yours is wired up differently.
17#ifndef AdafruitBleResetPin
18#define AdafruitBleResetPin D4
19#endif
20
21#ifndef AdafruitBleCSPin
22#define AdafruitBleCSPin B4
23#endif
24
25#ifndef AdafruitBleIRQPin
26#define AdafruitBleIRQPin E6
27#endif
28
29
30#define SAMPLE_BATTERY
31#define ConnectionUpdateInterval 1000 /* milliseconds */
32
33static struct {
34 bool is_connected;
35 bool initialized;
36 bool configured;
37
38#define ProbedEvents 1
39#define UsingEvents 2
40 bool event_flags;
41
42#ifdef SAMPLE_BATTERY
43 uint16_t last_battery_update;
44 uint32_t vbat;
45#endif
46 uint16_t last_connection_update;
47} state;
48
49// Commands are encoded using SDEP and sent via SPI
50// https://github.com/adafruit/Adafruit_BluefruitLE_nRF51/blob/master/SDEP.md
51
52#define SdepMaxPayload 16
53struct sdep_msg {
54 uint8_t type;
55 uint8_t cmd_low;
56 uint8_t cmd_high;
57 struct __attribute__((packed)) {
58 uint8_t len:7;
59 uint8_t more:1;
60 };
61 uint8_t payload[SdepMaxPayload];
62} __attribute__((packed));
63
64// The recv latency is relatively high, so when we're hammering keys quickly,
65// we want to avoid waiting for the responses in the matrix loop. We maintain
66// a short queue for that. Since there is quite a lot of space overhead for
67// the AT command representation wrapped up in SDEP, we queue the minimal
68// information here.
69
70enum queue_type {
71 QTKeyReport, // 1-byte modifier + 6-byte key report
72 QTConsumer, // 16-bit key code
73#ifdef MOUSE_ENABLE
74 QTMouseMove, // 4-byte mouse report
75#endif
76};
77
78struct queue_item {
79 enum queue_type queue_type;
80 uint16_t added;
81 union __attribute__((packed)) {
82 struct __attribute__((packed)) {
83 uint8_t modifier;
84 uint8_t keys[6];
85 } key;
86
87 uint16_t consumer;
88 struct __attribute__((packed)) {
89 uint8_t x, y, scroll, pan;
90 } mousemove;
91 };
92};
93
94// Items that we wish to send
95static RingBuffer<queue_item, 40> send_buf;
96// Pending response; while pending, we can't send any more requests.
97// This records the time at which we sent the command for which we
98// are expecting a response.
99static RingBuffer<uint16_t, 2> resp_buf;
100
101static bool process_queue_item(struct queue_item *item, uint16_t timeout);
102
103enum sdep_type {
104 SdepCommand = 0x10,
105 SdepResponse = 0x20,
106 SdepAlert = 0x40,
107 SdepError = 0x80,
108 SdepSlaveNotReady = 0xfe, // Try again later
109 SdepSlaveOverflow = 0xff, // You read more data than is available
110};
111
112enum ble_cmd {
113 BleInitialize = 0xbeef,
114 BleAtWrapper = 0x0a00,
115 BleUartTx = 0x0a01,
116 BleUartRx = 0x0a02,
117};
118
119enum ble_system_event_bits {
120 BleSystemConnected = 0,
121 BleSystemDisconnected = 1,
122 BleSystemUartRx = 8,
123 BleSystemMidiRx = 10,
124};
125
126// The SDEP.md file says 2MHz but the web page and the sample driver
127// both use 4MHz
128#define SpiBusSpeed 4000000
129
130#define SdepTimeout 150 /* milliseconds */
131#define SdepShortTimeout 10 /* milliseconds */
132#define SdepBackOff 25 /* microseconds */
133#define BatteryUpdateInterval 10000 /* milliseconds */
134
135static bool at_command(const char *cmd, char *resp, uint16_t resplen,
136 bool verbose, uint16_t timeout = SdepTimeout);
137static bool at_command_P(const char *cmd, char *resp, uint16_t resplen,
138 bool verbose = false);
139
140struct SPI_Settings {
141 uint8_t spcr, spsr;
142};
143
144static struct SPI_Settings spi;
145
146// Initialize 4Mhz MSBFIRST MODE0
147void SPI_init(struct SPI_Settings *spi) {
148 spi->spcr = _BV(SPE) | _BV(MSTR);
149 spi->spsr = _BV(SPI2X);
150
151 static_assert(SpiBusSpeed == F_CPU / 2, "hard coded at 4Mhz");
152
153 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
154 // Ensure that SS is OUTPUT High
155 digitalWrite(B0, PinLevelHigh);
156 pinMode(B0, PinDirectionOutput);
157
158 SPCR |= _BV(MSTR);
159 SPCR |= _BV(SPE);
160 pinMode(B1 /* SCK */, PinDirectionOutput);
161 pinMode(B2 /* MOSI */, PinDirectionOutput);
162 }
163}
164
165static inline void SPI_begin(struct SPI_Settings*spi) {
166 SPCR = spi->spcr;
167 SPSR = spi->spsr;
168}
169
170static inline uint8_t SPI_TransferByte(uint8_t data) {
171 SPDR = data;
172 asm volatile("nop");
173 while (!(SPSR & _BV(SPIF))) {
174 ; // wait
175 }
176 return SPDR;
177}
178
179static inline void spi_send_bytes(const uint8_t *buf, uint8_t len) {
180 if (len == 0) return;
181 const uint8_t *end = buf + len;
182 while (buf < end) {
183 SPDR = *buf;
184 while (!(SPSR & _BV(SPIF))) {
185 ; // wait
186 }
187 ++buf;
188 }
189}
190
191static inline uint16_t spi_read_byte(void) {
192 return SPI_TransferByte(0x00 /* dummy */);
193}
194
195static inline void spi_recv_bytes(uint8_t *buf, uint8_t len) {
196 const uint8_t *end = buf + len;
197 if (len == 0) return;
198 while (buf < end) {
199 SPDR = 0; // write a dummy to initiate read
200 while (!(SPSR & _BV(SPIF))) {
201 ; // wait
202 }
203 *buf = SPDR;
204 ++buf;
205 }
206}
207
208#if 0
209static void dump_pkt(const struct sdep_msg *msg) {
210 print("pkt: type=");
211 print_hex8(msg->type);
212 print(" cmd=");
213 print_hex8(msg->cmd_high);
214 print_hex8(msg->cmd_low);
215 print(" len=");
216 print_hex8(msg->len);
217 print(" more=");
218 print_hex8(msg->more);
219 print("\n");
220}
221#endif
222
223// Send a single SDEP packet
224static bool sdep_send_pkt(const struct sdep_msg *msg, uint16_t timeout) {
225 SPI_begin(&spi);
226
227 digitalWrite(AdafruitBleCSPin, PinLevelLow);
228 uint16_t timerStart = timer_read();
229 bool success = false;
230 bool ready = false;
231
232 do {
233 ready = SPI_TransferByte(msg->type) != SdepSlaveNotReady;
234 if (ready) {
235 break;
236 }
237
238 // Release it and let it initialize
239 digitalWrite(AdafruitBleCSPin, PinLevelHigh);
240 _delay_us(SdepBackOff);
241 digitalWrite(AdafruitBleCSPin, PinLevelLow);
242 } while (timer_elapsed(timerStart) < timeout);
243
244 if (ready) {
245 // Slave is ready; send the rest of the packet
246 spi_send_bytes(&msg->cmd_low,
247 sizeof(*msg) - (1 + sizeof(msg->payload)) + msg->len);
248 success = true;
249 }
250
251 digitalWrite(AdafruitBleCSPin, PinLevelHigh);
252
253 return success;
254}
255
256static inline void sdep_build_pkt(struct sdep_msg *msg, uint16_t command,
257 const uint8_t *payload, uint8_t len,
258 bool moredata) {
259 msg->type = SdepCommand;
260 msg->cmd_low = command & 0xff;
261 msg->cmd_high = command >> 8;
262 msg->len = len;
263 msg->more = (moredata && len == SdepMaxPayload) ? 1 : 0;
264
265 static_assert(sizeof(*msg) == 20, "msg is correctly packed");
266
267 memcpy(msg->payload, payload, len);
268}
269
270// Read a single SDEP packet
271static bool sdep_recv_pkt(struct sdep_msg *msg, uint16_t timeout) {
272 bool success = false;
273 uint16_t timerStart = timer_read();
274 bool ready = false;
275
276 do {
277 ready = digitalRead(AdafruitBleIRQPin);
278 if (ready) {
279 break;
280 }
281 _delay_us(1);
282 } while (timer_elapsed(timerStart) < timeout);
283
284 if (ready) {
285 SPI_begin(&spi);
286
287 digitalWrite(AdafruitBleCSPin, PinLevelLow);
288
289 do {
290 // Read the command type, waiting for the data to be ready
291 msg->type = spi_read_byte();
292 if (msg->type == SdepSlaveNotReady || msg->type == SdepSlaveOverflow) {
293 // Release it and let it initialize
294 digitalWrite(AdafruitBleCSPin, PinLevelHigh);
295 _delay_us(SdepBackOff);
296 digitalWrite(AdafruitBleCSPin, PinLevelLow);
297 continue;
298 }
299
300 // Read the rest of the header
301 spi_recv_bytes(&msg->cmd_low, sizeof(*msg) - (1 + sizeof(msg->payload)));
302
303 // and get the payload if there is any
304 if (msg->len <= SdepMaxPayload) {
305 spi_recv_bytes(msg->payload, msg->len);
306 }
307 success = true;
308 break;
309 } while (timer_elapsed(timerStart) < timeout);
310
311 digitalWrite(AdafruitBleCSPin, PinLevelHigh);
312 }
313 return success;
314}
315
316static void resp_buf_read_one(bool greedy) {
317 uint16_t last_send;
318 if (!resp_buf.peek(last_send)) {
319 return;
320 }
321
322 if (digitalRead(AdafruitBleIRQPin)) {
323 struct sdep_msg msg;
324
325again:
326 if (sdep_recv_pkt(&msg, SdepTimeout)) {
327 if (!msg.more) {
328 // We got it; consume this entry
329 resp_buf.get(last_send);
330 dprintf("recv latency %dms\n", TIMER_DIFF_16(timer_read(), last_send));
331 }
332
333 if (greedy && resp_buf.peek(last_send) && digitalRead(AdafruitBleIRQPin)) {
334 goto again;
335 }
336 }
337
338 } else if (timer_elapsed(last_send) > SdepTimeout * 2) {
339 dprintf("waiting_for_result: timeout, resp_buf size %d\n",
340 (int)resp_buf.size());
341
342 // Timed out: consume this entry
343 resp_buf.get(last_send);
344 }
345}
346
347static void send_buf_send_one(uint16_t timeout = SdepTimeout) {
348 struct queue_item item;
349
350 // Don't send anything more until we get an ACK
351 if (!resp_buf.empty()) {
352 return;
353 }
354
355 if (!send_buf.peek(item)) {
356 return;
357 }
358 if (process_queue_item(&item, timeout)) {
359 // commit that peek
360 send_buf.get(item);
361 dprintf("send_buf_send_one: have %d remaining\n", (int)send_buf.size());
362 } else {
363 dprint("failed to send, will retry\n");
364 _delay_ms(SdepTimeout);
365 resp_buf_read_one(true);
366 }
367}
368
369static void resp_buf_wait(const char *cmd) {
370 bool didPrint = false;
371 while (!resp_buf.empty()) {
372 if (!didPrint) {
373 dprintf("wait on buf for %s\n", cmd);
374 didPrint = true;
375 }
376 resp_buf_read_one(true);
377 }
378}
379
380static bool ble_init(void) {
381 state.initialized = false;
382 state.configured = false;
383 state.is_connected = false;
384
385 pinMode(AdafruitBleIRQPin, PinDirectionInput);
386 pinMode(AdafruitBleCSPin, PinDirectionOutput);
387 digitalWrite(AdafruitBleCSPin, PinLevelHigh);
388
389 SPI_init(&spi);
390
391 // Perform a hardware reset
392 pinMode(AdafruitBleResetPin, PinDirectionOutput);
393 digitalWrite(AdafruitBleResetPin, PinLevelHigh);
394 digitalWrite(AdafruitBleResetPin, PinLevelLow);
395 _delay_ms(10);
396 digitalWrite(AdafruitBleResetPin, PinLevelHigh);
397
398 _delay_ms(1000); // Give it a second to initialize
399
400 state.initialized = true;
401 return state.initialized;
402}
403
404static inline uint8_t min(uint8_t a, uint8_t b) {
405 return a < b ? a : b;
406}
407
408static bool read_response(char *resp, uint16_t resplen, bool verbose) {
409 char *dest = resp;
410 char *end = dest + resplen;
411
412 while (true) {
413 struct sdep_msg msg;
414
415 if (!sdep_recv_pkt(&msg, 2 * SdepTimeout)) {
416 dprint("sdep_recv_pkt failed\n");
417 return false;
418 }
419
420 if (msg.type != SdepResponse) {
421 *resp = 0;
422 return false;
423 }
424
425 uint8_t len = min(msg.len, end - dest);
426 if (len > 0) {
427 memcpy(dest, msg.payload, len);
428 dest += len;
429 }
430
431 if (!msg.more) {
432 // No more data is expected!
433 break;
434 }
435 }
436
437 // Ensure the response is NUL terminated
438 *dest = 0;
439
440 // "Parse" the result text; we want to snip off the trailing OK or ERROR line
441 // Rewind past the possible trailing CRLF so that we can strip it
442 --dest;
443 while (dest > resp && (dest[0] == '\n' || dest[0] == '\r')) {
444 *dest = 0;
445 --dest;
446 }
447
448 // Look back for start of preceeding line
449 char *last_line = strrchr(resp, '\n');
450 if (last_line) {
451 ++last_line;
452 } else {
453 last_line = resp;
454 }
455
456 bool success = false;
457 static const char kOK[] PROGMEM = "OK";
458
459 success = !strcmp_P(last_line, kOK );
460
461 if (verbose || !success) {
462 dprintf("result: %s\n", resp);
463 }
464 return success;
465}
466
467static bool at_command(const char *cmd, char *resp, uint16_t resplen,
468 bool verbose, uint16_t timeout) {
469 const char *end = cmd + strlen(cmd);
470 struct sdep_msg msg;
471
472 if (verbose) {
473 dprintf("ble send: %s\n", cmd);
474 }
475
476 if (resp) {
477 // They want to decode the response, so we need to flush and wait
478 // for all pending I/O to finish before we start this one, so
479 // that we don't confuse the results
480 resp_buf_wait(cmd);
481 *resp = 0;
482 }
483
484 // Fragment the command into a series of SDEP packets
485 while (end - cmd > SdepMaxPayload) {
486 sdep_build_pkt(&msg, BleAtWrapper, (uint8_t *)cmd, SdepMaxPayload, true);
487 if (!sdep_send_pkt(&msg, timeout)) {
488 return false;
489 }
490 cmd += SdepMaxPayload;
491 }
492
493 sdep_build_pkt(&msg, BleAtWrapper, (uint8_t *)cmd, end - cmd, false);
494 if (!sdep_send_pkt(&msg, timeout)) {
495 return false;
496 }
497
498 if (resp == NULL) {
499 auto now = timer_read();
500 while (!resp_buf.enqueue(now)) {
501 resp_buf_read_one(false);
502 }
503 auto later = timer_read();
504 if (TIMER_DIFF_16(later, now) > 0) {
505 dprintf("waited %dms for resp_buf\n", TIMER_DIFF_16(later, now));
506 }
507 return true;
508 }
509
510 return read_response(resp, resplen, verbose);
511}
512
513bool at_command_P(const char *cmd, char *resp, uint16_t resplen, bool verbose) {
514 auto cmdbuf = (char *)alloca(strlen_P(cmd) + 1);
515 strcpy_P(cmdbuf, cmd);
516 return at_command(cmdbuf, resp, resplen, verbose);
517}
518
519bool adafruit_ble_is_connected(void) {
520 return state.is_connected;
521}
522
523bool adafruit_ble_enable_keyboard(void) {
524 char resbuf[128];
525
526 if (!state.initialized && !ble_init()) {
527 return false;
528 }
529
530 state.configured = false;
531
532 // Disable command echo
533 static const char kEcho[] PROGMEM = "ATE=0";
534 // Make the advertised name match the keyboard
535 static const char kGapDevName[] PROGMEM =
536 "AT+GAPDEVNAME=" STR(PRODUCT) " " STR(DESCRIPTION);
537 // Turn on keyboard support
538 static const char kHidEnOn[] PROGMEM = "AT+BLEHIDEN=1";
539
540 // Adjust intervals to improve latency. This causes the "central"
541 // system (computer/tablet) to poll us every 10-30 ms. We can't
542 // set a smaller value than 10ms, and 30ms seems to be the natural
543 // processing time on my macbook. Keeping it constrained to that
544 // feels reasonable to type to.
545 static const char kGapIntervals[] PROGMEM = "AT+GAPINTERVALS=10,30,,";
546
547 // Reset the device so that it picks up the above changes
548 static const char kATZ[] PROGMEM = "ATZ";
549
550 // Turn down the power level a bit
551 static const char kPower[] PROGMEM = "AT+BLEPOWERLEVEL=-12";
552 static PGM_P const configure_commands[] PROGMEM = {
553 kEcho,
554 kGapIntervals,
555 kGapDevName,
556 kHidEnOn,
557 kPower,
558 kATZ,
559 };
560
561 uint8_t i;
562 for (i = 0; i < sizeof(configure_commands) / sizeof(configure_commands[0]);
563 ++i) {
564 PGM_P cmd;
565 memcpy_P(&cmd, configure_commands + i, sizeof(cmd));
566
567 if (!at_command_P(cmd, resbuf, sizeof(resbuf))) {
568 dprintf("failed BLE command: %S: %s\n", cmd, resbuf);
569 goto fail;
570 }
571 }
572
573 state.configured = true;
574
575 // Check connection status in a little while; allow the ATZ time
576 // to kick in.
577 state.last_connection_update = timer_read();
578fail:
579 return state.configured;
580}
581
582static void set_connected(bool connected) {
583 if (connected != state.is_connected) {
584 if (connected) {
585 print("****** BLE CONNECT!!!!\n");
586 } else {
587 print("****** BLE DISCONNECT!!!!\n");
588 }
589 state.is_connected = connected;
590
591 // TODO: if modifiers are down on the USB interface and
592 // we cut over to BLE or vice versa, they will remain stuck.
593 // This feels like a good point to do something like clearing
594 // the keyboard and/or generating a fake all keys up message.
595 // However, I've noticed that it takes a couple of seconds
596 // for macOS to to start recognizing key presses after BLE
597 // is in the connected state, so I worry that doing that
598 // here may not be good enough.
599 }
600}
601
602void adafruit_ble_task(void) {
603 char resbuf[48];
604
605 if (!state.configured && !adafruit_ble_enable_keyboard()) {
606 return;
607 }
608 resp_buf_read_one(true);
609 send_buf_send_one(SdepShortTimeout);
610
611 if (resp_buf.empty() && (state.event_flags & UsingEvents) &&
612 digitalRead(AdafruitBleIRQPin)) {
613 // Must be an event update
614 if (at_command_P(PSTR("AT+EVENTSTATUS"), resbuf, sizeof(resbuf))) {
615 uint32_t mask = strtoul(resbuf, NULL, 16);
616
617 if (mask & BleSystemConnected) {
618 set_connected(true);
619 } else if (mask & BleSystemDisconnected) {
620 set_connected(false);
621 }
622 }
623 }
624
625 if (timer_elapsed(state.last_connection_update) > ConnectionUpdateInterval) {
626 bool shouldPoll = true;
627 if (!(state.event_flags & ProbedEvents)) {
628 // Request notifications about connection status changes.
629 // This only works in SPIFRIEND firmware > 0.6.7, which is why
630 // we check for this conditionally here.
631 // Note that at the time of writing, HID reports only work correctly
632 // with Apple products on firmware version 0.6.7!
633 // https://forums.adafruit.com/viewtopic.php?f=8&t=104052
634 if (at_command_P(PSTR("AT+EVENTENABLE=0x1"), resbuf, sizeof(resbuf))) {
635 at_command_P(PSTR("AT+EVENTENABLE=0x2"), resbuf, sizeof(resbuf));
636 state.event_flags |= UsingEvents;
637 }
638 state.event_flags |= ProbedEvents;
639
640 // leave shouldPoll == true so that we check at least once
641 // before relying solely on events
642 } else {
643 shouldPoll = false;
644 }
645
646 static const char kGetConn[] PROGMEM = "AT+GAPGETCONN";
647 state.last_connection_update = timer_read();
648
649 if (at_command_P(kGetConn, resbuf, sizeof(resbuf))) {
650 set_connected(atoi(resbuf));
651 }
652 }
653
654#ifdef SAMPLE_BATTERY
655 // I don't know if this really does anything useful yet; the reported
656 // voltage level always seems to be around 3200mV. We may want to just rip
657 // this code out.
658 if (timer_elapsed(state.last_battery_update) > BatteryUpdateInterval &&
659 resp_buf.empty()) {
660 state.last_battery_update = timer_read();
661
662 if (at_command_P(PSTR("AT+HWVBAT"), resbuf, sizeof(resbuf))) {
663 state.vbat = atoi(resbuf);
664 }
665 }
666#endif
667}
668
669static bool process_queue_item(struct queue_item *item, uint16_t timeout) {
670 char cmdbuf[48];
671 char fmtbuf[64];
672
673 // Arrange to re-check connection after keys have settled
674 state.last_connection_update = timer_read();
675
676#if 1
677 if (TIMER_DIFF_16(state.last_connection_update, item->added) > 0) {
678 dprintf("send latency %dms\n",
679 TIMER_DIFF_16(state.last_connection_update, item->added));
680 }
681#endif
682
683 switch (item->queue_type) {
684 case QTKeyReport:
685 strcpy_P(fmtbuf,
686 PSTR("AT+BLEKEYBOARDCODE=%02x-00-%02x-%02x-%02x-%02x-%02x-%02x"));
687 snprintf(cmdbuf, sizeof(cmdbuf), fmtbuf, item->key.modifier,
688 item->key.keys[0], item->key.keys[1], item->key.keys[2],
689 item->key.keys[3], item->key.keys[4], item->key.keys[5]);
690 return at_command(cmdbuf, NULL, 0, true, timeout);
691
692 case QTConsumer:
693 strcpy_P(fmtbuf, PSTR("AT+BLEHIDCONTROLKEY=0x%04x"));
694 snprintf(cmdbuf, sizeof(cmdbuf), fmtbuf, item->consumer);
695 return at_command(cmdbuf, NULL, 0, true, timeout);
696
697#ifdef MOUSE_ENABLE
698 case QTMouseMove:
699 strcpy_P(fmtbuf, PSTR("AT+BLEHIDMOUSEMOVE=%d,%d,%d,%d"));
700 snprintf(cmdbuf, sizeof(cmdbuf), fmtbuf, item->mousemove.x,
701 item->mousemove.y, item->mousemove.scroll, item->mousemove.pan);
702 return at_command(cmdbuf, NULL, 0, true, timeout);
703#endif
704 default:
705 return true;
706 }
707}
708
709bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys,
710 uint8_t nkeys) {
711 struct queue_item item;
712 bool didWait = false;
713
714 item.queue_type = QTKeyReport;
715 item.key.modifier = hid_modifier_mask;
716 item.added = timer_read();
717
718 while (nkeys >= 0) {
719 item.key.keys[0] = keys[0];
720 item.key.keys[1] = nkeys >= 1 ? keys[1] : 0;
721 item.key.keys[2] = nkeys >= 2 ? keys[2] : 0;
722 item.key.keys[3] = nkeys >= 3 ? keys[3] : 0;
723 item.key.keys[4] = nkeys >= 4 ? keys[4] : 0;
724 item.key.keys[5] = nkeys >= 5 ? keys[5] : 0;
725
726 if (!send_buf.enqueue(item)) {
727 if (!didWait) {
728 dprint("wait for buf space\n");
729 didWait = true;
730 }
731 send_buf_send_one();
732 continue;
733 }
734
735 if (nkeys <= 6) {
736 return true;
737 }
738
739 nkeys -= 6;
740 keys += 6;
741 }
742
743 return true;
744}
745
746bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration) {
747 struct queue_item item;
748
749 item.queue_type = QTConsumer;
750 item.consumer = keycode;
751
752 while (!send_buf.enqueue(item)) {
753 send_buf_send_one();
754 }
755 return true;
756}
757
758#ifdef MOUSE_ENABLE
759bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll,
760 int8_t pan) {
761 struct queue_item item;
762
763 item.queue_type = QTMouseMove;
764 item.mousemove.x = x;
765 item.mousemove.y = y;
766 item.mousemove.scroll = scroll;
767 item.mousemove.pan = pan;
768
769 while (!send_buf.enqueue(item)) {
770 send_buf_send_one();
771 }
772 return true;
773}
774#endif
775
776uint32_t adafruit_ble_read_battery_voltage(void) {
777 return state.vbat;
778}
779
780bool adafruit_ble_set_mode_leds(bool on) {
781 if (!state.configured) {
782 return false;
783 }
784
785 // The "mode" led is the red blinky one
786 at_command_P(on ? PSTR("AT+HWMODELED=1") : PSTR("AT+HWMODELED=0"), NULL, 0);
787
788 // Pin 19 is the blue "connected" LED; turn that off too.
789 // When turning LEDs back on, don't turn that LED on if we're
790 // not connected, as that would be confusing.
791 at_command_P(on && state.is_connected ? PSTR("AT+HWGPIO=19,1")
792 : PSTR("AT+HWGPIO=19,0"),
793 NULL, 0);
794 return true;
795}
796
797// https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le/ble-generic#at-plus-blepowerlevel
798bool adafruit_ble_set_power_level(int8_t level) {
799 char cmd[46];
800 if (!state.configured) {
801 return false;
802 }
803 snprintf(cmd, sizeof(cmd), "AT+BLEPOWERLEVEL=%d", level);
804 return at_command(cmd, NULL, 0, false);
805}
diff --git a/tmk_core/protocol/lufa/adafruit_ble.h b/tmk_core/protocol/lufa/adafruit_ble.h
new file mode 100644
index 000000000..351fd55ae
--- /dev/null
+++ b/tmk_core/protocol/lufa/adafruit_ble.h
@@ -0,0 +1,60 @@
1/* Bluetooth Low Energy Protocol for QMK.
2 * Author: Wez Furlong, 2016
3 * Supports the Adafruit BLE board built around the nRF51822 chip.
4 */
5#pragma once
6#ifdef ADAFRUIT_BLE_ENABLE
7#include <stdbool.h>
8#include <stdint.h>
9#include <string.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15/* Instruct the module to enable HID keyboard support and reset */
16extern bool adafruit_ble_enable_keyboard(void);
17
18/* Query to see if the BLE module is connected */
19extern bool adafruit_ble_query_is_connected(void);
20
21/* Returns true if we believe that the BLE module is connected.
22 * This uses our cached understanding that is maintained by
23 * calling ble_task() periodically. */
24extern bool adafruit_ble_is_connected(void);
25
26/* Call this periodically to process BLE-originated things */
27extern void adafruit_ble_task(void);
28
29/* Generates keypress events for a set of keys.
30 * The hid modifier mask specifies the state of the modifier keys for
31 * this set of keys.
32 * Also sends a key release indicator, so that the keys do not remain
33 * held down. */
34extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys,
35 uint8_t nkeys);
36
37/* Send a consumer keycode, holding it down for the specified duration
38 * (milliseconds) */
39extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration);
40
41#ifdef MOUSE_ENABLE
42/* Send a mouse/wheel movement report.
43 * The parameters are signed and indicate positive of negative direction
44 * change. */
45extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll,
46 int8_t pan);
47#endif
48
49/* Compute battery voltage by reading an analog pin.
50 * Returns the integer number of millivolts */
51extern uint32_t adafruit_ble_read_battery_voltage(void);
52
53extern bool adafruit_ble_set_mode_leds(bool on);
54extern bool adafruit_ble_set_power_level(int8_t level);
55
56#ifdef __cplusplus
57}
58#endif
59
60#endif // ADAFRUIT_BLE_ENABLE
diff --git a/tmk_core/protocol/lufa/descriptor.c b/tmk_core/protocol/lufa/descriptor.c
index 6f2407f58..bf47787d2 100644
--- a/tmk_core/protocol/lufa/descriptor.c
+++ b/tmk_core/protocol/lufa/descriptor.c
@@ -164,6 +164,28 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtrakeyReport[] =
164}; 164};
165#endif 165#endif
166 166
167#ifdef RAW_ENABLE
168const USB_Descriptor_HIDReport_Datatype_t PROGMEM RawReport[] =
169{
170 HID_RI_USAGE_PAGE(16, 0xFF60), /* Vendor Page 0xFF60 */
171 HID_RI_USAGE(8, 0x61), /* Vendor Usage 0x61 */
172 HID_RI_COLLECTION(8, 0x01), /* Application */
173 HID_RI_USAGE(8, 0x62), /* Vendor Usage 0x62 */
174 HID_RI_LOGICAL_MINIMUM(8, 0x00),
175 HID_RI_LOGICAL_MAXIMUM(16, 0x00FF),
176 HID_RI_REPORT_COUNT(8, RAW_EPSIZE),
177 HID_RI_REPORT_SIZE(8, 0x08),
178 HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
179 HID_RI_USAGE(8, 0x63), /* Vendor Usage 0x63 */
180 HID_RI_LOGICAL_MINIMUM(8, 0x00),
181 HID_RI_LOGICAL_MAXIMUM(16, 0x00FF),
182 HID_RI_REPORT_COUNT(8, RAW_EPSIZE),
183 HID_RI_REPORT_SIZE(8, 0x08),
184 HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
185 HID_RI_END_COLLECTION(0),
186};
187#endif
188
167#ifdef CONSOLE_ENABLE 189#ifdef CONSOLE_ENABLE
168const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] = 190const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] =
169{ 191{
@@ -399,6 +421,58 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
399 }, 421 },
400#endif 422#endif
401 423
424 /*
425 * Raw
426 */
427 #ifdef RAW_ENABLE
428 .Raw_Interface =
429 {
430 .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
431
432 .InterfaceNumber = RAW_INTERFACE,
433 .AlternateSetting = 0x00,
434
435 .TotalEndpoints = 2,
436
437 .Class = HID_CSCP_HIDClass,
438 .SubClass = HID_CSCP_NonBootSubclass,
439 .Protocol = HID_CSCP_NonBootProtocol,
440
441 .InterfaceStrIndex = NO_DESCRIPTOR
442 },
443
444 .Raw_HID =
445 {
446 .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
447
448 .HIDSpec = VERSION_BCD(1,1,1),
449 .CountryCode = 0x00,
450 .TotalReportDescriptors = 1,
451 .HIDReportType = HID_DTYPE_Report,
452 .HIDReportLength = sizeof(RawReport)
453 },
454
455 .Raw_INEndpoint =
456 {
457 .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
458
459 .EndpointAddress = (ENDPOINT_DIR_IN | RAW_IN_EPNUM),
460 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
461 .EndpointSize = RAW_EPSIZE,
462 .PollingIntervalMS = 0x01
463 },
464
465 .Raw_OUTEndpoint =
466 {
467 .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
468
469 .EndpointAddress = (ENDPOINT_DIR_OUT | RAW_OUT_EPNUM),
470 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
471 .EndpointSize = RAW_EPSIZE,
472 .PollingIntervalMS = 0x01
473 },
474 #endif
475
402 /* 476 /*
403 * Console 477 * Console
404 */ 478 */
@@ -754,7 +828,6 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
754 .PollingIntervalMS = 0x05 828 .PollingIntervalMS = 0x05
755 }, 829 },
756#endif 830#endif
757
758}; 831};
759 832
760 833
@@ -846,6 +919,12 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
846 Size = sizeof(USB_HID_Descriptor_HID_t); 919 Size = sizeof(USB_HID_Descriptor_HID_t);
847 break; 920 break;
848#endif 921#endif
922#ifdef RAW_ENABLE
923 case RAW_INTERFACE:
924 Address = &ConfigurationDescriptor.Raw_HID;
925 Size = sizeof(USB_HID_Descriptor_HID_t);
926 break;
927#endif
849#ifdef CONSOLE_ENABLE 928#ifdef CONSOLE_ENABLE
850 case CONSOLE_INTERFACE: 929 case CONSOLE_INTERFACE:
851 Address = &ConfigurationDescriptor.Console_HID; 930 Address = &ConfigurationDescriptor.Console_HID;
@@ -878,6 +957,12 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
878 Size = sizeof(ExtrakeyReport); 957 Size = sizeof(ExtrakeyReport);
879 break; 958 break;
880#endif 959#endif
960#ifdef RAW_ENABLE
961 case RAW_INTERFACE:
962 Address = &RawReport;
963 Size = sizeof(RawReport);
964 break;
965#endif
881#ifdef CONSOLE_ENABLE 966#ifdef CONSOLE_ENABLE
882 case CONSOLE_INTERFACE: 967 case CONSOLE_INTERFACE:
883 Address = &ConsoleReport; 968 Address = &ConsoleReport;
diff --git a/tmk_core/protocol/lufa/descriptor.h b/tmk_core/protocol/lufa/descriptor.h
index c6c94e361..24ce420e6 100644
--- a/tmk_core/protocol/lufa/descriptor.h
+++ b/tmk_core/protocol/lufa/descriptor.h
@@ -71,6 +71,14 @@ typedef struct
71 USB_Descriptor_Endpoint_t Extrakey_INEndpoint; 71 USB_Descriptor_Endpoint_t Extrakey_INEndpoint;
72#endif 72#endif
73 73
74#ifdef RAW_ENABLE
75 // Raw HID Interface
76 USB_Descriptor_Interface_t Raw_Interface;
77 USB_HID_Descriptor_HID_t Raw_HID;
78 USB_Descriptor_Endpoint_t Raw_INEndpoint;
79 USB_Descriptor_Endpoint_t Raw_OUTEndpoint;
80#endif
81
74#ifdef CONSOLE_ENABLE 82#ifdef CONSOLE_ENABLE
75 // Console HID Interface 83 // Console HID Interface
76 USB_Descriptor_Interface_t Console_Interface; 84 USB_Descriptor_Interface_t Console_Interface;
@@ -137,10 +145,16 @@ typedef struct
137# define EXTRAKEY_INTERFACE MOUSE_INTERFACE 145# define EXTRAKEY_INTERFACE MOUSE_INTERFACE
138#endif 146#endif
139 147
148#ifdef RAW_ENABLE
149# define RAW_INTERFACE (EXTRAKEY_INTERFACE + 1)
150#else
151# define RAW_INTERFACE EXTRAKEY_INTERFACE
152#endif
153
140#ifdef CONSOLE_ENABLE 154#ifdef CONSOLE_ENABLE
141# define CONSOLE_INTERFACE (EXTRAKEY_INTERFACE + 1) 155# define CONSOLE_INTERFACE (RAW_INTERFACE + 1)
142#else 156#else
143# define CONSOLE_INTERFACE EXTRAKEY_INTERFACE 157# define CONSOLE_INTERFACE RAW_INTERFACE
144#endif 158#endif
145 159
146#ifdef NKRO_ENABLE 160#ifdef NKRO_ENABLE
@@ -182,12 +196,19 @@ typedef struct
182# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM 196# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM
183#endif 197#endif
184 198
199#ifdef RAW_ENABLE
200# define RAW_IN_EPNUM (EXTRAKEY_IN_EPNUM + 1)
201# define RAW_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2)
202#else
203# define RAW_OUT_EPNUM EXTRAKEY_IN_EPNUM
204#endif
205
185#ifdef CONSOLE_ENABLE 206#ifdef CONSOLE_ENABLE
186# define CONSOLE_IN_EPNUM (EXTRAKEY_IN_EPNUM + 1) 207# define CONSOLE_IN_EPNUM (RAW_OUT_EPNUM + 1)
187# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 1) 208//# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 2)
188//# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2) 209# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 1)
189#else 210#else
190# define CONSOLE_OUT_EPNUM EXTRAKEY_IN_EPNUM 211# define CONSOLE_OUT_EPNUM RAW_OUT_EPNUM
191#endif 212#endif
192 213
193#ifdef NKRO_ENABLE 214#ifdef NKRO_ENABLE
@@ -217,7 +238,6 @@ typedef struct
217# define CDC_OUT_EPNUM MIDI_STREAM_OUT_EPNUM 238# define CDC_OUT_EPNUM MIDI_STREAM_OUT_EPNUM
218#endif 239#endif
219 240
220
221#if defined(__AVR_ATmega32U2__) && CDC_OUT_EPNUM > 4 241#if defined(__AVR_ATmega32U2__) && CDC_OUT_EPNUM > 4
222# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI, SERIAL)" 242# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI, SERIAL)"
223#endif 243#endif
@@ -225,6 +245,7 @@ typedef struct
225#define KEYBOARD_EPSIZE 8 245#define KEYBOARD_EPSIZE 8
226#define MOUSE_EPSIZE 8 246#define MOUSE_EPSIZE 8
227#define EXTRAKEY_EPSIZE 8 247#define EXTRAKEY_EPSIZE 8
248#define RAW_EPSIZE 32
228#define CONSOLE_EPSIZE 32 249#define CONSOLE_EPSIZE 32
229#define NKRO_EPSIZE 32 250#define NKRO_EPSIZE 32
230#define MIDI_STREAM_EPSIZE 64 251#define MIDI_STREAM_EPSIZE 64
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 01c0e45b0..dd78fe621 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -51,6 +51,8 @@
51 51
52#include "descriptor.h" 52#include "descriptor.h"
53#include "lufa.h" 53#include "lufa.h"
54#include "quantum.h"
55#include <util/atomic.h>
54 56
55#ifdef NKRO_ENABLE 57#ifdef NKRO_ENABLE
56 #include "keycode_config.h" 58 #include "keycode_config.h"
@@ -66,11 +68,26 @@
66#ifdef BLUETOOTH_ENABLE 68#ifdef BLUETOOTH_ENABLE
67 #include "bluetooth.h" 69 #include "bluetooth.h"
68#endif 70#endif
71#ifdef ADAFRUIT_BLE_ENABLE
72 #include "adafruit_ble.h"
73#endif
69 74
70#ifdef VIRTSER_ENABLE 75#ifdef VIRTSER_ENABLE
71 #include "virtser.h" 76 #include "virtser.h"
72#endif 77#endif
73 78
79#if (defined(RGB_MIDI) | defined(RGBLIGHT_ANIMATIONS)) & defined(RGBLIGHT_ENABLE)
80 #include "rgblight.h"
81#endif
82
83#ifdef MIDI_ENABLE
84 #include "sysex_tools.h"
85#endif
86
87#ifdef RAW_ENABLE
88 #include "raw_hid.h"
89#endif
90
74uint8_t keyboard_idle = 0; 91uint8_t keyboard_idle = 0;
75/* 0: Boot Protocol, 1: Report Protocol(default) */ 92/* 0: Boot Protocol, 1: Report Protocol(default) */
76uint8_t keyboard_protocol = 1; 93uint8_t keyboard_protocol = 1;
@@ -79,9 +96,9 @@ static uint8_t keyboard_led_stats = 0;
79static report_keyboard_t keyboard_report_sent; 96static report_keyboard_t keyboard_report_sent;
80 97
81#ifdef MIDI_ENABLE 98#ifdef MIDI_ENABLE
82void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2); 99static void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2);
83void usb_get_midi(MidiDevice * device); 100static void usb_get_midi(MidiDevice * device);
84void midi_usb_init(MidiDevice * device); 101static void midi_usb_init(MidiDevice * device);
85#endif 102#endif
86 103
87/* Host driver */ 104/* Host driver */
@@ -166,6 +183,80 @@ USB_ClassInfo_CDC_Device_t cdc_device =
166}; 183};
167#endif 184#endif
168 185
186#ifdef RAW_ENABLE
187
188void raw_hid_send( uint8_t *data, uint8_t length )
189{
190 // TODO: implement variable size packet
191 if ( length != RAW_EPSIZE )
192 {
193 return;
194 }
195
196 if (USB_DeviceState != DEVICE_STATE_Configured)
197 {
198 return;
199 }
200
201 // TODO: decide if we allow calls to raw_hid_send() in the middle
202 // of other endpoint usage.
203 uint8_t ep = Endpoint_GetCurrentEndpoint();
204
205 Endpoint_SelectEndpoint(RAW_IN_EPNUM);
206
207 // Check to see if the host is ready to accept another packet
208 if (Endpoint_IsINReady())
209 {
210 // Write data
211 Endpoint_Write_Stream_LE(data, RAW_EPSIZE, NULL);
212 // Finalize the stream transfer to send the last packet
213 Endpoint_ClearIN();
214 }
215
216 Endpoint_SelectEndpoint(ep);
217}
218
219__attribute__ ((weak))
220void raw_hid_receive( uint8_t *data, uint8_t length )
221{
222 // Users should #include "raw_hid.h" in their own code
223 // and implement this function there. Leave this as weak linkage
224 // so users can opt to not handle data coming in.
225}
226
227static void raw_hid_task(void)
228{
229 // Create a temporary buffer to hold the read in data from the host
230 uint8_t data[RAW_EPSIZE];
231 bool data_read = false;
232
233 // Device must be connected and configured for the task to run
234 if (USB_DeviceState != DEVICE_STATE_Configured)
235 return;
236
237 Endpoint_SelectEndpoint(RAW_OUT_EPNUM);
238
239 // Check to see if a packet has been sent from the host
240 if (Endpoint_IsOUTReceived())
241 {
242 // Check to see if the packet contains data
243 if (Endpoint_IsReadWriteAllowed())
244 {
245 /* Read data */
246 Endpoint_Read_Stream_LE(data, sizeof(data), NULL);
247 data_read = true;
248 }
249
250 // Finalize the stream transfer to receive the last packet
251 Endpoint_ClearOUT();
252
253 if ( data_read )
254 {
255 raw_hid_receive( data, sizeof(data) );
256 }
257 }
258}
259#endif
169 260
170/******************************************************************************* 261/*******************************************************************************
171 * Console 262 * Console
@@ -285,10 +376,14 @@ void EVENT_USB_Device_WakeUp()
285#endif 376#endif
286} 377}
287 378
379
380
288#ifdef CONSOLE_ENABLE 381#ifdef CONSOLE_ENABLE
289static bool console_flush = false; 382static bool console_flush = false;
290#define CONSOLE_FLUSH_SET(b) do { \ 383#define CONSOLE_FLUSH_SET(b) do { \
291 uint8_t sreg = SREG; cli(); console_flush = b; SREG = sreg; \ 384 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {\
385 console_flush = b; \
386 } \
292} while (0) 387} while (0)
293 388
294// called every 1ms 389// called every 1ms
@@ -302,6 +397,7 @@ void EVENT_USB_Device_StartOfFrame(void)
302 Console_Task(); 397 Console_Task();
303 console_flush = false; 398 console_flush = false;
304} 399}
400
305#endif 401#endif
306 402
307/** Event handler for the USB_ConfigurationChanged event. 403/** Event handler for the USB_ConfigurationChanged event.
@@ -330,6 +426,14 @@ void EVENT_USB_Device_ConfigurationChanged(void)
330 EXTRAKEY_EPSIZE, ENDPOINT_BANK_SINGLE); 426 EXTRAKEY_EPSIZE, ENDPOINT_BANK_SINGLE);
331#endif 427#endif
332 428
429#ifdef RAW_ENABLE
430 /* Setup Raw HID Report Endpoints */
431 ConfigSuccess &= ENDPOINT_CONFIG(RAW_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
432 RAW_EPSIZE, ENDPOINT_BANK_SINGLE);
433 ConfigSuccess &= ENDPOINT_CONFIG(RAW_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
434 RAW_EPSIZE, ENDPOINT_BANK_SINGLE);
435#endif
436
333#ifdef CONSOLE_ENABLE 437#ifdef CONSOLE_ENABLE
334 /* Setup Console HID Report Endpoints */ 438 /* Setup Console HID Report Endpoints */
335 ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, 439 ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
@@ -492,9 +596,35 @@ static uint8_t keyboard_leds(void)
492 return keyboard_led_stats; 596 return keyboard_led_stats;
493} 597}
494 598
599#define SendToUSB 1
600#define SendToBT 2
601#define SendToBLE 4
602
603static inline uint8_t where_to_send(void) {
604#ifdef ADAFRUIT_BLE_ENABLE
605#if 0
606 if (adafruit_ble_is_connected()) {
607 // For testing, send to BLE as a priority
608 return SendToBLE;
609 }
610#endif
611
612 // This is the real policy
613 if (USB_DeviceState != DEVICE_STATE_Configured) {
614 if (adafruit_ble_is_connected()) {
615 return SendToBLE;
616 }
617 }
618#endif
619 return ((USB_DeviceState == DEVICE_STATE_Configured) ? SendToUSB : 0)
620#ifdef BLUETOOTH_ENABLE
621 || SendToBT
622#endif
623 ;
624}
625
495static void send_keyboard(report_keyboard_t *report) 626static void send_keyboard(report_keyboard_t *report)
496{ 627{
497
498#ifdef BLUETOOTH_ENABLE 628#ifdef BLUETOOTH_ENABLE
499 bluefruit_serial_send(0xFD); 629 bluefruit_serial_send(0xFD);
500 for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) { 630 for (uint8_t i = 0; i < KEYBOARD_EPSIZE; i++) {
@@ -503,9 +633,17 @@ static void send_keyboard(report_keyboard_t *report)
503#endif 633#endif
504 634
505 uint8_t timeout = 255; 635 uint8_t timeout = 255;
636 uint8_t where = where_to_send();
506 637
507 if (USB_DeviceState != DEVICE_STATE_Configured) 638#ifdef ADAFRUIT_BLE_ENABLE
508 return; 639 if (where & SendToBLE) {
640 adafruit_ble_send_keys(report->mods, report->keys, sizeof(report->keys));
641 }
642#endif
643
644 if (!(where & SendToUSB)) {
645 return;
646 }
509 647
510 /* Select the Keyboard Report Endpoint */ 648 /* Select the Keyboard Report Endpoint */
511#ifdef NKRO_ENABLE 649#ifdef NKRO_ENABLE
@@ -558,8 +696,17 @@ static void send_mouse(report_mouse_t *report)
558 696
559 uint8_t timeout = 255; 697 uint8_t timeout = 255;
560 698
561 if (USB_DeviceState != DEVICE_STATE_Configured) 699 uint8_t where = where_to_send();
562 return; 700
701#ifdef ADAFRUIT_BLE_ENABLE
702 if (where & SendToBLE) {
703 // FIXME: mouse buttons
704 adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h);
705 }
706#endif
707 if (!(where & SendToUSB)) {
708 return;
709 }
563 710
564 /* Select the Mouse Report Endpoint */ 711 /* Select the Mouse Report Endpoint */
565 Endpoint_SelectEndpoint(MOUSE_IN_EPNUM); 712 Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
@@ -617,9 +764,16 @@ static void send_consumer(uint16_t data)
617#endif 764#endif
618 765
619 uint8_t timeout = 255; 766 uint8_t timeout = 255;
767 uint8_t where = where_to_send();
620 768
621 if (USB_DeviceState != DEVICE_STATE_Configured) 769#ifdef ADAFRUIT_BLE_ENABLE
622 return; 770 if (where & SendToBLE) {
771 adafruit_ble_send_consumer_key(data, 0);
772 }
773#endif
774 if (!(where & SendToUSB)) {
775 return;
776 }
623 777
624 report_extra_t r = { 778 report_extra_t r = {
625 .report_id = REPORT_ID_CONSUMER, 779 .report_id = REPORT_ID_CONSUMER,
@@ -709,7 +863,7 @@ int8_t sendchar(uint8_t c)
709 ******************************************************************************/ 863 ******************************************************************************/
710 864
711#ifdef MIDI_ENABLE 865#ifdef MIDI_ENABLE
712void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2) { 866static void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2) {
713 MIDI_EventPacket_t event; 867 MIDI_EventPacket_t event;
714 event.Data1 = byte0; 868 event.Data1 = byte0;
715 event.Data2 = byte1; 869 event.Data2 = byte1;
@@ -769,7 +923,7 @@ void usb_send_func(MidiDevice * device, uint16_t cnt, uint8_t byte0, uint8_t byt
769 USB_USBTask(); 923 USB_USBTask();
770} 924}
771 925
772void usb_get_midi(MidiDevice * device) { 926static void usb_get_midi(MidiDevice * device) {
773 MIDI_EventPacket_t event; 927 MIDI_EventPacket_t event;
774 while (MIDI_Device_ReceiveEventPacket(&USB_MIDI_Interface, &event)) { 928 while (MIDI_Device_ReceiveEventPacket(&USB_MIDI_Interface, &event)) {
775 929
@@ -799,12 +953,12 @@ void usb_get_midi(MidiDevice * device) {
799 USB_USBTask(); 953 USB_USBTask();
800} 954}
801 955
802void midi_usb_init(MidiDevice * device){ 956static void midi_usb_init(MidiDevice * device){
803 midi_device_init(device); 957 midi_device_init(device);
804 midi_device_set_send_func(device, usb_send_func); 958 midi_device_set_send_func(device, usb_send_func);
805 midi_device_set_pre_input_process_func(device, usb_get_midi); 959 midi_device_set_pre_input_process_func(device, usb_get_midi);
806 960
807 SetupHardware(); 961 // SetupHardware();
808 sei(); 962 sei();
809} 963}
810 964
@@ -1029,7 +1183,7 @@ int main(void)
1029 1183
1030 print("Keyboard start.\n"); 1184 print("Keyboard start.\n");
1031 while (1) { 1185 while (1) {
1032 #ifndef BLUETOOTH_ENABLE 1186 #if !defined(BLUETOOTH_ENABLE) && !defined(ADAFRUIT_BLE_ENABLE)
1033 while (USB_DeviceState == DEVICE_STATE_Suspended) { 1187 while (USB_DeviceState == DEVICE_STATE_Suspended) {
1034 print("[s]"); 1188 print("[s]");
1035 suspend_power_down(); 1189 suspend_power_down();
@@ -1039,20 +1193,34 @@ int main(void)
1039 } 1193 }
1040 #endif 1194 #endif
1041 1195
1196 keyboard_task();
1197
1042#ifdef MIDI_ENABLE 1198#ifdef MIDI_ENABLE
1043 midi_device_process(&midi_device); 1199 midi_device_process(&midi_device);
1044 // MIDI_Task(); 1200 // MIDI_Task();
1045#endif 1201#endif
1046 keyboard_task(); 1202
1203#if defined(RGBLIGHT_ANIMATIONS) & defined(RGBLIGHT_ENABLE)
1204 rgblight_task();
1205#endif
1206
1207#ifdef ADAFRUIT_BLE_ENABLE
1208 adafruit_ble_task();
1209#endif
1047 1210
1048#ifdef VIRTSER_ENABLE 1211#ifdef VIRTSER_ENABLE
1049 virtser_task(); 1212 virtser_task();
1050 CDC_Device_USBTask(&cdc_device); 1213 CDC_Device_USBTask(&cdc_device);
1051#endif 1214#endif
1052 1215
1216#ifdef RAW_ENABLE
1217 raw_hid_task();
1218#endif
1219
1053#if !defined(INTERRUPT_CONTROL_ENDPOINT) 1220#if !defined(INTERRUPT_CONTROL_ENDPOINT)
1054 USB_USBTask(); 1221 USB_USBTask();
1055#endif 1222#endif
1223
1056 } 1224 }
1057} 1225}
1058 1226
@@ -1077,15 +1245,38 @@ void fallthrough_callback(MidiDevice * device,
1077#endif 1245#endif
1078} 1246}
1079 1247
1248
1080void cc_callback(MidiDevice * device, 1249void cc_callback(MidiDevice * device,
1081 uint8_t chan, uint8_t num, uint8_t val) { 1250 uint8_t chan, uint8_t num, uint8_t val) {
1082 //sending it back on the next channel 1251 //sending it back on the next channel
1083 midi_send_cc(device, (chan + 1) % 16, num, val); 1252 // midi_send_cc(device, (chan + 1) % 16, num, val);
1084} 1253}
1085 1254
1086void sysex_callback(MidiDevice * device, 1255uint8_t midi_buffer[MIDI_SYSEX_BUFFER] = {0};
1087 uint16_t start, uint8_t length, uint8_t * data) { 1256
1088 for (int i = 0; i < length; i++) 1257void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data) {
1089 midi_send_cc(device, 15, 0x7F & data[i], 0x7F & (start + i)); 1258 #ifdef API_SYSEX_ENABLE
1259 // SEND_STRING("\n");
1260 // send_word(start);
1261 // SEND_STRING(": ");
1262 for (uint8_t place = 0; place < length; place++) {
1263 // send_byte(*data);
1264 midi_buffer[start + place] = *data;
1265 if (*data == 0xF7) {
1266 // SEND_STRING("\nRD: ");
1267 // for (uint8_t i = 0; i < start + place + 1; i++){
1268 // send_byte(midi_buffer[i]);
1269 // SEND_STRING(" ");
1270 // }
1271 uint8_t * decoded = malloc(sizeof(uint8_t) * (sysex_decoded_length(start + place - 4)));
1272 uint16_t decode_length = sysex_decode(decoded, midi_buffer + 4, start + place - 4);
1273 process_api(decode_length, decoded);
1274 }
1275 // SEND_STRING(" ");
1276 data++;
1277 }
1278 #endif
1090} 1279}
1280
1281
1091#endif 1282#endif
diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h
index aad08d640..b11854101 100644
--- a/tmk_core/protocol/lufa/lufa.h
+++ b/tmk_core/protocol/lufa/lufa.h
@@ -68,8 +68,17 @@ typedef struct {
68} __attribute__ ((packed)) report_extra_t; 68} __attribute__ ((packed)) report_extra_t;
69 69
70#ifdef MIDI_ENABLE 70#ifdef MIDI_ENABLE
71void MIDI_Task(void); 71 void MIDI_Task(void);
72MidiDevice midi_device; 72 MidiDevice midi_device;
73 #define MIDI_SYSEX_BUFFER 32
74#endif
75
76#ifdef API_ENABLE
77 #include "api.h"
78#endif
79
80#ifdef API_SYSEX_ENABLE
81 #include "api_sysex.h"
73#endif 82#endif
74 83
75// #if LUFA_VERSION_INTEGER < 0x120730 84// #if LUFA_VERSION_INTEGER < 0x120730
diff --git a/tmk_core/protocol/lufa/ringbuffer.hpp b/tmk_core/protocol/lufa/ringbuffer.hpp
new file mode 100644
index 000000000..70a3c4881
--- /dev/null
+++ b/tmk_core/protocol/lufa/ringbuffer.hpp
@@ -0,0 +1,66 @@
1#pragma once
2// A simple ringbuffer holding Size elements of type T
3template <typename T, uint8_t Size>
4class RingBuffer {
5 protected:
6 T buf_[Size];
7 uint8_t head_{0}, tail_{0};
8 public:
9 inline uint8_t nextPosition(uint8_t position) {
10 return (position + 1) % Size;
11 }
12
13 inline uint8_t prevPosition(uint8_t position) {
14 if (position == 0) {
15 return Size - 1;
16 }
17 return position - 1;
18 }
19
20 inline bool enqueue(const T &item) {
21 static_assert(Size > 1, "RingBuffer size must be > 1");
22 uint8_t next = nextPosition(head_);
23 if (next == tail_) {
24 // Full
25 return false;
26 }
27
28 buf_[head_] = item;
29 head_ = next;
30 return true;
31 }
32
33 inline bool get(T &dest, bool commit = true) {
34 auto tail = tail_;
35 if (tail == head_) {
36 // No more data
37 return false;
38 }
39
40 dest = buf_[tail];
41 tail = nextPosition(tail);
42
43 if (commit) {
44 tail_ = tail;
45 }
46 return true;
47 }
48
49 inline bool empty() const { return head_ == tail_; }
50
51 inline uint8_t size() const {
52 int diff = head_ - tail_;
53 if (diff >= 0) {
54 return diff;
55 }
56 return Size + diff;
57 }
58
59 inline T& front() {
60 return buf_[tail_];
61 }
62
63 inline bool peek(T &item) {
64 return get(item, false);
65 }
66};
diff --git a/tmk_core/protocol/midi.mk b/tmk_core/protocol/midi.mk
index c85ae42ff..4855b23d3 100644
--- a/tmk_core/protocol/midi.mk
+++ b/tmk_core/protocol/midi.mk
@@ -4,6 +4,7 @@ SRC += midi.c \
4 midi_device.c \ 4 midi_device.c \
5 bytequeue/bytequeue.c \ 5 bytequeue/bytequeue.c \
6 bytequeue/interrupt_setting.c \ 6 bytequeue/interrupt_setting.c \
7 sysex_tools.c \
7 $(LUFA_SRC_USBCLASS) 8 $(LUFA_SRC_USBCLASS)
8 9
9VPATH += $(TMK_PATH)/$(MIDI_DIR) \ No newline at end of file 10VPATH += $(TMK_PATH)/$(MIDI_DIR) \ No newline at end of file
diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c
index c3e8b3c1c..d9ccbecb4 100644
--- a/tmk_core/protocol/ps2_mouse.c
+++ b/tmk_core/protocol/ps2_mouse.c
@@ -18,60 +18,59 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18#include <stdbool.h> 18#include <stdbool.h>
19#include<avr/io.h> 19#include<avr/io.h>
20#include<util/delay.h> 20#include<util/delay.h>
21#include "ps2.h"
22#include "ps2_mouse.h" 21#include "ps2_mouse.h"
23#include "report.h"
24#include "host.h" 22#include "host.h"
25#include "timer.h" 23#include "timer.h"
26#include "print.h" 24#include "print.h"
25#include "report.h"
27#include "debug.h" 26#include "debug.h"
27#include "ps2.h"
28 28
29/* ============================= MACROS ============================ */
29 30
30static report_mouse_t mouse_report = {}; 31static report_mouse_t mouse_report = {};
31 32
33static inline void ps2_mouse_print_report(report_mouse_t *mouse_report);
34static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report);
35static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report);
36static inline void ps2_mouse_enable_scrolling(void);
37static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report);
32 38
33static void print_usb_data(void); 39/* ============================= IMPLEMENTATION ============================ */
34
35 40
36/* supports only 3 button mouse at this time */ 41/* supports only 3 button mouse at this time */
37uint8_t ps2_mouse_init(void) { 42void ps2_mouse_init(void) {
38 uint8_t rcv;
39
40 ps2_host_init(); 43 ps2_host_init();
41 44
42 _delay_ms(1000); // wait for powering up 45 _delay_ms(PS2_MOUSE_INIT_DELAY); // wait for powering up
43 46
44 // send Reset 47 PS2_MOUSE_SEND(PS2_MOUSE_RESET, "ps2_mouse_init: sending reset");
45 rcv = ps2_host_send(0xFF);
46 print("ps2_mouse_init: send Reset: ");
47 phex(rcv); phex(ps2_error); print("\n");
48 48
49 // read completion code of BAT 49 PS2_MOUSE_RECEIVE("ps2_mouse_init: read BAT");
50 rcv = ps2_host_recv_response(); 50 PS2_MOUSE_RECEIVE("ps2_mouse_init: read DevID");
51 print("ps2_mouse_init: read BAT: ");
52 phex(rcv); phex(ps2_error); print("\n");
53 51
54 // read Device ID 52#ifdef PS2_MOUSE_USE_REMOTE_MODE
55 rcv = ps2_host_recv_response(); 53 ps2_mouse_set_remote_mode();
56 print("ps2_mouse_init: read DevID: "); 54#else
57 phex(rcv); phex(ps2_error); print("\n"); 55 ps2_mouse_enable_data_reporting();
56#endif
57
58#ifdef PS2_MOUSE_ENABLE_SCROLLING
59 ps2_mouse_enable_scrolling();
60#endif
58 61
59 // send Set Remote mode 62#ifdef PS2_MOUSE_USE_2_1_SCALING
60 rcv = ps2_host_send(0xF0); 63 ps2_mouse_set_scaling_2_1();
61 print("ps2_mouse_init: send 0xF0: "); 64#endif
62 phex(rcv); phex(ps2_error); print("\n");
63 65
64 return 0; 66 ps2_mouse_init_user();
65} 67}
66 68
67#define X_IS_NEG (mouse_report.buttons & (1<<PS2_MOUSE_X_SIGN)) 69__attribute__((weak))
68#define Y_IS_NEG (mouse_report.buttons & (1<<PS2_MOUSE_Y_SIGN)) 70void ps2_mouse_init_user(void) {
69#define X_IS_OVF (mouse_report.buttons & (1<<PS2_MOUSE_X_OVFLW)) 71}
70#define Y_IS_OVF (mouse_report.buttons & (1<<PS2_MOUSE_Y_OVFLW)) 72
71void ps2_mouse_task(void) 73void ps2_mouse_task(void) {
72{
73 enum { SCROLL_NONE, SCROLL_BTN, SCROLL_SENT };
74 static uint8_t scroll_state = SCROLL_NONE;
75 static uint8_t buttons_prev = 0; 74 static uint8_t buttons_prev = 0;
76 75
77 /* receives packet from mouse */ 76 /* receives packet from mouse */
@@ -79,142 +78,169 @@ void ps2_mouse_task(void)
79 rcv = ps2_host_send(PS2_MOUSE_READ_DATA); 78 rcv = ps2_host_send(PS2_MOUSE_READ_DATA);
80 if (rcv == PS2_ACK) { 79 if (rcv == PS2_ACK) {
81 mouse_report.buttons = ps2_host_recv_response(); 80 mouse_report.buttons = ps2_host_recv_response();
82 mouse_report.x = ps2_host_recv_response(); 81 mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER;
83 mouse_report.y = ps2_host_recv_response(); 82 mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER;
83#ifdef PS2_MOUSE_ENABLE_SCROLLING
84 mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK) * PS2_MOUSE_V_MULTIPLIER;
85#endif
84 } else { 86 } else {
85 if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); 87 if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n");
86 return; 88 return;
87 } 89 }
88 xprintf("%ud ", timer_read());
89 print("ps2_mouse raw: [");
90 phex(mouse_report.buttons); print("|");
91 print_hex8((uint8_t)mouse_report.x); print(" ");
92 print_hex8((uint8_t)mouse_report.y); print("]\n");
93 90
94 /* if mouse moves or buttons state changes */ 91 /* if mouse moves or buttons state changes */
95 if (mouse_report.x || mouse_report.y || 92 if (mouse_report.x || mouse_report.y || mouse_report.v ||
96 ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) { 93 ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) {
97 94#ifdef PS2_MOUSE_DEBUG_RAW
98#ifdef PS2_MOUSE_DEBUG 95 // Used to debug raw ps2 bytes from mouse
99 print("ps2_mouse raw: ["); 96 ps2_mouse_print_report(&mouse_report);
100 phex(mouse_report.buttons); print("|");
101 print_hex8((uint8_t)mouse_report.x); print(" ");
102 print_hex8((uint8_t)mouse_report.y); print("]\n");
103#endif 97#endif
104
105 buttons_prev = mouse_report.buttons; 98 buttons_prev = mouse_report.buttons;
99 ps2_mouse_convert_report_to_hid(&mouse_report);
100#if PS2_MOUSE_SCROLL_BTN_MASK
101 ps2_mouse_scroll_button_task(&mouse_report);
102#endif
103#ifdef PS2_MOUSE_DEBUG_HID
104 // Used to debug the bytes sent to the host
105 ps2_mouse_print_report(&mouse_report);
106#endif
107 host_mouse_send(&mouse_report);
108 }
109
110 ps2_mouse_clear_report(&mouse_report);
111}
106 112
107 // PS/2 mouse data is '9-bit integer'(-256 to 255) which is comprised of sign-bit and 8-bit value. 113void ps2_mouse_disable_data_reporting(void) {
108 // bit: 8 7 ... 0 114 PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting");
109 // sign \8-bit/ 115}
110 //
111 // Meanwhile USB HID mouse indicates 8bit data(-127 to 127), note that -128 is not used.
112 //
113 // This converts PS/2 data into HID value. Use only -127-127 out of PS/2 9-bit.
114 mouse_report.x = X_IS_NEG ?
115 ((!X_IS_OVF && -127 <= mouse_report.x && mouse_report.x <= -1) ? mouse_report.x : -127) :
116 ((!X_IS_OVF && 0 <= mouse_report.x && mouse_report.x <= 127) ? mouse_report.x : 127);
117 mouse_report.y = Y_IS_NEG ?
118 ((!Y_IS_OVF && -127 <= mouse_report.y && mouse_report.y <= -1) ? mouse_report.y : -127) :
119 ((!Y_IS_OVF && 0 <= mouse_report.y && mouse_report.y <= 127) ? mouse_report.y : 127);
120 116
121 // remove sign and overflow flags 117void ps2_mouse_enable_data_reporting(void) {
122 mouse_report.buttons &= PS2_MOUSE_BTN_MASK; 118 PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting");
119}
123 120
124 // invert coordinate of y to conform to USB HID mouse 121void ps2_mouse_set_remote_mode(void) {
125 mouse_report.y = -mouse_report.y; 122 PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode");
123 ps2_mouse_mode = PS2_MOUSE_REMOTE_MODE;
124}
126 125
126void ps2_mouse_set_stream_mode(void) {
127 PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_STREAM_MODE, "ps2 mouse set stream mode");
128 ps2_mouse_mode = PS2_MOUSE_STREAM_MODE;
129}
127 130
128#if PS2_MOUSE_SCROLL_BTN_MASK 131void ps2_mouse_set_scaling_2_1(void) {
129 static uint16_t scroll_button_time = 0; 132 PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1");
130 if ((mouse_report.buttons & (PS2_MOUSE_SCROLL_BTN_MASK)) == (PS2_MOUSE_SCROLL_BTN_MASK)) { 133}
131 if (scroll_state == SCROLL_NONE) { 134
132 scroll_button_time = timer_read(); 135void ps2_mouse_set_scaling_1_1(void) {
133 scroll_state = SCROLL_BTN; 136 PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1");
134 } 137}
135 138
136 // doesn't send Scroll Button 139void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) {
137 //mouse_report.buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK); 140 PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_RESOLUTION, resolution, "ps2 mouse set resolution");
138 141}
139 if (mouse_report.x || mouse_report.y) { 142
140 scroll_state = SCROLL_SENT; 143void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) {
141 144 PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_SAMPLE_RATE, sample_rate, "ps2 mouse set sample rate");
142 mouse_report.v = -mouse_report.y/(PS2_MOUSE_SCROLL_DIVISOR_V); 145}
143 mouse_report.h = mouse_report.x/(PS2_MOUSE_SCROLL_DIVISOR_H); 146
144 mouse_report.x = 0; 147/* ============================= HELPERS ============================ */
145 mouse_report.y = 0; 148
146 //host_mouse_send(&mouse_report); 149#define X_IS_NEG (mouse_report->buttons & (1<<PS2_MOUSE_X_SIGN))
147 } 150#define Y_IS_NEG (mouse_report->buttons & (1<<PS2_MOUSE_Y_SIGN))
151#define X_IS_OVF (mouse_report->buttons & (1<<PS2_MOUSE_X_OVFLW))
152#define Y_IS_OVF (mouse_report->buttons & (1<<PS2_MOUSE_Y_OVFLW))
153static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) {
154 // PS/2 mouse data is '9-bit integer'(-256 to 255) which is comprised of sign-bit and 8-bit value.
155 // bit: 8 7 ... 0
156 // sign \8-bit/
157 //
158 // Meanwhile USB HID mouse indicates 8bit data(-127 to 127), note that -128 is not used.
159 //
160 // This converts PS/2 data into HID value. Use only -127-127 out of PS/2 9-bit.
161 mouse_report->x = X_IS_NEG ?
162 ((!X_IS_OVF && -127 <= mouse_report->x && mouse_report->x <= -1) ? mouse_report->x : -127) :
163 ((!X_IS_OVF && 0 <= mouse_report->x && mouse_report->x <= 127) ? mouse_report->x : 127);
164 mouse_report->y = Y_IS_NEG ?
165 ((!Y_IS_OVF && -127 <= mouse_report->y && mouse_report->y <= -1) ? mouse_report->y : -127) :
166 ((!Y_IS_OVF && 0 <= mouse_report->y && mouse_report->y <= 127) ? mouse_report->y : 127);
167
168 // remove sign and overflow flags
169 mouse_report->buttons &= PS2_MOUSE_BTN_MASK;
170
171 // invert coordinate of y to conform to USB HID mouse
172 mouse_report->y = -mouse_report->y;
173}
174
175static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report) {
176 mouse_report->x = 0;
177 mouse_report->y = 0;
178 mouse_report->v = 0;
179 mouse_report->h = 0;
180 mouse_report->buttons = 0;
181}
182
183static inline void ps2_mouse_print_report(report_mouse_t *mouse_report) {
184 if (!debug_mouse) return;
185 print("ps2_mouse: [");
186 phex(mouse_report->buttons); print("|");
187 print_hex8((uint8_t)mouse_report->x); print(" ");
188 print_hex8((uint8_t)mouse_report->y); print(" ");
189 print_hex8((uint8_t)mouse_report->v); print(" ");
190 print_hex8((uint8_t)mouse_report->h); print("]\n");
191}
192
193static inline void ps2_mouse_enable_scrolling(void) {
194 PS2_MOUSE_SEND(PS2_MOUSE_SET_SAMPLE_RATE, "Initiaing scroll wheel enable: Set sample rate");
195 PS2_MOUSE_SEND(200, "200");
196 PS2_MOUSE_SEND(PS2_MOUSE_SET_SAMPLE_RATE, "Set sample rate");
197 PS2_MOUSE_SEND(100, "100");
198 PS2_MOUSE_SEND(PS2_MOUSE_SET_SAMPLE_RATE, "Set sample rate");
199 PS2_MOUSE_SEND(80, "80");
200 PS2_MOUSE_SEND(PS2_MOUSE_GET_DEVICE_ID, "Finished enabling scroll wheel");
201 _delay_ms(20);
202}
203
204#define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK)
205#define RELEASE_SCROLL_BUTTONS mouse_report->buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK)
206static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
207 static enum {
208 SCROLL_NONE,
209 SCROLL_BTN,
210 SCROLL_SENT,
211 } scroll_state = SCROLL_NONE;
212 static uint16_t scroll_button_time = 0;
213
214 if (PS2_MOUSE_SCROLL_BTN_MASK == (mouse_report->buttons & (PS2_MOUSE_SCROLL_BTN_MASK))) {
215 // All scroll buttons are pressed
216
217 if (scroll_state == SCROLL_NONE) {
218 scroll_button_time = timer_read();
219 scroll_state = SCROLL_BTN;
148 } 220 }
149 else if ((mouse_report.buttons & (PS2_MOUSE_SCROLL_BTN_MASK)) == 0) { 221
222 // If the mouse has moved, update the report to scroll instead of move the mouse
223 if (mouse_report->x || mouse_report->y) {
224 scroll_state = SCROLL_SENT;
225 mouse_report->v = -mouse_report->y/(PS2_MOUSE_SCROLL_DIVISOR_V);
226 mouse_report->h = mouse_report->x/(PS2_MOUSE_SCROLL_DIVISOR_H);
227 mouse_report->x = 0;
228 mouse_report->y = 0;
229 }
230 } else if (0 == (PS2_MOUSE_SCROLL_BTN_MASK & mouse_report->buttons)) {
231 // None of the scroll buttons are pressed
232
150#if PS2_MOUSE_SCROLL_BTN_SEND 233#if PS2_MOUSE_SCROLL_BTN_SEND
151 if (scroll_state == SCROLL_BTN && 234 if (scroll_state == SCROLL_BTN
152 TIMER_DIFF_16(timer_read(), scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) { 235 && timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) {
153 // send Scroll Button(down and up at once) when not scrolled 236 PRESS_SCROLL_BUTTONS;
154 mouse_report.buttons |= (PS2_MOUSE_SCROLL_BTN_MASK); 237 host_mouse_send(mouse_report);
155 host_mouse_send(&mouse_report); 238 _delay_ms(100);
156 _delay_ms(100); 239 RELEASE_SCROLL_BUTTONS;
157 mouse_report.buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK);
158 }
159#endif
160 scroll_state = SCROLL_NONE;
161 } 240 }
162 // doesn't send Scroll Button
163 mouse_report.buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK);
164#endif 241#endif
165 242 scroll_state = SCROLL_NONE;
166
167 host_mouse_send(&mouse_report);
168 print_usb_data();
169 } 243 }
170 // clear report
171 mouse_report.x = 0;
172 mouse_report.y = 0;
173 mouse_report.v = 0;
174 mouse_report.h = 0;
175 mouse_report.buttons = 0;
176}
177 244
178static void print_usb_data(void) 245 RELEASE_SCROLL_BUTTONS;
179{ 246}
180 if (!debug_mouse) return;
181 print("ps2_mouse usb: [");
182 phex(mouse_report.buttons); print("|");
183 print_hex8((uint8_t)mouse_report.x); print(" ");
184 print_hex8((uint8_t)mouse_report.y); print(" ");
185 print_hex8((uint8_t)mouse_report.v); print(" ");
186 print_hex8((uint8_t)mouse_report.h); print("]\n");
187}
188
189
190/* PS/2 Mouse Synopsis
191 * http://www.computer-engineering.org/ps2mouse/
192 *
193 * Command:
194 * 0xFF: Reset
195 * 0xF6: Set Defaults Sampling; rate=100, resolution=4cnt/mm, scaling=1:1, reporting=disabled
196 * 0xF5: Disable Data Reporting
197 * 0xF4: Enable Data Reporting
198 * 0xF3: Set Sample Rate
199 * 0xF2: Get Device ID
200 * 0xF0: Set Remote Mode
201 * 0xEB: Read Data
202 * 0xEA: Set Stream Mode
203 * 0xE9: Status Request
204 * 0xE8: Set Resolution
205 * 0xE7: Set Scaling 2:1
206 * 0xE6: Set Scaling 1:1
207 *
208 * Mode:
209 * Stream Mode: devices sends the data when it changs its state
210 * Remote Mode: host polls the data periodically
211 *
212 * This code uses Remote Mode and polls the data with Read Data(0xEB).
213 *
214 * Data format:
215 * byte|7 6 5 4 3 2 1 0
216 * ----+--------------------------------------------------------------
217 * 0|Yovflw Xovflw Ysign Xsign 1 Middle Right Left
218 * 1| X movement
219 * 2| Y movement
220 */
diff --git a/tmk_core/protocol/ps2_mouse.h b/tmk_core/protocol/ps2_mouse.h
index 27d9790d4..3c93a4634 100644
--- a/tmk_core/protocol/ps2_mouse.h
+++ b/tmk_core/protocol/ps2_mouse.h
@@ -19,16 +19,61 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19#define PS2_MOUSE_H 19#define PS2_MOUSE_H
20 20
21#include <stdbool.h> 21#include <stdbool.h>
22#include "debug.h"
22 23
23#define PS2_MOUSE_READ_DATA 0xEB 24#define PS2_MOUSE_SEND(command, message) \
25do { \
26 uint8_t rcv = ps2_host_send(command); \
27 if (debug_mouse) { \
28 print((message)); \
29 xprintf(" command: %X, result: %X, error: %X \n", command, rcv, ps2_error); \
30 } \
31} while(0)
32
33#define PS2_MOUSE_SEND_SAFE(command, message) \
34do { \
35 if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
36 ps2_mouse_disable_data_reporting(); \
37 } \
38 PS2_MOUSE_SEND(command, message); \
39 if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
40 ps2_mouse_enable_data_reporting(); \
41 } \
42} while(0)
43
44#define PS2_MOUSE_SET_SAFE(command, value, message) \
45do { \
46 if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
47 ps2_mouse_disable_data_reporting(); \
48 } \
49 PS2_MOUSE_SEND(command, message); \
50 PS2_MOUSE_SEND(value, "Sending value"); \
51 if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
52 ps2_mouse_enable_data_reporting(); \
53 } \
54} while(0)
55
56#define PS2_MOUSE_RECEIVE(message) \
57do { \
58 uint8_t rcv = ps2_host_recv_response(); \
59 if (debug_mouse) { \
60 print((message)); \
61 xprintf(" result: %X, error: %X \n", rcv, ps2_error); \
62 } \
63} while(0)
64
65static enum ps2_mouse_mode_e {
66 PS2_MOUSE_STREAM_MODE,
67 PS2_MOUSE_REMOTE_MODE,
68} ps2_mouse_mode = PS2_MOUSE_STREAM_MODE;
24 69
25/* 70/*
26 * Data format: 71 * Data format:
27 * byte|7 6 5 4 3 2 1 0 72 * byte|7 6 5 4 3 2 1 0
28 * ----+-------------------------------------------------------------- 73 * ----+----------------------------------------------------------------
29 * 0|Yovflw Xovflw Ysign Xsign 1 Middle Right Left 74 * 0|[Yovflw][Xovflw][Ysign ][Xsign ][ 1 ][Middle][Right ][Left ]
30 * 1| X movement(0-255) 75 * 1|[ X movement(0-255) ]
31 * 2| Y movement(0-255) 76 * 2|[ Y movement(0-255) ]
32 */ 77 */
33#define PS2_MOUSE_BTN_MASK 0x07 78#define PS2_MOUSE_BTN_MASK 0x07
34#define PS2_MOUSE_BTN_LEFT 0 79#define PS2_MOUSE_BTN_LEFT 0
@@ -39,10 +84,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
39#define PS2_MOUSE_X_OVFLW 6 84#define PS2_MOUSE_X_OVFLW 6
40#define PS2_MOUSE_Y_OVFLW 7 85#define PS2_MOUSE_Y_OVFLW 7
41 86
42
43/*
44 * Scroll by mouse move with pressing button
45 */
46/* mouse button to start scrolling; set 0 to disable scroll */ 87/* mouse button to start scrolling; set 0 to disable scroll */
47#ifndef PS2_MOUSE_SCROLL_BTN_MASK 88#ifndef PS2_MOUSE_SCROLL_BTN_MASK
48#define PS2_MOUSE_SCROLL_BTN_MASK (1<<PS2_MOUSE_BTN_MIDDLE) 89#define PS2_MOUSE_SCROLL_BTN_MASK (1<<PS2_MOUSE_BTN_MIDDLE)
@@ -58,9 +99,79 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
58#ifndef PS2_MOUSE_SCROLL_DIVISOR_H 99#ifndef PS2_MOUSE_SCROLL_DIVISOR_H
59#define PS2_MOUSE_SCROLL_DIVISOR_H 2 100#define PS2_MOUSE_SCROLL_DIVISOR_H 2
60#endif 101#endif
102/* multiply reported mouse values by these */
103#ifndef PS2_MOUSE_X_MULTIPLIER
104#define PS2_MOUSE_X_MULTIPLIER 1
105#endif
106#ifndef PS2_MOUSE_Y_MULTIPLIER
107#define PS2_MOUSE_Y_MULTIPLIER 1
108#endif
109#ifndef PS2_MOUSE_V_MULTIPLIER
110#define PS2_MOUSE_V_MULTIPLIER 1
111#endif
112/* For some mice this will need to be 0x0F */
113#ifndef PS2_MOUSE_SCROLL_MASK
114#define PS2_MOUSE_SCROLL_MASK 0xFF
115#endif
116#ifndef PS2_MOUSE_INIT_DELAY
117#define PS2_MOUSE_INIT_DELAY 1000
118#endif
61 119
120enum ps2_mouse_command_e {
121 PS2_MOUSE_RESET = 0xFF,
122 PS2_MOUSE_RESEND = 0xFE,
123 PS2_MOSUE_SET_DEFAULTS = 0xF6,
124 PS2_MOUSE_DISABLE_DATA_REPORTING = 0xF5,
125 PS2_MOUSE_ENABLE_DATA_REPORTING = 0xF4,
126 PS2_MOUSE_SET_SAMPLE_RATE = 0xF3,
127 PS2_MOUSE_GET_DEVICE_ID = 0xF2,
128 PS2_MOUSE_SET_REMOTE_MODE = 0xF0,
129 PS2_MOUSE_SET_WRAP_MODE = 0xEC,
130 PS2_MOUSE_READ_DATA = 0xEB,
131 PS2_MOUSE_SET_STREAM_MODE = 0xEA,
132 PS2_MOUSE_STATUS_REQUEST = 0xE9,
133 PS2_MOUSE_SET_RESOLUTION = 0xE8,
134 PS2_MOUSE_SET_SCALING_2_1 = 0xE7,
135 PS2_MOUSE_SET_SCALING_1_1 = 0xE6,
136};
137
138typedef enum ps2_mouse_resolution_e {
139 PS2_MOUSE_1_COUNT_MM,
140 PS2_MOUSE_2_COUNT_MM,
141 PS2_MOUSE_4_COUNT_MM,
142 PS2_MOUSE_8_COUNT_MM,
143} ps2_mouse_resolution_t;
144
145typedef enum ps2_mouse_sample_rate_e {
146 PS2_MOUSE_10_SAMPLES_SEC = 10,
147 PS2_MOUSE_20_SAMPLES_SEC = 20,
148 PS2_MOUSE_40_SAMPLES_SEC = 40,
149 PS2_MOUSE_60_SAMPLES_SEC = 60,
150 PS2_MOUSE_80_SAMPLES_SEC = 80,
151 PS2_MOUSE_100_SAMPLES_SEC = 100,
152 PS2_MOUSE_200_SAMPLES_SEC = 200,
153} ps2_mouse_sample_rate_t;
154
155void ps2_mouse_init(void);
156
157void ps2_mouse_init_user(void);
62 158
63uint8_t ps2_mouse_init(void);
64void ps2_mouse_task(void); 159void ps2_mouse_task(void);
65 160
161void ps2_mouse_disable_data_reporting(void);
162
163void ps2_mouse_enable_data_reporting(void);
164
165void ps2_mouse_set_remote_mode(void);
166
167void ps2_mouse_set_stream_mode(void);
168
169void ps2_mouse_set_scaling_2_1(void);
170
171void ps2_mouse_set_scaling_1_1(void);
172
173void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution);
174
175void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate);
176
66#endif 177#endif
diff --git a/tmk_core/ring_buffer.h b/tmk_core/ring_buffer.h
index 7bdebbcf3..005d1be61 100644
--- a/tmk_core/ring_buffer.h
+++ b/tmk_core/ring_buffer.h
@@ -4,13 +4,13 @@
4 * Ring buffer to store scan codes from keyboard 4 * Ring buffer to store scan codes from keyboard
5 *------------------------------------------------------------------*/ 5 *------------------------------------------------------------------*/
6#define RBUF_SIZE 32 6#define RBUF_SIZE 32
7#include <util/atomic.h>
7static uint8_t rbuf[RBUF_SIZE]; 8static uint8_t rbuf[RBUF_SIZE];
8static uint8_t rbuf_head = 0; 9static uint8_t rbuf_head = 0;
9static uint8_t rbuf_tail = 0; 10static uint8_t rbuf_tail = 0;
10static inline void rbuf_enqueue(uint8_t data) 11static inline void rbuf_enqueue(uint8_t data)
11{ 12{
12 uint8_t sreg = SREG; 13 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
13 cli();
14 uint8_t next = (rbuf_head + 1) % RBUF_SIZE; 14 uint8_t next = (rbuf_head + 1) % RBUF_SIZE;
15 if (next != rbuf_tail) { 15 if (next != rbuf_tail) {
16 rbuf[rbuf_head] = data; 16 rbuf[rbuf_head] = data;
@@ -18,36 +18,34 @@ static inline void rbuf_enqueue(uint8_t data)
18 } else { 18 } else {
19 print("rbuf: full\n"); 19 print("rbuf: full\n");
20 } 20 }
21 SREG = sreg; 21 }
22} 22}
23static inline uint8_t rbuf_dequeue(void) 23static inline uint8_t rbuf_dequeue(void)
24{ 24{
25 uint8_t val = 0; 25 uint8_t val = 0;
26 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
26 27
27 uint8_t sreg = SREG;
28 cli();
29 if (rbuf_head != rbuf_tail) { 28 if (rbuf_head != rbuf_tail) {
30 val = rbuf[rbuf_tail]; 29 val = rbuf[rbuf_tail];
31 rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE; 30 rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE;
32 } 31 }
33 SREG = sreg; 32 }
34 33
35 return val; 34 return val;
36} 35}
37static inline bool rbuf_has_data(void) 36static inline bool rbuf_has_data(void)
38{ 37{
39 uint8_t sreg = SREG; 38 bool has_data;
40 cli(); 39 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
41 bool has_data = (rbuf_head != rbuf_tail); 40 has_data = (rbuf_head != rbuf_tail);
42 SREG = sreg; 41 }
43 return has_data; 42 return has_data;
44} 43}
45static inline void rbuf_clear(void) 44static inline void rbuf_clear(void)
46{ 45{
47 uint8_t sreg = SREG; 46 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
48 cli();
49 rbuf_head = rbuf_tail = 0; 47 rbuf_head = rbuf_tail = 0;
50 SREG = sreg; 48 }
51} 49}
52 50
53#endif /* RING_BUFFER_H */ 51#endif /* RING_BUFFER_H */