aboutsummaryrefslogtreecommitdiff
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 8b8c45169..a082ea22e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,8 +16,8 @@ build/
16.vagrant/ 16.vagrant/
17.DS_STORE 17.DS_STORE
18 18
19# Eclipse Settings 19# Eclipse/PyCharm/Other IDE Settings
20.cproject 20.cproject
21.project 21.project
22.settings/ 22.settings/
23 23.idea
diff --git a/keyboard/clueboard1/Makefile b/keyboard/clueboard1/Makefile
new file mode 100644
index 000000000..767fc95ef
--- /dev/null
+++ b/keyboard/clueboard1/Makefile
@@ -0,0 +1,137 @@
1#----------------------------------------------------------------------------
2# On command line:
3#
4# make all = Make software.
5#
6# make clean = Clean out built project files.
7#
8# make coff = Convert ELF to AVR COFF.
9#
10# make extcoff = Convert ELF to AVR Extended COFF.
11#
12# make program = Download the hex file to the device.
13# Please customize your programmer settings(PROGRAM_CMD)
14#
15# make teensy = Download the hex file to the device, using teensy_loader_cli.
16# (must have teensy_loader_cli installed).
17#
18# make dfu = Download the hex file to the device, using dfu-programmer (must
19# have dfu-programmer installed).
20#
21# make flip = Download the hex file to the device, using Atmel FLIP (must
22# have Atmel FLIP installed).
23#
24# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
25# (must have dfu-programmer installed).
26#
27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
28# (must have Atmel FLIP installed).
29#
30# make debug = Start either simulavr or avarice as specified for debugging,
31# with avr-gdb or avr-insight as the front end for debugging.
32#
33# make filename.s = Just compile filename.c into the assembler code only.
34#
35# make filename.i = Create a preprocessed source file for use in submitting
36# bug reports to the GCC project.
37#
38# To rebuild project do "make clean" then "make all".
39#----------------------------------------------------------------------------
40
41# Target file name (without extension).
42TARGET = clueboard1
43
44
45# Directory common source filess exist
46TOP_DIR = ../..
47TMK_DIR = ../../tmk_core
48
49# Directory keyboard dependent files exist
50TARGET_DIR = .
51
52# # project specific files
53SRC = clueboard1.c \
54 led.c \
55
56ifdef KEYMAP
57 SRC := keymaps/keymap_$(KEYMAP).c $(SRC)
58else
59 SRC := keymaps/keymap_default.c $(SRC)
60endif
61
62CONFIG_H = config.h
63
64# MCU name
65#MCU = at90usb1287
66MCU = atmega32u4
67
68# Processor frequency.
69# This will define a symbol, F_CPU, in all source code files equal to the
70# processor frequency in Hz. You can then use this symbol in your source code to
71# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
72# automatically to create a 32-bit value in your source code.
73#
74# This will be an integer division of F_USB below, as it is sourced by
75# F_USB after it has run through any CPU prescalers. Note that this value
76# does not *change* the processor frequency - it should merely be updated to
77# reflect the processor speed set externally so that the code can use accurate
78# software delays.
79F_CPU = 16000000
80
81
82#
83# LUFA specific
84#
85# Target architecture (see library "Board Types" documentation).
86ARCH = AVR8
87
88# Input clock frequency.
89# This will define a symbol, F_USB, in all source code files equal to the
90# input clock frequency (before any prescaling is performed) in Hz. This value may
91# differ from F_CPU if prescaling is used on the latter, and is required as the
92# raw input clock is fed directly to the PLL sections of the AVR for high speed
93# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
94# at the end, this will be done automatically to create a 32-bit value in your
95# source code.
96#
97# If no clock division is performed on the input clock inside the AVR (via the
98# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
99F_USB = $(F_CPU)
100
101# Interrupt driven control endpoint task(+60)
102OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
103
104
105# Boot Section Size in *bytes*
106# Teensy halfKay 512
107# Teensy++ halfKay 1024
108# Atmel DFU loader 4096
109# LUFA bootloader 4096
110# USBaspLoader 2048
111OPT_DEFS += -DBOOTLOADER_SIZE=4096
112
113
114# Build Options
115# comment out to disable the options.
116#
117BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
118# MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
119EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
120CONSOLE_ENABLE = yes # Console for debug(+400)
121COMMAND_ENABLE = yes # Commands for debug and configuration
122NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
123# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
124# MIDI_ENABLE = YES # MIDI controls
125# UNICODE_ENABLE = YES # Unicode
126# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
127
128
129# Optimize size but this may cause error "relocation truncated to fit"
130#EXTRALDFLAGS = -Wl,--relax
131
132# Search Path
133VPATH += $(TARGET_DIR)
134VPATH += $(TOP_DIR)
135VPATH += $(TMK_DIR)
136
137include $(TOP_DIR)/quantum/quantum.mk
diff --git a/keyboard/clueboard1/clueboard1.c b/keyboard/clueboard1/clueboard1.c
new file mode 100644
index 000000000..252c65fcc
--- /dev/null
+++ b/keyboard/clueboard1/clueboard1.c
@@ -0,0 +1,27 @@
1#include "clueboard1.h"
2
3__attribute__ ((weak))
4void * matrix_init_user(void) {
5 // leave these blank
6};
7
8__attribute__ ((weak))
9void * matrix_scan_user(void) {
10 // leave these blank
11};
12
13void * matrix_init_kb(void) {
14 // put your keyboard start-up code here
15 // runs once when the firmware starts up
16 if (matrix_init_user) {
17 (*matrix_init_user)();
18 }
19};
20
21void * matrix_scan_kb(void) {
22 // put your looping keyboard code here
23 // runs every cycle (a lot)
24 if (matrix_scan_user) {
25 (*matrix_scan_user)();
26 }
27};
diff --git a/keyboard/clueboard1/clueboard1.h b/keyboard/clueboard1/clueboard1.h
new file mode 100644
index 000000000..1572ea2fd
--- /dev/null
+++ b/keyboard/clueboard1/clueboard1.h
@@ -0,0 +1,52 @@
1#ifndef CLUEBOARD1_H
2#define CLUEBOARD1_H
3
4#include "matrix.h"
5#include "keymap_common.h"
6#include <stddef.h>
7
8
9/* Clueboard matrix layout
10 * ,-----------------------------------------------------------. ,---.
11 * | 00| 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E| | 0F|
12 * |-----------------------------------------------------------| |---|
13 * | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| 1C| 1D| | 1F|
14 * |-----------------------------------------------------------| `---'
15 * | 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 2A| 2B| 2C| 2D|
16 * |------------------------------------------------------------.
17 * | 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 3A| 3B| 3C| 3D|3E|
18 * |------------------------------------------------------------------.
19 * | 40| 41| 42| 43| 45| 46| 49| 4A| 4B| 4C| 4D| 4E| 4F|
20 * `------------------------------------------------------------------'
21 * ,-----------------------------------------------------------. ,---.
22 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Yen| BS| |Ins|
23 * |-----------------------------------------------------------| |---|
24 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|
25 * |-----------------------------------------------------------| `---'
26 * |Caps | A| S| D| F| G| H| J| k| L| ;| '| # | Ent|
27 * |--------------------------------------------------------------.
28 * |Shift| \| Z| X| C| V| B| N| M| ,| .| /| \|Shift| Up|
29 * |------------------------------------------------------------------.
30 * |Ctrl|Alt|Gui |MHen| Space| Space|Henk|Gui |Ctrl| Fn|Left|Down|Rgt|
31 * `------------------------------------------------------------------'
32 */
33// The first section contains all of the arguements
34// The second converts the arguments into a two-dimensional array
35#define KEYMAP( \
36 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F, \
37 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1F, \
38 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, \
39 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
40 k40, k41, k42, k43, k45, k46, k49, k4A, k4B, k4C, k4D, k4E, k4F \
41) { \
42 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F }, \
43 { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, KC_NO, k1F }, \
44 { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D }, \
45 { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
46 { k40, k41, k42, k43, KC_NO, k45, k46, KC_NO, KC_NO, k49, k4A, k4B, k4C, k4D, k4E, k4F } \
47}
48
49void * matrix_init_user(void);
50void * matrix_scan_user(void);
51
52#endif
diff --git a/keyboard/clueboard1/config.h b/keyboard/clueboard1/config.h
new file mode 100644
index 000000000..01212078f
--- /dev/null
+++ b/keyboard/clueboard1/config.h
@@ -0,0 +1,86 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xC1ED
25#define PRODUCT_ID 0x2301
26#define DEVICE_VER 0x0003
27#define MANUFACTURER Clueboard
28#define PRODUCT Clueboard
29#define DESCRIPTION QMK keyboard firmware for Clueboard
30
31/* key matrix size */
32#define MATRIX_ROWS 5
33#define MATRIX_COLS 16
34
35// COLS: Left to right, ROWS: Top to bottom
36
37/* Column pin configuration
38 * col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
39 * pin: B3 F1 F4 F5 F6 C7 C6 B6 B5 B4 D7 D6 D4 F7 B0 B1
40 */
41#define COLS (int []){ B3, F1, F4, F5, F6, C7, C6, B6, B5, B4, D7, D6, D4, F7, B0, B1 }
42
43 /* Row pin configuration
44 * row: 0 1 2 3 4
45 * pin: D1 D0 D2 D5 D3
46 */
47#define ROWS (int []){ D1, D0, D2, D5, D3 }
48
49/* COL2ROW or ROW2COL */
50#define DIODE_DIRECTION COL2ROW
51
52/* define if matrix has ghost */
53//#define MATRIX_HAS_GHOST
54
55/* Set 0 if debouncing isn't needed */
56#define DEBOUNCE 5
57
58/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
59#define LOCKING_SUPPORT_ENABLE
60/* Locking resynchronize hack */
61#define LOCKING_RESYNC_ENABLE
62
63/* key combination for command */
64#define IS_COMMAND() ( \
65 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
66)
67
68/*
69 * Feature disable options
70 * These options are also useful to firmware size reduction.
71 */
72
73/* disable debug print */
74//#define NO_DEBUG
75
76/* disable print */
77//#define NO_PRINT
78
79/* disable action features */
80//#define NO_ACTION_LAYER
81//#define NO_ACTION_TAPPING
82//#define NO_ACTION_ONESHOT
83//#define NO_ACTION_MACRO
84//#define NO_ACTION_FUNCTION
85
86#endif
diff --git a/keyboard/clueboard1/keymaps/keymap_default.c b/keyboard/clueboard1/keymaps/keymap_default.c
new file mode 100644
index 000000000..bee7e35a0
--- /dev/null
+++ b/keyboard/clueboard1/keymaps/keymap_default.c
@@ -0,0 +1,108 @@
1#include "clueboard1.h"
2
3// Used for SHIFT_ESC
4#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
5
6// Each layer gets a name for readability, which is then used in the keymap matrix below.
7// The underscores don't mean anything - you can have a layer called STUFF or any other name.
8// Layer names don't all need to be of the same length, obviously, and you can also skip them
9// entirely and just use numbers.
10#define _BL 0
11#define _FL 1
12#define _RS 2
13
14const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15 /* Keymap _BL: (Base Layer) Default Layer
16 * ,--------------------------------------------------------------------------. ,----.
17 * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| BS| |PGUP|
18 * |--------------------------------------------------------------------------| |----|
19 * | Tab| Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |PGDN|
20 * |--------------------------------------------------------------------------| `----'
21 * |Capslck| A| S| D| F| G| H| J| K| L| ;| '| # | Ent|
22 * |-----------------------------------------------------------------------------.
23 * |Shift| BS| Z| X| C| V| B| N| M| ,| .| /| BS|Shift| UP|
24 * |------------------------------------------------------------------------|----|----.
25 * | Ctrl| Gui| Alt| MHen| Space| Space| Hen| Alt| Ctrl| _FL|LEFT|DOWN|RGHT|
26 * `----------------------------------------------------------------------------------'
27 */
28[_BL] = KEYMAP(
29 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, \
30 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, \
31 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, \
32 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, \
33 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),
34
35 /* Keymap _FL: Function Layer
36 * ,--------------------------------------------------------------------------. ,----.
37 * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12| | Del| |BLIN|
38 * |--------------------------------------------------------------------------| |----|
39 * | | | | | | | | |PScr|SLck|Paus| | | | |BLDE|
40 * |--------------------------------------------------------------------------| `----'
41 * | | | _RS| | | | | | | | | | | |
42 * |-----------------------------------------------------------------------------.
43 * | | | | | | | | | | | | | | |PGUP|
44 * |------------------------------------------------------------------------|----|----.
45 * | | | | | | | | | | _FL|HOME|PGDN| END|
46 * `----------------------------------------------------------------------------------'
47 */
48[_FL] = KEYMAP(
49 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, \
50 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, \
51 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, \
52 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, \
53 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),
54
55 /* Keymap _RS: Reset layer
56 * ,--------------------------------------------------------------------------. ,----.
57 * | | | | | | | | | | | | | | | | | |
58 * |--------------------------------------------------------------------------| |----|
59 * | | | | |RESET| | | | | | | | | | | |
60 * |--------------------------------------------------------------------------| `----'
61 * | | | _RS| | | | | | | | | | | |
62 * |-----------------------------------------------------------------------------.
63 * | | | | | | | | | | | | | | | |
64 * |------------------------------------------------------------------------|----|----.
65 * | | | | | | | | | | _FL| | | |
66 * `----------------------------------------------------------------------------------'
67 */
68[_RS] = KEYMAP(
69 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, \
70 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, \
71 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, \
72 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, \
73 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),
74};
75
76enum function_id {
77 SHIFT_ESC,
78};
79
80const uint16_t PROGMEM fn_actions[] = {
81 [0] = ACTION_FUNCTION(SHIFT_ESC),
82};
83
84void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
85 static uint8_t shift_esc_shift_mask;
86 switch (id) {
87 case SHIFT_ESC:
88 shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
89 if (record->event.pressed) {
90 if (shift_esc_shift_mask) {
91 add_key(KC_GRV);
92 send_keyboard_report();
93 } else {
94 add_key(KC_ESC);
95 send_keyboard_report();
96 }
97 } else {
98 if (shift_esc_shift_mask) {
99 del_key(KC_GRV);
100 send_keyboard_report();
101 } else {
102 del_key(KC_ESC);
103 send_keyboard_report();
104 }
105 }
106 break;
107 }
108}
diff --git a/keyboard/clueboard1/led.c b/keyboard/clueboard1/led.c
new file mode 100644
index 000000000..deb7143ee
--- /dev/null
+++ b/keyboard/clueboard1/led.c
@@ -0,0 +1,34 @@
1 /*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <avr/io.h>
19#include "stdint.h"
20#include "led.h"
21
22
23void led_set(uint8_t usb_led)
24{
25 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
26 // output low
27 DDRB |= (1<<2);
28 PORTB &= ~(1<<2);
29 } else {
30 // Hi-Z
31 DDRB &= ~(1<<2);
32 PORTB &= ~(1<<2);
33 }
34}
diff --git a/keyboard/clueboard2/Makefile b/keyboard/clueboard2/Makefile
new file mode 100644
index 000000000..788c20487
--- /dev/null
+++ b/keyboard/clueboard2/Makefile
@@ -0,0 +1,140 @@
1#----------------------------------------------------------------------------
2# On command line:
3#
4# make all = Make software.
5#
6# make clean = Clean out built project files.
7#
8# make coff = Convert ELF to AVR COFF.
9#
10# make extcoff = Convert ELF to AVR Extended COFF.
11#
12# make program = Download the hex file to the device.
13# Please customize your programmer settings(PROGRAM_CMD)
14#
15# make teensy = Download the hex file to the device, using teensy_loader_cli.
16# (must have teensy_loader_cli installed).
17#
18# make dfu = Download the hex file to the device, using dfu-programmer (must
19# have dfu-programmer installed).
20#
21# make flip = Download the hex file to the device, using Atmel FLIP (must
22# have Atmel FLIP installed).
23#
24# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
25# (must have dfu-programmer installed).
26#
27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
28# (must have Atmel FLIP installed).
29#
30# make debug = Start either simulavr or avarice as specified for debugging,
31# with avr-gdb or avr-insight as the front end for debugging.
32#
33# make filename.s = Just compile filename.c into the assembler code only.
34#
35# make filename.i = Create a preprocessed source file for use in submitting
36# bug reports to the GCC project.
37#
38# To rebuild project do "make clean" then "make all".
39#----------------------------------------------------------------------------
40
41# Target file name (without extension).
42TARGET = clueboard2
43
44
45# Directory common source filess exist
46TOP_DIR = ../..
47TMK_DIR = ../../tmk_core
48
49# Directory keyboard dependent files exist
50TARGET_DIR = .
51
52# # project specific files
53SRC = clueboard2.c led.c
54
55ifdef KEYMAP
56 SRC := keymaps/keymap_$(KEYMAP).c $(SRC)
57else
58 SRC := keymaps/keymap_default.c $(SRC)
59endif
60
61CONFIG_H = config.h
62
63# MCU name
64#MCU = at90usb1287
65MCU = atmega32u4
66
67# Processor frequency.
68# This will define a symbol, F_CPU, in all source code files equal to the
69# processor frequency in Hz. You can then use this symbol in your source code to
70# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
71# automatically to create a 32-bit value in your source code.
72#
73# This will be an integer division of F_USB below, as it is sourced by
74# F_USB after it has run through any CPU prescalers. Note that this value
75# does not *change* the processor frequency - it should merely be updated to
76# reflect the processor speed set externally so that the code can use accurate
77# software delays.
78F_CPU = 16000000
79
80
81#
82# LUFA specific
83#
84# Target architecture (see library "Board Types" documentation).
85ARCH = AVR8
86
87# Input clock frequency.
88# This will define a symbol, F_USB, in all source code files equal to the
89# input clock frequency (before any prescaling is performed) in Hz. This value may
90# differ from F_CPU if prescaling is used on the latter, and is required as the
91# raw input clock is fed directly to the PLL sections of the AVR for high speed
92# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
93# at the end, this will be done automatically to create a 32-bit value in your
94# source code.
95#
96# If no clock division is performed on the input clock inside the AVR (via the
97# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
98F_USB = $(F_CPU)
99
100# Interrupt driven control endpoint task(+60)
101OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
102
103
104# Boot Section Size in *bytes*
105# Teensy halfKay 512
106# Teensy++ halfKay 1024
107# Atmel DFU loader 4096
108# LUFA bootloader 4096
109# USBaspLoader 2048
110OPT_DEFS += -DBOOTLOADER_SIZE=4096
111
112
113# Build Options
114# comment out to disable the options.
115#
116BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
117# MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
118EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
119CONSOLE_ENABLE = yes # Console for debug(+400)
120COMMAND_ENABLE = yes # Commands for debug and configuration
121NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
122RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality
123BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
124# MIDI_ENABLE = YES # MIDI controls
125# UNICODE_ENABLE = YES # Unicode
126# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
127
128#ifdef BACKLIGHT_ENABLE
129 SRC := backlight.c $(SRC)
130#endif
131
132# Optimize size but this may cause error "relocation truncated to fit"
133#EXTRALDFLAGS = -Wl,--relax
134
135# Search Path
136VPATH += $(TARGET_DIR)
137VPATH += $(TOP_DIR)
138VPATH += $(TMK_DIR)
139
140include $(TOP_DIR)/quantum/quantum.mk
diff --git a/keyboard/clueboard2/backlight.c b/keyboard/clueboard2/backlight.c
new file mode 100644
index 000000000..5dfa4ba0a
--- /dev/null
+++ b/keyboard/clueboard2/backlight.c
@@ -0,0 +1,41 @@
1
2#include <avr/io.h>
3#include "backlight.h"
4#include "print.h"
5
6/* Clueboard 2.0 LED locations:
7 *
8 * Capslock: B4, pull high to turn on
9 * LCtrl: Shared with Capslock, DO NOT INSTALL LED'S IN BOTH
10 * Page Up: B7, pull high to turn on
11 * Escape: D6, pull high to turn on
12 * Arrows: D4, pull high to turn on
13 */
14
15void init_backlight_pin(void) {
16 print("init_backlight_pin()\n");
17 // Set our LED pins as output
18 DDRD |= (1<<6); // Esc
19 DDRB |= (1<<7); // Page Up
20 DDRD |= (1<<4); // Arrows
21
22 // Set our LED pins low
23 PORTD &= ~(1<<6); // Esc
24 PORTB &= ~(1<<7); // Page Up
25 PORTD &= ~(1<<4); // Arrows
26}
27
28void backlight_set(uint8_t level) {
29 if ( level == 0 ) {
30 // Turn off light
31 PORTD |= (1<<6); // Esc
32 PORTB |= (1<<7); // Page Up
33 PORTD |= (1<<4); // Arrows
34 } else {
35 // Turn on light
36 PORTD &= ~(1<<6); // Esc
37 PORTB &= ~(1<<7); // Page Up
38 PORTD &= ~(1<<4); // Arrows
39 }
40}
41
diff --git a/keyboard/clueboard2/clueboard2.c b/keyboard/clueboard2/clueboard2.c
new file mode 100644
index 000000000..97d393d18
--- /dev/null
+++ b/keyboard/clueboard2/clueboard2.c
@@ -0,0 +1,44 @@
1#include "clueboard2.h"
2
3#ifdef BACKLIGHT_ENABLE
4#include "backlight.h"
5#endif
6
7__attribute__ ((weak))
8void * matrix_init_user(void) {
9 // leave these blank
10};
11
12__attribute__ ((weak))
13void * matrix_scan_user(void) {
14 // leave these blank
15};
16
17void * matrix_init_kb(void) {
18 // put your keyboard start-up code here
19 // runs once when the firmware starts up
20 if (matrix_init_user) {
21 (*matrix_init_user)();
22 }
23 led_init_ports();
24
25 #ifdef BACKLIGHT_ENABLE
26 init_backlight_pin();
27 #endif
28
29 #ifdef RGBLIGHT_ENABLE
30 rgblight_init();
31 #endif
32
33 // JTAG disable for PORT F. write JTD bit twice within four cycles.
34 MCUCR |= (1<<JTD);
35 MCUCR |= (1<<JTD);
36};
37
38void * matrix_scan_kb(void) {
39 // put your looping keyboard code here
40 // runs every cycle (a lot)
41 if (matrix_scan_user) {
42 (*matrix_scan_user)();
43 }
44};
diff --git a/keyboard/clueboard2/clueboard2.h b/keyboard/clueboard2/clueboard2.h
new file mode 100644
index 000000000..822a79735
--- /dev/null
+++ b/keyboard/clueboard2/clueboard2.h
@@ -0,0 +1,57 @@
1#ifndef CLUEBOARD2_H
2#define CLUEBOARD2_H
3
4#include "matrix.h"
5#include "keymap_common.h"
6#include <stddef.h>
7
8
9/* Clueboard matrix layout
10 * ,-----------------------------------------------------------. ,---.
11 * | 00| 01| 02| 03| 04| 05| 06| 07| 50| 51| 52| 53| 54| 55| 56| | 57|
12 * |-----------------------------------------------------------| |---|
13 * | 10| 11| 12| 13| 14| 15| 16| 17| 60| 61| 62| 63| 64| 65| | 67|
14 * |-----------------------------------------------------------| `---'
15 * | 20| 21| 22| 23| 24| 25| 26| 27| 70| 71| 72| 73| 74| 75|
16 * |------------------------------------------------------------.
17 * | 30| 31| 32| 33| 34| 35| 36| 37| 80| 81| 82| 83| 84| 85|86|
18 * |------------------------------------------------------------------.
19 * | 40| 41| 42| 43| 45| 46| 90| 91| 92| 93| 94| 95| 96|
20 * `------------------------------------------------------------------'
21 * ,-----------------------------------------------------------. ,---.
22 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Yen| BS| |Ins|
23 * |-----------------------------------------------------------| |---|
24 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|
25 * |-----------------------------------------------------------| `---'
26 * |Caps | A| S| D| F| G| H| J| k| L| ;| '| # | Ent|
27 * |--------------------------------------------------------------.
28 * |Shift| \| Z| X| C| V| B| N| M| ,| .| /| \|Shift| Up|
29 * |------------------------------------------------------------------.
30 * |Ctrl|Alt|Gui |MHen| Space| Space|Henk|Gui |Ctrl| Fn|Left|Down|Rgt|
31 * `------------------------------------------------------------------'
32 */
33// The first section contains all of the arguments
34// The second converts the arguments into a two-dimensional array
35#define KEYMAP( \
36 k00, k01, k02, k03, k04, k05, k06, k07, k50, k51, k52, k53, k54, k55, k56, k57, \
37 k10, k11, k12, k13, k14, k15, k16, k17, k60, k61, k62, k63, k64, k65, k67, \
38 k20, k21, k22, k23, k24, k25, k26, k27, k70, k71, k72, k73, k74, k75, \
39 k30, k31, k32, k33, k34, k35, k36, k37, k80, k81, k82, k83, k84, k85, k86, \
40 k40, k41, k42, k43, k45, k46, k90, k92, k93, k94, k95, k96, k97 \
41) { \
42 { k00, k01, k02, k03, k04, k05, k06, k07 }, \
43 { k10, k11, k12, k13, k14, k15, k16, k17 }, \
44 { k20, k21, k22, k23, k24, k25, k26, k27 }, \
45 { k30, k31, k32, k33, k34, k35, k36, k37 }, \
46 { k40, k41, k42, k43, KC_NO, k45, k46, KC_NO }, \
47 { k50, k51, k52, k53, k54, k55, k56, k57 }, \
48 { k60, k61, k62, k63, k64, k65, KC_NO, k67 }, \
49 { k70, k71, k72, k73, k74, k75, KC_NO, KC_NO }, \
50 { k80, k81, k82, k83, k84, k85, k86, KC_NO }, \
51 { k90, KC_NO, k92, k93, k94, k95, k96, k97 } \
52}
53
54void * matrix_init_user(void);
55void * matrix_scan_user(void);
56
57#endif
diff --git a/keyboard/clueboard2/config.h b/keyboard/clueboard2/config.h
new file mode 100644
index 000000000..04166c20f
--- /dev/null
+++ b/keyboard/clueboard2/config.h
@@ -0,0 +1,100 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xC1ED
25#define PRODUCT_ID 0x2320
26#define DEVICE_VER 0x0001
27#define MANUFACTURER Clueboard
28#define PRODUCT Clueboard with RGB Underlighting
29#define DESCRIPTION QMK keyboard firmware for Clueboard
30
31/* key matrix size */
32#define MATRIX_ROWS 10
33#define MATRIX_COLS 8
34
35// COLS: Left to right, ROWS: Top to bottom
36
37/* Column pin configuration
38 * col: 0 1 2 3 4 5 6 7
39 * pin: F0 F1 F4 F5 F6 F7 E6 B1
40 */
41#define COLS (int []){ F0, F1, F4, F5, F6, F7, E6, B1 }
42
43 /* Row pin configuration
44 * row: 0 1 2 3 4 5 6 7 8 9
45 * pin: B2 C7 C6 B6 B5 B0 B3 D5 D3 D2
46 */
47#define ROWS (int []){ B2, C7, C6, B6, B5, B0, B3, D5, D3, D2 }
48
49/* COL2ROW or ROW2COL */
50#define DIODE_DIRECTION COL2ROW
51
52/* define if matrix has ghost */
53//#define MATRIX_HAS_GHOST
54
55/* Set 0 if debouncing isn't needed */
56#define DEBOUNCE 5
57
58/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
59#define LOCKING_SUPPORT_ENABLE
60/* Locking resynchronize hack */
61#define LOCKING_RESYNC_ENABLE
62
63/* key combination for command */
64#define IS_COMMAND() ( \
65 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
66)
67
68/* Backlight configuration
69 */
70#define BACKLIGHT_LEVELS 1
71
72/* Underlight configuration
73 */
74 #define ws2812_PORTREG PORTD
75 #define ws2812_DDRREG DDRD
76 #define ws2812_pin 7
77 #define RGBLED_NUM 14 // Number of LEDs
78 #define RGBLIGHT_HUE_STEP 10
79 #define RGBLIGHT_SAT_STEP 17
80 #define RGBLIGHT_VAL_STEP 17
81
82/*
83 * Feature disable options
84 * These options are also useful to firmware size reduction.
85 */
86
87/* disable debug print */
88//#define NO_DEBUG
89
90/* disable print */
91//#define NO_PRINT
92
93/* disable action features */
94//#define NO_ACTION_LAYER
95//#define NO_ACTION_TAPPING
96//#define NO_ACTION_ONESHOT
97//#define NO_ACTION_MACRO
98//#define NO_ACTION_FUNCTION
99
100#endif
diff --git a/keyboard/clueboard2/keymaps/keymap_default.c b/keyboard/clueboard2/keymaps/keymap_default.c
new file mode 100644
index 000000000..5d52f27a7
--- /dev/null
+++ b/keyboard/clueboard2/keymaps/keymap_default.c
@@ -0,0 +1,170 @@
1#include "clueboard2.h"
2
3#ifdef ENABLE_RGBLIGHT
4#include "rgblight.h"
5#endif
6
7// Used for SHIFT_ESC
8#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
9
10// Each layer gets a name for readability, which is then used in the keymap matrix below.
11// The underscores don't mean anything - you can have a layer called STUFF or any other name.
12// Layer names don't all need to be of the same length, obviously, and you can also skip them
13// entirely and just use numbers.
14#define _BL 0
15#define _FL 1
16#define _RS 2
17
18const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19 /* Keymap _BL: (Base Layer) Default Layer
20 * ,--------------------------------------------------------------------------. ,----.
21 * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| BS| |PGUP|
22 * |--------------------------------------------------------------------------| |----|
23 * | Tab| Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |PGDN|
24 * |--------------------------------------------------------------------------| `----'
25 * |Capslck| A| S| D| F| G| H| J| K| L| ;| '| # | Ent|
26 * |-----------------------------------------------------------------------------.
27 * |Shift| BS| Z| X| C| V| B| N| M| ,| .| /| BS|Shift| UP|
28 * |------------------------------------------------------------------------|----|----.
29 * | Ctrl| Gui| Alt| MHen| Space| Space| Hen| Alt| Ctrl| _FL|LEFT|DOWN|RGHT|
30 * `----------------------------------------------------------------------------------'
31 */
32[_BL] = KEYMAP(
33 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, \
34 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, \
35 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, \
36 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, \
37 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),
38
39 /* Keymap _FL: Function Layer
40 * ,--------------------------------------------------------------------------. ,----.
41 * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12| | Del| |BLIN|
42 * |--------------------------------------------------------------------------| |----|
43 * | | | | | | | | |PScr|SLck|Paus| | | | |BLDE|
44 * |--------------------------------------------------------------------------| `----'
45 * | | | _RS| | | | | | | | | | | |
46 * |-----------------------------------------------------------------------------.
47 * | | | | | | | | | | | | | | |PGUP|
48 * |------------------------------------------------------------------------|----|----.
49 * | | | | | | | | | | _FL|HOME|PGDN| END|
50 * `----------------------------------------------------------------------------------'
51 */
52[_FL] = KEYMAP(
53 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, \
54 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, \
55 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, \
56 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, \
57 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),
58
59 /* Keymap _RS: Reset layer
60 * ,--------------------------------------------------------------------------. ,----.
61 * | | | | | | | | | | | | | | | | | |
62 * |--------------------------------------------------------------------------| |----|
63 * | | | | |RESET| | | | | | | | | | | |
64 * |--------------------------------------------------------------------------| `----'
65 * | | | _RS| | | | | | | | | | | |
66 * |-----------------------------------------------------------------------------.
67 * | | | | | | | | | | | | | | | |
68 * |------------------------------------------------------------------------|----|----.
69 * | | | | | | | | | | _FL| | | |
70 * `----------------------------------------------------------------------------------'
71 */
72[_RS] = KEYMAP(
73 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), \
74 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), \
75 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, \
76 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), \
77 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)),
78};
79
80enum function_id {
81 SHIFT_ESC,
82 RGBLED_TOGGLE,
83 RGBLED_STEP_MODE,
84 RGBLED_INCREASE_HUE,
85 RGBLED_DECREASE_HUE,
86 RGBLED_INCREASE_SAT,
87 RGBLED_DECREASE_SAT,
88 RGBLED_INCREASE_VAL,
89 RGBLED_DECREASE_VAL
90};
91
92const uint16_t PROGMEM fn_actions[] = {
93 [0] = ACTION_FUNCTION(SHIFT_ESC),
94 [1] = ACTION_FUNCTION(RGBLED_TOGGLE),
95 [2] = ACTION_FUNCTION(RGBLED_STEP_MODE),
96 [3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
97 [4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
98 [5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
99 [6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
100 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
101 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
102};
103
104void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
105 static uint8_t shift_esc_shift_mask;
106 switch (id) {
107 case SHIFT_ESC:
108 shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
109 if (record->event.pressed) {
110 if (shift_esc_shift_mask) {
111 add_key(KC_GRV);
112 send_keyboard_report();
113 } else {
114 add_key(KC_ESC);
115 send_keyboard_report();
116 }
117 } else {
118 if (shift_esc_shift_mask) {
119 del_key(KC_GRV);
120 send_keyboard_report();
121 } else {
122 del_key(KC_ESC);
123 send_keyboard_report();
124 }
125 }
126 break;
127 //led operations
128 case RGBLED_TOGGLE:
129 if (record->event.pressed) {
130 rgblight_toggle();
131 }
132
133 break;
134 case RGBLED_INCREASE_HUE:
135 if (record->event.pressed) {
136 rgblight_increase_hue();
137 }
138 break;
139 case RGBLED_DECREASE_HUE:
140 if (record->event.pressed) {
141 rgblight_decrease_hue();
142 }
143 break;
144 case RGBLED_INCREASE_SAT:
145 if (record->event.pressed) {
146 rgblight_increase_sat();
147 }
148 break;
149 case RGBLED_DECREASE_SAT:
150 if (record->event.pressed) {
151 rgblight_decrease_sat();
152 }
153 break;
154 case RGBLED_INCREASE_VAL:
155 if (record->event.pressed) {
156 rgblight_increase_val();
157 }
158 break;
159 case RGBLED_DECREASE_VAL:
160 if (record->event.pressed) {
161 rgblight_decrease_val();
162 }
163 break;
164 case RGBLED_STEP_MODE:
165 if (record->event.pressed) {
166 rgblight_step();
167 }
168 break;
169 }
170}
diff --git a/keyboard/clueboard2/keymaps/keymap_max.c b/keyboard/clueboard2/keymaps/keymap_max.c
new file mode 100644
index 000000000..714d6390d
--- /dev/null
+++ b/keyboard/clueboard2/keymaps/keymap_max.c
@@ -0,0 +1,147 @@
1#include "clueboard2.h"
2
3#ifdef ENABLE_RGBLIGHT
4#include "rgblight.h"
5#endif
6
7// Used for SHIFT_ESC
8#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
9
10// Each layer gets a name for readability, which is then used in the keymap matrix below.
11// The underscores don't mean anything - you can have a layer called STUFF or any other name.
12// Layer names don't all need to be of the same length, obviously, and you can also skip them
13// entirely and just use numbers.
14#define _BL 0
15#define _FL 1
16#define _RS 2
17
18const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19 /* Keymap _BL: (Base Layer) Default Layer
20 * ,--------------------------------------------------------------------------. ,----.
21 * | Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| ~| BS| |PgUp|
22 * |--------------------------------------------------------------------------| |----|
23 * | Tab| Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |PgDn|
24 * |--------------------------------------------------------------------------| `----'
25 * |Capslck| A| S| D| F| G| H| J| K| L| ;| '| # | Ent|
26 * |-----------------------------------------------------------------------------.
27 * |Shift| BS| Z| X| C| V| B| N| M| ,| .| /| BS|Shift| Up|
28 * |------------------------------------------------------------------------|----|----.
29 * | Ctrl| Alt| Gui| MHen| Space| Space| Hen| Gui| Alt| Ctrl|Left|Down|Rght|
30 * `----------------------------------------------------------------------------------'
31 */
32[_BL] = KEYMAP(
33 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, \
34 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, \
35 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, \
36 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, \
37 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),
38
39 /* Keymap _FL: Function Layer
40 * ,--------------------------------------------------------------------------. ,----.
41 * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12| | Del| |BLIN|
42 * |--------------------------------------------------------------------------| |----|
43 * | | | | | | | | |PScr|SLck|Paus| | | | |BLDE|
44 * |--------------------------------------------------------------------------| `----'
45 * | | | _RS| | | | | | | | | | | |
46 * |-----------------------------------------------------------------------------.
47 * | | | | | | | | | | | | | | |PGUP|
48 * |------------------------------------------------------------------------|----|----.
49 * | | | | | | | | | | _FL|HOME|PGDN| END|
50 * `----------------------------------------------------------------------------------'
51 */
52[_FL] = KEYMAP(
53 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, \
54 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, \
55 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, \
56 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, \
57 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),
58
59 /* Keymap _RS: Reset/Underlight layer
60 * ,--------------------------------------------------------------------------. ,----.
61 * | | | | | | | | | | | | | | | | | |
62 * |--------------------------------------------------------------------------| |----|
63 * | | | | |RESET| | | | | | | | | | | |
64 * |--------------------------------------------------------------------------| `----'
65 * | | | _RS| | | | | | | | | | | |
66 * |-----------------------------------------------------------------------------.
67 * | | | | | | | | | | | | | | | |
68 * |------------------------------------------------------------------------|----|----.
69 * | | | | | | | | | | _FL| | | |
70 * `----------------------------------------------------------------------------------'
71 */
72[_RS] = KEYMAP(
73 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), \
74 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), \
75 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, \
76 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), \
77 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)),
78};
79
80enum function_id {
81 RGBLED_TOGGLE,
82 RGBLED_STEP_MODE,
83 RGBLED_INCREASE_HUE,
84 RGBLED_DECREASE_HUE,
85 RGBLED_INCREASE_SAT,
86 RGBLED_DECREASE_SAT,
87 RGBLED_INCREASE_VAL,
88 RGBLED_DECREASE_VAL,
89};
90
91const uint16_t PROGMEM fn_actions[] = {
92 [0] = ACTION_FUNCTION(RGBLED_TOGGLE),
93 [1] = ACTION_FUNCTION(RGBLED_STEP_MODE),
94 [2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
95 [3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
96 [4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
97 [5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
98 [6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
99 [7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
100};
101
102void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
103 switch (id) {
104 case RGBLED_TOGGLE:
105 //led operations
106 if (record->event.pressed) {
107 rgblight_toggle();
108 }
109
110 break;
111 case RGBLED_INCREASE_HUE:
112 if (record->event.pressed) {
113 rgblight_increase_hue();
114 }
115 break;
116 case RGBLED_DECREASE_HUE:
117 if (record->event.pressed) {
118 rgblight_decrease_hue();
119 }
120 break;
121 case RGBLED_INCREASE_SAT:
122 if (record->event.pressed) {
123 rgblight_increase_sat();
124 }
125 break;
126 case RGBLED_DECREASE_SAT:
127 if (record->event.pressed) {
128 rgblight_decrease_sat();
129 }
130 break;
131 case RGBLED_INCREASE_VAL:
132 if (record->event.pressed) {
133 rgblight_increase_val();
134 }
135 break;
136 case RGBLED_DECREASE_VAL:
137 if (record->event.pressed) {
138 rgblight_decrease_val();
139 }
140 break;
141 case RGBLED_STEP_MODE:
142 if (record->event.pressed) {
143 rgblight_step();
144 }
145 break;
146 }
147}
diff --git a/keyboard/clueboard2/keymaps/keymap_skully.c b/keyboard/clueboard2/keymaps/keymap_skully.c
new file mode 100644
index 000000000..74a03f2f3
--- /dev/null
+++ b/keyboard/clueboard2/keymaps/keymap_skully.c
@@ -0,0 +1,108 @@
1#include "clueboard2.h"
2
3// Used for SHIFT_ESC
4#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
5
6// Each layer gets a name for readability, which is then used in the keymap matrix below.
7// The underscores don't mean anything - you can have a layer called STUFF or any other name.
8// Layer names don't all need to be of the same length, obviously, and you can also skip them
9// entirely and just use numbers.
10#define _BL 0
11#define _FL 1
12#define _RS 2
13
14const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15 /* Keymap _BL: (Base Layer) Default Layer
16 * ,--------------------------------------------------------------------------. ,----.
17 * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| BS| |PGUP|
18 * |--------------------------------------------------------------------------| |----|
19 * | Tab| Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |PGDN|
20 * |--------------------------------------------------------------------------| `----'
21 * |Capslck| A| S| D| F| G| H| J| K| L| ;| '| # | Ent|
22 * |-----------------------------------------------------------------------------.
23 * |Shift| BS| Z| X| C| V| B| N| M| ,| .| /| BS|Shift| UP|
24 * |------------------------------------------------------------------------|----|----.
25 * | Ctrl| Gui| Alt| MHen| Space| Space| Hen| Alt| Ctrl| _FL|LEFT|DOWN|RGHT|
26 * `----------------------------------------------------------------------------------'
27 */
28[_BL] = KEYMAP(
29 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, \
30 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, \
31 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, \
32 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, \
33 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),
34
35 /* Keymap _FL: Function Layer
36 * ,--------------------------------------------------------------------------. ,----.
37 * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12| | Del| |BLIN|
38 * |--------------------------------------------------------------------------| |----|
39 * | | | | | | | | |PScr|SLck|Paus| | | | |BLDE|
40 * |--------------------------------------------------------------------------| `----'
41 * | | | _RS| | | | | | | | | | | |
42 * |-----------------------------------------------------------------------------.
43 * | | | | | | | | | | | | | | |PGUP|
44 * |------------------------------------------------------------------------|----|----.
45 * | | | | | | | | | | _FL|HOME|PGDN| END|
46 * `----------------------------------------------------------------------------------'
47 */
48[_FL] = KEYMAP(
49 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, \
50 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, \
51 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, \
52 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, \
53 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),
54
55 /* Keymap _RS: Reset layer
56 * ,--------------------------------------------------------------------------. ,----.
57 * | | | | | | | | | | | | | | | | | |
58 * |--------------------------------------------------------------------------| |----|
59 * | | | | |RESET| | | | | | | | | | | |
60 * |--------------------------------------------------------------------------| `----'
61 * | | | _RS| | | | | | | | | | | |
62 * |-----------------------------------------------------------------------------.
63 * | | | | | | | | | | | | | | | |
64 * |------------------------------------------------------------------------|----|----.
65 * | | | | | | | | | | _FL| | | |
66 * `----------------------------------------------------------------------------------'
67 */
68[_RS] = KEYMAP(
69 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, \
70 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, \
71 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, \
72 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, \
73 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),
74};
75
76enum function_id {
77 SHIFT_ESC,
78};
79
80const uint16_t PROGMEM fn_actions[] = {
81 [0] = ACTION_FUNCTION(SHIFT_ESC),
82};
83
84void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
85 static uint8_t shift_esc_shift_mask;
86 switch (id) {
87 case SHIFT_ESC:
88 shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
89 if (record->event.pressed) {
90 if (shift_esc_shift_mask) {
91 add_key(KC_GRV);
92 send_keyboard_report();
93 } else {
94 add_key(KC_ESC);
95 send_keyboard_report();
96 }
97 } else {
98 if (shift_esc_shift_mask) {
99 del_key(KC_GRV);
100 send_keyboard_report();
101 } else {
102 del_key(KC_ESC);
103 send_keyboard_report();
104 }
105 }
106 break;
107 }
108}
diff --git a/keyboard/clueboard2/led.c b/keyboard/clueboard2/led.c
new file mode 100644
index 000000000..5788fc7b1
--- /dev/null
+++ b/keyboard/clueboard2/led.c
@@ -0,0 +1,36 @@
1 /*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <avr/io.h>
19#include "stdint.h"
20#include "led.h"
21
22
23void led_init_ports() {
24 // * Set our LED pins as output
25 DDRB |= (1<<4);
26}
27
28void led_set(uint8_t usb_led) {
29 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
30 // Turn capslock on
31 PORTB |= (1<<4);
32 } else {
33 // Turn capslock off
34 PORTB &= ~(1<<4);
35 }
36}
diff --git a/keyboard/cluepad/Makefile b/keyboard/cluepad/Makefile
new file mode 100644
index 000000000..cfa130d75
--- /dev/null
+++ b/keyboard/cluepad/Makefile
@@ -0,0 +1,136 @@
1#----------------------------------------------------------------------------
2# On command line:
3#
4# make all = Make software.
5#
6# make clean = Clean out built project files.
7#
8# make coff = Convert ELF to AVR COFF.
9#
10# make extcoff = Convert ELF to AVR Extended COFF.
11#
12# make program = Download the hex file to the device.
13# Please customize your programmer settings(PROGRAM_CMD)
14#
15# make teensy = Download the hex file to the device, using teensy_loader_cli.
16# (must have teensy_loader_cli installed).
17#
18# make dfu = Download the hex file to the device, using dfu-programmer (must
19# have dfu-programmer installed).
20#
21# make flip = Download the hex file to the device, using Atmel FLIP (must
22# have Atmel FLIP installed).
23#
24# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
25# (must have dfu-programmer installed).
26#
27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
28# (must have Atmel FLIP installed).
29#
30# make debug = Start either simulavr or avarice as specified for debugging,
31# with avr-gdb or avr-insight as the front end for debugging.
32#
33# make filename.s = Just compile filename.c into the assembler code only.
34#
35# make filename.i = Create a preprocessed source file for use in submitting
36# bug reports to the GCC project.
37#
38# To rebuild project do "make clean" then "make all".
39#----------------------------------------------------------------------------
40
41# Target file name (without extension).
42TARGET = cluepad
43
44
45# Directory common source filess exist
46TOP_DIR = ../..
47TMK_DIR = ../../tmk_core
48
49# Directory keyboard dependent files exist
50TARGET_DIR = .
51
52# # project specific files
53SRC = cluepad.c backlight.c
54
55ifdef KEYMAP
56 SRC := keymaps/keymap_$(KEYMAP).c $(SRC)
57else
58 SRC := keymaps/keymap_default.c $(SRC)
59endif
60
61CONFIG_H = config.h
62
63# MCU name
64#MCU = at90usb1287
65MCU = atmega32u4
66
67# Processor frequency.
68# This will define a symbol, F_CPU, in all source code files equal to the
69# processor frequency in Hz. You can then use this symbol in your source code to
70# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
71# automatically to create a 32-bit value in your source code.
72#
73# This will be an integer division of F_USB below, as it is sourced by
74# F_USB after it has run through any CPU prescalers. Note that this value
75# does not *change* the processor frequency - it should merely be updated to
76# reflect the processor speed set externally so that the code can use accurate
77# software delays.
78F_CPU = 16000000
79
80
81#
82# LUFA specific
83#
84# Target architecture (see library "Board Types" documentation).
85ARCH = AVR8
86
87# Input clock frequency.
88# This will define a symbol, F_USB, in all source code files equal to the
89# input clock frequency (before any prescaling is performed) in Hz. This value may
90# differ from F_CPU if prescaling is used on the latter, and is required as the
91# raw input clock is fed directly to the PLL sections of the AVR for high speed
92# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
93# at the end, this will be done automatically to create a 32-bit value in your
94# source code.
95#
96# If no clock division is performed on the input clock inside the AVR (via the
97# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
98F_USB = $(F_CPU)
99
100# Interrupt driven control endpoint task(+60)
101OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
102
103
104# Boot Section Size in *bytes*
105# Teensy halfKay 512
106# Teensy++ halfKay 1024
107# Atmel DFU loader 4096
108# LUFA bootloader 4096
109# USBaspLoader 2048
110OPT_DEFS += -DBOOTLOADER_SIZE=4096
111
112
113# Build Options
114# comment out to disable the options.
115#
116BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
117# MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
118EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
119CONSOLE_ENABLE = yes # Console for debug(+400)
120COMMAND_ENABLE = yes # Commands for debug and configuration
121NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
122BACKLIGHT_ENABLE = yes # Enable numpad's backlight functionality
123RGBLIGHT_ENABLE = yes
124# MIDI_ENABLE = YES # MIDI controls
125# UNICODE_ENABLE = YES # Unicode
126# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
127
128# Optimize size but this may cause error "relocation truncated to fit"
129#EXTRALDFLAGS = -Wl,--relax
130
131# Search Path
132VPATH += $(TARGET_DIR)
133VPATH += $(TOP_DIR)
134VPATH += $(TMK_DIR)
135
136include $(TOP_DIR)/quantum/quantum.mk
diff --git a/keyboard/cluepad/backlight.c b/keyboard/cluepad/backlight.c
new file mode 100644
index 000000000..c0f853949
--- /dev/null
+++ b/keyboard/cluepad/backlight.c
@@ -0,0 +1,54 @@
1#include <avr/io.h>
2#include "backlight.h"
3#include "led.h"
4
5#include "print.h"
6
7int pwm_level;
8
9void led_set(uint8_t usb_led)
10{
11 print("led_set\n");
12}
13
14void init_backlight_pin(void)
15{
16 // Set C7 to output
17 DDRC |= (1<<7);
18
19 // Initialize the timer
20 TC4H = 0x03;
21 OCR4C = 0xFF;
22 TCCR4A = 0b10000010;
23 TCCR4B = 0b00000001;
24}
25
26void backlight_set(uint8_t level)
27{
28 // Determine the PWM level
29 switch (level)
30 {
31 case 0:
32 // 33%
33 pwm_level = 0x54;
34 break;
35 case 1:
36 // 66%
37 pwm_level = 0xA8;
38 break;
39 case 2:
40 // 100%
41 pwm_level = 0xFF;
42 break;
43 case 3:
44 // 0%
45 pwm_level = 0x00;
46 break;
47 default:
48 xprintf("Unknown level: %d\n", level);
49 }
50
51 // Write the PWM level to the timer
52 TC4H = pwm_level >> 8;
53 OCR4A = 0xFF & pwm_level;
54}
diff --git a/keyboard/cluepad/cluepad.c b/keyboard/cluepad/cluepad.c
new file mode 100644
index 000000000..ff3be5b9b
--- /dev/null
+++ b/keyboard/cluepad/cluepad.c
@@ -0,0 +1,39 @@
1#include "cluepad.h"
2
3__attribute__ ((weak))
4void * matrix_init_user(void) {
5 // leave these blank
6};
7
8__attribute__ ((weak))
9void * matrix_scan_user(void) {
10 // leave these blank
11};
12
13void * matrix_init_kb(void) {
14 // put your keyboard start-up code here
15 // runs once when the firmware starts up
16 if (matrix_init_user) {
17 (*matrix_init_user)();
18 }
19
20 #ifdef BACKLIGHT_ENABLE
21 init_backlight_pin();
22 #endif
23
24 #ifdef RGBLIGHT_ENABLE
25 rgblight_init();
26 #endif
27
28 // JTAG disable for PORT F. write JTD bit twice within four cycles.
29 MCUCR |= (1<<JTD);
30 MCUCR |= (1<<JTD);
31};
32
33void * matrix_scan_kb(void) {
34 // put your looping keyboard code here
35 // runs every cycle (a lot)
36 if (matrix_scan_user) {
37 (*matrix_scan_user)();
38 }
39};
diff --git a/keyboard/cluepad/cluepad.h b/keyboard/cluepad/cluepad.h
new file mode 100644
index 000000000..0d10d50b8
--- /dev/null
+++ b/keyboard/cluepad/cluepad.h
@@ -0,0 +1,41 @@
1#ifndef CLUEPAD_H
2#define CLUEPAD_H
3
4#include "matrix.h"
5#include "keymap_common.h"
6#include <stddef.h>
7
8
9/* Cluepad matrix layout
10 * .-------------------.
11 * |NLCK| /| *| -|
12 * |-------------------|
13 * | 7| 8| 9| |
14 * |--------------| |
15 * | 4| 5| 6| +|
16 * |-------------------|
17 * | 1| 2| 3| |
18 * |--------------| |
19 * | 0| .| Ent|
20 * '-------------------'
21 */
22// The first section contains all of the arguments
23// The second converts the arguments into a two-dimensional array
24#define KEYMAP( \
25 k00, k01, k02, k03, \
26 k10, k11, k12, k13, \
27 k20, k21, k22, \
28 k30, k31, k32, k33, \
29 k40, k42 \
30) { \
31 { k00, k01, k02, k03, }, \
32 { k10, k11, k12, k13, }, \
33 { k20, k21, k22, KC_NO, }, \
34 { k30, k31, k32, k33, }, \
35 { k40, KC_NO, k42, KC_NO } \
36}
37
38void * matrix_init_user(void);
39void * matrix_scan_user(void);
40
41#endif
diff --git a/keyboard/cluepad/config.h b/keyboard/cluepad/config.h
new file mode 100644
index 000000000..5ed421a6e
--- /dev/null
+++ b/keyboard/cluepad/config.h
@@ -0,0 +1,102 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xC1ED
25#define PRODUCT_ID 0x2312
26#define DEVICE_VER 0x0001
27#define MANUFACTURER Clueboard
28#define PRODUCT Cluepad with RGB Underlighting
29#define DESCRIPTION QMK keyboard firmware for Cluepad
30
31/* key matrix size */
32#define MATRIX_ROWS 5
33#define MATRIX_COLS 4
34
35// COLS: Left to right, ROWS: Top to bottom
36
37/* Column pin configuration
38 * col: 0 1 2 3
39 * pin: F4 E6 B1 D2
40 */
41#define COLS (int []){ F4, E6, B1, D2 }
42
43 /* Row pin configuration
44 * row: 0 1 2 3 4
45 * pin:
46 */
47#define ROWS (int []){ B0, D3, D5, D4, D6 }
48
49/* COL2ROW or ROW2COL */
50#define DIODE_DIRECTION COL2ROW
51
52/* define if matrix has ghost */
53//#define MATRIX_HAS_GHOST
54
55/* Set 0 if debouncing isn't needed */
56#define DEBOUNCE 5
57
58/* Number of backlighting levels */
59#define BACKLIGHT_LEVELS 3
60
61/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
62#define LOCKING_SUPPORT_ENABLE
63/* Locking resynchronize hack */
64#define LOCKING_RESYNC_ENABLE
65
66/* key combination for command */
67#define IS_COMMAND() ( \
68 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
69)
70
71/* Underlight configuration
72 */
73 #define ws2812_PORTREG PORTF
74 #define ws2812_DDRREG DDRF
75 #define ws2812_pin 6
76 #define RGBLED_NUM 4 // Number of LEDs
77 #define RGBLIGHT_HUE_STEP 10
78 #define RGBLIGHT_SAT_STEP 17
79 #define RGBLIGHT_VAL_STEP 17
80
81/*
82 * Feature disable options
83 * These options are also useful to firmware size reduction.
84 */
85
86/* disable debug print */
87//#define NO_DEBUG
88
89/* Debug forcibly enabled */
90#define ALWAYS_DEBUG
91
92/* disable print */
93//#define NO_PRINT
94
95/* disable action features */
96//#define NO_ACTION_LAYER
97//#define NO_ACTION_TAPPING
98//#define NO_ACTION_ONESHOT
99//#define NO_ACTION_MACRO
100//#define NO_ACTION_FUNCTION
101
102#endif
diff --git a/keyboard/cluepad/keymaps/keymap_default.c b/keyboard/cluepad/keymaps/keymap_default.c
new file mode 100644
index 000000000..32cb43c74
--- /dev/null
+++ b/keyboard/cluepad/keymaps/keymap_default.c
@@ -0,0 +1,122 @@
1#include "cluepad.h"
2
3#include "backlight.h"
4#include "rgblight.h"
5
6// Each layer gets a name for readability, which is then used in the keymap matrix below.
7// The underscores don't mean anything - you can have a layer called STUFF or any other name.
8// Layer names don't all need to be of the same length, obviously, and you can also skip them
9// entirely and just use numbers.
10#define _BL 0
11#define _FL 1
12#define _RS 2
13
14const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15 /* Keymap _BL: (Base Layer) Default Layer
16 * .-------------------.
17 * |NL F| /| *| -|
18 * |-------------------|
19 * | 7| 8| 9| |
20 * |--------------| |
21 * | 4| 5| 6| +|
22 * |-------------------|
23 * | 1| 2| 3| |
24 * |--------------| |
25 * | 0| .| Ent|
26 * '-------------------'
27 */
28[_BL] = KEYMAP(
29 LT(_FL, KC_NLCK), KC_PSLS, KC_PAST, KC_PMNS, \
30 KC_P7, KC_P8, KC_P9, KC_PPLS, \
31 KC_P4, KC_P5, KC_P6, \
32 KC_P1, KC_P2, KC_P3, KC_PENT, \
33 KC_P0, KC_PDOT),
34
35 /* Keymap _FL: Function Layer
36 * .-------------------.
37 * |NL F| | | Fn0|
38 * |-------------------|
39 * | Fn2| | Fn4| |
40 * |--------------| |
41 * | Fn3|BL_S| Fn5| Fn6|
42 * |-------------------|
43 * | | | | |
44 * |--------------| |
45 * | Fn1| | Fn7|
46 * '-------------------'
47 */
48[_FL] = KEYMAP(
49 LT(_FL, KC_NLCK), KC_TRNS, KC_TRNS, F(0), \
50 F(2), KC_TRNS, F(4), F(6), \
51 F(3), BL_STEP, F(5), \
52 KC_TRNS, KC_TRNS, KC_TRNS, F(7), \
53 F(1), KC_TRNS)
54};
55
56enum function_id {
57 RGBLED_TOGGLE,
58 RGBLED_STEP_MODE,
59 RGBLED_INCREASE_HUE,
60 RGBLED_DECREASE_HUE,
61 RGBLED_INCREASE_SAT,
62 RGBLED_DECREASE_SAT,
63 RGBLED_INCREASE_VAL,
64 RGBLED_DECREASE_VAL,
65};
66
67const uint16_t PROGMEM fn_actions[] = {
68 [0] = ACTION_FUNCTION(RGBLED_TOGGLE),
69 [1] = ACTION_FUNCTION(RGBLED_STEP_MODE),
70 [2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
71 [3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
72 [4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
73 [5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
74 [6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
75 [7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
76};
77
78void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
79 switch (id) {
80 case RGBLED_TOGGLE:
81 if (record->event.pressed) {
82 rgblight_toggle();
83 }
84 break;
85 case RGBLED_INCREASE_HUE:
86 if (record->event.pressed) {
87 rgblight_increase_hue();
88 }
89 break;
90 case RGBLED_DECREASE_HUE:
91 if (record->event.pressed) {
92 rgblight_decrease_hue();
93 }
94 break;
95 case RGBLED_INCREASE_SAT:
96 if (record->event.pressed) {
97 rgblight_increase_sat();
98 }
99 break;
100 case RGBLED_DECREASE_SAT:
101 if (record->event.pressed) {
102 rgblight_decrease_sat();
103 }
104 break;
105 case RGBLED_INCREASE_VAL:
106 if (record->event.pressed) {
107 rgblight_increase_val();
108 }
109 break;
110 case RGBLED_DECREASE_VAL:
111 if (record->event.pressed) {
112 rgblight_decrease_val();
113 }
114 break;
115 case RGBLED_STEP_MODE:
116 if (record->event.pressed) {
117 rgblight_step();
118 }
119 break;
120 }
121}
122