aboutsummaryrefslogtreecommitdiff
path: root/keyboard/clueboard1
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/clueboard1')
-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
6 files changed, 444 insertions, 0 deletions
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}