From 317c624761741f71856f20ab55916e637183edb4 Mon Sep 17 00:00:00 2001 From: Nicholas Shaff Date: Sat, 11 Aug 2018 15:23:11 -0500 Subject: Keyboard: Six Shooter Keyboard (#3598) * Created base sixshooter configuration * Added SixShooter basic LED on/off support. * Updated LED identifier numbers to align with layout identifiers (and IDs on PCB). * Minor sixshooter documentation cleanup. * Added sixshooter info.json file. * Moved sixshooter custom keycodes out of keymaps and into base keyboard files, small documentation tweaks. * Removed unnecessary boot section size definition. * Removing CONFIG_H if/define and replacing with #pragma once. --- keyboards/sixshooter/config.h | 128 +++++++++++++++++++++++++ keyboards/sixshooter/info.json | 13 +++ keyboards/sixshooter/keymaps/default/keymap.c | 42 ++++++++ keyboards/sixshooter/keymaps/default/readme.md | 1 + keyboards/sixshooter/readme.md | 13 +++ keyboards/sixshooter/rules.mk | 64 +++++++++++++ keyboards/sixshooter/sixshooter.c | 57 +++++++++++ keyboards/sixshooter/sixshooter.h | 55 +++++++++++ 8 files changed, 373 insertions(+) create mode 100644 keyboards/sixshooter/config.h create mode 100644 keyboards/sixshooter/info.json create mode 100644 keyboards/sixshooter/keymaps/default/keymap.c create mode 100644 keyboards/sixshooter/keymaps/default/readme.md create mode 100644 keyboards/sixshooter/readme.md create mode 100644 keyboards/sixshooter/rules.mk create mode 100644 keyboards/sixshooter/sixshooter.c create mode 100644 keyboards/sixshooter/sixshooter.h (limited to 'keyboards') diff --git a/keyboards/sixshooter/config.h b/keyboards/sixshooter/config.h new file mode 100644 index 000000000..163a3ab43 --- /dev/null +++ b/keyboards/sixshooter/config.h @@ -0,0 +1,128 @@ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6666 +#define DEVICE_VER 0x0001 +#define MANUFACTURER bpiphany +#define PRODUCT sixshooter +#define DESCRIPTION A PCB for the CM Storm switch tester utilizing a Teensy 2.0. + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 6 + +/* + * 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 MATRIX_ROW_PINS { } +#define MATRIX_COL_PINS { F7, F6, F1, F5, F4, F0 } +#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 DEBOUNCING_DELAY 5 + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION diff --git a/keyboards/sixshooter/info.json b/keyboards/sixshooter/info.json new file mode 100644 index 000000000..79044589d --- /dev/null +++ b/keyboards/sixshooter/info.json @@ -0,0 +1,13 @@ +{ + "keyboard_name": "SixShooter", + "maintainer": "qmk", + "url": "https://geekhack.org/index.php?topic=70033.0", + "width": 3, + "height": 2, + "layouts": { + "LAYOUT": { + "key_count": 6, + "layout": [{"label":"K00", "x":0, "y":0}, {"label":"K01", "x":1, "y":0}, {"label":"K02", "x":2, "y":0}, {"label":"K03", "x":0, "y":1}, {"label":"K04", "x":1, "y":1}, {"label":"K05", "x":2, "y":1}] + } + } +} diff --git a/keyboards/sixshooter/keymaps/default/keymap.c b/keyboards/sixshooter/keymaps/default/keymap.c new file mode 100644 index 000000000..ca0973c60 --- /dev/null +++ b/keyboards/sixshooter/keymaps/default/keymap.c @@ -0,0 +1,42 @@ +/* Copyright 2018 QMK Community + * + * 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 _BL 0 +#define _FN 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap 0: Media Keys + * ,-----------. + * |Mut| V-| V+| + * |---+---+---| + * |Prv|Ply|Nxt| + * `-----------' + */ + [_BL] = LAYOUT( /* Base */ + MO(_FN), KC_VOLD, KC_VOLU, \ + KC_MPRV, KC_MPLY, KC_MNXT \ + ), + [_FN] = LAYOUT( + KC_TRNS, SS_LON, SS_LOFF, \ + KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +void matrix_init_user(void) { + /* Default all LEDs to on */ + sixshooter_led_all_on(); +} diff --git a/keyboards/sixshooter/keymaps/default/readme.md b/keyboards/sixshooter/keymaps/default/readme.md new file mode 100644 index 000000000..050a6f234 --- /dev/null +++ b/keyboards/sixshooter/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for sixshooter diff --git a/keyboards/sixshooter/readme.md b/keyboards/sixshooter/readme.md new file mode 100644 index 000000000..18229bdbf --- /dev/null +++ b/keyboards/sixshooter/readme.md @@ -0,0 +1,13 @@ +# The Six Shooter + +A PCB for the CM Storm switch tester utilizing a Teensy 2.0 designed by Bpiphany. Because the PCB was designed with individual pins for each LED, there are custom keycodes (`SS_LON` and `SS_LOFF`) for turning on and off the backlight LEDs. + +Keyboard Maintainer: QMK Community\ +Hardware Supported: Six Shooter PCB, Teensy 2.0\ +Hardware Availability: [GeekHack.org](https://geekhack.org/index.php?topic=70033.0) + +Make example for this keyboard (after setting up your build environment): + + make sixshooter:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/sixshooter/rules.mk b/keyboards/sixshooter/rules.mk new file mode 100644 index 000000000..5bf8d2165 --- /dev/null +++ b/keyboards/sixshooter/rules.mk @@ -0,0 +1,64 @@ +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + +# Bootloader +# This definition is optional, and if your keyboard supports multiple bootloaders of +# different sizes, comment this out, and the correct address will be loaded +# automatically (+60). See bootloader.mk for all options. +BOOTLOADER = halfkay + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # 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 +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 diff --git a/keyboards/sixshooter/sixshooter.c b/keyboards/sixshooter/sixshooter.c new file mode 100644 index 000000000..814d219a2 --- /dev/null +++ b/keyboards/sixshooter/sixshooter.c @@ -0,0 +1,57 @@ +#include "sixshooter.h" + +extern inline void sixshooter_led_0_on(void); +extern inline void sixshooter_led_1_on(void); +extern inline void sixshooter_led_2_on(void); +extern inline void sixshooter_led_3_on(void); +extern inline void sixshooter_led_4_on(void); +extern inline void sixshooter_led_5_on(void); + +extern inline void sixshooter_led_0_off(void); +extern inline void sixshooter_led_1_off(void); +extern inline void sixshooter_led_2_off(void); +extern inline void sixshooter_led_3_off(void); +extern inline void sixshooter_led_4_off(void); +extern inline void sixshooter_led_5_off(void); + +extern inline void sixshooter_led_all_on(void); +extern inline void sixshooter_led_all_off(void); + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + if (record->event.pressed) { + + /* Check for custom keycodes for turning on and off LEDs */ + switch(keycode) { + case SS_LON: + sixshooter_led_all_on(); + return false; + case SS_LOFF: + sixshooter_led_all_off(); + return false; + } + } + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + led_set_user(usb_led); +} diff --git a/keyboards/sixshooter/sixshooter.h b/keyboards/sixshooter/sixshooter.h new file mode 100644 index 000000000..d27b1e419 --- /dev/null +++ b/keyboards/sixshooter/sixshooter.h @@ -0,0 +1,55 @@ +#ifndef SIXSHOOTER_H +#define SIXSHOOTER_H + +#include "quantum.h" + +#define LAYOUT( \ + K00, K01, K02, \ + K03, K04, K05 \ +) { \ + { K00, K01, K02, K03, K04, K05 }, \ +} + + +/* + * Define keyboard specific keycodes for controlling on/off for all LEDs as they + * are all on different pins with this PCB, rather than a single backlight pin + */ +enum keyboard_keycode { + SS_LON = SAFE_RANGE, + SS_LOFF, + SAFE_RANGE_KB +}; + +inline void sixshooter_led_0_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); } +inline void sixshooter_led_1_on(void) { DDRC |= (1<<7); PORTC |= (1<<7); } +inline void sixshooter_led_2_on(void) { DDRD |= (1<<0); PORTD |= (1<<0); } +inline void sixshooter_led_3_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); } +inline void sixshooter_led_4_on(void) { DDRD |= (1<<7); PORTD |= (1<<7); } +inline void sixshooter_led_5_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); } + +inline void sixshooter_led_0_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); } +inline void sixshooter_led_1_off(void) { DDRC &= ~(1<<7); PORTC &= ~(1<<7); } +inline void sixshooter_led_2_off(void) { DDRD &= ~(1<<0); PORTD &= ~(1<<0); } +inline void sixshooter_led_3_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); } +inline void sixshooter_led_4_off(void) { DDRD &= ~(1<<7); PORTD &= ~(1<<7); } +inline void sixshooter_led_5_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); } + +inline void sixshooter_led_all_on(void) { + sixshooter_led_0_on(); + sixshooter_led_1_on(); + sixshooter_led_2_on(); + sixshooter_led_3_on(); + sixshooter_led_4_on(); + sixshooter_led_5_on(); +} +inline void sixshooter_led_all_off(void) { + sixshooter_led_0_off(); + sixshooter_led_1_off(); + sixshooter_led_2_off(); + sixshooter_led_3_off(); + sixshooter_led_4_off(); + sixshooter_led_5_off(); +} + +#endif -- cgit v1.2.3