From 20424fd37f84cbe08740539a48b6bb4839e0a179 Mon Sep 17 00:00:00 2001 From: Matthew Dias Date: Sun, 13 Mar 2022 01:36:12 -0600 Subject: [Keyboard] Add Glitch (#16444) Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- keyboards/p3d/glitch/config.h | 84 +++++++ keyboards/p3d/glitch/glitch.c | 58 +++++ keyboards/p3d/glitch/glitch.h | 40 ++++ keyboards/p3d/glitch/info.json | 300 +++++++++++++++++++++++++ keyboards/p3d/glitch/keymaps/default/keymap.c | 29 +++ keyboards/p3d/glitch/keymaps/default/readme.md | 1 + keyboards/p3d/glitch/readme.md | 24 ++ keyboards/p3d/glitch/rules.mk | 20 ++ 8 files changed, 556 insertions(+) create mode 100644 keyboards/p3d/glitch/config.h create mode 100644 keyboards/p3d/glitch/glitch.c create mode 100644 keyboards/p3d/glitch/glitch.h create mode 100644 keyboards/p3d/glitch/info.json create mode 100644 keyboards/p3d/glitch/keymaps/default/keymap.c create mode 100644 keyboards/p3d/glitch/keymaps/default/readme.md create mode 100644 keyboards/p3d/glitch/readme.md create mode 100644 keyboards/p3d/glitch/rules.mk (limited to 'keyboards/p3d') diff --git a/keyboards/p3d/glitch/config.h b/keyboards/p3d/glitch/config.h new file mode 100644 index 0000000000..e7f78123d9 --- /dev/null +++ b/keyboards/p3d/glitch/config.h @@ -0,0 +1,84 @@ +/* +Copyright 2021 Matthew Dias + +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" + +#define VENDOR_ID 0x7033 +#define PRODUCT_ID 0x3568 +#define DEVICE_VER 0x0001 +#define MANUFACTURER P3D Store +#define PRODUCT Glitch + +/* key matrix size */ +#define MATRIX_ROWS 10 +#define MATRIX_COLS 8 + +/* + * 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) + * + */ + +/* A Custom matrix.c is used to poll the port expander C6 shows that the pins are hardwired there */ +#define MATRIX_ROW_PINS { D5, D6, B6, D7, C7, B4, B5, D3, D4, C6 } +#define MATRIX_COL_PINS { B2, D2, B3, B7, F5, F4, F1, F0 } +#define UNUSED_PINS + +#define RGB_DI_PIN B1 +#define RGBLED_NUM 25 +#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 +#define RGBLIGHT_EFFECT_TWINKLE + +#define ENCODERS_PAD_A { F6 } +#define ENCODERS_PAD_B { F7 } +#define ENCODER_RESOLUTION 2 + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +#define USB_MAX_POWER_CONSUMPTION 400 + +/* 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 + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT diff --git a/keyboards/p3d/glitch/glitch.c b/keyboards/p3d/glitch/glitch.c new file mode 100644 index 0000000000..a62f578994 --- /dev/null +++ b/keyboards/p3d/glitch/glitch.c @@ -0,0 +1,58 @@ +/* Copyright 2021 Matthew Dias + * + * 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 "glitch.h" + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { + return false; + } + if (clockwise) { + // tap_code(RGB_MOD); + rgblight_step(); + } else { + // tap_code(RGB_RMOD); + rgblight_step_reverse(); + } + + return false; +} +#endif + +#ifdef OLED_ENABLE +bool oled_task_kb(void) { + if (!oled_task_user()) { + return false; + } + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case 0: + oled_write_P(PSTR("Default\n"), false); + break; + default: + oled_write_P(PSTR("Undefined\n"), false); + } + + // Host Keyboard LED Status + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); + oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); + oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); + + return false; +} diff --git a/keyboards/p3d/glitch/glitch.h b/keyboards/p3d/glitch/glitch.h new file mode 100644 index 0000000000..4b4f77396b --- /dev/null +++ b/keyboards/p3d/glitch/glitch.h @@ -0,0 +1,40 @@ +/* Copyright 2021 Matthew Dias + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define XXX KC_NO + +#include "quantum.h" + +#define LAYOUT_all( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \ + K10, K11, K12, K13, K14, K15, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, \ + K20, K21, K22, K23, K24, K25, K27, K28, K29, K2A, K2B, K2C, K2E, K2F, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, \ + K40, K41, K43, K45, K47, K49, K4B, K4C, K4D, K4E, K4F \ +) { \ + { K00, K02, K04, K06, K08, K0A, K0C, K0E }, \ + { K01, K03, K05, K07, K09, K0B, K0D, K0F }, \ + { K10, K12, K14, XXX, K18, K1A, K1C, K1E }, \ + { K11, K13, K15, K17, K19, K1B, K1D, K1F }, \ + { K20, K22, K24, XXX, K28, K2A, K2C, K2E }, \ + { K21, K23, K25, K27, K29, K2B, XXX, K2F }, \ + { K30, K32, K34, K36, K38, K3A, K3C, K3E }, \ + { XXX, K33, K35, K37, K39, K3B, K3D, K3F }, \ + { K40, XXX, XXX, XXX, XXX, XXX, K4C, K4E }, \ + { K41, K43, K45, K47, K49, K4B, K4D, K4F } \ +} diff --git a/keyboards/p3d/glitch/info.json b/keyboards/p3d/glitch/info.json new file mode 100644 index 0000000000..6445e200f8 --- /dev/null +++ b/keyboards/p3d/glitch/info.json @@ -0,0 +1,300 @@ +{ + "keyboard_name": "Glitch", + "url": "https://p3dstore.com/products/p3d-glitch-group-buy", + "maintainer": "matthewdias", + "layouts": { + "LAYOUT_all": { + "layout": [{ + "x": 19.1, + "y": 0.1 + }, { + "label": "ESC", + "x": 0.5, + "y": 0.5 + }, { + "label": "1", + "x": 1.5, + "y": 0.5 + }, { + "label": "_", + "x": 14.5, + "y": 0.6 + }, { + "label": "+", + "x": 15.5, + "y": 0.6 + }, { + "label": "Back", + "x": 16.5, + "y": 0.6 + }, { + "label": "Del", + "x": 17.5, + "y": 0.6 + }, { + "label": "2", + "x": 3.25, + "y": 1.0 + }, { + "label": "3", + "x": 4.25, + "y": 1.0 + }, { + "label": "4", + "x": 5.25, + "y": 1.0 + }, { + "label": "5", + "x": 6.25, + "y": 1.0 + }, { + "label": "6", + "x": 7.25, + "y": 1.0 + }, { + "label": "7", + "x": 10, + "y": 1.0 + }, { + "label": "8", + "x": 11, + "y": 1.0 + }, { + "label": "9", + "x": 12, + "y": 1.0 + }, { + "label": "0", + "x": 13, + "y": 1.0 + }, { + "label": "TAB", + "x": 0.15, + "y": 1.5, + "w": 1.5 + }, { + "label": "Q", + "x": 1.65, + "y": 1.5 + }, { + "label": "P", + "x": 14.35, + "y": 1.6 + }, { + "label": "[", + "x": 15.35, + "y": 1.6 + }, { + "label": "]", + "x": 16.35, + "y": 1.6 + }, { + "label": "\\", + "x": 17.35, + "y": 1.6, + "w": 1.5 + }, { + "x": 19.1, + "y": 1.6 + }, { + "label": "W", + "x": 3.75, + "y": 2.0 + }, { + "label": "E", + "x": 4.75, + "y": 2.0 + }, { + "label": "R", + "x": 5.75, + "y": 2.0 + }, { + "label": "T", + "x": 6.75, + "y": 2.0 + }, { + "label": "Y", + "x": 9.5, + "y": 2.0 + }, { + "label": "U", + "x": 10.5, + "y": 2.0 + }, { + "label": "I", + "x": 11.5, + "y": 2.0 + }, { + "label": "O", + "x": 12.5, + "y": 2.0 + }, { + "label": "CAPS", + "x": 0.15, + "y": 2.5, + "w": 1.75 + }, { + "label": "A", + "x": 1.9, + "y": 2.5 + }, { + "label": ";", + "x": 14.6, + "y": 2.6 + }, { + "label": "'", + "x": 15.6, + "y": 2.6 + }, { + "label": "ENTER", + "x": 16.6, + "y": 2.6, + "w": 2.25 + }, { + "x": 19.1, + "y": 2.6 + }, { + "label": "S", + "x": 4, + "y": 3.0 + }, { + "label": "D", + "x": 5, + "y": 3.0 + }, { + "label": "F", + "x": 6, + "y": 3.0 + }, { + "label": "G", + "x": 7, + "y": 3.0 + }, { + "label": "H", + "x": 9.75, + "y": 3.0 + }, { + "label": "J", + "x": 10.75, + "y": 3.0 + }, { + "label": "K", + "x": 11.75, + "y": 3.0 + }, { + "label": "L", + "x": 12.75, + "y": 3.0 + }, { + "label": "SHIFT", + "x": 0, + "y": 3.5, + "w": 2.25 + }, { + "label": "Z", + "x": 2.25, + "y": 3.5 + }, { + "label": ".", + "x": 14.25, + "y": 3.6 + }, { + "label": "?", + "x": 15.25, + "y": 3.6 + }, { + "label": "SHIFT", + "x": 16.25, + "y": 3.6, + "w": 1.75 + }, { + "x": 19.5, + "y": 3.6 + }, { + "label": "UP", + "x": 18.25, + "y": 3.85 + }, { + "label": "X", + "x": 4.5, + "y": 4.0 + }, { + "label": "C", + "x": 5.5, + "y": 4.0 + }, { + "label": "V", + "x": 6.5, + "y": 4.0 + }, { + "label": "B", + "x": 7.5, + "y": 4.0 + }, { + "label": "BEE", + "x": 9.25, + "y": 4.0 + }, { + "label": "N", + "x": 10.25, + "y": 4.0 + }, { + "label": "M", + "x": 11.25, + "y": 4.0 + }, { + "label": ",", + "x": 12.25, + "y": 4.0 + }, { + "label": "CTRL", + "x": 0, + "y": 4.5, + "w": 1.25 + }, { + "label": "WIN", + "x": 1.25, + "y": 4.5, + "w": 1.25 + }, { + "label": "WIN", + "x": 15, + "y": 4.6 + }, { + "label": "CTRL", + "x": 16, + "y": 4.6 + }, { + "label": "LEFT", + "x": 17.25, + "y": 4.85 + }, { + "label": "DOWN", + "x": 18.25, + "y": 4.85 + }, { + "label": "RIGHT", + "x": 19.25, + "y": 4.85 + }, { + "x": 4.75, + "y": 5.0, + "w": 2.75 + }, { + "label": "ALT", + "x": 7.5, + "y": 5.0, + "w": 1.25 + }, { + "label": "ALT", + "x": 9.5, + "y": 5.0, + "w": 1.25 + }, { + "x": 10.75, + "y": 5.0, + "w": 2.25 + }] + } + } +} diff --git a/keyboards/p3d/glitch/keymaps/default/keymap.c b/keyboards/p3d/glitch/keymaps/default/keymap.c new file mode 100644 index 0000000000..43aa53c9f1 --- /dev/null +++ b/keyboards/p3d/glitch/keymaps/default/keymap.c @@ -0,0 +1,29 @@ +/* Copyright 2021 Matthew Dias + * + * 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 + +//This is the ANSI version of the PCB + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = LAYOUT_all( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_MUTE, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT +) +}; + diff --git a/keyboards/p3d/glitch/keymaps/default/readme.md b/keyboards/p3d/glitch/keymaps/default/readme.md new file mode 100644 index 0000000000..8661c4b95f --- /dev/null +++ b/keyboards/p3d/glitch/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for Glitch diff --git a/keyboards/p3d/glitch/readme.md b/keyboards/p3d/glitch/readme.md new file mode 100644 index 0000000000..b29dc6e930 --- /dev/null +++ b/keyboards/p3d/glitch/readme.md @@ -0,0 +1,24 @@ +# Glitch + +Hotswap RGB Alice-style with OLED and Rotary Knob + +- Keyboard Maintainer: matthewdias +- Hardware Supported: Glitch PCB +- Hardware Availability: https://p3dstore.com + +Make example for this keyboard (after setting up your build environment): + + make p3d/glitch:default + +Flashing example for this keyboard: + + make p3d/glitch:default:flash + +## Bootloader + +Enter the bootloader in one of 2 ways: + +* **Bootmagic reset**: Hold down the top left and plug in the keyboard +* **Physical reset button**: Briefly press the button on the top of the PCB + +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/p3d/glitch/rules.mk b/keyboards/p3d/glitch/rules.mk new file mode 100644 index 0000000000..7ec8d5c09a --- /dev/null +++ b/keyboards/p3d/glitch/rules.mk @@ -0,0 +1,20 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes +OLED_ENABLE = yes -- cgit v1.2.3