summaryrefslogtreecommitdiff
path: root/keyboards/s_ol
diff options
context:
space:
mode:
authorSimon Fell <fellforce@gmail.com>2022-12-12 18:36:05 -0800
committerGitHub <noreply@github.com>2022-12-12 18:36:05 -0800
commit2792ee6573f94008fd6e6825d58b40b34696e44b (patch)
tree247a8654c076105716c0b0e477ffa7919dcc459f /keyboards/s_ol
parent29b8bbc4a03f0dce4259ebd3a958a2221b58fae8 (diff)
[Keymap] superfell's custom keymap for the 0xc pad (#19196)
Diffstat (limited to 'keyboards/s_ol')
-rw-r--r--keyboards/s_ol/0xc_pad/keymaps/superfell/keymap.c86
-rw-r--r--keyboards/s_ol/0xc_pad/keymaps/superfell/readme.md7
2 files changed, 93 insertions, 0 deletions
diff --git a/keyboards/s_ol/0xc_pad/keymaps/superfell/keymap.c b/keyboards/s_ol/0xc_pad/keymaps/superfell/keymap.c
new file mode 100644
index 0000000000..ff626b9236
--- /dev/null
+++ b/keyboards/s_ol/0xc_pad/keymaps/superfell/keymap.c
@@ -0,0 +1,86 @@
+/* Copyright 2022 Simon Fell
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include QMK_KEYBOARD_H
+
+enum custom_layers {
+ _NUMPAD,
+ _CONTROL,
+ _ADJUST,
+};
+
+#define RGBLIGHT_TIMEOUT 30000 // 30 seconds
+
+// clang-format off
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [_NUMPAD] = LAYOUT(
+ TO(_CONTROL), KC_DOT,
+ KC_7 , KC_8, KC_9,
+ KC_4, KC_5, KC_6, KC_0,
+ KC_1 , KC_2 , KC_3
+ ),
+ [_CONTROL] = LAYOUT(
+ TO(_ADJUST), _______,
+ LGUI(KC_X), LGUI(KC_C), LGUI(KC_V),
+ LGUI(KC_Q), LGUI(KC_W), LGUI(KC_N), LGUI(KC_S),
+ KC_VOLD , KC_MUTE , KC_VOLU
+ ),
+ [_ADJUST] = LAYOUT(
+ TO(_NUMPAD), QK_BOOT,
+ XXXXXXX, XXXXXXX, XXXXXXX,
+ RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX,
+ RGB_TOG, RGB_VAD, RGB_VAI
+ ),
+};
+// clang-format on
+
+layer_state_t layer_state_set_user(layer_state_t state) {
+ switch (get_highest_layer(state)) {
+ case _NUMPAD:
+ rgblight_sethsv_noeeprom(170, 255, 128);
+ rgblight_mode_noeeprom(2);
+ break;
+ case _CONTROL:
+ rgblight_mode_noeeprom(3);
+ break;
+ case _ADJUST:
+ rgblight_mode_noeeprom(4);
+ break;
+ }
+ return state;
+}
+// turn rgb off after some amount of inactivity
+
+static uint16_t key_timer; // timer to track the last keyboard activity
+static bool is_rgb_timeout = false; // store if RGB has timed out or not in a boolean
+
+/* Runs at the end of each scan loop, check if RGB timeout has occurred */
+void housekeeping_task_user(void) {
+ if (!is_rgb_timeout && timer_elapsed(key_timer) > RGBLIGHT_TIMEOUT) {
+ rgblight_disable_noeeprom();
+ is_rgb_timeout = true;
+ }
+}
+
+/* Runs after each key press, check if activity occurred */
+void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ key_timer = timer_read(); // store time of last refresh
+ if (is_rgb_timeout) { // only do something if rgb has timed out
+ is_rgb_timeout = false;
+ rgblight_enable_noeeprom();
+ }
+ }
+}
diff --git a/keyboards/s_ol/0xc_pad/keymaps/superfell/readme.md b/keyboards/s_ol/0xc_pad/keymaps/superfell/readme.md
new file mode 100644
index 0000000000..85325649a6
--- /dev/null
+++ b/keyboards/s_ol/0xc_pad/keymaps/superfell/readme.md
@@ -0,0 +1,7 @@
+# 0xC.pad Layout
+
+​
+This is a 3 layer layout comprising of numpad, a number of osx shortcuts and an adjust layer
+that can put it into boot mode.
+The top left key cycles between the layers.
+The layers all have unique rgb animations so you can easily tell which layer is active.