From db8cf0b872a1350f11d2de931f7b375feaec69c2 Mon Sep 17 00:00:00 2001 From: Walter Hanley Date: Thu, 6 Jan 2022 19:38:42 -0600 Subject: [Keyboard] Add Support for Wren Keyboard (#14570) * initial prime_o commit * Cleaned up comments, other things. * Updated keymap to use standard seven-underscore KC_TRNS notation * initial prime_o commit * Cleaned up comments, other things. * Updated keymap to use standard seven-underscore KC_TRNS notation * Initial Code for Wren Keyboard This is the initial hardware test commit for the wren. More detailed keymaps will be added soon. * Update layout and add author * Add PCB Image and Clarify Bootloader Instructions * Update config.h Updating config.h to remove mentions to LED backlighting (not supported on this PCB) * Update wren.h to match PR checklist * Roll back addition of code that should have been in wren.h * Update /default/keymap.c Make keyboard.c "pristine" to the best of my ability and add information about configuring a "non-standard" layout. * Update readme.md * Update keymap readmes to match PR checklist * Update readme.md * Final touches before PR * Un-delete non-wren files * Create rules.mk * Create config.h * Update keyboards/wren/keymaps/walterhanley/keymap.c * Update keyboards/wren/keymaps/walterhanley/keymap.c * Update keyboards/wren/wren.c As per feedback, move encoder definition to wren.c from keymap.c. * Update keyboards/wren/keymaps/walterhanley/keymap.c As per feedback, move encoder definition to wren.c from keymap.c * Update keyboards/wren/keymaps/default/keymap.c As per feedback, move encoder definition to wren.c from keymap.c * Create Keymap-Level config.h I've been dealing with some issues with this board over-drawing power on certain devices; this should fix that issue on my build without affecting other users. * Add bells and whistles to personal keymap This update adds bells and whistles to my personal keymap. I couldn't figure out how to modify rotary encoder functionality for just my personal layout with the definition in wren.c, so I moved it back into the individual keymaps. Please let me know if this is an issue and I can look into possible alternative implementations. * Update to match drashna's requested changes * Update keymap.c This update refines drashna's requested changes. * Update keymap.c Fix typo --- keyboards/wren/config.h | 125 +++++++++++++++++++ keyboards/wren/keymaps/default/keymap.c | 36 ++++++ keyboards/wren/keymaps/default/readme.md | 11 ++ keyboards/wren/keymaps/walterhanley/config.h | 20 +++ keyboards/wren/keymaps/walterhanley/keymap.c | 170 ++++++++++++++++++++++++++ keyboards/wren/keymaps/walterhanley/readme.md | 12 ++ keyboards/wren/readme.md | 27 ++++ keyboards/wren/rules.mk | 21 ++++ keyboards/wren/wren.c | 35 ++++++ keyboards/wren/wren.h | 46 +++++++ 10 files changed, 503 insertions(+) create mode 100644 keyboards/wren/config.h create mode 100644 keyboards/wren/keymaps/default/keymap.c create mode 100644 keyboards/wren/keymaps/default/readme.md create mode 100644 keyboards/wren/keymaps/walterhanley/config.h create mode 100644 keyboards/wren/keymaps/walterhanley/keymap.c create mode 100644 keyboards/wren/keymaps/walterhanley/readme.md create mode 100644 keyboards/wren/readme.md create mode 100644 keyboards/wren/rules.mk create mode 100644 keyboards/wren/wren.c create mode 100644 keyboards/wren/wren.h (limited to 'keyboards') diff --git a/keyboards/wren/config.h b/keyboards/wren/config.h new file mode 100644 index 0000000000..93b8468c17 --- /dev/null +++ b/keyboards/wren/config.h @@ -0,0 +1,125 @@ +/* +Copyright 2021 Walter Hanley + +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 + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0000 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Walter Hanley +#define PRODUCT wren + +/* key matrix size */ +// Rows are doubled-up (Bottom set of rows are used for the right half) +#define MATRIX_ROWS 10 +#define MATRIX_COLS 10 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * + */ +#define MATRIX_ROW_PINS { D3, D2, C6, D4, B5 } +#define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6, F5, F4, D7, F0 } +#define UNUSED_PINS + +// define encoders +#define ENCODERS_PAD_A \ + { E6 } +#define ENCODERS_PAD_B \ + { B4 } +#define ENCODERS_PAD_A_RIGHT \ + { B4 } +#define ENCODERS_PAD_B_RIGHT \ + { E6 } + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +#define USE_I2C + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is useful for the Windows task manager shortcut (ctrl+shift+esc). + */ +//#define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION + +/* Bootmagic Lite key configuration */ +//#define BOOTMAGIC_LITE_ROW 0 +//#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/wren/keymaps/default/keymap.c b/keyboards/wren/keymaps/default/keymap.c new file mode 100644 index 0000000000..637e0e08b8 --- /dev/null +++ b/keyboards/wren/keymaps/default/keymap.c @@ -0,0 +1,36 @@ +/* Copyright 2021 Walter Hanley + * + * 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 + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE +}; + +/* This layout preserves the entire keyboard matrix, but only includes keycodes + * for a numpad/nav cluster configuration. Depending on your configuration, you + * may need to replace some of the existing KC_NO values with actual keycodes. + */ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT( + KC_PSLS, KC_7, KC_8, KC_9, KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, KC_INS, KC_HOME, KC_PGUP, KC_NO, + KC_PAST, KC_4, KC_5, KC_6, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_NO, + KC_PMNS, KC_1, KC_2, KC_3, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_UP, KC_NO, KC_NO, + KC_PPLS, KC_0, KC_DOT, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, + KC_NLCK, KC_LALT, KC_LGUI, KC_BSPC, KC_ENT, KC_SPC, KC_DEL, KC_RGUI, KC_RALT, KC_MUTE + ) +}; diff --git a/keyboards/wren/keymaps/default/readme.md b/keyboards/wren/keymaps/default/readme.md new file mode 100644 index 0000000000..7227050dd4 --- /dev/null +++ b/keyboards/wren/keymaps/default/readme.md @@ -0,0 +1,11 @@ +![Default Layout](https://github.com/walterhanley/wren-keyboard/blob/main/images/author-layout.png?raw=true) + +# Default Wren Layout + +This is the default Wren layout, which lacks any layers. It should be fairly +straightforward, with the sole exception of the equals key in the place of the +grave key and the grave key in the place of the delete key. + +This layout preserves the entire keyboard matrix, but only includes keycodes +for a numpad/nav cluster configuration. Depending on your configuration, you +may need to replace some of the existing KC_NO values with actual keycodes. diff --git a/keyboards/wren/keymaps/walterhanley/config.h b/keyboards/wren/keymaps/walterhanley/config.h new file mode 100644 index 0000000000..3dd5b47c16 --- /dev/null +++ b/keyboards/wren/keymaps/walterhanley/config.h @@ -0,0 +1,20 @@ +/* Copyright 2021 Walter Hanley + * + * 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 + +// Lower board power consumption to boost compatibility +#define USB_MAX_POWER_CONSUMPTION 250 diff --git a/keyboards/wren/keymaps/walterhanley/keymap.c b/keyboards/wren/keymaps/walterhanley/keymap.c new file mode 100644 index 0000000000..ee4b6f3734 --- /dev/null +++ b/keyboards/wren/keymaps/walterhanley/keymap.c @@ -0,0 +1,170 @@ +/* Copyright 2021 Walter Hanley + * + * 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 + +// Cmd-tab tablesetting +bool is_cmd_tab_active = false; +uint16_t cmd_tab_timer = 0; + +// Alt-tab tablesetting +bool is_alt_tab_active = false; +uint16_t alt_tab_timer = 0; + +// Defines keycode alias +#define ECTL LCTL_T(KC_ESC) +#define EGUI LGUI_T(KC_ESC) +#define DELSYM LT(_SYMBOL, KC_DEL) +#define SCLNAV LT(_NAV, KC_SCLN) +#define TGNLCK TG(_NLCK) + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _MAC, + _WIN, + _NLCK, + _SYMBOL, + _NAV +}; + +// Defines the keycodes used by our macros in process_record_user +enum custom_keycodes { + NSEAL = SAFE_RANGE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Mac */ + [_MAC] = LAYOUT( + KC_PSLS, KC_7, KC_8, KC_9, KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, KC_INS, KC_HOME, KC_PGUP, KC_NO, + KC_PAST, KC_4, KC_5, KC_6, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_NO, + KC_PMNS, KC_1, KC_2, KC_3, ECTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, SCLNAV, KC_QUOT, KC_NO, KC_UP, KC_NO, KC_NO, + KC_PPLS, KC_0, KC_DOT, KC_ENT, KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, + TGNLCK, KC_LALT, KC_LGUI, KC_BSPC, KC_ENT, KC_SPC, DELSYM, KC_RGUI, KC_RALT, KC_MUTE + ), + + /* Windows */ + [_WIN] = LAYOUT( + KC_PSLS, KC_7, KC_8, KC_9, KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, KC_INS, KC_HOME, KC_PGUP, KC_NO, + KC_PAST, KC_4, KC_5, KC_6, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_NO, + KC_PMNS, KC_1, KC_2, KC_3, EGUI, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, SCLNAV, KC_QUOT, KC_NO, KC_UP, KC_NO, KC_NO, + KC_PPLS, KC_0, KC_DOT, KC_ENT, KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, + TGNLCK, KC_LALT, KC_LCTL, KC_BSPC, KC_ENT, KC_SPC, DELSYM, KC_RCTL, KC_RALT, KC_MUTE + ), + + /* In-Keyboard Numlock */ + [_NLCK] = LAYOUT( + KC_PSLS, KC_HOME, KC_UP, KC_PGUP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_PAST, KC_LEFT, KC_5, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_PMNS, KC_END, KC_DOWN, KC_PGDN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_PPLS, KC_INS, KC_DOT, KC_ENT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + TGNLCK, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + /* Symbols, F-Keys, and Text Macros */ + [_SYMBOL] = LAYOUT( + NSEAL, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, KC_UNDS, KC_LCBR, KC_LBRC, _______, _______, KC_RBRC, KC_RCBR, KC_MINS, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + /* Nav Cluster and Settings*/ + [_NAV] = LAYOUT( + DF(_MAC), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + DF(_WIN), _______, _______, _______, _______, KC_PGUP, KC_HOME, KC_UP, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* First encoder */ + // Encoder functionality for _MAC layer + if (IS_LAYER_ON(_MAC)) + { + if (clockwise) { + if (!is_cmd_tab_active) { + is_cmd_tab_active = true; + register_code(KC_LGUI); + } + cmd_tab_timer = timer_read(); + tap_code16(KC_TAB); + } else { + if (!is_cmd_tab_active) { + is_cmd_tab_active = true; + register_code(KC_LGUI); + } + cmd_tab_timer = timer_read(); + tap_code16(S(KC_TAB)); + } + } + // Encoder functionality for _WIN layer + else if (IS_LAYER_ON(_WIN)) { + if (clockwise) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_code(KC_LALT); + } + alt_tab_timer = timer_read(); + tap_code16(KC_TAB); + } else { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_code(KC_LALT); + } + alt_tab_timer = timer_read(); + tap_code16(S(KC_TAB)); + } + } + } else if (index == 1) { /* Second encoder */ + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } + return true; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case NSEAL: + if (record->event.pressed) { + // when keycode NSEAL is pressed + SEND_STRING("What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little 'clever' comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo."); + } else { + // when keycode NSEAL is released + } + break; + } + return true; +} + +void matrix_scan_user(void) { + if (is_cmd_tab_active) { + if (timer_elapsed(cmd_tab_timer) > 1000) { + unregister_code(KC_LGUI); + is_cmd_tab_active = false; + } + } + if (is_alt_tab_active) { + if (timer_elapsed(alt_tab_timer) > 1000) { + unregister_code(KC_LALT); + is_alt_tab_active = false; + } + } +} diff --git a/keyboards/wren/keymaps/walterhanley/readme.md b/keyboards/wren/keymaps/walterhanley/readme.md new file mode 100644 index 0000000000..27e32360dc --- /dev/null +++ b/keyboards/wren/keymaps/walterhanley/readme.md @@ -0,0 +1,12 @@ +![Author's Layout](https://github.com/walterhanley/wren-keyboard/blob/main/images/author-layout.png?raw=true) + +# Author's Wren Layout + +This is my personal Wren layout, which includes a few layers and macros that +I find useful. It started as a clone of the default keymap, but will likely +diverge more as time goes on. + +Please note that this layout preserves the entire keyboard matrix, but only +includes keycodes for a numpad/nav cluster configuration. Depending on your +configuration, you may need to replace some of the existing KC_NO values +with actual keycodes. diff --git a/keyboards/wren/readme.md b/keyboards/wren/readme.md new file mode 100644 index 0000000000..8de95734d6 --- /dev/null +++ b/keyboards/wren/readme.md @@ -0,0 +1,27 @@ +# Wren + +![Wren PCB](https://raw.githubusercontent.com/walterhanley/wren-keyboard/main/images/wren-universal.png) +![Wren Layout](https://raw.githubusercontent.com/walterhanley/wren-keyboard/main/images/author-layout.png) + +A split ergonomic "system keyboard" aimed at providing numpad and nav cluster functionality. For more information, please see the [project repo](https://github.com/walterhanley/wren-keyboard). + +* Keyboard Maintainer: [Walter Hanley](https://github.com/walterhanley) +* Hardware Supported: Wren Universal PCB and Elite C (Pro Micro configurations likely supported but not tested) +* Hardware Availability: Source files available at [project repository](https://github.com/walterhanley/wren-keyboard) + +Make example for this keyboard (after setting up your build environment): + + make wren:default + +Flashing example for this keyboard: + + make wren:default:flash + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + +## Bootloader + +Enter the bootloader in 2 ways: + +* **Physical reset button**: Briefly press the button on the front of the PCB below the microcontroler +* **Keycode in layout**: Press the key mapped to `RESET` if it is available diff --git a/keyboards/wren/rules.mk b/keyboards/wren/rules.mk new file mode 100644 index 0000000000..76e0fdf55d --- /dev/null +++ b/keyboards/wren/rules.mk @@ -0,0 +1,21 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes # Enables the use of one or more encoders +SPLIT_KEYBOARD = yes # Enables split keyboard diff --git a/keyboards/wren/wren.c b/keyboards/wren/wren.c new file mode 100644 index 0000000000..487c9d3070 --- /dev/null +++ b/keyboards/wren/wren.c @@ -0,0 +1,35 @@ +/* Copyright 2021 Walter Hanley + * + * 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 "wren.h" + +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { return false; } + if (index == 0) { /* First encoder */ + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); + } + } else if (index == 1) { /* Second encoder */ + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } + return true; +} diff --git a/keyboards/wren/wren.h b/keyboards/wren/wren.h new file mode 100644 index 0000000000..ee589fe23c --- /dev/null +++ b/keyboards/wren/wren.h @@ -0,0 +1,46 @@ +/* Copyright 2021 Walter Hanley + * + * 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 + +#include "quantum.h" + +/* This is a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, L06, L07, L08, L09, R00, R01, R02, R03, R04, R05, R06, R07, R08, R09, \ + L10, L11, L12, L13, L14, L15, L16, L17, L18, L19, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, \ + L20, L21, L22, L23, L24, L25, L26, L27, L28, L29, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, \ + L30, L31, L32, L33, L34, L35, L36, L37, L38, L39, R30, R31, R32, R33, R34, R35, R36, R37, R38, R39, \ + LT0, LT1, LT2, LT3, LT4, RT0, RT1, RT2, RT3, RT4 \ +) { \ + { L09, L08, L07, L06, L05, L04, L03, L02, L01, L00 }, \ + { L19, L18, L17, L16, L15, L14, L13, L12, L11, L10 }, \ + { L29, L28, L27, L26, L25, L24, L23, L22, L21, L20 }, \ + { L39, L38, L37, L36, L35, L34, L33, L32, L31, L30 }, \ + { LT4, LT3, LT2, LT1, LT0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { R00, R01, R02, R03, R04, R05, R06, R07, R08, R09 }, \ + { R10, R11, R12, R13, R14, R15, R16, R17, R18, R19 }, \ + { R20, R21, R22, R23, R24, R25, R26, R27, R28, R29 }, \ + { R30, R31, R32, R33, R34, R35, R36, R37, R38, R39 }, \ + { RT0, RT1, RT2, RT3, RT4, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +} -- cgit v1.2.3