diff --git a/keyboards/capsunlocked/cu7/config.h b/keyboards/capsunlocked/cu7/config.h new file mode 100644 index 000000000000..9b99e27e2c75 --- /dev/null +++ b/keyboards/capsunlocked/cu7/config.h @@ -0,0 +1,80 @@ +/* +Copyright 2021 CapsUnlocked + +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 0x4355 +#define PRODUCT_ID 0x0007 +#define DEVICE_VER 0x0001 +#define MANUFACTURER CapsUnlocked +#define PRODUCT CU7 + +#define VIAL_KEYBOARD_UID {0x19, 0xFF, 0xE1, 0x15, 0x74, 0x04, 0x69, 0x00} +#define VIAL_UNLOCK_COMBO_ROWS { 1, 1 } +#define VIAL_UNLOCK_COMBO_COLS { 0, 2 } + +/* key matrix size */ +#define MATRIX_ROWS 3 +#define MATRIX_COLS 3 + +/* + * 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 ENCODER_RESOLUTION 2 + +#define ENCODERS_PAD_A { D6 } +#define ENCODERS_PAD_B { D4 } + +#define MATRIX_ROW_PINS { D7, F0, F6, } +#define MATRIX_COL_PINS { F5, F7, F4, } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* 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 + +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +#define RGB_DI_PIN F1 +#ifdef RGB_DI_PIN +#define RGBLIGHT_ANIMATIONS +// #define RGBLIGHT_EFFECT_BREATHING +#define RGBLED_NUM 6 +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 +#define RGBLIGHT_LIMIT_VAL 50 +#endif diff --git a/keyboards/capsunlocked/cu7/cu7.c b/keyboards/capsunlocked/cu7/cu7.c new file mode 100644 index 000000000000..815ac53c9409 --- /dev/null +++ b/keyboards/capsunlocked/cu7/cu7.c @@ -0,0 +1,14 @@ +/* +Copyright 2021 CapsUnlocked +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 "cu7.h" diff --git a/keyboards/capsunlocked/cu7/cu7.h b/keyboards/capsunlocked/cu7/cu7.h new file mode 100644 index 000000000000..9505e28beee7 --- /dev/null +++ b/keyboards/capsunlocked/cu7/cu7.h @@ -0,0 +1,37 @@ +/* +Copyright 2021 CapsUnlocked +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 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( \ + K01, \ + K10, K11, K12, \ + K20, K21, K22 \ +) { \ + { KC_NO, K01, KC_NO }, \ + { K10, K11, K12 }, \ + { K20, K21, K22 } \ +} + +#define encoder_update(clockwise) encoder_update_user(uint8_t index, clockwise) diff --git a/keyboards/capsunlocked/cu7/info.json b/keyboards/capsunlocked/cu7/info.json new file mode 100644 index 000000000000..2d1503d561ce --- /dev/null +++ b/keyboards/capsunlocked/cu7/info.json @@ -0,0 +1,12 @@ +{ + "keyboard_name": "CU7", + "url": "", + "maintainer": "qmk", + "width": 3, + "height": 4.5, + "layouts": { + "LAYOUT": { + "layout": [{"x":0, "y":2.5}, {"x":1, "y":2.5}, {"x":2, "y":2.5}, {"x":0, "y":3.5}, {"x":1, "y":3.5}, {"x":2, "y":3.5}] + } + } +} diff --git a/keyboards/capsunlocked/cu7/keymaps/default/keymap.c b/keyboards/capsunlocked/cu7/keymaps/default/keymap.c new file mode 100644 index 000000000000..52737523ac84 --- /dev/null +++ b/keyboards/capsunlocked/cu7/keymaps/default/keymap.c @@ -0,0 +1,48 @@ +/* +Copyright 2021 CapsUnlocked + +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 + +#define MEDIA_KEY_DELAY 10 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + MO(1), + KC_1, KC_2, KC_3, + KC_4, KC_5, KC_6 + ), + [1] = LAYOUT( + _______, + RGB_MOD, KC_UP, RESET, + KC_LEFT, KC_DOWN, KC_RGHT + ), +}; + +// Volume up/down on the encoder +void encoder_update_user(uint8_t index, bool clockwise) { + uint16_t held_keycode_timer = timer_read(); + + if (clockwise) { + register_code(KC_VOLU); + while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY) {} + unregister_code(KC_VOLU); + } + else { + register_code(KC_VOLD); + while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY) {} + unregister_code(KC_VOLD); + } +} diff --git a/keyboards/capsunlocked/cu7/keymaps/default/readme.md b/keyboards/capsunlocked/cu7/keymaps/default/readme.md new file mode 100644 index 000000000000..e6123685748a --- /dev/null +++ b/keyboards/capsunlocked/cu7/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for CU7 \ No newline at end of file diff --git a/keyboards/capsunlocked/cu7/keymaps/via/keymap.c b/keyboards/capsunlocked/cu7/keymaps/via/keymap.c new file mode 100644 index 000000000000..2673dfbdeb7a --- /dev/null +++ b/keyboards/capsunlocked/cu7/keymaps/via/keymap.c @@ -0,0 +1,39 @@ +/* Copyright 2021 CapsUnlocked + * + * 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] = { + [0] = LAYOUT( + MO(1), + KC_1, KC_2, KC_3, + KC_4, KC_5, KC_6 + ), + [1] = LAYOUT( + _______, + RGB_MOD, KC_UP, RESET, + KC_LEFT, KC_DOWN, KC_RGHT + ), + [2] = LAYOUT( + _______, + _______, _______, _______, + _______, _______, _______ + ), + [3] = LAYOUT( + _______, + _______, _______, _______, + _______, _______, _______ + ), +}; diff --git a/keyboards/capsunlocked/cu7/keymaps/via/rules.mk b/keyboards/capsunlocked/cu7/keymaps/via/rules.mk new file mode 100644 index 000000000000..57da7154e727 --- /dev/null +++ b/keyboards/capsunlocked/cu7/keymaps/via/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes +VIAL_ENABLE = yes +VIAL_ENCODERS_ENABLE = yes diff --git a/keyboards/capsunlocked/cu7/keymaps/via/vial.json b/keyboards/capsunlocked/cu7/keymaps/via/vial.json new file mode 100644 index 000000000000..db03cd31378f --- /dev/null +++ b/keyboards/capsunlocked/cu7/keymaps/via/vial.json @@ -0,0 +1,18 @@ +{ + "name": "CapsUnlocked CU7", + "vendorId": "0x4355", + "productId": "0x0007", + "lighting": "qmk_rgblight", + "matrix": { + "rows": 3, + "cols": 3 + }, + "layouts": { + "keymap": [ + [{"x":0.25},"0,0\n\n\n\n\n\n\n\n\ne",{"x":0.5},"0,1\n\n\n\n\n\n\n\n\ne"], + [{"x":1.0},"0,1"], + ["1,0","1,1","1,2"], + ["2,0","2,1","2,2"] + ] + } +} diff --git a/keyboards/capsunlocked/cu7/readme.md b/keyboards/capsunlocked/cu7/readme.md new file mode 100644 index 000000000000..eda0a4a3377d --- /dev/null +++ b/keyboards/capsunlocked/cu7/readme.md @@ -0,0 +1,13 @@ +# CU7 + +The CU7 is a customisable 3x2 key macropad with a clickable rotary encoder. + +* Keyboard maintainer: [rys](https://github.com/rys) +* Hardware supported: CU7 +* Hardware availability: [CapsUnlocked](https://caps-unlocked.com/cu7/) + +Make example for this keyboard (after setting up your build environment): + + make capsunlocked/cu7:default + +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/capsunlocked/cu7/rules.mk b/keyboards/capsunlocked/cu7/rules.mk new file mode 100644 index 000000000000..408bd0a18ab2 --- /dev/null +++ b/keyboards/capsunlocked/cu7/rules.mk @@ -0,0 +1,27 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +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 = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) +ENCODER_ENABLE = yes