From 507dd18f2436a07abe49fdbd1ef851bb8b7ca324 Mon Sep 17 00:00:00 2001 From: fenuks Date: Mon, 29 Nov 2021 16:41:21 +0000 Subject: [Keyboard] Adapt downsteam Ghost Squid support to latest QMK (#14607) Co-authored-by: fenuks --- keyboards/bpiphany/ghost_squid/config.h | 42 ++++++++++ keyboards/bpiphany/ghost_squid/ghost_squid.c | 26 ++++++ keyboards/bpiphany/ghost_squid/ghost_squid.h | 44 ++++++++++ .../bpiphany/ghost_squid/keymaps/default/keymap.c | 77 +++++++++++++++++ .../bpiphany/ghost_squid/keymaps/default/readme.md | 1 + keyboards/bpiphany/ghost_squid/matrix.c | 97 ++++++++++++++++++++++ keyboards/bpiphany/ghost_squid/readme.md | 27 ++++++ keyboards/bpiphany/ghost_squid/rules.mk | 23 +++++ 8 files changed, 337 insertions(+) create mode 100644 keyboards/bpiphany/ghost_squid/config.h create mode 100644 keyboards/bpiphany/ghost_squid/ghost_squid.c create mode 100644 keyboards/bpiphany/ghost_squid/ghost_squid.h create mode 100644 keyboards/bpiphany/ghost_squid/keymaps/default/keymap.c create mode 100644 keyboards/bpiphany/ghost_squid/keymaps/default/readme.md create mode 100644 keyboards/bpiphany/ghost_squid/matrix.c create mode 100644 keyboards/bpiphany/ghost_squid/readme.md create mode 100644 keyboards/bpiphany/ghost_squid/rules.mk (limited to 'keyboards') diff --git a/keyboards/bpiphany/ghost_squid/config.h b/keyboards/bpiphany/ghost_squid/config.h new file mode 100644 index 0000000000..bb8535b177 --- /dev/null +++ b/keyboards/bpiphany/ghost_squid/config.h @@ -0,0 +1,42 @@ +/* +Copyright 2016 Daniel Svensson + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6050 +#define DEVICE_VER 0x0104 +#define MANUFACTURER Bathroom Epiphanies +#define PRODUCT ghost_squid + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 18 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +#define LED_PIN_ON_STATE 0 +#define LED_NUM_LOCK_PIN C5 +#define LED_CAPS_LOCK_PIN C6 +#define LED_SCROLL_LOCK_PIN B7 + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 diff --git a/keyboards/bpiphany/ghost_squid/ghost_squid.c b/keyboards/bpiphany/ghost_squid/ghost_squid.c new file mode 100644 index 0000000000..3ecac66f7a --- /dev/null +++ b/keyboards/bpiphany/ghost_squid/ghost_squid.c @@ -0,0 +1,26 @@ +/* +Copyright 2016 Daniel Svensson + +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 "ghost_squid.h" + +void keyboard_pre_init_kb(void) { + setPinOutput(D0); + writePinLow(D0); + fn_led_off(); + + keyboard_pre_init_user(); +} diff --git a/keyboards/bpiphany/ghost_squid/ghost_squid.h b/keyboards/bpiphany/ghost_squid/ghost_squid.h new file mode 100644 index 0000000000..839c9fc123 --- /dev/null +++ b/keyboards/bpiphany/ghost_squid/ghost_squid.h @@ -0,0 +1,44 @@ +/* +Copyright 2016 Daniel Svensson + +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" + +#define fn_led_on() writePinLow(D0) +#define fn_led_off() writePinHigh(D0) + +#define ___ KC_NO + +#define LAYOUT( \ + KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \ + KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, KK1, KL1, KQ1, KQ0, \ + KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, KK5, KL5, KQ5, KO5, \ + KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1, KK2, KL2, KQ2, \ + KN2, KI6, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, KO6, KK3, KL3, KQ3, KO3, \ + KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0, KL6, KQ6 \ + ) { /* 00-A 01-B 02-C 03-D 04-E 05-F 06-G 07-H 08-I 09-J 10-K 11-L 12-M 13-N 14-O 15-P 16-Q 17-R */ \ + /* 0 */ { ___ , KB0 , KC0 , KD0 , ___ , KF0 , KG0 , ___ , ___ , ___ , KK0 , KL0 , ___ , ___ , KO0 , ___ , KQ0 , KR0 }, \ + /* 1 */ { KA1 , KB1 , ___ , KD1 , KE1 , KF1 , KG1 , KH1 , KI1 , KJ1 , KK1 , KL1 , ___ , ___ , ___ , ___ , KQ1 , ___ }, \ + /* 2 */ { ___ , KB2 , ___ , KD2 , KE2 , KF2 , KG2 , KH2 , KI2 , KJ2 , KK2 , KL2 , ___ , KN2 , ___ , KP2 , KQ2 , KR2 }, \ + /* 3 */ { ___ , KB3 , ___ , KD3 , KE3 , KF3 , KG3 , KH3 , KI3 , KJ3 , KK3 , KL3 , KM3 , KN3 , KO3 , ___ , KQ3 , KR3 }, \ + /* 4 */ { KA4 , KB4 , ___ , KD4 , KE4 , KF4 , KG4 , KH4 , KI4 , KJ4 , KK4 , KL4 , ___ , ___ , KO4 , ___ , KQ4 , KR4 }, \ + /* 5 */ { KA5 , ___ , KC5 , KD5 , KE5 , KF5 , KG5 , KH5 , KI5 , KJ5 , KK5 , KL5 , ___ , ___ , KO5 , ___ , KQ5 , KR5 }, \ + /* 6 */ { ___ , KB6 , KC6 , ___ , KE6 , KF6 , KG6 , KH6 , KI6 , KJ6 , KK6 , KL6 , ___ , ___ , KO6 , ___ , KQ6 , KR6 }, \ + /* 7 */ { KA7 , KB7 , KC7 , KD7 , KE7 , KF7 , KG7 , KH7 , KI7 , KJ7 , ___ , ___ , ___ , ___ , KO7 , ___ , KQ7 , KR7 } \ + } + diff --git a/keyboards/bpiphany/ghost_squid/keymaps/default/keymap.c b/keyboards/bpiphany/ghost_squid/keymaps/default/keymap.c new file mode 100644 index 0000000000..09523ebbb9 --- /dev/null +++ b/keyboards/bpiphany/ghost_squid/keymaps/default/keymap.c @@ -0,0 +1,77 @@ +/* +Copyright 2016 Daniel Svensson + +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 + +/* Default qwerty layout +* ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ ┌───────────┐ +* │ESC│ │F1 │F2 │F3 │F4 │ │F5 │F6 │F7 │F8 │ │F9 │F10│F11│F12│ │PRT│SCR│PAU│ │Ghost Squid│ +* └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ └───────────┘ +* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ ┌───┬───┬───┬───┐ +* │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│ │INS│HOM│PgU│ │NUM│ / │ * │ - │ +* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ ├───┼───┼───┼───┤ +* │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ │DEL│END│PgD│ │ 7 │ 8 │ 9 │ │ +* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ ↲ │ └───┴───┴───┘ ├───┼───┼───┤ + │ +* │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ \ │ │ │ 7 │ 8 │ 9 │ │ +* ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ ┌───┐ ├───┼───┼───┼───┤ +* │Shif│ # │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift │ │ ↑ │ │ 1 │ 2 │ 3 │ │ +* ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ ├───┴───┼───┤ ↲ │ +* │Ctrl│GUI │Alt │ │ Alt│ GUI│Fn │Ctrl│ │ ← │ ↓ │ → │ │ 0 │ , │ │ +* └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ └───────┴───┴───┘ +*/ + +enum layer_names { + KM_QWERTY, + KM_MEDIA, + KM_GUI_LOCK +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Layer 0: Standard ISO layer */ + [KM_QWERTY] = LAYOUT( +KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS, +KC_GRV, 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_INS, KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, +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_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, +KC_CLCK, 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_P4, KC_P5, KC_P6, +KC_LSFT, KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, +KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,MO(KM_MEDIA),KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0, KC_PDOT), + /* Layer 1: Function layer */ + [KM_MEDIA] = LAYOUT( +_______,_______,_______,_______,_______, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_STOP, KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK, TG(KM_GUI_LOCK),KC_MUTE, KC_VOLD, KC_VOLU,_______,_______, RESET, +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______, +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______), + [KM_GUI_LOCK] = LAYOUT( +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, +_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, +_______,KC_NO,_______,_______,_______,KC_NO,_______,_______,_______,_______,_______,_______,_______) +}; + + +layer_state_t layer_state_set_user(layer_state_t state) { + if (IS_LAYER_ON_STATE(state, KM_GUI_LOCK)) { + fn_led_on(); + } else { + fn_led_off(); + } + return state; +} diff --git a/keyboards/bpiphany/ghost_squid/keymaps/default/readme.md b/keyboards/bpiphany/ghost_squid/keymaps/default/readme.md new file mode 100644 index 0000000000..3c27324d1c --- /dev/null +++ b/keyboards/bpiphany/ghost_squid/keymaps/default/readme.md @@ -0,0 +1 @@ +# Default layout desc TODO diff --git a/keyboards/bpiphany/ghost_squid/matrix.c b/keyboards/bpiphany/ghost_squid/matrix.c new file mode 100644 index 0000000000..b0ad607555 --- /dev/null +++ b/keyboards/bpiphany/ghost_squid/matrix.c @@ -0,0 +1,97 @@ +/* + Copyright 2014 Ralf Schmitt + Copyright 2016 Daniel Svensson + + 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 "matrix.h" +#include "quantum.h" + +matrix_row_t read_rows(void) { + return + (PINB & (1 << 1) ? 0 : ((matrix_row_t)1 << 0)) | + (PINC & (1 << 2) ? 0 : ((matrix_row_t)1 << 1)) | + (PINB & (1 << 6) ? 0 : ((matrix_row_t)1 << 2)) | + (PINB & (1 << 4) ? 0 : ((matrix_row_t)1 << 3)) | + (PINB & (1 << 3) ? 0 : ((matrix_row_t)1 << 4)) | + (PINB & (1 << 2) ? 0 : ((matrix_row_t)1 << 5)) | + (PINB & (1 << 0) ? 0 : ((matrix_row_t)1 << 6)) | + (PINB & (1 << 5) ? 0 : ((matrix_row_t)1 << 7)); +} + +void select_col(uint8_t col) { + switch (col) { + case 0: PORTD = (PORTD & ~0b01111110) | 0b01100010; break; + case 1: PORTD = (PORTD & ~0b01111110) | 0b01101000; break; + case 2: PORTD = (PORTD & ~0b01111110) | 0b01101100; break; + case 3: PORTD = (PORTD & ~0b01111110) | 0b01110000; break; + case 4: PORTD = (PORTD & ~0b01111110) | 0b01111000; break; + case 5: PORTD = (PORTD & ~0b01111110) | 0b01100000; break; + case 6: PORTD = (PORTD & ~0b01111110) | 0b01110100; break; + case 7: PORTD = (PORTD & ~0b01111110) | 0b01100100; break; + case 8: PORTD = (PORTD & ~0b01111110) | 0b01111100; break; + case 9: PORTD = (PORTD & ~0b01111110) | 0b01101010; break; + case 10: PORTD = (PORTD & ~0b01111110) | 0b00110110; break; + case 11: PORTD = (PORTD & ~0b01111110) | 0b00010110; break; + case 12: PORTD = (PORTD & ~0b01111110) | 0b01001110; break; + case 13: PORTD = (PORTD & ~0b01111110) | 0b00111110; break; + case 14: PORTD = (PORTD & ~0b01111110) | 0b00011110; break; + case 15: PORTD = (PORTD & ~0b01111110) | 0b01000110; break; + case 16: PORTD = (PORTD & ~0b01111110) | 0b00100110; break; + case 17: PORTD = (PORTD & ~0b01111110) | 0b00101110; break; + } +} + +void matrix_init_custom(void) { + /* Column output pins */ + setPinOutput(D1); + setPinOutput(D2); + setPinOutput(D3); + setPinOutput(D4); + setPinOutput(D5); + setPinOutput(D6); + + /* Row input pins */ + writePinHigh(B0); + writePinHigh(B1); + writePinHigh(B2); + writePinHigh(B3); + writePinHigh(B4); + writePinHigh(B5); + writePinHigh(B6); + writePinHigh(C2); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool changed = false; + + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + select_col(col); + matrix_io_delay(); + matrix_row_t rows = read_rows(); + + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + bool prev_bit = current_matrix[row] & ((matrix_row_t)1 << col); + bool curr_bit = rows & (1 << row); + + if (prev_bit != curr_bit) { + current_matrix[row] ^= (matrix_row_t)1 << col; + changed = true; + } + } + } + + return changed; +} diff --git a/keyboards/bpiphany/ghost_squid/readme.md b/keyboards/bpiphany/ghost_squid/readme.md new file mode 100644 index 0000000000..ab39e0f725 --- /dev/null +++ b/keyboards/bpiphany/ghost_squid/readme.md @@ -0,0 +1,27 @@ +# Ghost Squid Controller + +This is the firmware for Rev. 20140518 of the Ghost Squid controller by [Bathroom Epiphanies](http://bathroomepiphanies.com/controllers/), a replacement controller for the [Cooler Master Quick Fire XT](https://www.coolermaster.com/catalog/peripheral/keyboards/quick-fire-xt/). + +The code was adapted from the [BathroomEpiphanies QMK Firmware](https://github.com/BathroomEpiphanies/epiphanies_qmk_keyboard/tree/master/keyboards/ghost_squid_20140518). + +* Keyboard Maintainer: QMK Community +* Hardware Supported: Ghost Squid +* Hardware Availability: [1upkeyboards](https://1upkeyboards.com/shop/controllers/qf-xt-ghost-squid-controller-2/) + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `RESET` if it is available + +Make example for this keyboard (after setting up your build environment): + +104 key default layout: + + make bpiphany/ghost_squid:default + +Flashing example for this keyboard: + + make bpiphany/ghost_squid: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). diff --git a/keyboards/bpiphany/ghost_squid/rules.mk b/keyboards/bpiphany/ghost_squid/rules.mk new file mode 100644 index 0000000000..cedec6cd72 --- /dev/null +++ b/keyboards/bpiphany/ghost_squid/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega32u2 + +# 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 +# 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 +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +CUSTOM_MATRIX = lite +SRC += matrix.c -- cgit v1.2.3