summaryrefslogtreecommitdiffstats
path: root/keyboard/phantom
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/phantom')
-rw-r--r--keyboard/phantom/Makefile.lufa137
-rw-r--r--keyboard/phantom/Makefile.pjrc108
-rw-r--r--keyboard/phantom/README.md248
-rw-r--r--keyboard/phantom/config.h51
-rw-r--r--keyboard/phantom/keymap.c151
-rw-r--r--keyboard/phantom/keymap_7bit.h42
-rw-r--r--keyboard/phantom/keymap_ansi.h22
-rw-r--r--keyboard/phantom/keymap_ansi_150.h22
-rw-r--r--keyboard/phantom/keymap_iso.h22
-rw-r--r--keyboard/phantom/keymap_iso_150.h22
-rw-r--r--keyboard/phantom/led.c49
-rw-r--r--keyboard/phantom/matrix.c274
12 files changed, 1148 insertions, 0 deletions
diff --git a/keyboard/phantom/Makefile.lufa b/keyboard/phantom/Makefile.lufa
new file mode 100644
index 0000000000..a0b3b1444d
--- /dev/null
+++ b/keyboard/phantom/Makefile.lufa
@@ -0,0 +1,137 @@
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device.
+# Please customize your programmer settings(PROGRAM_CMD)
+#
+# make teensy = Download the hex file to the device, using teensy_loader_cli.
+# (must have teensy_loader_cli installed).
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+# Target file name (without extension).
+TARGET = phantom_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC += keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+
+# MCU name
+#MCU = at90usb1287
+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)
+
+
+# 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 = yes # Console for debug(+400)
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=512
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+ansi: OPT_DEFS += -DLAYOUT_ANSI
+ansi: all
+
+ansi_150: OPT_DEFS += -DLAYOUT_ANSI_150
+ansi_150: all
+
+iso: OPT_DEFS += -DLAYOUT_ISO
+iso: all
+
+iso_150: OPT_DEFS += -DLAYOUT_ISO_150
+iso_150: all
+
+7bit: OPT_DEFS += -DLAYOUT_7BIT
+7bit: all
diff --git a/keyboard/phantom/Makefile.pjrc b/keyboard/phantom/Makefile.pjrc
new file mode 100644
index 0000000000..7bf5f80f40
--- /dev/null
+++ b/keyboard/phantom/Makefile.pjrc
@@ -0,0 +1,108 @@
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device.
+# Please customize your programmer settings(PROGRAM_CMD)
+#
+# make teensy = Download the hex file to the device, using teensy_loader_cli.
+# (must have teensy_loader_cli installed).
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+# Target file name (without extension).
+TARGET = phantom_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+
+# MCU name, you MUST set this to match the board you are using
+# type "make clean" after changing this, so all files will be rebuilt
+#MCU = at90usb162 # Teensy 1.0
+MCU = atmega32u4 # Teensy 2.0
+#MCU = at90usb646 # Teensy++ 1.0
+#MCU = at90usb1286 # Teensy++ 2.0
+
+
+# Processor frequency.
+# Normally the first thing your program should do is set the clock prescaler,
+# so your program will run at the correct speed. You should also set this
+# variable to same clock speed. The _delay_ms() macro uses this, and many
+# examples use this variable to calculate timings. Do not add a "UL" here.
+F_CPU = 16000000
+
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+#MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
+CONSOLE_ENABLE = yes # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover(+500)
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+ansi: OPT_DEFS += -DLAYOUT_ANSI
+ansi: all
+
+ansi_150: OPT_DEFS += -DLAYOUT_ANSI_150
+ansi_150: all
+
+iso: OPT_DEFS += -DLAYOUT_ISO
+iso: all
+
+iso_150: OPT_DEFS += -DLAYOUT_ISO_150
+iso_150: all
+
+7bit: OPT_DEFS += -DLAYOUT_7BIT
+7bit: all
diff --git a/keyboard/phantom/README.md b/keyboard/phantom/README.md
new file mode 100644
index 0000000000..368ae97e85
--- /dev/null
+++ b/keyboard/phantom/README.md
@@ -0,0 +1,248 @@
+Phantom keyboard firmware
+======================
+DIY keyboard developed by Geekhack and Deskthority communities.
+The PCB was engineered by bpiphany from the original idea of HaveANiceDay.
+
+## Wiki on Deskthority.net
+- [Info](http://deskthority.net/wiki/Phantom)
+- [Assembly Instructions](http://deskthority.net/wiki/Phantom)
+
+
+Build
+-----
+Move to this directory then just run `make` like:
+
+ $ make -f Makefile.[pjrc|lufa] [ansi|ansi_150|iso|iso_150|7bit]
+
+Use `Makefile.pjrc` if you want to use PJRC stack or use `Makefile.lufa` for LUFA stack.
+
+
+LEDs
+----
+It is possible to configure the LEDs in 2 different ways.
+
+### 1. LED Brightness
+The brightness of the LEDs can be controlled by software.
+
+To select brightness edit [config.h](config.h) and set `LED_BRIGHTNESS` to a value
+between 0 and 255:
+
+ #define LED_BRIGHTNESS 250
+
+
+### 2. Sleep LED
+It is possible to have the LEDs fade in and out when the computer is suspended.
+
+To enable this feature, uncomment the `SLEEP_LED_ENABLE` line in the makefile you are using:
+
+ SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+
+*Note that this will set the LEDs to full brightness as this feature can't be combined with the brightness control.*
+
+
+Keymap
+------
+The PCB supports multiple physical layouts.
+Each layout have their own keymap file.
+
+*Note that only the ANSI keymap is tested on actual hardware.*
+
+To customize a keymap:
+
+1. Edit the file that corresponds to your layout.
+2. Specify your layout when building.
+
+See [keymap.c](keymap.c) to define your own custom layout.
+
+
+### 1. ANSI
+This is the default keymap.
+
+See [keymap_ansi.h](keymap_ansi.h) for detail.
+
+#### 1.0. ANSI Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ |-----------------------------------------------------------| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------| ,---.
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 1.1. ANSI Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt|Media| | | | |
+ |-----------------------------------------------------------| '-----------'
+ | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+
+### 2. ANSI 150
+Layout with 1.5 unit modifiers.
+
+See [keymap_ansi_150.h](keymap_ansi_150.h) for detail.
+
+#### 2.0. ANSI 150 Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ |-----------------------------------------------------------| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------| ,---.
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl |Gui|Alt | Space |Alt |Gui|Ctl | |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 2.1. ANSI 150 Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt|Media| | | | |
+ |-----------------------------------------------------------| '-----------'
+ | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+
+### 3. ISO
+ISO layout.
+
+See [keymap_iso.h](keymap_iso.h) for detail.
+
+#### 3.0. ISO Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |Del|End|PgD|
+ |------------------------------------------------------` Ret| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '| #| |
+ |-----------------------------------------------------------| ,---.
+ |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 3.1. ISO Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt| | | | | |
+ |------------------------------------------------------` Med| '-----------'
+ | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+
+### 4. ISO 150
+ISO layout with 1.5 unit modifiers.
+
+See [keymap_iso_150.h](keymap_iso_150.h) for detail.
+
+#### 4.0. ISO 150 Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |Del|End|PgD|
+ |------------------------------------------------------` Ret| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '| #| |
+ |-----------------------------------------------------------| ,---.
+ |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl |Gui|Alt | Space |Alt |Gui|Ctl | |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 4.1. ISO 150 Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt| | | | | |
+ |------------------------------------------------------` Med| '-----------'
+ | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+
+### 5. 7bit
+Layout using all the available keys on the PCB.
+
+This keymap is only provided as an example of what can be done using this layout.
+No real thought has been put into this keymap.
+
+See [keymap_7bit.h](keymap_7bit.h) for detail.
+
+#### 5.0. 7bit Default Layer
+ ,-----------------------------------------------------------. ,-----------.
+ |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|V- |V+ | |PrS|ScL|Pau|
+ `-----------------------------------------------------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| (| )| |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs| |Del|End|PgD|
+ |-----------------------------------------------------------| |-----------|
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '| \| Ret| |Stp|Ply|Med|
+ |-----------------------------------------------------------| |-----------|
+ |Cap|Shif| Z| X| C| V| B| N| M| ,| .| /|Shift |Cap| |Prv|Up |Nxt|
+ |-----------------------------------------------------------| |-----------|
+ |Ctrl |Gui|Alt |Spc |Bspc |Del|Ret |Alt |Gui |App|Ctrl | |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 5.1. 7bit Media Layer
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | |Slp|
+ `-----------------------------------------------------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt|Media| | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
diff --git a/keyboard/phantom/config.h b/keyboard/phantom/config.h
new file mode 100644
index 0000000000..6f5389336e
--- /dev/null
+++ b/keyboard/phantom/config.h
@@ -0,0 +1,51 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6057
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT Phantom
+
+/* message strings */
+#define DESCRIPTION t.m.k. keyboard firmware for Phantom
+
+/* matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 17
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 7
+
+/* Set LED brightness 0-255.
+ * This have no effect if sleep LED is enabled. */
+#define LED_BRIGHTNESS 250
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#endif
diff --git a/keyboard/phantom/keymap.c b/keyboard/phantom/keymap.c
new file mode 100644
index 0000000000..a040434f24
--- /dev/null
+++ b/keyboard/phantom/keymap.c
@@ -0,0 +1,151 @@
+/*
+Copyright 2011 Jun Wako <wakojun@gmail.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * Keymap for Phantom controller
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "debug.h"
+#include "keymap.h"
+
+// Convert physical keyboard layout to matrix array.
+// This is a macro to define keymap easily in keyboard layout form.
+#define KEYMAP( \
+ K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, \
+ K0A, K0B, K0C, K0D, K0F, K0G, K0H, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+) { \
+/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ \
+/* 5 */ { KC_##K5A, KC_##K4A, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F, KC_##K5H, KC_##K5I, KC_##K5J, KC_##K5K, KC_##K5L, KC_##K5M, KC_##K5N, KC_##K5O, KC_##K5P, KC_##K5Q, KC_##K5R}, \
+/* 4 */ { KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F, KC_##K4G, KC_##K4H, KC_##K4I, KC_##K4J, KC_##K4K, KC_##K4L, KC_##K4M, KC_##K4N, KC_##K4O, KC_##K4P, KC_##K4Q, KC_##K4R}, \
+/* 3 */ { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F, KC_##K3G, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K3L, KC_##K3M, KC_##K3N, KC_##K3P, KC_##K3Q, KC_##K3R}, \
+/* 2 */ { KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F, KC_##K2G, KC_##K2H, KC_##K2I, KC_##K2J, KC_##K2K, KC_##K2L, KC_##K2M, KC_##K2N, KC_##K2P, KC_##K2Q, KC_##K2R}, \
+/* 1 */ { KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F, KC_##K1G, KC_##K1H, KC_##K1I, KC_##K1J, KC_##K1K, KC_##K1L, KC_##K1M, KC_##K1N, KC_##K1P, KC_##K1Q, KC_##K1R}, \
+/* 0 */ { KC_##K0A, KC_##K0B, KC_##K0C, KC_##K5B, KC_##K0D, KC_##K0F, KC_##K5G, KC_##K0G, KC_##K0H, KC_NO, KC_##K0K, KC_##K0L, KC_##K0M, KC_##K0N, KC_##K0P, KC_##K0Q, KC_##K0R} \
+}
+
+#define KEYMAP_ANSI( \
+ K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, \
+ K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1Q, \
+ K0A, K0B, K0C, K0G, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+) KEYMAP( \
+ K5A, NO, K5C, K5D, K5E, K5F, NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, NO, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, NO, K2N, NO, NO, NO, \
+ K1A, NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, NO, K1N, NO, K1Q, NO, \
+ K0A, K0B, K0C, NO, NO, K0G, NO, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+)
+
+#define KEYMAP_ANSI_150( \
+ K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, \
+ K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1Q, \
+ K0A, K0B, K0C, K0G, K0L, K0M, K0N, K0P, K0Q, K0R \
+) KEYMAP( \
+ K5A, NO, K5C, K5D, K5E, K5F, NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, NO, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, NO, K2N, NO, NO, NO, \
+ K1A, NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, NO, K1N, NO, K1Q, NO, \
+ K0A, K0B, K0C, NO, NO, K0G, NO, NO, K0L, K0M, K0N, K0P, K0Q, K0R \
+)
+
+#define KEYMAP_ISO( \
+ K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1Q, \
+ K0A, K0B, K0C, K0G, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+) KEYMAP( \
+ K5A, NO, K5C, K5D, K5E, K5F, NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, NO, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, NO, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, NO, NO, NO, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, NO, K1N, NO, K1Q, NO, \
+ K0A, K0B, K0C, NO, NO, K0G, NO, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+)
+
+#define KEYMAP_ISO_150( \
+ K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1Q, \
+ K0A, K0B, K0C, K0G, K0L, K0M, K0N, K0P, K0Q, K0R \
+) KEYMAP( \
+ K5A, NO, K5C, K5D, K5E, K5F, NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, NO, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, NO, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, NO, NO, NO, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, NO, K1N, NO, K1Q, NO, \
+ K0A, K0B, K0C, NO, NO, K0G, NO, NO, K0L, K0M, K0N, K0P, K0Q, K0R \
+)
+
+#if defined(LAYOUT_7BIT)
+ #include "keymap_7bit.h"
+#elif defined(LAYOUT_ISO_150)
+ #include "keymap_iso_150.h"
+#elif defined(LAYOUT_ISO)
+ #include "keymap_iso.h"
+#elif defined(LAYOUT_ANSI_150)
+ #include "keymap_ansi_150.h"
+#else
+ #include "keymap_ansi.h"
+#endif
+
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+ } else {
+ // fall back to layer 0
+ return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/keyboard/phantom/keymap_7bit.h b/keyboard/phantom/keymap_7bit.h
new file mode 100644
index 0000000000..e6c4eabb22
--- /dev/null
+++ b/keyboard/phantom/keymap_7bit.h
@@ -0,0 +1,42 @@
+// Phantom 7bit
+/*
+ * 7bit:
+ *
+ * ,-----------------------------------------------------------. ,-----------.
+ * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|V- |V+ | |PrS|ScL|Pau|
+ * `-----------------------------------------------------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------.
+ * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| (| )| |Ins|Hom|PgU|
+ * |-----------------------------------------------------------| |-----------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs| |Del|End|PgD|
+ * |-----------------------------------------------------------| |-----------|
+ * |Fn0 | A| S| D| F| G| H| J| K| L| ;| '| \| Ret| |MSt|Ply|Med|
+ * |-----------------------------------------------------------| |-----------|
+ * |Cap|Shif| Z| X| C| V| B| N| M| ,| .| /|Shift |Cap| |Prv|Up |Nxt|
+ * |-----------------------------------------------------------| |-----------|
+ * |Ctrl |Gui|Alt |Spc |Bspc |Del|Ret |Alt |Gui |App|Ctrl | |Lef|Dow|Rig|
+ * `-----------------------------------------------------------' `-----------'
+ */
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty + a few media keys */
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, VOLD,VOLU, PSCR,SLCK,BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, FN1, FN2, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, DEL, END, PGDN, \
+ FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS,ENT, MSTP,MPLY,MSEL, \
+ CAPS,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,CAPS, MPRV,UP, MNXT, \
+ LCTL,LGUI,LALT,SPC, BSPC,DEL, ENT, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT),
+ /* 1: media keys */
+ KEYMAP(\
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,MSEL, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS)
+};
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_MODS_KEY(MOD_LSFT, KC_9),
+ [2] = ACTION_MODS_KEY(MOD_LSFT, KC_0)
+};
diff --git a/keyboard/phantom/keymap_ansi.h b/keyboard/phantom/keymap_ansi.h
new file mode 100644
index 0000000000..96a4c9dfb3
--- /dev/null
+++ b/keyboard/phantom/keymap_ansi.h
@@ -0,0 +1,22 @@
+// Phantom ANSI
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_ANSI(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, \
+ FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+