aboutsummaryrefslogtreecommitdiffstats
path: root/users/spidey3/spidey3.c
diff options
context:
space:
mode:
authorspidey3 <josh@windowoffire.com>2020-03-23 00:11:41 -0400
committerGitHub <noreply@github.com>2020-03-22 21:11:41 -0700
commit7e0dc5376f2d57a1b24831c4e25699a2cf2326af (patch)
tree141dd6fdbd2c9fac18b6d10c823187bd2a04b497 /users/spidey3/spidey3.c
parent6d1af6384227c941d817fee6f7e49537fc78cf2d (diff)
downloadfirmware-7e0dc5376f2d57a1b24831c4e25699a2cf2326af.tar.gz
firmware-7e0dc5376f2d57a1b24831c4e25699a2cf2326af.tar.bz2
firmware-7e0dc5376f2d57a1b24831c4e25699a2cf2326af.zip
[Keymap] Add spidey3 keymap for 75_ansi, and a spidey3 userspace (#8470)
* First cut at Josh Diamond's KBD75 customizations. Includes: * My unique keymap with ChromeOS specific keys * Use RGB underglow to indicate Caps Lock * Some unicode bindings * Some changes to make debugging easier * Updated spidey3 to be applicable to all 75_ansi boards * Sadly, ChromeOS doesn't pay attention to most consumer codes * Add mac layer; fix flakeyness in CAPS_LOCK underglow. * Make layers.json match the keymap (to the extent possible) * Major cleanup; fix broken debug persistence * Cleanup some whitespace issues * Fix incorrect log message. * Rework layer indication to user RGBLIGHT_LAYERS * Update layouts/community/75_ansi/spidey3/keymap.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Rename users/spidey3/rgblight.c to layer_rgb.c per suggestion * Refactor to use set_single_persistant_default_layer(). * Use dprint/f to make logging more elegant. * Update users/spidey3/config.h Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update users/spidey3/config.h Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update layouts/community/75_ansi/spidey3/rules.mk Co-Authored-By: Ryan <fauxpark@gmail.com> * Update users/spidey3/spidey3.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update users/spidey3/layer_rgb.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update users/spidey3/init.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Changes from code review Co-authored-by: Joshua Diamond <jdiamond@Deep-Thought.local> Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'users/spidey3/spidey3.c')
-rw-r--r--users/spidey3/spidey3.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c
new file mode 100644
index 000000000..d0b794704
--- /dev/null
+++ b/users/spidey3/spidey3.c
@@ -0,0 +1,80 @@
+#include QMK_KEYBOARD_H
+
+#include "spidey3.h"
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+
+// If console is enabled, it will print the matrix position and status of each key pressed
+// dprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
+
+ if (record->event.pressed) {
+ switch (keycode) {
+#ifndef NO_DEBUG
+ // Re-implement this here, but fix the persistence!
+ case DEBUG:
+ debug_enable ^= 1;
+ if (debug_enable) {
+ print("DEBUG: enabled.\n");
+ } else {
+ print("DEBUG: disabled.\n");
+ }
+ eeconfig_update_debug(debug_config.raw);
+#endif
+ return false;
+ case SPI_LNX:
+ dprint("SPIDEY3: SPI_LNX\n");
+ set_single_persistent_default_layer(_BASE);
+ layer_off(_OSX);
+#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE)
+ set_unicode_input_mode(UC_LNX);
+#endif
+ return false;
+ case SPI_OSX:
+ dprint("SPIDEY3: SPI_OSX\n");
+ set_single_persistent_default_layer(_OSX);
+#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE)
+ set_unicode_input_mode(UC_OSX);
+#endif
+ return false;
+ case SPI_WIN:
+ dprint("SPIDEY3: SPI_WIN\n");
+ set_single_persistent_default_layer(_BASE);
+ layer_off(_OSX);
+#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE)
+ set_unicode_input_mode(UC_WINC);
+#endif
+ return false;
+ }
+ }
+
+#ifdef RGBLIGHT_ENABLE
+ bool res = process_record_user_rgb(keycode, record);
+ if (!res) return false;
+#endif
+
+ return true;
+}
+
+layer_state_t default_layer_state_set_user(layer_state_t state) {
+#ifdef RGBLIGHT_ENABLE
+ return default_layer_state_set_user_rgb(state);
+#else
+ return state;
+#endif
+}
+
+layer_state_t layer_state_set_user(layer_state_t state) {
+#ifdef RGBLIGHT_ENABLE
+ return layer_state_set_user_rgb(state);
+#else
+ return state;
+#endif
+}
+
+bool led_update_user(led_t led_state) {
+#ifdef RGBLIGHT_ENABLE
+ return led_update_user_rgb(led_state);
+#else
+ return true;
+#endif
+}