diff --git a/keyboards/work_louder/encoder_actions.c b/keyboards/work_louder/encoder_actions.c new file mode 100644 index 0000000000..b41a248a83 --- /dev/null +++ b/keyboards/work_louder/encoder_actions.c @@ -0,0 +1,68 @@ +/* Copyright 2020 Neil Brian Ramirez + * Copyright 2021 drashna jael're (@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 3 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 "encoder_actions.h" + +#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE) + +# ifdef ENCODERS +static uint8_t encoder_state[ENCODERS] = {0}; +static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY; +static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY; +# endif + +void encoder_action_unregister(void) { +# ifdef ENCODERS + for (int index = 0; index < ENCODERS; ++index) { + if (encoder_state[index]) { + keyevent_t encoder_event = (keyevent_t) { + .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], + .pressed = false, + .time = (timer_read() | 1) + }; + encoder_state[index] = 0; + action_exec(encoder_event); + } + } +# endif +} + +void encoder_action_register(uint8_t index, bool clockwise) { +# ifdef ENCODERS + keyevent_t encoder_event = (keyevent_t) { + .key = clockwise ? encoder_cw[index] : encoder_ccw[index], + .pressed = true, + .time = (timer_read() | 1) + }; + encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); + action_exec(encoder_event); +# endif +} + +void matrix_scan_kb(void) { + encoder_action_unregister(); + matrix_scan_user(); +} + +bool encoder_update_kb(uint8_t index, bool clockwise) { + encoder_action_register(index, clockwise); + // don't return user actions, because they are in the keymap + // encoder_update_user(index, clockwise); + return true; +}; + +#endif diff --git a/keyboards/work_louder/encoder_actions.h b/keyboards/work_louder/encoder_actions.h new file mode 100644 index 0000000000..2484af52ae --- /dev/null +++ b/keyboards/work_louder/encoder_actions.h @@ -0,0 +1,21 @@ +/* Copyright 2020 Neil Brian Ramirez + * + * 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 3 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 "quantum.h" + +void encoder_action_unregister(void); + +void encoder_action_register(uint8_t index, bool clockwise); diff --git a/keyboards/work_louder/loop/config.h b/keyboards/work_louder/loop/config.h new file mode 100644 index 0000000000..011fe4f321 --- /dev/null +++ b/keyboards/work_louder/loop/config.h @@ -0,0 +1,159 @@ +/* +Copyright 2021 Work Louder + +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 0x574C +#define PRODUCT_ID 0x1DF8 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Work Louder +#define PRODUCT loop + +/* key matrix size */ +#define MATRIX_ROWS 2 +#define MATRIX_COLS 12 + +/* + * 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 { F5 } +#define MATRIX_COL_PINS { B3, B2, B1, D6, D7, B4, B5, B6, C6, C7, F7, F6 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + + +//#define LED_NUM_LOCK_PIN B0 +//#define LED_CAPS_LOCK_PIN B1 +//#define LED_SCROLL_LOCK_PIN B2 +//#define LED_COMPOSE_PIN B3 +//#define LED_KANA_PIN B4 + +//#define BACKLIGHT_PIN B7 +//#define BACKLIGHT_LEVELS 3 +//#define BACKLIGHT_BREATHING + +#define RGBLIGHT_DI_PIN E6 +# define RGBLED_NUM 24 +//# define RGBLIGHT_HUE_STEP 8 +//# define RGBLIGHT_SAT_STEP 8 +//# define RGBLIGHT_VAL_STEP 8 +//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ +# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +/*== all animations enable ==*/ +# define RGBLIGHT_ANIMATIONS +/*== or choose animations ==*/ +//# define RGBLIGHT_EFFECT_BREATHING +//# define RGBLIGHT_EFFECT_RAINBOW_MOOD +//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_CHRISTMAS +//# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_RGB_TEST +//# define RGBLIGHT_EFFECT_ALTERNATING +/*== customize breathing effect ==*/ +/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +/*==== use exp() and sin() ====*/ +//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 +//#endif + +#define RGB_DI_PIN F1 +#define DRIVER_LED_TOTAL 9 +#define RGB_MATRIX_DISABLE_KEYCODES + +/* 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 11 + +#define ENCODERS_PAD_A { D0, D2, D5 } +#define ENCODERS_PAD_B { D1, D3, D4 } + +#define ENCODERS 3 + +#define ENCODERS_CW_KEY { { 0, 1 }, { 2, 1 }, { 4, 1 } } +#define ENCODERS_CCW_KEY { { 1, 1 }, { 3, 1 }, { 5, 1 } } diff --git a/keyboards/work_louder/loop/info.json b/keyboards/work_louder/loop/info.json new file mode 100644 index 0000000000..35ab8f93a8 --- /dev/null +++ b/keyboards/work_louder/loop/info.json @@ -0,0 +1,26 @@ +{ + "keyboard_name": "loop", + "url": "", + "maintainer": "Work Louder", + "width": 12, + "height": 1, + "layouts": { + "LAYOUT": { + "layout": [ + {"label": "k00", "x": 0, "y": 0}, + {"label": "k01", "x": 1, "y": 0}, + {"label": "k02", "x": 2, "y": 0}, + + {"label": "k03", "x": 3, "y": 1, "w": 0}, + {"label": "k04", "x": 4, "y": 1, "w": 0}, + {"label": "k05", "x": 5, "y": 1, "w": 0}, + {"label": "k06", "x": 6, "y": 1, "w": 0}, + {"label": "k07", "x": 7, "y": 1, "w": 0}, + {"label": "k08", "x": 8, "y": 1, "w": 0}, + {"label": "k09", "x": 9, "y": 1, "w": 0}, + {"label": "k0a", "x": 10, "y": 1, "w": 0}, + {"label": "k0b", "x": 11, "y": 1, "w": 0}, + ] + } + } +} diff --git a/keyboards/work_louder/loop/keymaps/default/keymap.c b/keyboards/work_louder/loop/keymaps/default/keymap.c new file mode 100644 index 0000000000..25ecb15a48 --- /dev/null +++ b/keyboards/work_louder/loop/keymaps/default/keymap.c @@ -0,0 +1,54 @@ +/* Copyright 2021 Work Louder + * + * 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 + + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [0] = LAYOUT( + KC_MUTE, KC_MPLY, R_M_TOG, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, MO(1) + ), + [1] = LAYOUT( + RESET, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, MO(2), _______ + ), + [2] = LAYOUT( + RESET, _______, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, _______ + ) +}; + + +// void encoder_update_user(uint8_t index, bool clockwise) { +// if (index == 0) { +// if (clockwise) { +// tap_code(KC_VOLD); +// } else { +// tap_code(KC_VOLU); +// } +// } else if (index == 2) { +// if (clockwise) { +// tap_code(KC_MPRV); +// } else { +// tap_code(KC_MNXT); +// } +// } else { +// if (clockwise) { +// rgb_matrix_step_reverse(); +// } else { +// rgb_matrix_step(); +// } +// } +// } diff --git a/keyboards/work_louder/loop/keymaps/default/readme.md b/keyboards/work_louder/loop/keymaps/default/readme.md new file mode 100644 index 0000000000..d11673e062 --- /dev/null +++ b/keyboards/work_louder/loop/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for loop diff --git a/keyboards/work_louder/loop/keymaps/via/keymap.c b/keyboards/work_louder/loop/keymaps/via/keymap.c new file mode 100644 index 0000000000..134bce65df --- /dev/null +++ b/keyboards/work_louder/loop/keymaps/via/keymap.c @@ -0,0 +1,36 @@ +/* Copyright 2021 Work Louder + * + * 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 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [0] = LAYOUT_via( + KC_MUTE, KC_MPLY, R_M_TOG, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, MO(1), + KC_VOLD, KC_VOLD, KC_MPRV, KC_MNXT, R_M_MOD, R_M_RMOD + ), + [1] = LAYOUT_via( + RESET, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, MO(2), _______, + _______, _______, _______, _______, RGB_MOD, RGB_RMOD + ), + [2] = LAYOUT_via( + RESET, _______, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, _______, + _______, _______, _______, _______, R_M_MOD, R_M_RMOD + ), + [3] = LAYOUT_via( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______ + ) +}; diff --git a/keyboards/work_louder/loop/keymaps/via/rules.mk b/keyboards/work_louder/loop/keymaps/via/rules.mk new file mode 100644 index 0000000000..36b7ba9cbc --- /dev/null +++ b/keyboards/work_louder/loop/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/work_louder/loop/loop.c b/keyboards/work_louder/loop/loop.c new file mode 100644 index 0000000000..3551995317 --- /dev/null +++ b/keyboards/work_louder/loop/loop.c @@ -0,0 +1,56 @@ +/* Copyright 2021 Work Louder + * + * 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 "loop.h" + +#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE) +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { return false; } + if (index == 0) { + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + } else if (index == 1) { + if (clockwise) { + tap_code(KC_MPRV); + } else { + tap_code(KC_MNXT); + } + } else { + if (clockwise) { + rgb_matrix_step_reverse(); + } else { + rgb_matrix_step(); + } + } + return true; +} +#endif + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { + { + { NO_LED, NO_LED, NO_LED, 8, 7, 6, 5, 4, 3, 2, 1, 0 } + }, { + { 36, 32 }, { 55, 32 }, { 74, 32 }, { 93, 32 }, { 112, 32 }, { 131, 32 }, { 150, 32 }, { 169, 32 }, { 188, 32 } + }, { + 4, 4, 4, 4, 4, 4, 4, 4, 4 + } +}; + +#endif diff --git a/keyboards/work_louder/loop/loop.h b/keyboards/work_louder/loop/loop.h new file mode 100644 index 0000000000..acad9d7b3c --- /dev/null +++ b/keyboards/work_louder/loop/loop.h @@ -0,0 +1,43 @@ +/* Copyright 2021 Work Louder + * + * 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" +#include "encoder_actions.h" +#include "rgb_functions.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( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b \ +) { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b } \ +} + +#define LAYOUT_via( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ + k00_a, k00_b, k01_a, k01_b, k02_a, k02_b \ +) { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \ + { k00_a, k00_b, k01_a, k01_b, k02_a, k02_b } \ +} diff --git a/keyboards/work_louder/loop/post_config.h b/keyboards/work_louder/loop/post_config.h new file mode 100644 index 0000000000..263818bffe --- /dev/null +++ b/keyboards/work_louder/loop/post_config.h @@ -0,0 +1,22 @@ +/* +Copyright 2021 Drashna Jael're + +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 + +#ifndef TAP_CODE_DELAY +# define TAP_CODE_DELAY 10 +#endif diff --git a/keyboards/work_louder/loop/readme.md b/keyboards/work_louder/loop/readme.md new file mode 100644 index 0000000000..fce5108cba --- /dev/null +++ b/keyboards/work_louder/loop/readme.md @@ -0,0 +1,24 @@ +# Work Louder Loop Pad + +![loop](https://worklouder.cc/wp-content/uploads/2021/02/LAST-1536x960.png) + +A 9 key macro pad with 3 encoders and RGB. + +* Keyboard Maintainer: [Work Louder](https://github.com/drashna) +* Hardware Supported: An ATmega32u4 based macro pad with per key and underglow RGB +* Hardware Availability: [Work Louder](https://shop.worklouder.cc/) + +Make example for this keyboard (after setting up your build environment): + + make work_louder/loop:default + +Flashing example for this keyboard: + + make work_louder/loop:default:flash + +Enter bootloader to flash the keyboard, you do either: + + * Hold down the right most key while plugging in the keyboard + * Hold the third encoder down, and hit the first encoder + +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). diff --git a/keyboards/work_louder/loop/rules.mk b/keyboards/work_louder/loop/rules.mk new file mode 100644 index 0000000000..4df169834c --- /dev/null +++ b/keyboards/work_louder/loop/rules.mk @@ -0,0 +1,27 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +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 +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 + +SRC += encoder_actions.c rgb_functions.c diff --git a/keyboards/work_louder/nano/config.h b/keyboards/work_louder/nano/config.h new file mode 100644 index 0000000000..4c897b7e51 --- /dev/null +++ b/keyboards/work_louder/nano/config.h @@ -0,0 +1,164 @@ +/* +Copyright 2021 Drashna Jael're + +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 0x574C +#define PRODUCT_ID 0xE6EF +#define DEVICE_VER 0x0001 +#define MANUFACTURER Work Louder +#define PRODUCT nano + +/* key matrix size */ +#define MATRIX_ROWS 1 +#ifdef VIA_ENABLE +# define MATRIX_COLS 5 +#else +# define MATRIX_COLS 3 +#endif + +/* + * 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 { F7 } +#define MATRIX_COL_PINS { B5, B6, C6 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + + +//#define LED_NUM_LOCK_PIN B0 +//#define LED_CAPS_LOCK_PIN B1 +//#define LED_SCROLL_LOCK_PIN B2 +//#define LED_COMPOSE_PIN B3 +//#define LED_KANA_PIN B4 + +//#define BACKLIGHT_PIN B7 +//#define BACKLIGHT_LEVELS 3 +//#define BACKLIGHT_BREATHING + +#define RGBLIGHT_DI_PIN C7 +# define RGBLED_NUM 6 +//# define RGBLIGHT_HUE_STEP 8 +//# define RGBLIGHT_SAT_STEP 8 +//# define RGBLIGHT_VAL_STEP 8 +//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ +# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +/*== all animations enable ==*/ +# define RGBLIGHT_ANIMATIONS +/*== or choose animations ==*/ +//# define RGBLIGHT_EFFECT_BREATHING +//# define RGBLIGHT_EFFECT_RAINBOW_MOOD +//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_CHRISTMAS +//# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_RGB_TEST +//# define RGBLIGHT_EFFECT_ALTERNATING +/*== customize breathing effect ==*/ +/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +/*==== use exp() and sin() ====*/ +//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 +//#endif + +#define RGB_DI_PIN F6 +#define DRIVER_LED_TOTAL 2 +#define RGB_MATRIX_DISABLE_KEYCODES + +/* 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 3 + + +#define ENCODERS_PAD_A { D7 } +#define ENCODERS_PAD_B { B4 } + +#define ENCODERS 1 + +#define ENCODERS_CW_KEY { { 3, 0 } } +#define ENCODERS_CCW_KEY { { 4, 0 } } diff --git a/keyboards/work_louder/nano/info.json b/keyboards/work_louder/nano/info.json new file mode 100644 index 0000000000..37d25531f4 --- /dev/null +++ b/keyboards/work_louder/nano/info.json @@ -0,0 +1,16 @@ +{ + "keyboard_name": "nano", + "url": "", + "maintainer": "Work Louder", + "width": 3, + "height": 1, + "layouts": { + "LAYOUT": { + "layout": [ + {"label": "k00", "x": 0, "y": 0}, + {"label": "k01", "x": 1, "y": 0}, + {"label": "k02", "x": 2, "y": 0}, + ] + } + } +} diff --git a/keyboards/work_louder/nano/keymaps/default/keymap.c b/keyboards/work_louder/nano/keymaps/default/keymap.c new file mode 100644 index 0000000000..e1b4bbcb98 --- /dev/null +++ b/keyboards/work_louder/nano/keymaps/default/keymap.c @@ -0,0 +1,37 @@ +/* Copyright 2021 Drashna Jael're + * + * 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 + + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [0] = LAYOUT( + KC_PSCR, KC_LSFT, MO(1) + ), + [1] = LAYOUT( + RESET, KC_LCTL, _______ + ) +}; + + +// void encoder_update_user(uint8_t index, bool clockwise) { +// if (clockwise) { +// tap_code(KC_PGDN); +// } else { +// tap_code(KC_PGUP); +// } +// } diff --git a/keyboards/work_louder/nano/keymaps/default/readme.md b/keyboards/work_louder/nano/keymaps/default/readme.md new file mode 100644 index 0000000000..1ca552d721 --- /dev/null +++ b/keyboards/work_louder/nano/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for nano diff --git a/keyboards/work_louder/nano/keymaps/via/keymap.c b/keyboards/work_louder/nano/keymaps/via/keymap.c new file mode 100644 index 0000000000..84a54a4aac --- /dev/null +++ b/keyboards/work_louder/nano/keymaps/via/keymap.c @@ -0,0 +1,38 @@ +/* Copyright 2021 Drashna Jael're + * + * 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 + + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [0] = LAYOUT_via( + KC_PSCR, MACRO00, MO(1), + KC_PGDN, KC_PGUP + ), + [1] = LAYOUT_via( + RESET, MACRO01, _______, + _______, _______ + ), + [2] = LAYOUT_via( + _______, _______, _______, + _______, _______ + ), + [3] = LAYOUT_via( + _______, _______, _______, + _______, _______ + ) +}; diff --git a/keyboards/work_louder/nano/keymaps/via/rules.mk b/keyboards/work_louder/nano/keymaps/via/rules.mk new file mode 100644 index 0000000000..36b7ba9cbc --- /dev/null +++ b/keyboards/work_louder/nano/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/work_louder/nano/nano.c b/keyboards/work_louder/nano/nano.c new file mode 100644 index 0000000000..62d44ef133 --- /dev/null +++ b/keyboards/work_louder/nano/nano.c @@ -0,0 +1,42 @@ +/* Copyright 2021 Drashna Jael're + * + * 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 "nano.h" + +#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE) +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { return false; } + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); + } + return true; +} +#endif + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { + { + { NO_LED, 1, 0 } + }, { + { 103, 32 }, { 122, 32 } + }, { + 4, 4 + } +}; + +#endif diff --git a/keyboards/work_louder/nano/nano.h b/keyboards/work_louder/nano/nano.h new file mode 100644 index 0000000000..6f7463e6a4 --- /dev/null +++ b/keyboards/work_louder/nano/nano.h @@ -0,0 +1,42 @@ +/* Copyright 2021 Drashna Jael're + * + * 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" +#include "encoder_actions.h" +#include "rgb_functions.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( \ + k00, k01, k02 \ +) { \ + { k00, k01, k02 } \ +} + +#define LAYOUT_via( \ + k00, k01, k02, \ + k00_a, k00_b \ +) { \ + { k00, k01, k02, k00_a, k00_b } \ +} diff --git a/keyboards/work_louder/nano/post_config.h b/keyboards/work_louder/nano/post_config.h new file mode 100644 index 0000000000..263818bffe --- /dev/null +++ b/keyboards/work_louder/nano/post_config.h @@ -0,0 +1,22 @@ +/* +Copyright 2021 Drashna Jael're + +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 + +#ifndef TAP_CODE_DELAY +# define TAP_CODE_DELAY 10 +#endif diff --git a/keyboards/work_louder/nano/readme.md b/keyboards/work_louder/nano/readme.md new file mode 100644 index 0000000000..10bfcfd7e0 --- /dev/null +++ b/keyboards/work_louder/nano/readme.md @@ -0,0 +1,26 @@ +# Work Louder Nano pad + +![nano](https://worklouder.cc/wp-content/uploads/2021/02/LAST-1536x960.png) + +A 2 key macro pad with an encoder and RGB + +* Keyboard Maintainer: [Work Louder](https://github.com/drashna) +* Hardware Supported: An ATmega32u4 based macro pad with per key and underglow RGB +* Hardware Availability: [Work Louder](https://shop.worklouder.cc/) + + +Make example for this keyboard (after setting up your build environment): + + make work_louder/nano:default + +Flashing example for this keyboard: + + make work_louder/nano:default:flash + +Enter bootloader to flash the keyboard, you do either: + + * Hold down the right most key while plugging in the keyboard (furthest from encoder) + * Hold the third key down, and hit the encoder. + + +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). diff --git a/keyboards/work_louder/nano/rules.mk b/keyboards/work_louder/nano/rules.mk new file mode 100644 index 0000000000..fc478334b7 --- /dev/null +++ b/keyboards/work_louder/nano/rules.mk @@ -0,0 +1,27 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +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 +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 + +SRC += encoder_actions.c rgb_functions.c diff --git a/keyboards/work_louder/rgb_functions.c b/keyboards/work_louder/rgb_functions.c new file mode 100644 index 0000000000..5a2043f9b4 --- /dev/null +++ b/keyboards/work_louder/rgb_functions.c @@ -0,0 +1,69 @@ +/* Copyright 2021 Drashna Jael're + * + * 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 "rgb_functions.h" + +#if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_EANBLE) +# undef RGB_DI_PIN +# define RGBLIGHT_DI_PIN +# include "ws2812.c" + +void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { + ws2812_setleds(start_led, num_leds); +} +#endif + +#ifdef RGB_MATRIX_ENABLE +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { return false; } + + if (record->event.pressed) { + switch(keycode) { + case RGB_MATRIX_TOGGLE: // toggle rgb matrix + rgb_matrix_toggle(); + return false; + case RGB_MATRIX_MODE_INC: + rgb_matrix_step(); + return false; + case RGB_MATRIX_MODE_DEC: + rgb_matrix_step_reverse(); + return false; + case RGB_MATRIX_HUE_INC: + rgb_matrix_increase_hue(); + return false; + case RGB_MATRIX_HUE_DEC: + rgb_matrix_decrease_hue(); + return false; + case RGB_MATRIX_SAT_INC: + rgb_matrix_increase_sat(); + return false; + case RGB_MATRIX_SAT_DEC: + rgb_matrix_decrease_sat(); + return false; + case RGB_MATRIX_VAL_INC: + rgb_matrix_increase_val(); + return false; + case RGB_MATRIX_VAL_DEC: + rgb_matrix_decrease_val(); + return false; + default: + break; + } + } + return true; +} +#endif diff --git a/keyboards/work_louder/rgb_functions.h b/keyboards/work_louder/rgb_functions.h new file mode 100644 index 0000000000..9a5cda0fc6 --- /dev/null +++ b/keyboards/work_louder/rgb_functions.h @@ -0,0 +1,85 @@ +/* Copyright 2020 Neil Brian Ramirez + * + * 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 3 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 "quantum.h" + +#ifndef VIA_ENABLE +# ifndef RGB_MATRIX_TOGGLE +# define RGB_MATRIX_TOGGLE KC_F15 +# endif +# ifndef RGB_MATRIX_MODE_INC +# define RGB_MATRIX_MODE_INC KC_F16 +# endif +# ifndef RGB_MATRIX_MODE_DEC +# define RGB_MATRIX_MODE_DEC KC_F17 +# endif +# ifndef RGB_MATRIX_HUE_INC +# define RGB_MATRIX_HUE_INC KC_F18 +# endif +# ifndef RGB_MATRIX_HUE_DEC +# define RGB_MATRIX_HUE_DEC KC_F19 +# endif +# ifndef RGB_MATRIX_SAT_INC +# define RGB_MATRIX_SAT_INC KC_F20 +# endif +# ifndef RGB_MATRIX_SAT_DEC +# define RGB_MATRIX_SAT_DEC KC_F21 +# endif +# ifndef RGB_MATRIX_VAL_INC +# define RGB_MATRIX_VAL_INC KC_F22 +# endif +# ifndef RGB_MATRIX_VAL_DEC +# define RGB_MATRIX_VAL_DEC KC_F23 +# endif +#else +# ifndef RGB_MATRIX_TOGGLE +# define RGB_MATRIX_TOGGLE USER00 +# endif +# ifndef RGB_MATRIX_MODE_INC +# define RGB_MATRIX_MODE_INC USER01 +# endif +# ifndef RGB_MATRIX_MODE_DEC +# define RGB_MATRIX_MODE_DEC USER02 +# endif +# ifndef RGB_MATRIX_HUE_INC +# define RGB_MATRIX_HUE_INC USER03 +# endif +# ifndef RGB_MATRIX_HUE_DEC +# define RGB_MATRIX_HUE_DEC USER04 +# endif +# ifndef RGB_MATRIX_SAT_INC +# define RGB_MATRIX_SAT_INC USER05 +# endif +# ifndef RGB_MATRIX_SAT_DEC +# define RGB_MATRIX_SAT_DEC USER06 +# endif +# ifndef RGB_MATRIX_VAL_INC +# define RGB_MATRIX_VAL_INC USER07 +# endif +# ifndef RGB_MATRIX_VAL_DEC +# define RGB_MATRIX_VAL_DEC USER08 +# endif +#endif + +#define R_M_TOG RGB_MATRIX_TOGGLE +#define R_M_MOD RGB_MATRIX_MODE_INC +#define R_M_RMOD RGB_MATRIX_MODE_DEC +#define R_M_HUI RGB_MATRIX_HUE_INC +#define R_M_HUD RGB_MATRIX_HUE_DEC +#define R_M_SAI RGB_MATRIX_SAT_INC +#define R_M_SAD RGB_MATRIX_SAT_DEC +#define R_M_VAI RGB_MATRIX_VAL_INC +#define R_M_VAD RGB_MATRIX_VAL_DEC diff --git a/keyboards/work_louder/work_board/config.h b/keyboards/work_louder/work_board/config.h new file mode 100644 index 0000000000..2ccc1be4c4 --- /dev/null +++ b/keyboards/work_louder/work_board/config.h @@ -0,0 +1,159 @@ +/* +Copyright 2021 Drashna Jael're + +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 0x574C +#define PRODUCT_ID 0xDCD0 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Work Louder +#define PRODUCT Work Board + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 13 + +/* + * 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 { F0, F1, F4, F5 } +#define MATRIX_COL_PINS { D3, D5, D4, D6, D7, B4, B5, B6, C6, C7, F7, F6, E6 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +#define LED_NUM_LOCK_PIN B2 +#define LED_CAPS_LOCK_PIN B3 +#define LED_SCROLL_LOCK_PIN B7 +//#define LED_COMPOSE_PIN B3 +//#define LED_KANA_PIN B4 + +//#define BACKLIGHT_PIN B7 +//#define BACKLIGHT_LEVELS 3 +//#define BACKLIGHT_BREATHING + +#define RGBLIGHT_DI_PIN D2 +# define RGBLED_NUM 26 +//# define RGBLIGHT_HUE_STEP 8 +//# define RGBLIGHT_SAT_STEP 8 +//# define RGBLIGHT_VAL_STEP 8 +# define RGBLIGHT_LIMIT_VAL 100 /* The maximum brightness level */ +# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +/*== all animations enable ==*/ +# define RGBLIGHT_ANIMATIONS +/*== or choose animations ==*/ +//# define RGBLIGHT_EFFECT_BREATHING +//# define RGBLIGHT_EFFECT_RAINBOW_MOOD +//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_CHRISTMAS +//# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_RGB_TEST +//# define RGBLIGHT_EFFECT_ALTERNATING +/*== customize breathing effect ==*/ +/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +/*==== use exp() and sin() ====*/ +//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 +//#endif + +#define RGB_DI_PIN D0 +#define DRIVER_LED_TOTAL 50 +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 100 +#define RGB_MATRIX_DISABLE_KEYCODES + +/* 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 + +#define ENCODERS_PAD_A { B0 } +#define ENCODERS_PAD_B { B1 } + +#define ENCODERS 1 + +#define ENCODERS_CW_KEY { { 12, 1 } } +#define ENCODERS_CCW_KEY { { 12, 2 } } + +/* Bootmagic Lite key configuration */ +//#define BOOTMAGIC_LITE_ROW 0 +//#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/work_louder/work_board/info.json b/keyboards/work_louder/work_board/info.json new file mode 100644 index 0000000000..a3313cd7bc --- /dev/null +++ b/keyboards/work_louder/work_board/info.json @@ -0,0 +1,114 @@ +{ + "keyboard_name": "work board", + "url": "", + "maintainer": "Work Louder", + "width": 13, + "height": 4, + "layouts": { + "LAYOUT_2u_space": { + "layout": [ + { "x": 0, "y": 0 }, + { "x": 1, "y": 0 }, + { "x": 2, "y": 0 }, + { "x": 3, "y": 0 }, + { "x": 4, "y": 0 }, + { "x": 5, "y": 0 }, + { "x": 6, "y": 0 }, + { "x": 7, "y": 0 }, + { "x": 8, "y": 0 }, + { "x": 9, "y": 0 }, + { "x": 10, "y": 0 }, + { "x": 11, "y": 0 }, + { "x": 12, "y": 0 }, + { "x": 0, "y": 1 }, + { "x": 1, "y": 1 }, + { "x": 2, "y": 1 }, + { "x": 3, "y": 1 }, + { "x": 4, "y": 1 }, + { "x": 5, "y": 1 }, + { "x": 6, "y": 1 }, + { "x": 7, "y": 1 }, + { "x": 8, "y": 1 }, + { "x": 9, "y": 1 }, + { "x": 10, "y": 1 }, + { "x": 11, "y": 1 }, + { "x": 0, "y": 2 }, + { "x": 1, "y": 2 }, + { "x": 2, "y": 2 }, + { "x": 3, "y": 2 }, + { "x": 4, "y": 2 }, + { "x": 5, "y": 2 }, + { "x": 6, "y": 2 }, + { "x": 7, "y": 2 }, + { "x": 8, "y": 2 }, + { "x": 9, "y": 2 }, + { "x": 10, "y": 2 }, + { "x": 11, "y": 2 }, + { "x": 0, "y": 3 }, + { "x": 1, "y": 3 }, + { "x": 2, "y": 3 }, + { "x": 3, "y": 3 }, + { "x": 4, "y": 3 }, + { "x": 5, "y": 3, "w": 2 }, + { "x": 7, "y": 3 }, + { "x": 8, "y": 3 }, + { "x": 9, "y": 3 }, + { "x": 10, "y": 3 }, + { "x": 11, "y": 3 } + ] + }, + "LAYOUT": { + "layout": [ + { "x": 0, "y": 0 }, + { "x": 1, "y": 0 }, + { "x": 2, "y": 0 }, + { "x": 3, "y": 0 }, + { "x": 4, "y": 0 }, + { "x": 5, "y": 0 }, + { "x": 6, "y": 0 }, + { "x": 7, "y": 0 }, + { "x": 8, "y": 0 }, + { "x": 9, "y": 0 }, + { "x": 10, "y": 0 }, + { "x": 11, "y": 0 }, + { "x": 12, "y": 0 }, + { "x": 0, "y": 1 }, + { "x": 1, "y": 1 }, + { "x": 2, "y": 1 }, + { "x": 3, "y": 1 }, + { "x": 4, "y": 1 }, + { "x": 5, "y": 1 }, + { "x": 6, "y": 1 }, + { "x": 7, "y": 1 }, + { "x": 8, "y": 1 }, + { "x": 9, "y": 1 }, + { "x": 10, "y": 1 }, + { "x": 11, "y": 1 }, + { "x": 0, "y": 2 }, + { "x": 1, "y": 2 }, + { "x": 2, "y": 2 }, + { "x": 3, "y": 2 }, + { "x": 4, "y": 2 }, + { "x": 5, "y": 2 }, + { "x": 6, "y": 2 }, + { "x": 7, "y": 2 }, + { "x": 8, "y": 2 }, + { "x": 9, "y": 2 }, + { "x": 10, "y": 2 }, + { "x": 11, "y": 2 }, + { "x": 0, "y": 3 }, + { "x": 1, "y": 3 }, + { "x": 2, "y": 3 }, + { "x": 3, "y": 3 }, + { "x": 4, "y": 3 }, + { "x": 5, "y": 3 }, + { "x": 6, "y": 3 }, + { "x": 7, "y": 3 }, + { "x": 8, "y": 3 }, + { "x": 9, "y": 3 }, + { "x": 10, "y": 3 }, + { "x": 11, "y": 3 } + ] + } + } +} diff --git a/keyboards/work_louder/work_board/keymaps/default/keymap.c b/keyboards/work_louder/work_board/keymaps/default/keymap.c new file mode 100644 index 0000000000..a3415d1e1e --- /dev/null +++ b/keyboards/work_louder/work_board/keymaps/default/keymap.c @@ -0,0 +1,207 @@ +/* Copyright 2015-2017 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 . + */ + +#include QMK_KEYBOARD_H + +enum planck_layers { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, +}; + +enum tap_dances { + ENC_TAP, +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = LAYOUT( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, TD(ENC_TAP), + 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , + KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_COLEMAK] = LAYOUT( + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, _______, + KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , + KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = LAYOUT( + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, _______, + KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , + KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = LAYOUT( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, _______, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = LAYOUT( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, _______, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + + +/* Adjust (Lower + Raise) + * v------------------------RGB CONTROL--------------------v + * ,-----------------------------------------------------------------------------------. + * | | Reset|Debug | RGB |RGBMOD| HUE+ | HUE- | SAT+ | SAT- |BRGTH+|BRGTH-| Del | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | |MUSmod|Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof|TermOn|TermOf| | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = LAYOUT( + _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , _______, + _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +) + +}; + + +void dance_enc_finished(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + register_code(KC_MPLY); + } else if (state->count == 2) { + register_code(KC_MNXT); + } else { + register_code(KC_MPRV); + } +} + +void dance_enc_reset(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + unregister_code(KC_MPLY); + } else if (state->count == 2) { + unregister_code(KC_MNXT); + } else { + unregister_code(KC_MPRV); + } +} + +// Tap Dance definitions +qk_tap_dance_action_t tap_dance_actions[] = { + [ENC_TAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_enc_finished, dance_enc_reset), +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + break; + } + return true; +} diff --git a/keyboards/work_louder/work_board/keymaps/default/readme.md b/keyboards/work_louder/work_board/keymaps/default/readme.md new file mode 100644 index 0000000000..3b2d89b9a6 --- /dev/null +++ b/keyboards/work_louder/work_board/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for work diff --git a/keyboards/work_louder/work_board/keymaps/default/rules.mk b/keyboards/work_louder/work_board/keymaps/default/rules.mk new file mode 100644 index 0000000000..e5ddcae8d9 --- /dev/null +++ b/keyboards/work_louder/work_board/keymaps/default/rules.mk @@ -0,0 +1 @@ +TAP_DANCE_ENABLE = yes diff --git a/keyboards/work_louder/work_board/keymaps/via/keymap.c b/keyboards/work_louder/work_board/keymaps/via/keymap.c new file mode 100644 index 0000000000..6bdc75ac22 --- /dev/null +++ b/keyboards/work_louder/work_board/keymaps/via/keymap.c @@ -0,0 +1,95 @@ +/* Copyright 2015-2017 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 . + */ + +#include QMK_KEYBOARD_H + +enum planck_layers { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; + +enum tap_dances { + ENC_TAP, +}; + +#define LOWER KC_FN13 +#define RAISE KC_FN23 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_via( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, USER09, + 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_VOLD, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , KC_VOLU, + KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + ), + + [_LOWER] = LAYOUT_via( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, _______, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_PGDN, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY + ), + + [_RAISE] = LAYOUT_via( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, _______, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_DOWN, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, KC_UP, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY + ), + + [_ADJUST] = LAYOUT_via( + _______, RESET, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , R_M_TOG, + _______, _______, MU_MOD, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, R_M_HUI, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, R_M_HUD, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + + +void dance_enc_finished(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + register_code(KC_MPLY); + } else if (state->count == 2) { + register_code(KC_MNXT); + } else { + register_code(KC_MPRV); + } +} + +void dance_enc_reset(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + unregister_code(KC_MPLY); + } else if (state->count == 2) { + unregister_code(KC_MNXT); + } else { + unregister_code(KC_MPRV); + } +} + +// Tap Dance definitions +qk_tap_dance_action_t tap_dance_actions[] = { + [ENC_TAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_enc_finished, dance_enc_reset), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (keycode == USER09) { + preprocess_tap_dance(TD(ENC_TAP), record); + return process_tap_dance(TD(ENC_TAP), record); + } + return true; +} diff --git a/keyboards/work_louder/work_board/keymaps/via/rules.mk b/keyboards/work_louder/work_board/keymaps/via/rules.mk new file mode 100644 index 0000000000..791d5ab502 --- /dev/null +++ b/keyboards/work_louder/work_board/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +TAP_DANCE_ENABLE = yes diff --git a/keyboards/work_louder/work_board/post_config.h b/keyboards/work_louder/work_board/post_config.h new file mode 100644 index 0000000000..263818bffe --- /dev/null +++ b/keyboards/work_louder/work_board/post_config.h @@ -0,0 +1,22 @@ +/* +Copyright 2021 Drashna Jael're + +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 + +#ifndef TAP_CODE_DELAY +# define TAP_CODE_DELAY 10 +#endif diff --git a/keyboards/work_louder/work_board/readme.md b/keyboards/work_louder/work_board/readme.md new file mode 100644 index 0000000000..3e7cd9631b --- /dev/null +++ b/keyboards/work_louder/work_board/readme.md @@ -0,0 +1,24 @@ +# Work Louder Work Board + +![work](https://worklouder.cc/wp-content/uploads/2021/02/LAST-1536x960.png) + +A 40% ortho keyboard with an encoder and per key and underglow RGB + +* Keyboard Maintainer: [Work Louder](https://github.com/drashna) +* Hardware Supported: An ATmega32u4 based 40% with per key and underglow RGB +* Hardware Availability: [Work Louder](https://shop.worklouder.cc/) + +Make example for this keyboard (after setting up your build environment): + + make work_louder/work:default + +Flashing example for this keyboard: + + make work_louder/work:default:flash + +Enter bootloader to flash the keyboard, you do either: + + * Hold down the key in the left and top most position while plugging in the keyboard + * Hold the RAISE and LOWER keys and hit Q + +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). diff --git a/keyboards/work_louder/work_board/rules.mk b/keyboards/work_louder/work_board/rules.mk new file mode 100644 index 0000000000..0731edd415 --- /dev/null +++ b/keyboards/work_louder/work_board/rules.mk @@ -0,0 +1,29 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +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 +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes +LTO_ENABLE = yes + +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 + +SRC += encoder_actions.c rgb_functions.c diff --git a/keyboards/work_louder/work_board/work_board.c b/keyboards/work_louder/work_board/work_board.c new file mode 100644 index 0000000000..32d36e9406 --- /dev/null +++ b/keyboards/work_louder/work_board/work_board.c @@ -0,0 +1,93 @@ +/* Copyright 2021 Drashna Jael're + * + * 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 "work_board.h" + +#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE) +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { return false; } + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + return true; +} +#endif + +#ifdef OLED_DRIVER_ENABLE +# ifdef RGB_MATRIX_ENABLE +# error Cannot run OLED and Per Key RGB at the same time due to pin conflicts +# endif +__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_90; } + +__attribute__((weak)) void oled_task_user(void) { + oled_write_P(PSTR("LAYER"), false); + oled_write_P(PSTR("Lower"), layer_state_is(3)); + oled_write_P(PSTR("Raise"), layer_state_is(4)); + oled_write_P(PSTR("Adjst"), layer_state_is(5)); + + led_t led_usb_state = host_keyboard_led_state(); + oled_write_P(PSTR("Lock:"), false); + oled_write_P(PSTR(" "), false); + oled_write_P(PSTR("N"), led_usb_state.num_lock); + oled_write_P(PSTR("C"), led_usb_state.caps_lock); + oled_write_ln_P(PSTR("S"), led_usb_state.scroll_lock); + + uint8_t modifiers = get_mods() | get_oneshot_mods(); + oled_write_P(PSTR("Mods:"), false); + oled_write_P(PSTR(" "), false); + oled_write_P(PSTR("S"), (modifiers & MOD_MASK_SHIFT)); + oled_write_P(PSTR("C"), (modifiers & MOD_MASK_CTRL)); + oled_write_P(PSTR("A"), (modifiers & MOD_MASK_ALT)); + oled_write_P(PSTR("G"), (modifiers & MOD_MASK_GUI)); + + /* Show Ctrl-Gui Swap options */ + static const char PROGMEM logo[][2][3] = { + {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, + {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, + }; + oled_write_P(PSTR("BTMGK"), false); + oled_write_P(PSTR(" "), false); + oled_write_P(logo[0][0], !keymap_config.swap_lctl_lgui); + oled_write_P(logo[1][0], keymap_config.swap_lctl_lgui); + oled_write_P(PSTR(" "), false); + oled_write_P(logo[0][1], !keymap_config.swap_lctl_lgui); + oled_write_P(logo[1][1], keymap_config.swap_lctl_lgui); + oled_write_P(PSTR(" NKRO"), keymap_config.nkro); +} +#endif + + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + { 49, 48, 47, 46, 45, 43, 42, 41, 40, 39, 38, 37}, + { 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 }, + { 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13 }, + { 0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12 }, +}, { + { 223, 63 }, { 203, 63 }, { 183, 63 }, { 162, 63 }, { 142, 63 }, { 122, 63 }, { 101, 63 }, { 81, 63 }, { 61, 63 }, { 40, 63 }, { 20, 63 }, { 0, 63 }, + { 0, 42 }, { 20, 42 }, { 40, 42 }, { 61, 42 }, { 81, 42 }, { 101, 42 }, { 122, 42 }, { 142, 42 }, { 162, 42 }, { 183, 42 }, { 203, 42 }, { 223, 42 }, + { 223, 21 }, { 203, 21 }, { 183, 21 }, { 162, 21 }, { 142, 21 }, { 122, 21 }, { 101, 21 }, { 81, 21 }, { 61, 21 }, { 40, 21 }, { 20, 21 }, { 0, 21 }, + { 0, 0 }, { 20, 0 }, { 40, 0 }, { 61, 0 }, { 81, 0 }, { 101, 0 }, { 122, 0 }, { 132, 0 }, { 142, 0 }, { 162, 0 }, { 183, 0 }, { 203, 0 }, { 223, 0 }, +}, { + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 4,4,4, 1, 1, 1, 1, 1 +} }; + +#endif diff --git a/keyboards/work_louder/work_board/work_board.h b/keyboards/work_louder/work_board/work_board.h new file mode 100644 index 0000000000..25a881a19c --- /dev/null +++ b/keyboards/work_louder/work_board/work_board.h @@ -0,0 +1,83 @@ +/* Copyright 2021 Drashna Jael're + * + * 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" +#include "encoder_actions.h" +#include "rgb_functions.h" + +#define ___ KC_NO + +/* 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_2u_space( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ + k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, ___ }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, ___ }, \ + { k30, k31, k32, k33, k34, k35, ___, k37, k38, k39, k3a, k3b, ___ } \ +} + +#define LAYOUT( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, ___ }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, ___ }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, ___ } \ +} + +#define LAYOUT_2u_space_via( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k0c_a, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k0c_b, \ + k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k0c_a }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k0c_b }, \ + { k30, k31, k32, k33, k34, k35, ___, k37, k38, k39, k3a, k3b, ___ } \ +} + +#define LAYOUT_via( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k0c_a, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k0c_b, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k0c_a }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k0c_b }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, ___ } \ +}