瀏覽代碼

[Keymap] add "ridingqwerty" user and keymap for atreus keyboard (#6533)

* add userspace and atreus keymap

* cleaning up notes/comments

* Update keyboards/atreus/keymaps/ridingqwerty/atreus.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Update keyboards/atreus/keymaps/ridingqwerty/atreus.c

Co-Authored-By: Joel Challis <git@zvecr.com>

* Create readme.md

* remove reference to matrix_init_kb from atreus.c

* correct atreus.c

* remove unnecessary defines

* merge register/unregister sequence into single tapcode

* move 'LAYOUT to keymap.c; remove atreus.h

* remove TAPPING_TERM from keyboard-level config.h
ridingqwerty 5 年之前
父節點
當前提交
0c03811d6a

+ 13 - 0
keyboards/atreus/keymaps/ridingqwerty/config.h

@@ -0,0 +1,13 @@
+#pragma once
+
+#undef MATRIX_ROWS
+#define MATRIX_ROWS 8
+
+#undef MATRIX_COLS
+#define MATRIX_COLS 6
+
+#undef MATRIX_ROW_PINS
+#define MATRIX_ROW_PINS { A6, A7, A8, A15, B11, B12, A14, A13 }
+
+#undef MATRIX_COL_PINS
+#define MATRIX_COL_PINS { B5, B4, B3, B2, B1, B0 }

+ 116 - 0
keyboards/atreus/keymaps/ridingqwerty/keymap.c

@@ -0,0 +1,116 @@
+/* Copyright 2019 George Koenig
+ *
+ * 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
+#include "ridingqwerty.h"
+
+/*                                                         Atreus      
+        ┏━━━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━┓                 ┏━━━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━┯━━━━━━━━┓
+        ┃   Q    │   W    │   E    │   R    │   T    ┃                 ┃   Y    │   U    │   I    │   O    │   P    ┃
+        ┠────────┼────────┼────────┼────────┼────────┨                 ┠────────┼────────┼────────┼────────┼────────┨
+       /┃  ¶ A   │   S    │   D    │   F    │   G    ┃                 ┃   H    │   J    │   K    │   L    │  🔢 ;  ┃
+        ┠────────┼────────┼────────┼────────┼────────┞━━━━━━━━┳━━━━━━━━┞────────┼────────┼────────┼────────┼────────┨
+       /┃  ⇧ Z   │   X    │   C    │   V    │   B    │        ┃        │   N    │   M    │   ,    │  𝔽 .   │  ⇧ /   ┃
+        ┠────────┼────────┼────────┼────────┼────────┤  ¶ ⎋   ┃  ❦ ⇥   ├────────┼────────┼────────┼────────┼────────┨
+        ┃  ⎈ ⎋   │  ⌘ ⇥   │  ⎇ [   │  ⇧ ]   │ 🔢 ⌫   │        ┃        │  ★ ␣   │  ⇧ -   │  ⎇ =   │  ⌘ '   │  ⎈ ↵   ┃
+        ┗━━━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━┻━━━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━┷━━━━━━━━┛
+                    MODS                   //              LAYERS              //                  MODS           //
+*/
+
+#ifdef LAYOUT
+#undef LAYOUT
+#define LAYOUT( \
+    K00,   K01,   K02,   K03,   K04,                 K40,   K41,   K42,   K43,   K44, \
+    K10,   K11,   K12,   K13,   K14,                 K50,   K51,   K52,   K53,   K54, \
+    K20,   K21,   K22,   K23,   K24,                 K60,   K61,   K62,   K63,   K64, \
+    K30,   K31,   K32,   K33,   K34,   K35,   K70,   K71,   K72,   K73,   K74,   K75  \
+) { \
+  { K00, K01, K02, K03, K04, KC_NO }, \
+  { K10, K11, K12, K13, K14, KC_NO }, \
+  { K20, K21, K22, K23, K24, KC_NO }, \
+  { K30, K31, K32, K33, K34, K35   }, \
+  { K44, K43, K42, K41, K40, KC_NO }, \
+  { K54, K53, K52, K51, K50, KC_NO }, \
+  { K64, K63, K62, K61, K60, KC_NO }, \
+  { K75, K74, K73, K72, K71, K70   }  \
+}
+#endif
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+  [_QWERTY] = LAYOUT( /* Qwerty */
+    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,                      KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,
+    ED_A,    KC_S,    KC_D,    KC_F,    KC_G,                      KC_H,    KC_J,    KC_K,    KC_L,    NM_SCLN,
+    LS_Z,    KC_X,    KC_C,    KC_V,    KC_B,                      KC_N,    KC_M,    KC_COMM, FK_DOT,  RS_SLSH,
+    LC_ESC,  LG_TAB,  LA_LBRC, LS_RBRC, NM_BSPC, ED_ESC,  SC_TAB,  SM_SPC,  RS_MINS, RA_EQL,  RG_QUOT, RC_ENT
+  ),
+  [_EDITOR] = LAYOUT( /* ED_A, ED_ESC */
+    KC_GRV,  _______, KC_END,  _______, KC_TAB,                    _______, _______, KC_INS,  _______, KC_PGUP,
+    KC_HOME, _______, KC_DELT, _______, _______,                   KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, KC_ENT, 
+    _______, _______, _______, _______, _______,                   KC_PGDN, _______, _______, _______, KC_BSLS,
+    _______, _______, _______, _______, _______, _______, KC_ENT,  _______, _______, _______, _______, _______
+  ),
+  [_NUMBER] = LAYOUT( /* NM_SCLN, NM_BSPC */
+    KC_1,    KC_2,    KC_3,    KC_4,    KC_5,                      KC_6,    KC_7,    KC_8,    KC_9,    KC_0,  
+    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,                      _______, KC_4,    KC_5,    KC_6,    _______,
+    _______, _______, _______, _______, _______,                   _______, KC_1,    KC_2,    KC_3,    KC_BSLS,
+    _______, _______, _______, _______, _______, KC_MINS, KC_EQL,  KC_0,    KC_0,    KC_DOT,  _______, _______
+  ),
+  [_SYMBOL] = LAYOUT( /* SM_SPC */
+    KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC,                   KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,
+    KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,                   _______, _______, _______, _______, KC_COLN, 
+    _______, _______, _______, _______, _______,                   _______, _______, _______, _______, KC_BSLS, 
+    _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, _______, _______, _______, _______, _______
+  ),
+  [_F_KEYS] = LAYOUT( /* FK_DOT */
+    KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,                     KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  
+    KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,                    _______, _______, _______, _______, KC_F11,
+    KC_F11,  KC_F12,  _______, _______, _______,                   _______, _______, _______, _______, KC_F12,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+  ),
+  [_SECRET] = LAYOUT( /* shhhh... */
+    RESET,   _______, _______, RUSTY,   FUEL,                      KC_F13,  _______, _______, _______, _______,
+    AR1ST,   SYSNOC,  _______, _______, _______,                   _______, _______, _______, OS_LAB,  _______,
+    CDLOCAL, _______, C0RE,    VAXIS,   _______,                   _______, MUNKY,   _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+  ),
+  [_FINAL] = LAYOUT( /* . */
+    _______, _______, _______, _______, _______,                   _______, _______, _______, _______, _______, 
+    _______, _______, _______, _______, _______,                   _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______,                   _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+  )
+};
+
+// custom tap/hold keys
+uint16_t key_timer;
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
+    switch(keycode) {
+        case RG_QUOT:   
+            if (record->event.pressed) {
+                key_timer = timer_read();
+                layer_on(_NUMBER);
+                register_mods(MOD_BIT(KC_RGUI));
+            } else {
+                unregister_mods(MOD_BIT(KC_RGUI));
+                layer_off(_NUMBER);
+                if (timer_elapsed(key_timer) < TAPPING_TERM) {
+                    tap_code(KC_QUOT);
+                }
+            }
+            return false; break;
+    }
+    return true;
+};

+ 1 - 0
keyboards/atreus/keymaps/ridingqwerty/readme.md

@@ -0,0 +1 @@
+This is a handwired Atreus42 using a Proton C

+ 17 - 0
keyboards/atreus/keymaps/ridingqwerty/rules.mk

@@ -0,0 +1,17 @@
+MCU = STM32F303
+
+# Build Options
+#   comment out to disable the options.
+#
+BACKLIGHT_ENABLE = no
+BOOTMAGIC_ENABLE = no  # Virtual DIP switch configuration
+#MOUSEKEY_ENABLE = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = yes  # Console for debug
+COMMAND_ENABLE = yes    # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
+NKRO_ENABLE = yes     # USB Nkey Rollover
+AUDIO_ENABLE = yes
+RGBLIGHT_ENABLE = no
+# SERIAL_LINK_ENABLE = yes
+#TAP_DANCE_ENABLE = yes

+ 3 - 0
users/ridingqwerty/config.h

@@ -0,0 +1,3 @@
+#pragma once
+#define TAPPING_TERM 175
+#define MACRO_TIMER 5

+ 33 - 0
users/ridingqwerty/process_records.c

@@ -0,0 +1,33 @@
+#include "ridingqwerty.h"
+
+__attribute__ ((weak))
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
+  return true;
+}
+
+__attribute__ ((weak))
+bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
+  return true;
+}
+
+uint16_t user_key_timer;
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+  switch(keycode) {
+    case RG_QUOT:
+      if (record->event.pressed) {
+        user_key_timer = timer_read();
+        layer_on(_NUMBER);
+        register_mods(MOD_BIT(KC_RGUI));
+      } else {
+        unregister_mods(MOD_BIT(KC_RGUI));
+        layer_off(_NUMBER);
+	if (timer_elapsed(user_key_timer) < TAPPING_TERM) {
+          register_code(KC_QUOT);
+	  unregister_code(KC_QUOT);
+	}
+      }
+      return false; break;
+  }
+  return process_record_keymap(keycode, record) &&
+    process_record_secrets(keycode, record);
+}

+ 29 - 0
users/ridingqwerty/process_records.h

@@ -0,0 +1,29 @@
+#pragma once
+#include "ridingqwerty.h"
+
+#if defined(KEYMAP_SAFE_RANGE)
+  #define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
+#else
+  #define PLACEHOLDER_SAFE_RANGE SAFE_RANGE
+#endif
+
+bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
+
+enum userspace_custom_keycodes {
+    FIRST = PLACEHOLDER_SAFE_RANGE,
+    RUSTY,
+    FUEL,
+    C0RE,
+    MUNKY,
+    AR1ST,
+    VAXIS,
+    OS_LAB,
+    CDLOCAL,
+    SYSNOC,
+    RG_QUOT,
+    LAST
+};
+
+bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record);

+ 1 - 0
users/ridingqwerty/ridingqwerty.c

@@ -0,0 +1 @@
+#include "ridingqwerty.h"

+ 37 - 0
users/ridingqwerty/ridingqwerty.h

@@ -0,0 +1,37 @@
+#pragma once
+
+#include "quantum.h"
+#include "process_records.h"
+
+enum userspace_layers
+{
+    _QWERTY = 0,
+    _EDITOR,
+    _NUMBER,
+    _SYMBOL,
+    _F_KEYS,
+    _DEBUG,
+    _SECRET,
+    _FINAL
+};
+
+// modtaps
+#define LS_Z MT(MOD_LSFT, KC_Z)
+#define LC_ESC MT(MOD_LCTL, KC_ESC)
+#define LG_TAB MT(MOD_LGUI, KC_TAB)
+#define LA_LBRC MT(MOD_LALT, KC_LBRC)
+#define LS_RBRC MT(MOD_LSFT, KC_RBRC)
+#define RS_MINS MT(MOD_RSFT, KC_MINS)
+#define RA_EQL MT(MOD_RALT, KC_EQL)
+//RG_LMOT defined in process_records.h
+#define RC_ENT MT(MOD_RCTL, KC_ENT)
+#define RS_SLSH MT(MOD_RSFT, KC_SLSH)
+// layertaps
+#define ED_A LT(_EDITOR, KC_A)
+#define ED_ESC LT(_EDITOR, KC_ESC)
+#define NM_SCLN LT(_NUMBER, KC_SCLN)
+#define NM_BSPC LT(_NUMBER, KC_BSPC)
+#define SM_SPC LT(_SYMBOL, KC_SPC)
+#define SC_TAB LT(_SECRET, KC_TAB)
+#define FK_DOT LT(_F_KEYS, KC_DOT)
+

+ 8 - 0
users/ridingqwerty/rules.mk

@@ -0,0 +1,8 @@
+#LEADER_ENABLE = yes
+
+SRC += ridingqwerty.c \
+       process_records.c
+
+ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
+  SRC += secrets.c
+endif