summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorDaniel Shields <daniel.shields@bcs.org>2019-09-25 17:21:07 +0100
committernoroadsleft <18669334+noroadsleft@users.noreply.github.com>2019-09-25 09:21:07 -0700
commit00abe5d8edf801cad351bf428a24532ed80f652c (patch)
tree5afe96081a573c79cd8c41aa58fed26372e0fa5a /users
parent0f9e2659c96370377e36ddab0508498e151bfc62 (diff)
[Keymap] Various enhancements for dshields user space and keymaps. (#6816)
- Add oneshot mod/layer unlocking - Fix Planck rev 3 backlight breathing - Fix Planck rev 6 build with arm gcc 9.2.0 - General code clean up
Diffstat (limited to 'users')
-rw-r--r--users/dshields/config.h1
-rw-r--r--users/dshields/dshields.c43
-rw-r--r--users/dshields/dshields.h12
-rw-r--r--users/dshields/rules.mk15
4 files changed, 43 insertions, 28 deletions
diff --git a/users/dshields/config.h b/users/dshields/config.h
index 743f16f999..17eb98bd4f 100644
--- a/users/dshields/config.h
+++ b/users/dshields/config.h
@@ -5,6 +5,7 @@
#define ONESHOT_TAP_TOGGLE 2
#define ONESHOT_TIMEOUT 3000
#define RETRO_TAPPING
+#define BACKLIGHT_BREATHING
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
diff --git a/users/dshields/dshields.c b/users/dshields/dshields.c
index 6aff5c6716..bc88cae561 100644
--- a/users/dshields/dshields.c
+++ b/users/dshields/dshields.c
@@ -1,30 +1,31 @@
-extern keymap_config_t keymap_config;
+#include "quantum.h"
+#include "dshields.h"
-/* uncomment to reset
-void matrix_init_user(void) {
- eeconfig_init();
-};
-*/
+extern bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record);
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_record_dynamic_macro(keycode, record)) {
return false;
}
- return true;
-}
-
-// work in progress
-uint32_t layer_state_set_user(uint32_t state) {
- switch (biton32(state)) {
- case DEF:
- set_all_leds_to(0,0,0);
- break;
- case FUN:
- // TODO light the fn keys
- // set_led_to(?, 0, 128, 0);
- // set_led_to(?, 0, 128, 0);
- break;
+ if (keycode == KC_ESC && record->event.pressed) {
+ bool rc = true;
+ uint8_t mods = 0;
+ if ((mods = get_oneshot_mods()) && !has_oneshot_mods_timed_out()) {
+ clear_oneshot_mods();
+ unregister_mods(mods);
+ rc = false;
+ }
+ if ((mods = get_oneshot_locked_mods())) {
+ clear_oneshot_locked_mods();
+ unregister_mods(mods);
+ rc = false;
+ }
+ if (is_oneshot_layer_active()) {
+ layer_clear();
+ rc = false;
+ }
+ return rc;
}
- return state;
+ return true;
}
diff --git a/users/dshields/dshields.h b/users/dshields/dshields.h
index c746e74fb5..a65ccfea00 100644
--- a/users/dshields/dshields.h
+++ b/users/dshields/dshields.h
@@ -24,8 +24,18 @@
#ifdef KEYBOARD_planck_light
#define LGT_TOG RGB_TOG
#define LGT_MOD RGB_MOD
-#else
+ #define LGT_BRT _______
+#endif
+#ifdef KEYBOARD_planck_rev3
#define LGT_TOG BL_TOGG
#define LGT_MOD BL_STEP
+ #define LGT_BRT BL_BRTG
+#endif
+#ifdef KEYBOARD_planck_rev6
+ #define LGT_TOG _______
+ #define LGT_MOD _______
+ #define LGT_BRT _______
#endif
+enum layers { DEF, LWR, RSE, FUN };
+enum keycodes { DYNAMIC_MACRO_RANGE = SAFE_RANGE };
diff --git a/users/dshields/rules.mk b/users/dshields/rules.mk
index a2bec43357..06f6e5e9fa 100644
--- a/users/dshields/rules.mk
+++ b/users/dshields/rules.mk
@@ -1,9 +1,11 @@
-MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
-COMMAND_ENABLE = no # Commands for debug and configuration
-CONSOLE_ENABLE = no # Console for debug(+400)
-EXTRAKEY_ENABLE = no
-SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
-API_SYSEX_ENABLE = no
+SRC += dshields.c
+
+MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
+COMMAND_ENABLE = no # Commands for debug and configuration
+CONSOLE_ENABLE = no # Console for debug(+400)
+EXTRAKEY_ENABLE = no
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+API_SYSEX_ENABLE = no
ifeq ($(strip $(KEYBOARD)), planck/rev3)
AUDIO_ENABLE = no
@@ -11,6 +13,7 @@ ifeq ($(strip $(KEYBOARD)), planck/rev3)
RGB_MATRIX_ENABLE = no
endif
ifeq ($(strip $(KEYBOARD)), planck/rev6)
+ CFLAGS += -Wno-error=deprecated
EXTRALDFLAGS = -Wl,--build-id=none
AUDIO_ENABLE = no
BACKLIGHT_ENABLE = no