Browse Source

Additional custom handwired layout - Space Oddity (#1868)

* Add existing file

* Add new keyboard layout - initial commit

* Revised readme.md

* Clarified readme.md, reorganized keymap.c, and added license text.

* Fixing last incomplete commit

* Just a little code cleanup to make things more readable.
pull/1880/head
James 6 years ago
committed by Jack Humbert
parent
commit
ab3dbd8daa
6 changed files with 327 additions and 0 deletions
  1. +66
    -0
      keyboards/handwired/space_oddity/config.h
  2. +156
    -0
      keyboards/handwired/space_oddity/keymaps/default/keymap.c
  3. +25
    -0
      keyboards/handwired/space_oddity/readme.md
  4. +57
    -0
      keyboards/handwired/space_oddity/rules.mk
  5. +1
    -0
      keyboards/handwired/space_oddity/space_oddity.c
  6. +22
    -0
      keyboards/handwired/space_oddity/space_oddity.h

+ 66
- 0
keyboards/handwired/space_oddity/config.h View File

@ -0,0 +1,66 @@
#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 James Taylor
#define PRODUCT Space Odyssey
#define DESCRIPTION Keyboard
#define CATERINA_BOOTLOADER
#define MOUSEKEY_INTERVAL 16
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 7
#define MOUSEKEY_WHEEL_DELAY 0
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 12
/* key matrix pins */
#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3 }
#define MATRIX_COL_PINS { B2, B6, B5, B4, E6, D7, C6, D4, D0, D1, D2, D3 }
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* number of backlight levels */
#ifdef BACKLIGHT_PIN
#define BACKLIGHT_LEVELS 0
#endif
/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5
/* 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
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* prevent stuck modifiers */
#define PREVENT_STUCK_MODIFIERS
#ifdef RGB_DI_PIN
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 0
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#endif
#endif

+ 156
- 0
keyboards/handwired/space_oddity/keymaps/default/keymap.c View File

@ -0,0 +1,156 @@
/* Keymap for Space Oddity Keyboard
Copyright (C) 2017 James Taylor
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 3 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 <https://www.gnu.org/licenses/>.
*/
#include "space_oddity.h"
// Planck keycodes needed for dynamic macros
enum planck_keycodes {
QWERTY = SAFE_RANGE,
DYNAMIC_MACRO_RANGE,
};
// Tap Dance
enum {
SFT_CAPS = 0,
};
#include "dynamic_macro.h"
#define MOUSE_LAYER 2
const uint16_t PROGMEM fn_actions[] = {
[2] = ACTION_LAYER_TOGGLE(MOUSE_LAYER),
};
qk_tap_dance_action_t tap_dance_actions[] = {
[SFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS),
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP(
M(0), M(1), M(2), M(3), M(4), DYN_MACRO_PLAY1, DYN_MACRO_PLAY2,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, 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_MINS,
CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
TD(SFT_CAPS), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT),
MO(2), MO(1), KC_LGUI, KC_RALT, KC_LCTRL, KC_SPC, ALT_T(KC_LEFT), ALL_T(KC_RGHT), LT(1, KC_UP), LT(2, KC_DOWN)),
KEYMAP(
M(7), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, DYN_REC_START1, DYN_REC_START2,
DYN_REC_STOP, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LBRC, KC_P7, KC_P8, KC_P9, KC_ASTR, KC_DEL,
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_RBRC, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_EQL,
KC_BSLS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_LCBR, KC_P1, KC_P2, KC_P3, KC_MINS, KC_PIPE,
KC_TRNS, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_RCBR, KC_P0, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
KEYMAP(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_TRNS, KC_TRNS, KC_MS_BTN1, KC_MS_BTN3, KC_MS_BTN2, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(2))
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch (id) {
case 0:
if (record->event.pressed) {
SEND_STRING("()"SS_TAP(X_LEFT));
}
break;
case 1:
if (record->event.pressed) {
SEND_STRING("[]"SS_TAP(X_LEFT));
}
break;
case 2:
if (record->event.pressed) {
SEND_STRING("{}"SS_TAP(X_LEFT));
}
break;
case 7:
if (record->event.pressed) {
SEND_STRING("(lambda ())"SS_TAP(X_LEFT)SS_TAP(X_LEFT));
}
break;
}
return MACRO_NONE;
}
void matrix_init_user(void) {
}
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_record_dynamic_macro(keycode, record)) {
return false;
}
return true;
}
void led_set_user(uint8_t usb_led) {
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
} else {
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
} else {
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
} else {
}
if (usb_led & (1 << USB_LED_COMPOSE)) {
} else {
}
if (usb_led & (1 << USB_LED_KANA)) {
} else {
}
}

+ 25
- 0
keyboards/handwired/space_oddity/readme.md View File

@ -0,0 +1,25 @@
Space Oddity Keyboard
=====================
This firmware is for an Emacs-focused handwired custom keyboard using an Arduino Pro Micro.
As originally designed, the top row consists of 2u keys which are used for user-defined macros. The keys for Shift and Enter are 1.75u.
Some simple example macros are included. To add your own, simply add the number of the macro you want in the appropriate section.
A picture of the finished product can be found here: https://imgur.com/dE9Y4XK
## Pinout
The following pins are used:
- Columns 1-12: B2, B6, B5, B4, E6, D7, C6, D4, D0, D1, D2, D3
- Rows 1-6: F4, F5, F6, F7, B1, B3
## Compiling and loading the firmware
To build the firmware, run `make handwired/space-oddity` from the toplevel directory.
On GNU/Linux, you can flash the default layout onto the microcontroller by using `avrdude -p atmega32u4 -P /dev/ttyACM0 -c avr109 -U flash:w:handwired_space_oddity_default.hex`. Note that the device name under `/dev` may be different.
This design was conceived by James Taylor. Any requests for further information and/or tips for building your own are welcome!

+ 57
- 0
keyboards/handwired/space_oddity/rules.mk View File

@ -0,0 +1,57 @@
# 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*
OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE ?= yes # 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
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
AUDIO_ENABLE ?= no
RGBLIGHT_ENABLE ?= no
TAP_DANCE_ENABLE = yes

+ 1
- 0
keyboards/handwired/space_oddity/space_oddity.c View File

@ -0,0 +1 @@
#include "space_oddity.h"

+ 22
- 0
keyboards/handwired/space_oddity/space_oddity.h View File

@ -0,0 +1,22 @@
#ifndef KB_H
#define KB_H
#include "quantum.h"
#define KEYMAP( \
K000, K002, K004, K006, K008, K010, K011, \
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, \
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, \
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, \
K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, \
K500, K501, K502, K503, K505, K507, K508, K509, K510, K511 \
) { \
{ K000, KC_NO, K002, KC_NO, K004, KC_NO, K006, KC_NO, K008, KC_NO, K010, K011 }, \
{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111 }, \
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211 }, \
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311 }, \
{ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411 }, \
{ K500, K501, K502, K503, KC_NO, K505, KC_NO, K507, K508, K509, K510, K511 } \
}
#endif

Loading…
Cancel
Save