From 0c03811d6affb31d9952e9b4c9c0f5e10fddee8a Mon Sep 17 00:00:00 2001 From: ridingqwerty Date: Fri, 16 Aug 2019 19:54:16 -0400 Subject: [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 * Update keyboards/atreus/keymaps/ridingqwerty/atreus.c Co-Authored-By: Joel Challis * 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 --- users/ridingqwerty/config.h | 3 +++ users/ridingqwerty/process_records.c | 33 ++++++++++++++++++++++++++++++++ users/ridingqwerty/process_records.h | 29 ++++++++++++++++++++++++++++ users/ridingqwerty/ridingqwerty.c | 1 + users/ridingqwerty/ridingqwerty.h | 37 ++++++++++++++++++++++++++++++++++++ users/ridingqwerty/rules.mk | 8 ++++++++ 6 files changed, 111 insertions(+) create mode 100644 users/ridingqwerty/config.h create mode 100644 users/ridingqwerty/process_records.c create mode 100644 users/ridingqwerty/process_records.h create mode 100644 users/ridingqwerty/ridingqwerty.c create mode 100644 users/ridingqwerty/ridingqwerty.h create mode 100644 users/ridingqwerty/rules.mk (limited to 'users/ridingqwerty') diff --git a/users/ridingqwerty/config.h b/users/ridingqwerty/config.h new file mode 100644 index 0000000000..2461b8b8dd --- /dev/null +++ b/users/ridingqwerty/config.h @@ -0,0 +1,3 @@ +#pragma once +#define TAPPING_TERM 175 +#define MACRO_TIMER 5 diff --git a/users/ridingqwerty/process_records.c b/users/ridingqwerty/process_records.c new file mode 100644 index 0000000000..be72883ecb --- /dev/null +++ b/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); +} diff --git a/users/ridingqwerty/process_records.h b/users/ridingqwerty/process_records.h new file mode 100644 index 0000000000..2c453bcd93 --- /dev/null +++ b/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); diff --git a/users/ridingqwerty/ridingqwerty.c b/users/ridingqwerty/ridingqwerty.c new file mode 100644 index 0000000000..fd39021da5 --- /dev/null +++ b/users/ridingqwerty/ridingqwerty.c @@ -0,0 +1 @@ +#include "ridingqwerty.h" diff --git a/users/ridingqwerty/ridingqwerty.h b/users/ridingqwerty/ridingqwerty.h new file mode 100644 index 0000000000..ae5262567c --- /dev/null +++ b/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) + diff --git a/users/ridingqwerty/rules.mk b/users/ridingqwerty/rules.mk new file mode 100644 index 0000000000..9c38467448 --- /dev/null +++ b/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 -- cgit v1.2.3