From a656de0e17e1a43b899f7f7b1aef093851b6b699 Mon Sep 17 00:00:00 2001 From: David Allemang Date: Tue, 20 Feb 2024 14:49:58 -0500 Subject: [PATCH] crkbd layout --- keyboards/crkbd/keymaps/allemangd/config.h | 41 +++++++++++ keyboards/crkbd/keymaps/allemangd/keymap.c | 86 ++++++++++++++++++++++ keyboards/crkbd/keymaps/allemangd/rules.mk | 21 ++++++ users/allemangd/allemangd.c | 36 +++++++++ users/allemangd/allemangd.h | 81 ++++++++++++++++++++ users/allemangd/readme.md | 14 ++++ users/allemangd/rules.mk | 1 + 7 files changed, 280 insertions(+) create mode 100644 keyboards/crkbd/keymaps/allemangd/config.h create mode 100644 keyboards/crkbd/keymaps/allemangd/keymap.c create mode 100644 keyboards/crkbd/keymaps/allemangd/rules.mk create mode 100644 users/allemangd/allemangd.c create mode 100644 users/allemangd/allemangd.h create mode 100644 users/allemangd/readme.md create mode 100644 users/allemangd/rules.mk diff --git a/keyboards/crkbd/keymaps/allemangd/config.h b/keyboards/crkbd/keymaps/allemangd/config.h new file mode 100644 index 00000000000..c3e49bb8dc8 --- /dev/null +++ b/keyboards/crkbd/keymaps/allemangd/config.h @@ -0,0 +1,41 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +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 . +*/ + +#pragma once + +#define ENABLE_COMPILE_KEYCODE + +//#define USE_MATRIX_I2C + +/* Select hand configuration */ + +#define EE_HANDS +#define USE_SERIAL_PD2 + +#undef MANUFACTURER +#define MANUFACTURER "allemangD" +#undef PRODUCT +#define PRODUCT "Corne" + +#define OLED_DISABLE_TIMEOUT +#define OLED_BRIGHTNESS 128 + +//#define QUICK_TAP_TERM 0 +//#define TAPPING_TERM 100 diff --git a/keyboards/crkbd/keymaps/allemangd/keymap.c b/keyboards/crkbd/keymaps/allemangd/keymap.c new file mode 100644 index 00000000000..a2b2e9babf1 --- /dev/null +++ b/keyboards/crkbd/keymaps/allemangd/keymap.c @@ -0,0 +1,86 @@ +/* +Copyright 2019 @foostan +Copyright 2020 Drashna Jaelre <@drashna> + +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 . +*/ + +#include QMK_KEYBOARD_H + +#include "allemangd.h" + +// todo render_status + +#define UNWRAP_LAYOUT(...) LAYOUT_split_3x6_3(__VA_ARGS__) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_DVORAK] = UNWRAP_LAYOUT( + KC_TAB, __DVORAK_L1________________________________, __DVORAK_R1________________________________, KC_BSPC, + KC_ESC, __DVORAK_L2________________________________, __DVORAK_R2________________________________, KC_MINS, + KC_LSFT, __DVORAK_L3________________________________, __DVORAK_R3________________________________, KC_RSFT, + KC_LCTL, ET_LWER, DL_LALT, IN_RALT, SP_RAIS, AP_RCTL +), +[_LOWER] = UNWRAP_LAYOUT( + _______, __LOWER_L1_________________________________, __LOWER_R1_________________________________, _______, + _______, __LOWER_L2_________________________________, __LOWER_R2_________________________________, _______, + _______, __LOWER_L3_________________________________, __LOWER_R3_________________________________, _______, + _______, _______, _______, _______, _______, _______ +), +[_RAISE] = UNWRAP_LAYOUT( + KC_GRV, __RAISE_L1_________________________________, __RAISE_R1_________________________________, _______, + _______, __RAISE_L2_________________________________, __RAISE_R2_________________________________, _______, + _______, __RAISE_L3_________________________________, __RAISE_R3_________________________________, _______, + _______, _______, _______, _______, _______, _______ +), +[_ADJUST] = UNWRAP_LAYOUT( + QK_MAKE, __ADJUST_L1________________________________, __ADJUST_R1________________________________, QK_BOOT, + KC_VRSN, __ADJUST_L2________________________________, __ADJUST_R2________________________________, KC_PSCR, + _______, __ADJUST_L3________________________________, __ADJUST_R3________________________________, _______, + _______, _______, _______, _______, _______, _______ +), +}; +// clang-format on + +static void oled_render_layer_state(void) { + oled_write_P(PSTR("layer: "), false); + switch (get_highest_layer(layer_state)) { + case 0: + oled_write_ln_P(PSTR("dvorak"), false); + break; + case 1: + oled_write_ln_P(PSTR("lower"), false); + break; + case 2: + oled_write_ln_P(PSTR("raise"), false); + break; + case 3: + oled_write_ln_P(PSTR("adjust"), false); + break; + default: + oled_write_ln_P(PSTR("undef"), false); + break; + } +} + +void oled_render_logo(void); + +bool oled_task_user(void) { + if (is_keyboard_master()) { + oled_render_layer_state(); + } else { + oled_render_logo(); + } + return false; +} diff --git a/keyboards/crkbd/keymaps/allemangd/rules.mk b/keyboards/crkbd/keymaps/allemangd/rules.mk new file mode 100644 index 00000000000..2bdd6ed38f1 --- /dev/null +++ b/keyboards/crkbd/keymaps/allemangd/rules.mk @@ -0,0 +1,21 @@ +BOOTMAGIC_ENABLE = no +MOUSEKEY_ENABLE = yes +EXTRAKEY_ENABLE = yes +CONSOLE_ENABLE = yes +DEBUG_ENABLE = yes +NKRO_ENABLE = yes +BACKLIGHT_ENABLE = no +MIDI_ENABLE = no +AUDIO_ENABLE = no +UNICODE_ENABLE = no +BLUETOOTH_ENABLE = no +RGBLIGHT_ENABLE = no +SWAP_HANDS_ENABLE = no +RGB_MATRIX_ENABLE = no +HAPTIC_ENABLE = no +SLEEP_LED_ENABLE = no + +BOOTLOADER = caterina + +OLED_ENABLE = yes +OLED_DRIVER = ssd1306 diff --git a/users/allemangd/allemangd.c b/users/allemangd/allemangd.c new file mode 100644 index 00000000000..8945e32ec0b --- /dev/null +++ b/users/allemangd/allemangd.c @@ -0,0 +1,36 @@ +#include "allemangd.h" + +#define PRESS (record->event.pressed) +#define RELEASE (!record->event.pressed) + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_VRSN: + return PRESS && vrsn(); + default: + return true; + } +} + +bool vrsn() { + SEND_STRING( + QMK_KEYBOARD + ":" + QMK_KEYMAP + " (" + QMK_VERSION + " @ " + QMK_BUILDDATE + ")" + ); + return true; +} + +__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { + return state; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); + return layer_state_set_keymap(state); +} diff --git a/users/allemangd/allemangd.h b/users/allemangd/allemangd.h new file mode 100644 index 00000000000..85680182df6 --- /dev/null +++ b/users/allemangd/allemangd.h @@ -0,0 +1,81 @@ +#ifndef USERSPACE +#define USERSPACE + +#include "quantum.h" + +#include QMK_KEYBOARD_H +#include "version.h" + +void my_custom_function(void); + +enum userspace_layers { + _DVORAK = 0, + _LOWER, + _RAISE, + _ADJUST, + _MOUSE, +}; + +#define ET_LWER LT(_LOWER, KC_ENTER) +#define SP_RAIS LT(_RAISE, KC_SPC) +#define DL_LALT MT(MOD_LALT, KC_DEL) +#define IN_RALT MT(MOD_RALT, KC_INS) +#define AP_RCTL MT(MOD_RCTL, KC_APP) + +#if defined(KEYMAP_SAFE_RANGE) +# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE +#else +# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE +#endif + +enum userspace_custom_keycodes { + KC_VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info + NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes +}; + +bool vrsn(void); + +// clang-format off + +// todo LGUI_T in DVORAK_L3, DVORAK_R3 + +#define __BLANK____________________________________ _______, _______, _______, _______, _______ + +#define LG_SCLN LGUI_T(KC_SCLN) +#define RG_Z RGUI_T(KC_Z) + +#define __DVORAK_L1________________________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define __DVORAK_L2________________________________ KC_A, KC_O, KC_E, KC_U, KC_I +#define __DVORAK_L3________________________________ LG_SCLN, KC_Q, KC_J, KC_K, KC_X + +#define __DVORAK_R1________________________________ KC_F, KC_G, KC_C, KC_R, KC_L +#define __DVORAK_R2________________________________ KC_D, KC_H, KC_T, KC_N, KC_S +#define __DVORAK_R3________________________________ KC_B, KC_M, KC_W, KC_V, RG_Z + +#define __LOWER_L1_________________________________ KC_1, KC_2, KC_3, KC_4, KC_5 +#define __LOWER_L2_________________________________ KC_6, KC_7, KC_8, KC_9, KC_0 +#define __LOWER_L3_________________________________ _______, _______, _______, _______, _______ + +#define __LOWER_R1_________________________________ _______, KC_SLSH, KC_EQL, KC_BSLS, KC_QUES +#define __LOWER_R2_________________________________ _______, KC_LBRC, KC_LPRN, KC_RPRN, KC_RBRC +#define __LOWER_R3_________________________________ _______, _______, _______, _______, _______ + +#define __RAISE_L1_________________________________ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC +#define __RAISE_L2_________________________________ KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_CIRC +#define __RAISE_L3_________________________________ KC_SCLN, _______, _______, KC_AMPR, KC_PIPE + +#define __RAISE_R1_________________________________ _______, _______, KC_UP, _______, _______ +#define __RAISE_R2_________________________________ _______, KC_LEFT, KC_DOWN, KC_RGHT, _______ +#define __RAISE_R3_________________________________ _______, _______, _______, _______, _______ + +#define __ADJUST_L1________________________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 +#define __ADJUST_L2________________________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 +#define __ADJUST_L3________________________________ KC_F11, KC_F12, KC_F13, KC_F14, KC_F15 + +#define __ADJUST_R1________________________________ KC_MUTE, _______, KC_PGUP, _______, _______ +#define __ADJUST_R2________________________________ KC_VOLU, KC_HOME, KC_PGDN, KC_END, _______ +#define __ADJUST_R3________________________________ KC_VOLD, KC_MPRV, KC_MPLY, KC_MNXT, _______ + +// clang-format on + +#endif diff --git a/users/allemangd/readme.md b/users/allemangd/readme.md new file mode 100644 index 00000000000..fdea33b67a9 --- /dev/null +++ b/users/allemangd/readme.md @@ -0,0 +1,14 @@ +Copyright @ + +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 . \ No newline at end of file diff --git a/users/allemangd/rules.mk b/users/allemangd/rules.mk new file mode 100644 index 00000000000..2b9735860bf --- /dev/null +++ b/users/allemangd/rules.mk @@ -0,0 +1 @@ +SRC += allemangd.c