From bfd673fbae7861e819eb17e0d1da58a1af76391a Mon Sep 17 00:00:00 2001 From: Robbie Gill Date: Thu, 30 Jun 2016 06:13:08 -0700 Subject: [PATCH] initial version of handwired/fivethirteen (#462) --- keyboards/handwired/fivethirteen/Makefile | 73 ++++++++ keyboards/handwired/fivethirteen/README.md | 28 +++ keyboards/handwired/fivethirteen/config.h | 162 ++++++++++++++++++ .../handwired/fivethirteen/fivethirteen.c | 8 + .../handwired/fivethirteen/fivethirteen.h | 21 +++ .../fivethirteen/keymaps/default/keymap.c | 49 ++++++ 6 files changed, 341 insertions(+) create mode 100644 keyboards/handwired/fivethirteen/Makefile create mode 100644 keyboards/handwired/fivethirteen/README.md create mode 100644 keyboards/handwired/fivethirteen/config.h create mode 100644 keyboards/handwired/fivethirteen/fivethirteen.c create mode 100644 keyboards/handwired/fivethirteen/fivethirteen.h create mode 100644 keyboards/handwired/fivethirteen/keymaps/default/keymap.c diff --git a/keyboards/handwired/fivethirteen/Makefile b/keyboards/handwired/fivethirteen/Makefile new file mode 100644 index 000000000..711759917 --- /dev/null +++ b/keyboards/handwired/fivethirteen/Makefile @@ -0,0 +1,73 @@ + +# 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 + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=512 + + +# 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 ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # 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 controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 + +ifndef QUANTUM_DIR + include ../../../Makefile +endif + + diff --git a/keyboards/handwired/fivethirteen/README.md b/keyboards/handwired/fivethirteen/README.md new file mode 100644 index 000000000..b2e13cd6d --- /dev/null +++ b/keyboards/handwired/fivethirteen/README.md @@ -0,0 +1,28 @@ +fivethirteen keyboard firmware +====================== + +## Quantum MK Firmware + +For the full Quantum feature list, see [the parent readme.md](/doc/readme.md). + +## Building + +Download or clone the whole firmware and navigate to the keyboards/handwired/fivethirteen folder. +Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use +the Teensy Loader to program your .hex file. + +Depending on which keymap you would like to use, you will have to compile slightly differently. + +### Default + +To build with the default keymap, simply run `make`. + +### Other Keymaps + +To build the firmware binary hex file with a keymap just do `make` with `keymap` option like: + +``` +$ make keymap=[default|jack|] +``` + +Keymaps follow the format **__keymap.c__** and are stored in folders in the `keymaps` folder, eg `keymaps/my_keymap/` diff --git a/keyboards/handwired/fivethirteen/config.h b/keyboards/handwired/fivethirteen/config.h new file mode 100644 index 000000000..76596342b --- /dev/null +++ b/keyboards/handwired/fivethirteen/config.h @@ -0,0 +1,162 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER rdg +#define PRODUCT fivethirteen +#define DESCRIPTION handwired 5x13 matrix keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 13 + +/* + * 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 { F6, F7, B6, B5, B4 } +#define MATRIX_COL_PINS { B0, B1, B2, B3, F0, D0, D1, D2, D3, C6, C7, D6, D7 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ + +/* 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 + +/* + * 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 + +#endif diff --git a/keyboards/handwired/fivethirteen/fivethirteen.c b/keyboards/handwired/fivethirteen/fivethirteen.c new file mode 100644 index 000000000..4c16e72eb --- /dev/null +++ b/keyboards/handwired/fivethirteen/fivethirteen.c @@ -0,0 +1,8 @@ +#include "fivethirteen.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} diff --git a/keyboards/handwired/fivethirteen/fivethirteen.h b/keyboards/handwired/fivethirteen/fivethirteen.h new file mode 100644 index 000000000..faa6de737 --- /dev/null +++ b/keyboards/handwired/fivethirteen/fivethirteen.h @@ -0,0 +1,21 @@ +#ifndef FIVETHIRTEEN_H +#define FIVETHIRTEEN_H + +#include "quantum.h" + +#define KEYMAP( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k010, k011, k012, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k110, k111, k112, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k210, k211, k212, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k310, k311, k312, \ + k40, k41, k42, k43, k44, k46, k47, k48, k49, k410, k411, k412 \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k010, k011, k012 }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k110, k111, k112 }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k210, k211, k212 }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k310, k311, k312 }, \ + { k40, k41, k42, k43, k44, KC_NO, k46, k47, k48, k49, k410, k411, k412 } \ +} + +#endif diff --git a/keyboards/handwired/fivethirteen/keymaps/default/keymap.c b/keyboards/handwired/fivethirteen/keymaps/default/keymap.c new file mode 100644 index 000000000..d718510d5 --- /dev/null +++ b/keyboards/handwired/fivethirteen/keymaps/default/keymap.c @@ -0,0 +1,49 @@ +#include "fivethirteen.h" + +#define _______ KC_TRNS + +#define HDN 1 +#define OSY 2 +#define MOS 3 +#define CTL_ESC CTL_T(KC_ESC) +#define SFT_BSP SFT_T(KC_BSPC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = KEYMAP( + 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_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, \ + CTL_ESC, 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_UP, KC_BSLS, \ + MO(MOS), KC_LCTL, KC_LALT, KC_LGUI, MO(HDN), KC_SPC , SFT_BSP, MO(OSY), MO(HDN), KC_LEFT, KC_DOWN, KC_RGHT \ +), +[HDN] = KEYMAP( + _______, 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_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______, \ + _______, KC_TILD, KC_GRV, KC_BSLS, KC_PIPE, KC_MINS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TILD, KC_GRV, _______, \ + _______, _______, _______, _______, _______, _______, _______, KC_ENT, _______, _______, _______, KC_PGUP, _______, \ + _______, _______, _______, _______, _______, KC_UNDS , KC_DEL, _______, _______, KC_HOME, KC_PGDN, KC_END \ +), +[OSY] = KEYMAP( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +), +[MOS] = KEYMAP( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, KC_BTN1, KC_BTN2, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, KC_WH_D, KC_WH_U, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +) +}; + + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + return MACRO_NONE; +};