summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--keyboard/clueboard1/Makefile137
-rw-r--r--keyboard/clueboard1/clueboard1.c27
-rw-r--r--keyboard/clueboard1/clueboard1.h52
-rw-r--r--keyboard/clueboard1/config.h86
-rw-r--r--keyboard/clueboard1/keymaps/keymap_default.c108
-rw-r--r--keyboard/clueboard1/led.c34
-rw-r--r--keyboard/clueboard2/Makefile140
-rw-r--r--keyboard/clueboard2/backlight.c41
-rw-r--r--keyboard/clueboard2/clueboard2.c44
-rw-r--r--keyboard/clueboard2/clueboard2.h57
-rw-r--r--keyboard/clueboard2/config.h100
-rw-r--r--keyboard/clueboard2/keymaps/keymap_default.c170
-rw-r--r--keyboard/clueboard2/keymaps/keymap_max.c147
-rw-r--r--keyboard/clueboard2/keymaps/keymap_skully.c108
-rw-r--r--keyboard/clueboard2/led.c36
-rw-r--r--keyboard/cluepad/Makefile136
-rw-r--r--keyboard/cluepad/backlight.c54
-rw-r--r--keyboard/cluepad/cluepad.c39
-rw-r--r--keyboard/cluepad/cluepad.h41
-rw-r--r--keyboard/cluepad/config.h102
-rw-r--r--keyboard/cluepad/keymaps/keymap_default.c122
22 files changed, 1783 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 8b8c45169d..a082ea22e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,8 +16,8 @@ build/
.vagrant/
.DS_STORE
-# Eclipse Settings
+# Eclipse/PyCharm/Other IDE Settings
.cproject
.project
.settings/
-
+.idea
diff --git a/keyboard/clueboard1/Makefile b/keyboard/clueboard1/Makefile
new file mode 100644
index 0000000000..767fc95efb
--- /dev/null
+++ b/keyboard/clueboard1/Makefile
@@ -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 = clueboard1
+
+
+# Directory common source filess exist
+TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# # project specific files
+SRC = clueboard1.c \
+ led.c \
+
+ifdef KEYMAP
+ SRC := keymaps/keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymaps/keymap_default.c $(SRC)
+endif
+
+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)
+
+# 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=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 = 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
+# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+# MIDI_ENABLE = YES # MIDI controls
+# UNICODE_ENABLE = YES # Unicode
+# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
+
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TOP_DIR)/quantum/quantum.mk
diff --git a/keyboard/clueboard1/clueboard1.c b/keyboard/clueboard1/clueboard1.c
new file mode 100644
index 0000000000..252c65fcc2
--- /dev/null
+++ b/keyboard/clueboard1/clueboard1.c
@@ -0,0 +1,27 @@
+#include "clueboard1.h"
+
+__attribute__ ((weak))
+void * matrix_init_user(void) {
+ // leave these blank
+};
+
+__attribute__ ((weak))
+void * matrix_scan_user(void) {
+ // leave these blank
+};
+
+void * matrix_init_kb(void) {
+ // put your keyboard start-up code here
+ // runs once when the firmware starts up
+ if (matrix_init_user) {
+ (*matrix_init_user)();
+ }
+};
+
+void * matrix_scan_kb(void) {
+ // put your looping keyboard code here
+ // runs every cycle (a lot)
+ if (matrix_scan_user) {
+ (*matrix_scan_user)();
+ }
+};
diff --git a/keyboard/clueboard1/clueboard1.h b/keyboard/clueboard1/clueboard1.h
new file mode 100644
index 0000000000..1572ea2fdc
--- /dev/null
+++ b/keyboard/clueboard1/clueboard1.h
@@ -0,0 +1,52 @@
+#ifndef CLUEBOARD1_H
+#define CLUEBOARD1_H
+
+#include "matrix.h"
+#include "keymap_common.h"
+#include <stddef.h>
+
+
+/* Clueboard matrix layout
+ * ,-----------------------------------------------------------. ,---.
+ * | 00| 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E| | 0F|
+ * |-----------------------------------------------------------| |---|
+ * | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| 1C| 1D| | 1F|
+ * |-----------------------------------------------------------| `---'
+ * | 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 2A| 2B| 2C| 2D|
+ * |------------------------------------------------------------.
+ * | 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 3A| 3B| 3C| 3D|3E|
+ * |------------------------------------------------------------------.
+ * | 40| 41| 42| 43| 45| 46| 49| 4A| 4B| 4C| 4D| 4E| 4F|
+ * `------------------------------------------------------------------'
+ * ,-----------------------------------------------------------. ,---.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Yen| BS| |Ins|
+ * |-----------------------------------------------------------| |---|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|
+ * |-----------------------------------------------------------| `---'
+ * |Caps | A| S| D| F| G| H| J| k| L| ;| '| # | Ent|
+ * |--------------------------------------------------------------.
+ * |Shift| \| Z| X| C| V| B| N| M| ,| .| /| \|Shift| Up|
+ * |------------------------------------------------------------------.
+ * |Ctrl|Alt|Gui |MHen| Space| Space|Henk|Gui |Ctrl| Fn|Left|Down|Rgt|
+ * `------------------------------------------------------------------'
+ */
+// The first section contains all of the arguements
+// The second converts the arguments into a two-dimensional array
+#define KEYMAP( \
+ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F, \
+ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1F, \
+ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, \
+ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
+ k40, k41, k42, k43, k45, k46, k49, k4A, k4B, k4C, k4D, k4E, k4F \
+) { \
+ { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F }, \
+ { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, KC_NO, k1F }, \
+ { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D }, \
+ { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
+ { k40, k41, k42, k43, KC_NO, k45, k46, KC_NO, KC_NO, k49, k4A, k4B, k4C, k4D, k4E, k4F } \
+}
+
+void * matrix_init_user(void);
+void * matrix_scan_user(void);
+
+#endif
diff --git a/keyboard/clueboard1/config.h b/keyboard/clueboard1/config.h
new file mode 100644
index 0000000000..01212078f1
--- /dev/null
+++ b/keyboard/clueboard1/config.h
@@ -0,0 +1,86 @@
+/*
+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
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xC1ED
+#define PRODUCT_ID 0x2301
+#define DEVICE_VER 0x0003
+#define MANUFACTURER Clueboard
+#define PRODUCT Clueboard
+#define DESCRIPTION QMK keyboard firmware for Clueboard
+
+/* key matrix size */
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 16
+
+// COLS: Left to right, ROWS: Top to bottom
+
+/* Column pin configuration
+ * col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ * pin: B3 F1 F4 F5 F6 C7 C6 B6 B5 B4 D7 D6 D4 F7 B0 B1
+ */
+#define COLS (int []){ B3, F1, F4, F5, F6, C7, C6, B6, B5, B4, D7, D6, D4, F7, B0, B1 }
+
+ /* Row pin configuration
+ * row: 0 1 2 3 4
+ * pin: D1 D0 D2 D5 D3
+ */
+#define ROWS (int []){ D1, D0, D2, D5, D3 }
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 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)) \
+)
+
+/*
+ * 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/keyboard/clueboard1/keymaps/keymap_default.c b/keyboard/clueboard1/keymaps/keymap_default.c
new file mode 100644
index 0000000000..bee7e35a07
--- /dev/null
+++ b/keyboard/clueboard1/keymaps/keymap_default.c
@@ -0,0 +1,108 @@
+#include "clueboard1.h"
+
+// Used for SHIFT_ESC
+#define MODS_CTRL_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
+#define _RS 2
+
+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| -| =| \| BS| |PGUP|
+ * |--------------------------------------------------------------------------| |----|
+ * | Tab| Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |PGDN|
+ * |--------------------------------------------------------------------------| `----'
+ * |Capslck| A| S| D| F| G| H| J| K| L| ;| '| # | Ent|
+ * |-----------------------------------------------------------------------------.
+ * |Shift| BS| Z| X| C| V| B| N| M| ,| .| /| BS|Shift| UP|
+ * |------------------------------------------------------------------------|----|----.
+ * | Ctrl| Gui| Alt| MHen| Space| Space| Hen| Alt| Ctrl| _FL|LEFT|DOWN|RGHT|
+ * `----------------------------------------------------------------------------------'
+ */
+[_BL] = KEYMAP(
+ F(0), 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_BSLS, KC_BSPC, KC_PGUP, \
+ 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_PGDN, \
+ 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_NUHS, KC_ENT, \
+ KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_RSFT, KC_UP, \
+ KC_LCTL, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC,KC_SPC, KC_HENK, KC_RALT, KC_RCTL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ /* Keymap _FL: Function Layer
+ * ,--------------------------------------------------------------------------. ,----.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12| | Del| |BLIN|
+ * |--------------------------------------------------------------------------| |----|
+ * | | | | | | | | |PScr|SLck|Paus| | | | |BLDE|
+ * |--------------------------------------------------------------------------| `----'
+ * | | | _RS| | | | | | | | | | | |
+ * |-----------------------------------------------------------------------------.
+ * | | | | | | | | | | | | | | |PGUP|
+ * |------------------------------------------------------------------------|----|----.
+ * | | | | | | | | | | _FL|HOME|PGDN| END|
+ * `----------------------------------------------------------------------------------'
+ */
+[_FL] = KEYMAP(
+ KC_GRV, 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_TRNS, KC_DEL, BL_INC, \
+ KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, \
+ KC_TRNS, KC_TRNS, MO(_RS),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,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, \
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), KC_HOME, KC_PGDN, KC_END),
+
+ /* Keymap _RS: Reset layer
+ * ,--------------------------------------------------------------------------. ,----.
+ * | | | | | | | | | | | | | | | | | |
+ * |--------------------------------------------------------------------------| |----|
+ * | | | | |RESET| | | | | | | | | | | |
+ * |--------------------------------------------------------------------------| `----'
+ * | | | _RS| | | | | | | | | | | |
+ * |-----------------------------------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |------------------------------------------------------------------------|----|----.
+ * | | | | | | | | | | _FL| | | |
+ * `----------------------------------------------------------------------------------'
+ */
+[_RS] = KEYMAP(
+ 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,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, MO(_RS),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,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, MO(_FL), KC_TRNS, KC_TRNS, KC_TRNS),
+};
+
+enum function_id {
+ SHIFT_ESC,
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_FUNCTION(SHIFT_ESC),
+};
+
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
+ static uint8_t shift_esc_shift_mask;
+ switch (id) {
+ case SHIFT_ESC:
+ shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
+ if (record->event.pressed) {
+ if (shift_esc_shift_mask) {
+ add_key(KC_GRV);
+ send_keyboard_report();
+ } else {
+ add_key(KC_ESC);
+ send_keyboard_report();
+ }
+ } else {
+ if (shift_esc_shift_mask) {
+ del_key(KC_GRV);
+ send_keyboard_report();
+ } else {
+ del_key(KC_ESC);
+ send_keyboard_report();
+ }
+ }
+ break;
+ }
+}
diff --git a/keyboard/clueboard1/led.c b/keyboard/clueboard1/led.c
new file mode 100644
index 0000000000..deb7143eec
--- /dev/null
+++ b/keyboard/clueboard1/led.c
@@ -0,0 +1,34 @@
+ /*
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ // output low
+ DDRB |= (1<<2);
+ PORTB &= ~(1<<2);
+ } else {
+ // Hi-Z
+ DDRB &= ~(1<<2);
+ PORTB &= ~(1<<2);
+ }
+}
diff --git a/keyboard/clueboard2/Makefile b/keyboard/clueboard2/Makefile
new file mode 100644
index 0000000000..788c204872
--- /dev/null
+++ b/keyboard/clueboard2/Makefile
@@ -0,0 +1,140 @@
+#----------------------------------------------------------------------------
+# 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 = clueboard2
+
+
+# Directory common source filess exist
+TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# # project specific files
+SRC = clueboard2.c led.c
+
+ifdef KEYMAP
+ SRC := keymaps/keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymaps/keymap_default.c $(SRC)
+endif
+
+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)
+
+# 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=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 = 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
+RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+# MIDI_ENABLE = YES # MIDI controls
+# UNICODE_ENABLE = YES # Unicode
+# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
+
+#ifdef BACKLIGHT_ENABLE
+ SRC := backlight.c $(SRC)
+#endif
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TOP_DIR)/quantum/quantum.mk
diff --git a/keyboard/clueboard2/backlight.c b/keyboard/clueboard2/backlight.c
new file mode 100644
index 0000000000..5dfa4ba0ae
--- /dev/null
+++ b/keyboard/clueboard2/backlight.c
@@ -0,0 +1,41 @@
+
+#include <avr/io.h>
+#include "backlight.h"
+#include "print.h"
+
+/* Clueboard 2.0 LED locations:
+ *
+ * Capslock: B4, pull high to turn on
+ * LCtrl: Shared with Capslock, DO NOT INSTALL LED'S IN BOTH
+ * Page Up: B7, pull high to turn on
+ * Escape: D6, pull high to turn on
+ * Arrows: D4, pull high to turn on
+ */
+
+void init_backlight_pin(void) {
+ print("init_backlight_pin()\n");
+ // Set our LED pins as output
+ DDRD |= (1<<6); // Esc
+ DDRB |= (1<<7); // Page Up
+ DDRD |= (1<<4); // Arrows
+
+ // Set our LED pins low
+ PORTD &= ~(1<<6); // Esc
+ PORTB &= ~(1<<7); // Page Up
+ PORTD &= ~(1<<4); // Arrows
+}
+
+void backlight_set(uint8_t level) {
+ if ( level == 0 ) {
+ // Turn off light
+ PORTD |= (1<<6); // Esc
+ PORTB |= (1<<7); // Page Up
+ PORTD |= (1<<4); // Arrows
+ } else {
+ // Turn on light
+ PORTD &= ~(1<<6); // Esc
+ PORTB &= ~(1<<7); // Page Up
+ PORTD &= ~(1<<4); // Arrows
+ }
+}
+
diff --git a/keyboard/clueboard2/clueboard2.c b/keyboard/clueboard2/clueboard2.c
new file mode 100644
index 0000000000..97d393d18d
--- /dev/null
+++ b/keyboard/clueboard2/clueboard2.c
@@ -0,0 +1,44 @@
+#include "clueboard2.h"
+
+#ifdef BACKLIGHT_ENABLE
+#include "backlight.h"
+#endif
+
+__attribute__ ((weak))
+void * matrix_init_user(void) {
+ // leave these blank
+};
+
+__attribute__ ((weak))
+void * matrix_scan_user(void) {
+ // leave these blank
+};
+
+void * matrix_init_kb(void) {
+ // put your keyboard start-up code here
+ // runs once when the firmware starts up
+ if (matrix_init_user) {
+ (*matrix_init_user)();
+ }
+ led_init_ports();
+
+ #ifdef BACKLIGHT_ENABLE
+ init_backlight_pin();
+ #endif
+
+ #ifdef RGBLIGHT_ENABLE
+ rgblight_init();
+ #endif
+
+ // JTAG disable for PORT F. write JTD bit twice within four cycles.
+ MCUCR |= (1<<JTD);
+ MCUCR |= (1<<JTD);
+};
+
+void * matrix_scan_kb(void) {
+ // put your looping keyboard code here
+ // runs every cycle (a lot)
+ if (matrix_scan_user) {
+ (*matrix_scan_user)();
+ }
+};
diff --git a/keyboard/clueboard2/clueboard2.h b/keyboard/clueboard2/clueboard2.h
new file mode 100644
index 0000000000..822a797351
--- /dev/null
+++ b/keyboard/clueboard2/clueboard2.h
@@ -0,0 +1,57 @@
+#ifndef CLUEBOARD2_H
+#define CLUEBOARD2_H
+
+#include "matrix.h"
+#include "keymap_common.h"
+#include <stddef.h>
+
+
+/* Clueboard matrix layout
+ * ,-----------------------------------------------------------. ,---.
+ * | 00| 01| 02| 03| 04| 05| 06| 07| 50| 51| 52| 53| 54| 55| 56| | 57|
+ * |-----------------------------------------------------------| |---|
+ * | 10| 11| 12| 13| 14| 15| 16| 17| 60| 61| 62| 63| 64| 65| | 67|
+ * |-----------------------------------------------------------| `---'
+ * | 20| 21| 22| 23| 24| 25| 26| 27| 70| 71| 72| 73| 74| 75|
+ * |------------------------------------------------------------.
+ * | 30| 31| 32| 33| 34| 35| 36| 37| 80| 81| 82| 83| 84| 85|86|
+ * |------------------------------------------------------------------.
+ * | 40| 41| 42| 43| 45| 46| 90| 91| 92| 93| 94| 95| 96|
+ * `------------------------------------------------------------------'
+ * ,-----------------------------------------------------------. ,---.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Yen| BS| |Ins|
+ * |-----------------------------------------------------------| |---|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|
+ * |-----------------------------------------------------------| `---'
+ * |Caps | A| S| D| F| G| H| J| k| L| ;| '| # | Ent|
+ * |--------------------------------------------------------------.
+ * |Shift| \| Z| X| C| V| B| N| M| ,| .| /| \|Shift| Up|
+ * |------------------------------------------------------------------.
+ * |Ctrl|Alt|Gui |MHen| Space| Space|Henk|Gui |Ctrl| Fn|Left|Down|Rgt|
+ * `------------------------------------------------------------------'
+ */
+// The first section contains all of the arguments
+// The second converts the arguments into a two-dimensional array
+#define KEYMAP( \
+ k00, k01, k02, k03, k04, k05, k06, k07, k50, k51, k52, k53, k54, k55, k56, k57, \
+ k10, k11, k12, k13, k14, k15, k16, k17, k60, k61, k62, k63, k64, k65, k67, \
+ k20, k21, k22, k23, k24, k25, k26, k27, k70, k71, k72, k73, k74, k75, \
+ k30, k31, k32, k33, k34, k35, k36, k37, k80, k81, k82, k83, k84, k85, k86, \
+ k40, k41, k42, k43, k45, k46, k90, k92, k93, k94, k95, k96, k97 \
+) { \
+ { k00, k01, k02, k03, k04, k05, k06, k07 }, \
+ { k10, k11, k12, k13, k14, k15, k16, k17 }, \
+ { k20, k21, k22, k23, k24, k25, k26, k27 }, \
+ { k30, k31, k32, k33, k34, k35, k36, k37 }, \
+ { k40, k41, k42, k43, KC_NO, k45, k46, KC_NO }, \
+ { k50, k51, k52, k53, k54, k55, k56, k57 }, \
+ { k60, k61, k62, k63, k64, k65, KC_NO, k67 }, \
+ { k70, k71, k72, k73, k74, k75, KC_NO, KC_NO }, \
+ { k80, k81, k82, k83, k84, k85, k86, KC_NO }, \
+ { k90, KC_NO, k92, k93, k94, k95, k96, k97 } \
+}
+
+void * matrix_init_user(void);
+void * matrix_scan_user(void);
+
+#endif
diff --git a/keyboard/clueboard2/config.h b/keyboard/clueboard2/config.h
new file mode 100644
index 0000000000..04166c20f6
--- /dev/null
+++ b/keyboard/clueboard2/config.h
@@ -0,0 +1,100 @@
+/*
+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
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xC1ED
+#define PRODUCT_ID 0x2320
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Clueboard
+#define PRODUCT Clueboard with RGB Underlighting
+#define DESCRIPTION QMK keyboard firmware for Clueboard
+
+/* key matrix size */
+#define MATRIX_ROWS 10
+#define MATRIX_COLS 8
+
+// COLS: Left to right, ROWS: Top to bottom
+
+/* Column pin configuration
+ * col: 0 1 2 3 4 5 6 7
+ * pin: F0 F1 F4 F5 F6 F7 E6 B1
+ */
+#define COLS (int []){ F0, F1, F4, F5, F6, F7, E6, B1 }
+
+ /* Row pin configuration
+ * row: 0 1 2 3 4 5 6 7 8 9
+ * pin: B2 C7 C6 B6 B5 B0 B3 D5 D3 D2
+ */
+#define ROWS (int []){ B2, C7, C6, B6, B5, B0, B3, D5, D3, D2 }
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 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)) \
+)
+
+/* Backlight configuration
+ */
+#define BACKLIGHT_LEVELS 1
+
+/* Underlight configuration
+ */
+ #define ws2812_PORTREG PORTD
+ #define ws2812_DDRREG DDRD
+ #define ws2812_pin 7
+ #define RGBLED_NUM 14 // Number of LEDs
+ #define RGBLIGHT_HUE_STEP 10
+ #define RGBLIGHT_SAT_STEP 17
+ #define RGBLIGHT_VAL_STEP 17
+
+/*
+ * 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/keyboard/clueboard2/keymaps/keymap_default.c b/keyboard/clueboard2/keymaps/keymap_default.c
new file mode 100644
index 0000000000..5d52f27a72
--- /dev/null
+++ b/keyboard/clueboard2/keymaps/keymap_default.c
@@ -0,0 +1,170 @@
+#include "clueboard2.h"
+
+#ifdef ENABLE_RGBLIGHT
+#include "rgblight.h"
+#endif
+
+// Used for SHIFT_ESC
+#define MODS_CTRL_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
+#define _RS 2
+
+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| -| =| \| BS| |PGUP|
+ * |--------------------------------------------------------------------------| |----|
+ * | Tab| Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |PGDN|
+ * |--------------------------------------------------------------------------| `----'
+ * |Capslck| A| S| D| F| G| H| J| K| L| ;| '| # | Ent|
+ * |-----------------------------------------------------------------------------.
+ * |Shift| BS| Z| X| C| V| B| N| M| ,| .| /| BS|Shift| UP|
+ * |------------------------------------------------------------------------|----|----.
+ * | Ctrl| Gui| Alt| MHen| Space| Space| Hen| Alt| Ctrl| _FL|LEFT|DOWN|RGHT|
+ * `----------------------------------------------------------------------------------'
+ */
+[_BL] = KEYMAP(
+ F(0), 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_GRV, KC_BSPC, KC_PGUP, \
+ 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_PGDN, \
+ 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_NUHS, KC_ENT, \
+ KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_RSFT, KC_UP, \
+ KC_LCTL, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC,KC_SPC, KC_HENK, KC_RALT, KC_RCTL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ /* Keymap _FL: Function Layer
+ * ,--------------------------------------------------------------------------. ,----.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12| | Del| |BLIN|
+ * |--------------------------------------------------------------------------| |----|
+ * | | | | | | | | |PScr|SLck|Paus| | | | |BLDE|
+ * |--------------------------------------------------------------------------| `----'
+ * | | | _RS| | | | | | | | | | | |
+ * |-----------------------------------------------------------------------------.
+ * | | | | | | | | | | | | | | |PGUP|
+ * |------------------------------------------------------------------------|----|----.
+ * | | | | | | | | | | _FL|HOME|PGDN| END|
+ * `----------------------------------------------------------------------------------'
+ */
+[_FL] = KEYMAP(
+ KC_GRV, 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_TRNS, KC_DEL, BL_STEP, \
+ KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
+ KC_TRNS, KC_TRNS, MO(_RS),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,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, \
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), KC_HOME, KC_PGDN, KC_END),
+
+ /* Keymap _RS: Reset layer
+ * ,--------------------------------------------------------------------------. ,----.
+ * | | | | | | | | | | | | | | | | | |
+ * |--------------------------------------------------------------------------| |----|
+ * | | | | |RESET| | | | | | | | | | | |
+ * |--------------------------------------------------------------------------| `----'
+ * | | | _RS| | | | | | | | | | | |
+ * |-----------------------------------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |------------------------------------------------------------------------|----|----.
+ * | | | | | | | | | | _FL| | | |
+ * `----------------------------------------------------------------------------------'
+ */
+[_RS] = KEYMAP(
+ 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(0), F(6), \
+ 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, F(7), \
+ KC_TRNS, KC_TRNS, MO(_RS),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
+ MO(_FL), KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), F(4), \
+ KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, F(1), F(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(3), F(5), F(2)),
+};
+
+enum function_id {
+ SHIFT_ESC,
+ RGBLED_TOGGLE,
+ RGBLED_STEP_MODE,
+ RGBLED_INCREASE_HUE,
+ RGBLED_DECREASE_HUE,
+ RGBLED_INCREASE_SAT,
+ RGBLED_DECREASE_SAT,
+ RGBLED_INCREASE_VAL,
+ RGBLED_DECREASE_VAL
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_FUNCTION(SHIFT_ESC),
+ [1] = ACTION_FUNCTION(RGBLED_TOGGLE),
+ [2] = ACTION_FUNCTION(RGBLED_STEP_MODE),
+ [3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
+ [4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
+ [5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
+ [6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
+ [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
+ [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
+};
+
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
+ static uint8_t shift_esc_shift_mask;
+ switch (id) {
+ case SHIFT_ESC:
+ shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
+ if (record->event.pressed) {
+ if (shift_esc_shift_mask) {
+ add_key(KC_GRV);
+ send_keyboard_report();
+ } else {
+ add_key(KC_ESC);
+ send_keyboard_report();
+ }
+ } else {
+ if (shift_esc_shift_mask) {
+ del_key(KC_GRV);
+ send_keyboard_report();
+ } else {
+ del_key(KC_ESC);
+ send_keyboard_report();
+ }
+ }
+ break;
+ //led operations
+ case RGBLED_TOGGLE:
+ if (record->event.pressed) {
+ rgblight_toggle();
+ }
+
+ break;
+ case RGBLED_INCREASE_HUE:
+ if (record->event.pressed) {
+ rgblight_increase_hue();
+ }
+ break;
+ case RGBLED_DECREASE_HUE:
+ if (record->event.pressed) {
+ rgblight_decrease_hue();
+ }
+ break;
+ case RGBLED_INCREASE_SAT:
+ if (record->event.pressed) {
+ rgblight_increase_sat();
+ }
+ break;
+ case RGBLED_DECREASE_SAT:
+ if (record->event.pressed) {
+ rgblight_decrease_sat();
+ }
+ break;
+ case RGBLED_INCREASE_VAL:
+ if (record->event.pressed) {
+ rgblight_increase_val();
+ }
+ break;
+ case RGBLED_DECREASE_VAL:
+ if (record->event.pressed) {
+ rgblight_decrease_val();
+ }
+ break;
+ case RGBLED_STEP_MODE:
+ if (record->event.pressed) {
+ rgblight_step();
+ }
+ break;
+ }
+}
diff --git a/keyboard/clueboard2/keymaps/keymap_max.c b/keyboard/clueboard2/keymaps/keymap_max.c
new file mode 100644
index 0000000000..714d6390d9
--- /dev/null
+++ b/keyboard/clueboard2/keymaps/keymap_max.c
@@ -0,0 +1,147 @@
+#include "clueboard2.h"
+
+#ifdef ENABLE_RGBLIGHT
+#include "rgblight.h"
+#endif
+
+// Used for SHIFT_ESC
+#define MODS_CTRL_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
+#define _RS 2
+
+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| -| =| ~| BS| |PgUp|
+ * |--------------------------------------------------------------------------| |----|
+ * | Tab| Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |PgDn|
+ * |--------------------------------------------------------------------------| `----'
+ * |Capslck| A| S| D| F| G| H| J| K| L| ;| '| # | Ent|
+ * |-----------------------------------------------------------------------------.
+ * |Shift| BS| Z| X| C| V| B| N| M| ,| .| /| BS|Shift| Up|
+ * |------------------------------------------------------------------------|----|----.
+ * | Ctrl| Alt| Gui| MHen| Space| Space| Hen| Gui| Alt| Ctrl|Left|Down|Rght|
+ * `----------------------------------------------------------------------------------'
+ */
+[_BL] = 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_GRV, KC_BSPC, KC_PGUP, \
+ 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_PGDN, \
+ 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_NUHS, KC_ENT, \
+ MO(_FL), KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_FL), KC_UP, \
+ KC_LCTL, KC_LALT, KC_LGUI,KC_MHEN, KC_SPC, KC_SPC, KC_HENK, KC_RGUI, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
+
+ /* Keymap _FL: Function Layer
+ * ,--------------------------------------------------------------------------. ,----.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12| | Del| |BLIN|
+ * |--------------------------------------------------------------------------| |----|
+ * | | | | | | | | |PScr|SLck|Paus| | | | |BLDE|
+ * |--------------------------------------------------------------------------| `----'
+ * | | | _RS| | | | | | | | | | | |
+ * |-----------------------------------------------------------------------------.
+ * | | | | | | | | | | | | | | |PGUP|
+ * |------------------------------------------------------------------------|----|----.
+ * | | | | | | | | | | _FL|HOME|PGDN| END|
+ * `----------------------------------------------------------------------------------'
+ */
+[_FL] = KEYMAP(
+ KC_GRV, 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_TRNS, KC_DEL, BL_STEP, \
+ KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
+ KC_TRNS, KC_TRNS, MO(_RS),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
+ MO(_FL), KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), KC_PGUP, \
+ KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END),
+
+ /* Keymap _RS: Reset/Underlight layer
+ * ,--------------------------------------------------------------------------. ,----.
+ * | | | | | | | | | | | | | | | | | |
+ * |--------------------------------------------------------------------------| |----|
+ * | | | | |RESET| | | | | | | | | | | |
+ * |--------------------------------------------------------------------------| `----'
+ * | | | _RS| | | | | | | | | | | |
+ * |-----------------------------------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |------------------------------------------------------------------------|----|----.
+ * | | | | | | | | | | _FL| | | |
+ * `----------------------------------------------------------------------------------'
+ */
+[_RS] = KEYMAP(
+ 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(0), F(6), \
+ 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, F(7), \
+ KC_TRNS, KC_TRNS, MO(_RS),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
+ MO(_FL), KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), F(4), \
+ KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, F(1), F(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(3), F(5), F(2)),
+};
+
+enum function_id {
+ RGBLED_TOGGLE,
+ RGBLED_STEP_MODE,
+ RGBLED_INCREASE_HUE,
+ RGBLED_DECREASE_HUE,
+ RGBLED_INCREASE_SAT,
+ RGBLED_DECREASE_SAT,
+ RGBLED_INCREASE_VAL,
+ RGBLED_DECREASE_VAL,
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_FUNCTION(RGBLED_TOGGLE),
+ [1] = ACTION_FUNCTION(RGBLED_STEP_MODE),
+ [2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
+ [3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
+ [4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
+ [5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
+ [6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
+ [7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
+};
+
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
+ switch (id) {
+ case RGBLED_TOGGLE:
+ //led operations
+ if (record->event.pressed) {
+ rgblight_toggle();
+ }
+
+ break;
+ case RGBLED_INCREASE_HUE:
+ if (record->event.pressed) {
+ rgblight_increase_hue();
+ }
+ break;
+ case RGBLED_DECREASE_HUE:
+ if (record->event.pressed) {
+ rgblight_decrease_hue();
+ }
+ break;
+ case RGBLED_INCREASE_SAT:
+ if (record->event.pressed) {
+ rgblight_increase_sat();
+ }
+ break;
+ case RGBLED_DECREASE_SAT:
+ if (record->event.pressed) {
+ rgblight_decrease_sat();
+ }
+ break;
+ case RGBLED_INCREASE_VAL:
+ if (record->event.pressed) {
+ rgblight_increase_val();
+ }
+ break;
+ case RGBLED_DECREASE_VAL:
+ if (record->event.pressed) {
+ rgblight_decrease_val();
+ }
+ break;
+ case RGBLED_STEP_MODE:
+ if (record->event.pressed) {
+ rgblight_step();
+ }
+ break;
+ }
+}
diff --git a/keyboard/clueboard2/keymaps/keymap_skully.c b/keyboard/clueboard2/keymaps/keymap_skully.c
new file mode 100644
index 0000000000..74a03f2f30
--- /dev/null
+++ b/keyboard/clueboard2/keymaps/keymap_skully.c
@@ -0,0 +1,108 @@
+#include "clueboard2.h"
+
+// Used for SHIFT_ESC
+#define MODS_CTRL_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
+#define _RS 2
+
+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| -| =| \| BS| |PGUP|
+ * |--------------------------------------------------------------------------| |----|
+ * | Tab| Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |PGDN|
+ * |--------------------------------------------------------------------------| `----'
+ * |Capslck| A| S| D| F| G| H| J| K| L| ;| '| # | Ent|
+ * |-----------------------------------------------------------------------------.
+ * |Shift| BS| Z| X| C| V| B| N| M| ,| .| /| BS|Shift| UP|
+ * |------------------------------------------------------------------------|----|----.
+ * | Ctrl| Gui| Alt| MHen| Space| Space| Hen| Alt| Ctrl| _FL|LEFT|DOWN|RGHT|
+ * `----------------------------------------------------------------------------------'
+ */
+[_BL] = KEYMAP(
+ F(0), 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_GRV, KC_BSPC, KC_PGUP, \
+ 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_PGDN, \
+ KC_LCTL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, \
+ KC_LSFT,KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_RSFT, KC_UP, \
+ KC_LCTL,KC_LALT,KC_LGUI,MO(_FL), KC_SPC, KC_SPC, MO(_FL), KC_RGUI, KC_RCTL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ /* Keymap _FL: Function Layer
+ * ,--------------------------------------------------------------------------. ,----.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12| | Del| |BLIN|
+ * |--------------------------------------------------------------------------| |----|
+ * | | | | | | | | |PScr|SLck|Paus| | | | |BLDE|
+ * |--------------------------------------------------------------------------| `----'
+ * | | | _RS| | | | | | | | | | | |
+ * |-----------------------------------------------------------------------------.
+ * | | | | | | | | | | | | | | |PGUP|
+ * |------------------------------------------------------------------------|----|----.
+ * | | | | | | | | | | _FL|HOME|PGDN| END|
+ * `----------------------------------------------------------------------------------'
+ */
+[_FL] = KEYMAP(
+ KC_GRV, 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_TRNS,KC_DEL, BL_STEP, \
+ KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, \
+ KC_TRNS,KC_TRNS,MO(_RS),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,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_PGUP, \
+ KC_TRNS,KC_TRNS,KC_TRNS,MO(_FL), KC_TRNS,KC_TRNS, MO(_FL),KC_TRNS,KC_TRNS,MO(_FL),KC_HOME,KC_PGDN,KC_END),
+
+ /* Keymap _RS: Reset layer
+ * ,--------------------------------------------------------------------------. ,----.
+ * | | | | | | | | | | | | | | | | | |
+ * |--------------------------------------------------------------------------| |----|
+ * | | | | |RESET| | | | | | | | | | | |
+ * |--------------------------------------------------------------------------| `----'
+ * | | | _RS| | | | | | | | | | | |
+ * |-----------------------------------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |------------------------------------------------------------------------|----|----.
+ * | | | | | | | | | | _FL| | | |
+ * `----------------------------------------------------------------------------------'
+ */
+[_RS] = KEYMAP(
+ 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,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,MO(_RS),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,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,MO(_FL),KC_TRNS, KC_TRNS, KC_TRNS),
+};
+
+enum function_id {
+ SHIFT_ESC,
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_FUNCTION(SHIFT_ESC),
+};
+
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
+ static uint8_t shift_esc_shift_mask;
+ switch (id) {
+ case SHIFT_ESC:
+ shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
+ if (record->event.pressed) {
+ if (shift_esc_shift_mask) {
+ add_key(KC_GRV);
+ send_keyboard_report();
+ } else {
+ add_key(KC_ESC);
+ send_keyboard_report();
+ }
+ } else {
+ if (shift_esc_shift_mask) {
+ del_key(KC_GRV);
+ send_keyboard_report();
+ } else {
+ del_key(KC_ESC);
+ send_keyboard_report();
+ }
+ }
+ break;
+ }
+}
diff --git a/keyboard/clueboard2/led.c b/keyboard/clueboard2/led.c
new file mode 100644
index 0000000000..5788fc7b1f
--- /dev/null
+++ b/keyboard/clueboard2/led.c
@@ -0,0 +1,36 @@
+ /*
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+
+void led_init_ports() {
+ // * Set our LED pins as output
+ DDRB |= (1<<4);
+}
+
+void led_set(uint8_t usb_led) {
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ // Turn capslock on
+ PORTB |= (1<<4);
+ } else {
+ // Turn capslock off
+ PORTB &= ~(1<<4);
+ }
+}
diff --git a/keyboard/cluepad/Makefile b/keyboard/cluepad/Makefile
new file mode 100644
index 0000000000..cfa130d75a
--- /dev/null
+++ b/keyboard/cluepad/Makefile
@@ -0,0 +1,136 @@
+#----------------------------------------------------------------------------
+# 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 = cluepad
+
+
+# Directory common source filess exist
+TOP_DIR = ../..
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# # project specific files
+SRC = cluepad.c backlight.c
+
+ifdef KEYMAP
+ SRC := keymaps/keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymaps/keymap_default.c $(SRC)
+endif
+
+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)
+
+# 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=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 = 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
+BACKLIGHT_ENABLE = yes # Enable numpad's backlight functionality
+RGBLIGHT_ENABLE = yes
+# MIDI_ENABLE = YES # MIDI controls
+# UNICODE_ENABLE = YES # Unicode
+# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TOP_DIR)/quantum/quantum.mk
diff --git a/keyboard/cluepad/backlight.c b/keyboard/cluepad/backlight.c
new file mode 100644
index 0000000000..c0f8539494
--- /dev/null
+++ b/keyboard/cluepad/backlight.c
@@ -0,0 +1,54 @@
+#include <avr/io.h>
+#include "backlight.h"
+#include "led.h"
+
+#include "print.h"
+
+int pwm_level;
+
+void led_set(uint8_t usb_led)
+{
+ print("led_set\n");
+}
+
+void init_backlight_pin(void)
+{
+ // Set C7 to output
+ DDRC |= (1<<7);
+
+ // Initialize the timer
+ TC4H = 0x03;
+ OCR4C = 0xFF;
+ TCCR4A = 0b10000010;
+ TCCR4B = 0b00000001;
+}
+
+void backlight_set(uint8_t level)
+{
+ // Determine the PWM level
+ switch (level)
+ {
+ case 0:
+ // 33%
+ pwm_level = 0x54;
+ break;
+ case 1:
+ // 66%
+ pwm_level = 0xA8;
+ break;
+ case 2:
+ // 100%
+ pwm_level = 0xFF;
+ break;
+ case 3:
+ // 0%
+ pwm_level = 0x00;
+ break;
+ default:
+ xprintf("Unknown level: %d\n", level);
+ }
+
+ // Write the PWM level to the timer
+ TC4H = pwm_level >> 8;
+ OCR4A = 0xFF & pwm_level;
+}
diff --git a/keyboard/cluepad/cluepad.c b/keyboard/cluepad/cluepad.c
new file mode 100644
index 0000000000..ff3be5b9b5
--- /dev/null
+++ b/keyboard/cluepad/cluepad.c
@@ -0,0 +1,39 @@
+#include "cluepad.h"
+
+__attribute__ ((weak))
+void * matrix_init_user(void) {
+ // leave these blank
+};
+
+__attribute__ ((weak))
+void * matrix_scan_user(void) {
+ // leave these blank
+};
+
+void * matrix_init_kb(void) {
+ // put your keyboard start-up code here
+ // runs once when the firmware starts up
+ if (matrix_init_user) {
+ (*matrix_init_user)();
+ }
+
+ #ifdef BACKLIGHT_ENABLE
+ init_backlight_pin();
+ #endif
+
+ #ifdef RGBLIGHT_ENABLE
+ rgblight_init();
+ #endif
+
+ // JTAG disable for PORT F. write JTD bit twice within four cycles.
+ MCUCR |= (1<<JTD);
+ MCUCR |= (1<<JTD);
+};
+
+void * matrix_scan_kb(void) {
+ // put your looping keyboard code here
+ // runs every cycle (a lot)
+ if (matrix_scan_user) {
+ (*matrix_scan_user)();
+ }
+};
diff --git a/keyboard/cluepad/cluepad.h b/keyboard/cluepad/cluepad.h
new file mode 100644
index 0000000000..0d10d50b8f
--- /dev/null
+++ b/keyboard/cluepad/cluepad.h
@@ -0,0 +1,41 @@
+#ifndef CLUEPAD_H
+#define CLUEPAD_H
+
+#include "matrix.h"
+#include "keymap_common.h"
+#include <stddef.h>
+
+
+/* Cluepad matrix layout
+ * .-------------------.
+ * |NLCK| /| *| -|
+ * |-------------------|
+ * | 7| 8| 9| |
+ * |--------------| |
+ * | 4| 5| 6| +|
+ * |-------------------|
+ * | 1| 2| 3| |
+ * |--------------| |
+ * | 0| .| Ent|
+ * '-------------------'
+ */
+// The first section contains all of the arguments
+// The second converts the arguments into a two-dimensional array
+#define KEYMAP( \
+ k00, k01, k02, k03, \
+ k10, k11, k12, k13, \
+ k20, k21, k22, \
+ k30, k31, k32, k33, \
+ k40, k42 \
+) { \
+ { k00, k01, k02, k03, }, \
+ { k10, k11, k12, k13, }, \
+ { k20, k21, k22, KC_NO, }, \
+ { k30, k31, k32, k33, }, \
+ { k40, KC_NO, k42, KC_NO } \
+}
+
+void * matrix_init_user(void);
+void * matrix_scan_user(void);
+
+#endif
diff --git a/keyboard/cluepad/config.h b/keyboard/cluepad/config.h
new file mode 100644
index 0000000000..5ed421a6e0
--- /dev/null
+++ b/keyboard/cluepad/config.h
@@ -0,0 +1,102 @@
+/*
+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
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xC1ED
+#define PRODUCT_ID 0x2312
+#define DEVICE_VER 0x0001
+#define MANUFACTURER Clueboard
+#define PRODUCT Cluepad with RGB Underlighting
+#define DESCRIPTION QMK keyboard firmware for Cluepad
+
+/* key matrix size */
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 4
+
+// COLS: Left to right, ROWS: Top to bottom
+
+/* Column pin configuration
+ * col: 0 1 2 3
+ * pin: F4 E6 B1 D2
+ */
+#define COLS (int []){ F4, E6, B1, D2 }
+
+ /* Row pin configuration
+ * row: 0 1 2 3 4
+ * pin:
+ */
+#define ROWS (int []){ B0, D3, D5, D4, D6 }
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+/* Number of backlighting levels */
+#define BACKLIGHT_LEVELS 3
+
+/* 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)) \
+)
+
+/* Underlight configuration
+ */
+ #define ws2812_PORTREG PORTF
+ #define ws2812_DDRREG DDRF
+ #define ws2812_pin 6
+ #define RGBLED_NUM 4 // Number of LEDs
+ #define RGBLIGHT_HUE_STEP 10
+ #define RGBLIGHT_SAT_STEP 17
+ #define RGBLIGHT_VAL_STEP 17
+
+/*
+ * Feature disable options
+ * These options are also useful to firmware size reduction.
+ */
+
+/* disable debug print */
+//#define NO_DEBUG
+
+/* Debug forcibly enabled */
+#define ALWAYS_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/keyboard/cluepad/keymaps/keymap_default.c b/keyboard/cluepad/keymaps/keymap_default.c
new file mode 100644
index 0000000000..32cb43c745
--- /dev/null
+++ b/keyboard/cluepad/keymaps/keymap_default.c
@@ -0,0 +1,122 @@
+#include "cluepad.h"
+
+#include "backlight.h"
+#include "rgblight.h"
+
+// 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
+#define _RS 2
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Keymap _BL: (Base Layer) Default Layer
+ * .-------------------.
+ * |NL F| /| *| -|
+ * |-------------------|
+ * | 7| 8| 9| |
+ * |--------------| |
+ * | 4| 5| 6| +|
+ * |-------------------|
+ * | 1| 2| 3| |
+ * |--------------| |
+ * | 0| .| Ent|
+ * '-------------------'
+ */
+[_BL] = KEYMAP(
+ LT(_FL, KC_NLCK), KC_PSLS, KC_PAST, KC_PMNS, \
+ KC_P7, KC_P8, KC_P9, KC_PPLS, \
+ KC_P4, KC_P5, KC_P6, \
+ KC_P1, KC_P2, KC_P3, KC_PENT, \
+ KC_P0, KC_PDOT),
+
+ /* Keymap _FL: Function Layer
+ * .-------------------.
+ * |NL F| | | Fn0|
+ * |-------------------|
+ * | Fn2| | Fn4| |
+ * |--------------| |
+ * | Fn3|BL_S| Fn5| Fn6|
+ * |-------------------|
+ * | | | | |
+ * |--------------| |
+ * | Fn1| | Fn7|
+ * '-------------------'
+ */
+[_FL] = KEYMAP(
+ LT(_FL, KC_NLCK), KC_TRNS, KC_TRNS, F(0), \
+ F(2), KC_TRNS, F(4), F(6), \
+ F(3), BL_STEP, F(5), \
+ KC_TRNS, KC_TRNS, KC_TRNS, F(7), \
+ F(1), KC_TRNS)
+};
+
+enum function_id {
+ RGBLED_TOGGLE,
+ RGBLED_STEP_MODE,
+ RGBLED_INCREASE_HUE,
+ RGBLED_DECREASE_HUE,
+ RGBLED_INCREASE_SAT,
+ RGBLED_DECREASE_SAT,
+ RGBLED_INCREASE_VAL,
+ RGBLED_DECREASE_VAL,
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_FUNCTION(RGBLED_TOGGLE),
+ [1] = ACTION_FUNCTION(RGBLED_STEP_MODE),
+ [2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
+ [3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
+ [4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
+ [5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
+ [6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
+ [7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
+};
+
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
+ switch (id) {
+ case RGBLED_TOGGLE:
+ if (record->event.pressed) {
+ rgblight_toggle();
+ }
+ break;
+ case RGBLED_INCREASE_HUE:
+ if (record->event.pressed) {
+ rgblight_increase_hue();
+ }
+ break;
+ case RGBLED_DECREASE_HUE:
+ if (record->event.pressed) {
+ rgblight_decrease_hue();
+ }
+ break;
+ case RGBLED_INCREASE_SAT:
+ if (record->event.pressed) {
+ rgblight_increase_sat();
+ }
+ break;
+ case RGBLED_DECREASE_SAT:
+ if (record->event.pressed) {
+ rgblight_decrease_sat();
+ }
+ break;
+ case RGBLED_INCREASE_VAL:
+ if (record->event.pressed) {
+ rgblight_increase_val();
+ }
+ break;
+ case RGBLED_DECREASE_VAL:
+ if (record->event.pressed) {
+ rgblight_decrease_val();
+ }
+ break;
+ case RGBLED_STEP_MODE:
+ if (record->event.pressed) {
+ rgblight_step();
+ }
+ break;
+ }
+}
+