From 220551ed5fa3fc2a6ead4a182bad189b21ab40cc Mon Sep 17 00:00:00 2001 From: fauxpark Date: Fri, 1 Mar 2019 07:06:26 +1100 Subject: [PATCH] [Keyboard] GH60 Satan improvements (#5264) * GH60 Satan improvements * Link no worky * Accidentally a h * Use MOD_MASK_SHIFT from core * Remove nonexistent layouts from here --- keyboards/satan/config.h | 12 +- keyboards/satan/keymaps/default/keymap.c | 65 +++---- keyboards/satan/pinout.txt | 1 - keyboards/satan/readme.md | 30 +++- keyboards/satan/rules.mk | 23 +-- keyboards/satan/satan.c | 28 ++- keyboards/satan/satan.h | 213 +++++++++++------------ 7 files changed, 179 insertions(+), 193 deletions(-) delete mode 100644 keyboards/satan/pinout.txt diff --git a/keyboards/satan/config.h b/keyboards/satan/config.h index dbe98e87ef6..c15e5c37c16 100644 --- a/keyboards/satan/config.h +++ b/keyboards/satan/config.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once #include "config_common.h" @@ -26,7 +25,7 @@ along with this program. If not, see . #define DEVICE_VER 0x0003 #define MANUFACTURER SATAN #define PRODUCT GH60 -#define DESCRIPTION QMK keyboard firmware for Satan GH60 with WS2812 support +#define DESCRIPTION 60% keyboard with backlight and WS2812 support /* key matrix size */ #define MATRIX_ROWS 5 @@ -58,12 +57,11 @@ along with this program. If not, see . */ #define BACKLIGHT_LEVELS 4 -/* Underlight configuration +/* Underglow configuration */ - #define RGB_DI_PIN E2 #define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 8 // Number of LEDs +#define RGBLED_NUM 8 #define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_SAT_STEP 17 #define RGBLIGHT_VAL_STEP 17 @@ -85,5 +83,3 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -#endif diff --git a/keyboards/satan/keymaps/default/keymap.c b/keyboards/satan/keymaps/default/keymap.c index fc9d3b7ab76..2dec5464ccf 100644 --- a/keyboards/satan/keymaps/default/keymap.c +++ b/keyboards/satan/keymaps/default/keymap.c @@ -4,71 +4,64 @@ enum custom_keycodes { SFT_ESC = SAFE_RANGE }; -// Used for SHIFT_ESC -#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) - // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _BL 0 -#define _FL 1 +enum layer_names { + _BL, + _FL +}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap _BL: (Base Layer) Default Layer * ,-----------------------------------------------------------. - * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | + * |Esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Backsp| * |-----------------------------------------------------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | + * | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | * |-----------------------------------------------------------| - * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | + * | Caps | A | S | D | F | G | H | J | K | L | ; | ' | Enter | * |-----------------------------------------------------------| - * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | + * | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | * |-----------------------------------------------------------| - * |Ctrl|Gui |Alt | Space |Alt |Gui |FN |Ctrl | + * |Ctrl|GUI |Alt | Space | Alt| GUI| Fn | Ctrl| * `-----------------------------------------------------------' */ -[_BL] = LAYOUT_60_ansi( - SFT_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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \ - KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, MO(_FL),KC_RCTL), + [_BL] = LAYOUT_60_ansi( + SFT_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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_FL), KC_RCTL + ), /* Keymap _FL: Function Layer * ,-----------------------------------------------------------. - * | | | | | | | | | | | | | | RESET| + * | ` | | | | | | | | | | | | | Reset | * |-----------------------------------------------------------| - * | | | | | | | | | | | |BL-|BL+|BL | + * | | | | | | | | | | | |BL-|BL+| BL | * |-----------------------------------------------------------| - * | | | | | | | | | | | | | + * | | | | | | | | | | | | | | * |-----------------------------------------------------------| - * | | F1|F2 | F3|F4 | F5| F6| F7| F8| | | | + * | | | | | | | | | | | | | * |-----------------------------------------------------------| * | | | | | | | | | * `-----------------------------------------------------------' */ -[_FL] = LAYOUT_60_ansi( - #ifdef RGBLIGHT_ENABLE - KC_GRV, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,RESET, \ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, BL_DEC,BL_INC, BL_TOGG, \ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \ - _______,RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD,_______,_______,_______, \ - _______,_______,_______, _______, _______,_______,_______, _______), - #else - KC_GRV, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,RESET, \ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, BL_DEC, BL_INC,BL_TOGG, \ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ - _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ - _______,_______,_______, _______, _______,_______,_______,_______), - #endif + [_FL] = LAYOUT_60_ansi( + KC_GRV, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_DEC, BL_INC, BL_TOGG, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______ + ) }; bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case SFT_ESC: if (record->event.pressed) { - if (get_mods() & MODS_SHIFT_MASK) { + if (get_mods() & MOD_MASK_SHIFT) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -76,7 +69,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { send_keyboard_report(); } } else { - if (get_mods() & MODS_SHIFT_MASK) { + if (get_mods() & MOD_MASK_SHIFT) { del_key(KC_GRV); send_keyboard_report(); } else { diff --git a/keyboards/satan/pinout.txt b/keyboards/satan/pinout.txt deleted file mode 100644 index d1ad4ac8835..00000000000 --- a/keyboards/satan/pinout.txt +++ /dev/null @@ -1 +0,0 @@ -For WS2812B LED strip support, connect DIN from strip to PE2 on ATmega32u4 controller (see reference image controller.jpg) \ No newline at end of file diff --git a/keyboards/satan/readme.md b/keyboards/satan/readme.md index a2552edf8db..7eb272cf304 100644 --- a/keyboards/satan/readme.md +++ b/keyboards/satan/readme.md @@ -1,15 +1,33 @@ -Satan GH60 -========== +# Satan GH60 -![controller](https://i.imgur.com/9vyRBoT.jpg) -![power](https://i.imgur.com/pHMZHLP.jpg) +A clone of the GH60 60% keyboard, with full backlighting support. Keyboard Maintainer: QMK Community Hardware Supported: Satan GH60 PCB -Hardware Availability: https://1upkeyboards.com/gh60-satan-pcb.html +Hardware Availability: https://www.1upkeyboards.com/shop/controllers/gh60-satan-pcb/ Make example for this keyboard (after setting up your build environment): make satan:default -See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. +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). + +## RGB Underglow (WS2812B LED Strip) + +This board also supports underglow with a slight mod. + +Connect the DIN pad of the LED strip to PE2 on the ATmega32U4, like so: + +![controller](https://i.imgur.com/9vyRBoT.jpg) + +Then connect VCC and GND to pins 1 and 6 at the bottom of the PCB: + +![power](https://i.imgur.com/pHMZHLP.jpg) + +## ISP Header + +If you want to flash another bootloader (such as QMK-DFU), or can't get into the bootloader in the first place, the row of pins at the bottom can be used to ISP flash the board: + +| 1 | 2 | 3 | 4 | 5 | 6 | 7 | +|---|----|---|----|-----|---|----| +|VCC|MISO|SCK|MOSI|RESET|GND|*NC*| diff --git a/keyboards/satan/rules.mk b/keyboards/satan/rules.mk index 98200ab02ca..51161490e4d 100644 --- a/keyboards/satan/rules.mk +++ b/keyboards/satan/rules.mk @@ -1,6 +1,4 @@ - # MCU name -#MCU = at90usb1287 MCU = atmega32u4 # Processor frequency. @@ -16,7 +14,6 @@ MCU = atmega32u4 # software delays. F_CPU = 16000000 - # # LUFA specific # @@ -39,7 +36,6 @@ F_USB = $(F_CPU) # Interrupt driven control endpoint task(+60) OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT - # Boot Section Size in *bytes* # Teensy halfKay 512 # Teensy++ halfKay 1024 @@ -48,21 +44,20 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # USBaspLoader 2048 OPT_DEFS += -DBOOTLOADER_SIZE=4096 - # Build Options # comment out to disable the options. # -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 = yes # Console for debug(+400) +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 = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality (+4870) BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality (+1150) -MIDI_ENABLE = no # MIDI controls +MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no -UNICODE_ENABLE = no # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -LAYOUTS = 60_ansi 60_iso 60_ansi_split_bs_rshift \ No newline at end of file +LAYOUTS = 60_ansi 60_iso 60_ansi_split_bs_rshift diff --git a/keyboards/satan/satan.c b/keyboards/satan/satan.c index d2c5d5c2054..8542a57c43a 100644 --- a/keyboards/satan/satan.c +++ b/keyboards/satan/satan.c @@ -1,30 +1,24 @@ #include "satan.h" -#include "led.h" void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - matrix_init_user(); - led_init_ports(); + matrix_init_user(); + led_init_ports(); }; void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - matrix_scan_user(); + matrix_scan_user(); }; void led_init_ports(void) { - // * Set our LED pins as output - DDRB |= (1<<2); + setPinOutput(B2); } void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<