diff --git a/keyboards/tapedeck/config.h b/keyboards/tapedeck/config.h new file mode 100644 index 000000000000..6d9a8e19a62b --- /dev/null +++ b/keyboards/tapedeck/config.h @@ -0,0 +1,24 @@ +/* Copyright 2023 Gowla + * + * 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 + +/* SLIDER */ +#define POT_ENABLE + +/* RGB Default */ +# define RGB_MATRIX_DEFAULT_MODE RGBLIGHT_MODE_RAINBOW_MOOD + diff --git a/keyboards/tapedeck/info.json b/keyboards/tapedeck/info.json new file mode 100644 index 000000000000..bc32e2b5ea9f --- /dev/null +++ b/keyboards/tapedeck/info.json @@ -0,0 +1,67 @@ +{ + "manufacturer": "Gowla", + "keyboard_name": "Tapedeck", + "maintainer": "Gowla", + "development_board": "promicro", + "diode_direction": "ROW2COL", + "encoder": { + "rotary": [ + { + "pin_a": "F4", + "pin_b": "F5" + }, + { + "pin_a": "F6", + "pin_b": "F7" + } + ] + }, + "features": { + "bootmagic": true, + "encoder": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgblight": true, + }, + "matrix_pins": { + "cols": ["B5", "B4", "E6", "D7", "C6"], + "rows": ["B2", "B3", "B1"] + }, + "rgblight": { + "led_count": 3, + "pin": "B6", + "animations": { + "knight": true, + "rainbow_swirl": true, + "rainbow_mood": true, + "rgb_test": true + } + }, + "url": "https://github.com/SamGowland/Gowla-Macro-Boards", + "usb": { + "device_version": "1.0.0", + "pid": "0x0000", + "vid": "0xFEED" + }, + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "k00", "matrix": [0, 0], "x": 0, "y": 0 }, + { "label": "k01", "matrix": [0, 1], "x": 1, "y": 0 }, + { "label": "k02", "matrix": [0, 2], "x": 2, "y": 0 }, + { "label": "k03", "matrix": [0, 3], "x": 3, "y": 0 }, + { "label": "k04", "matrix": [0, 4], "x": 5, "y": 0.5 }, + { "label": "k10", "matrix": [1, 0], "x": 0, "y": 1 }, + { "label": "k11", "matrix": [1, 1], "x": 1, "y": 1 }, + { "label": "k12", "matrix": [1, 2], "x": 2, "y": 1 }, + { "label": "k13", "matrix": [1, 3], "x": 3, "y": 1 }, + { "label": "k14", "matrix": [1, 4], "x": 5, "y": 1.75 }, + { "label": "k20", "matrix": [2, 0], "x": 0, "y": 2 }, + { "label": "k21", "matrix": [2, 1], "x": 1, "y": 2 }, + { "label": "k22", "matrix": [2, 2], "x": 2, "y": 2 }, + { "label": "k23", "matrix": [2, 3], "x": 3, "y": 2 } + ] + } + } +} \ No newline at end of file diff --git a/keyboards/tapedeck/keymaps/default/keymap.c b/keyboards/tapedeck/keymaps/default/keymap.c new file mode 100644 index 000000000000..ad8fe3731f8f --- /dev/null +++ b/keyboards/tapedeck/keymaps/default/keymap.c @@ -0,0 +1,33 @@ +/* Copyright 2023 Gowla + * + * 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 BASE 0 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [BASE] = LAYOUT( + KC_ESC, KC_MNXT, KC_MPLY, KC_MNXT, KC_MPLY, + RGB_MODE_RAINBOW, RGB_MODE_RGBTEST, RGB_M_K, RGB_TOG, KC_MPLY, + KC_F1, KC_F2, KC_F3, KC_F14 + ) +}; + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [BASE] = { ENCODER_CCW_CW(KC_WH_D, KC_WH_U), ENCODER_CCW_CW(KC_BRID, KC_BRIU) } +}; +#endif diff --git a/keyboards/tapedeck/keymaps/default/rules.mk b/keyboards/tapedeck/keymaps/default/rules.mk new file mode 100644 index 000000000000..20bd7170718d --- /dev/null +++ b/keyboards/tapedeck/keymaps/default/rules.mk @@ -0,0 +1,4 @@ +# Build Options +# change yes to no to disable +# +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/tapedeck/readme.md b/keyboards/tapedeck/readme.md new file mode 100644 index 000000000000..57216b3349cd --- /dev/null +++ b/keyboards/tapedeck/readme.md @@ -0,0 +1,33 @@ +# Gowla Tapedeck + +![Image of Tapedeck](https://i.ibb.co/R3JVMjM/tapedeck.jpg) + +4x4 12 Key Macro Board with 60MM Slider, RGB and 2 X Rotary Encoders. For use with QMK, designed and sold by Gowla. + +* Keyboard Maintainer: [Gowla](https://github.com/SamGowland/) +* Hardware Supported: Pro Micro ATmega32U4, Cherry MX Switches, Alps 60MM Slider +* Hardware Availability: [Repo](https://github.com/SamGowland/Gowla-Macro-Boards) + +Make example for this keyboard (after setting up your build environment): + + make tapedeck:default + +Flashing example for this keyboard: + + make tapedeck: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 3 ways: + +* **Bootmagic reset**: Hold down the top-left key (underneath the Pro Micro) and plug in the keyboard. This will also clear EEPROM, so it is a good first step if the keyboard is misbehaving. +* **Physical reset**: Remove the back plate and short the `RST` and `GND` pins on the Pro Micro. +* **Keycode in layout**: There is no key mapped to `QK_BOOT` in the pre-created keymaps, but you may assign this key in any keymaps you create. + +As a Pro Micro-compatible board, the Gowla Tapedeck uses `caterina` as its bootloader by default. Many popular Pro Micro alternatives like the Elite-C, Bit-C, Sea-Micro, Puchi-C etc should be flashed with a different bootloader such as `atmel-dfu`. + +If the incorrect bootloader is specified, bootmagic reset and the `QK_BOOT` keycode will not work. + +To avoid this problem, set the correct bootloader in your custom keymap's `rules.mk` file before compiling, or flash using an appropriate target (e.g. `make tapedeck:default:dfu`). See [flashing instructions and bootloader information](https://docs.qmk.fm/#/flashing) for more details. diff --git a/keyboards/tapedeck/rules.mk b/keyboards/tapedeck/rules.mk new file mode 100644 index 000000000000..3039719f6e61 --- /dev/null +++ b/keyboards/tapedeck/rules.mk @@ -0,0 +1,4 @@ +# Build Options +# change yes to no to disable +# +QUANTUM_LIB_SRC += analog.c diff --git a/keyboards/tapedeck/tapedeck.c b/keyboards/tapedeck/tapedeck.c new file mode 100644 index 000000000000..dba9fb59c961 --- /dev/null +++ b/keyboards/tapedeck/tapedeck.c @@ -0,0 +1,87 @@ +/* Copyright 2023 Gowla + * + * 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 "quantum.h" + +#ifdef POT_ENABLE + #include "analog.h" +#endif + +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_WH_U); + } else { + tap_code(KC_WH_D); + } + } else if (index == 1) { /* Second encoder */ + if (clockwise) { + tap_code(KC_BRIU); + } else { + tap_code(KC_BRID); + } + } + return true; +} + +void keyboard_post_init_kb(void) { +#ifdef POT_ENABLE + analogReference(ADC_REF_POWER); +#endif + keyboard_post_init_user(); +} + +#ifdef POT_ENABLE +int16_t pot_val = 0; +int16_t prev_val = 0; +int16_t val = 0; +uint8_t divisor = 0; + +long map(long x, long in_min, long in_max, long out_min, long out_max) +{ + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; +} + +void slider(void) { + if (divisor++) { // only run the slider function 1/256 times it's called + return; + } + + pot_val = analogReadPin(D4); + val = map(pot_val, 0, 1023, 1, 50); // Windows Specific + + if (( val > (prev_val + 1)) && val != prev_val){ + int i; + for (i = prev_val; i < val; i++ ) + {tap_code(KC_VOLU);} + } + if ((val < (prev_val - 1)) && val != prev_val){ + int i; + for (i = val; i < prev_val; i++ ) + {tap_code(KC_VOLD);} + } + prev_val = val; +} +#endif + +void housekeeping_task_kb(void) { +#ifdef POT_ENABLE + slider(); +#endif +}