aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Goodwin <samuel.goodwin@me.com>2016-05-29 19:18:01 +0200
committerJack Humbert <jack.humb@gmail.com>2016-05-29 13:18:01 -0400
commit478a18d23797e3c6bd9d55732a963fc65db647d9 (patch)
treede07ab84314d5d8a8e731181a967962ea0c34d04
parentb85dd60397e139f787ae26552145391f34686f4d (diff)
downloadqmk_firmware-478a18d23797e3c6bd9d55732a963fc65db647d9.tar.gz
qmk_firmware-478a18d23797e3c6bd9d55732a963fc65db647d9.zip
Add support for the KC60 v2.0 2015-09-12 (#360)
* Don't save the ctags file in the repo. * Initial support for the KC60 board. Only 5x5 working so far. * Rename because this isn't the same KC60 as others. * Add in some generic layout. Pins seem to be in the right order except the 6th column spews gibberish. * Don't need this for now. * Move this to some other folder. * Trying again to start over. * Don't need to start over because I figured out why the 'broken' stuff wasn't working. * Attempt to enable backlighting. It's on on pin B7 like other boards. * Fix last port changes and fix LED control in keymap. * Trying some other LED code. * Bootloader needs to be bigger. Disabling backlight for now. * Simplify LED code while I try to figure it out. * Turn back on backlighting. * Backlighting works now. Just need to get levels or breathing working. * Trying to allow for turning off the LEDs before I get to brightness levels. * The missing link: need to run the init_ports function for LEDs to work properly. * Removing breathing stuff since it bricks the board. * Clean up default layer. * Cleanup keymap, KC60 doesn't support a 5th right bottom-row button.
-rw-r--r--keyboard/kc60_v2/Makefile158
-rw-r--r--keyboard/kc60_v2/README.md24
-rw-r--r--keyboard/kc60_v2/config.h161
-rw-r--r--keyboard/kc60_v2/kc60.c111
-rw-r--r--keyboard/kc60_v2/kc60.h36
-rw-r--r--keyboard/kc60_v2/keymaps/default.c24
-rw-r--r--keyboard/planck/.gitignore1
7 files changed, 515 insertions, 0 deletions
diff --git a/keyboard/kc60_v2/Makefile b/keyboard/kc60_v2/Makefile
new file mode 100644
index 000000000..33ece3164
--- /dev/null
+++ b/keyboard/kc60_v2/Makefile
@@ -0,0 +1,158 @@
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 = kc60
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 = kc60.c
54
55ifdef KEYMAP
56 SRC := keymaps/$(KEYMAP).c $(SRC)
57else
58 SRC := keymaps/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# change yes to no to disable
115#
116BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
117MOUSEKEY_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
121KEYBOARD_LOCK_ENABLE = yes # Allow locking of keyboard via magic key
122# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
123SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
124# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
125NKRO_ENABLE = no # USB Nkey Rollover
126BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
127MIDI_ENABLE = no # MIDI controls
128UNICODE_ENABLE = no # Unicode
129BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
130AUDIO_ENABLE = no # Audio output on port C6
131
132
133ifdef KEYMAP
134
135ifeq ("$(wildcard keymaps/$(KEYMAP).c)","")
136ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
137 include keymaps/$(KEYMAP)/makefile.mk
138endif
139endif
140
141else
142
143ifneq ("$(wildcard keymaps/default/makefile.mk)","")
144 include keymaps/default/makefile.mk
145endif
146
147endif
148
149# Optimize size but this may cause error "relocation truncated to fit"
150#EXTRALDFLAGS = -Wl,--relax
151
152# Search Path
153VPATH += $(TARGET_DIR)
154VPATH += $(TOP_DIR)
155VPATH += $(TMK_DIR)
156
157include $(TOP_DIR)/quantum/quantum.mk
158
diff --git a/keyboard/kc60_v2/README.md b/keyboard/kc60_v2/README.md
new file mode 100644
index 000000000..4be448d15
--- /dev/null
+++ b/keyboard/kc60_v2/README.md
@@ -0,0 +1,24 @@
1kc60 keyboard firmware
2======================
3
4## Quantum MK Firmware
5
6For the full Quantum feature list, see [the parent README.md](/README.md).
7
8## Building
9
10Download or clone the whole firmware and navigate to the keyboard/kc60 folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file.
11
12Depending on which keymap you would like to use, you will have to compile slightly differently.
13
14### Default
15To build with the default keymap, simply run `make`.
16
17### Other Keymaps
18Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `<name>.c` in the keymaps folder, and see keymap document (you can find in top README.md) and existent keymap files.
19
20To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like:
21```
22$ make KEYMAP=[default|jack|<name>]
23```
24Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder.
diff --git a/keyboard/kc60_v2/config.h b/keyboard/kc60_v2/config.h
new file mode 100644
index 000000000..16bc1cbb2
--- /dev/null
+++ b/keyboard/kc60_v2/config.h
@@ -0,0 +1,161 @@
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 0xFEED
25#define PRODUCT_ID 0x6060
26#define DEVICE_VER 0x0001
27#define MANUFACTURER You
28#define PRODUCT kc60v2
29#define DESCRIPTION A custom keyboard
30
31/* key matrix size */
32#define MATRIX_ROWS 5
33#define MATRIX_COLS 14
34
35/*
36 * Keyboard Matrix Assignments
37 *
38 * Change this to how you wired your keyboard
39 * COLS: AVR pins used for columns, left to right
40 * ROWS: AVR pins used for rows, top to bottom
41 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
42 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
43 *
44*/
45
46// Possible pins for columns include: F1 F0 E6 D7 D6 D4 C7 C6 B7 B5 B4 B3 B1 B0
47// Pins for rows include: D0 D1 F6 F7 D5
48#define MATRIX_ROW_PINS { D0, D1, F6, F7, D5 }
49#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3 }
50#define UNUSED_PINS
51
52/* COL2ROW or ROW2COL */
53#define DIODE_DIRECTION COL2ROW
54
55/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
56#define DEBOUNCING_DELAY 5
57
58/* define if matrix has ghost (lacks anti-ghosting diodes) */
59//#define MATRIX_HAS_GHOST
60
61/* number of backlight levels */
62#define BACKLIGHT_LEVELS 3
63
64/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
65#define LOCKING_SUPPORT_ENABLE
66/* Locking resynchronize hack */
67#define LOCKING_RESYNC_ENABLE
68
69/*
70 * Force NKRO
71 *
72 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
73 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
74 * makefile for this to work.)
75 *
76 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
77 * until the next keyboard reset.
78 *
79 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
80 * fully operational during normal computer usage.
81 *
82 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
83 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
84 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
85 * power-up.
86 *
87 */
88//#define FORCE_NKRO
89
90/*
91 * Magic Key Options
92 *
93 * Magic keys are hotkey commands that allow control over firmware functions of
94 * the keyboard. They are best used in combination with the HID Listen program,
95 * found here: https://www.pjrc.com/teensy/hid_listen.html
96 *
97 * The options below allow the magic key functionality to be changed. This is
98 * useful if your keyboard/keypad is missing keys and you want magic key support.
99 *
100 */
101
102/* key combination for magic key command */
103#define IS_COMMAND() ( \
104 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
105)
106
107/* control how magic key switches layers */
108//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
109//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
110//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
111
112/* override magic key keymap */
113//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
114//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
115//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
116//#define MAGIC_KEY_HELP1 H
117//#define MAGIC_KEY_HELP2 SLASH
118//#define MAGIC_KEY_DEBUG D
119//#define MAGIC_KEY_DEBUG_MATRIX X
120//#define MAGIC_KEY_DEBUG_KBD K
121//#define MAGIC_KEY_DEBUG_MOUSE M
122//#define MAGIC_KEY_VERSION V
123//#define MAGIC_KEY_STATUS S
124//#define MAGIC_KEY_CONSOLE C
125//#define MAGIC_KEY_LAYER0_ALT1 ESC
126//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
127//#define MAGIC_KEY_LAYER0 0
128//#define MAGIC_KEY_LAYER1 1
129//#define MAGIC_KEY_LAYER2 2
130//#define MAGIC_KEY_LAYER3 3
131//#define MAGIC_KEY_LAYER4 4
132//#define MAGIC_KEY_LAYER5 5
133//#define MAGIC_KEY_LAYER6 6
134//#define MAGIC_KEY_LAYER7 7
135//#define MAGIC_KEY_LAYER8 8
136//#define MAGIC_KEY_LAYER9 9
137//#define MAGIC_KEY_BOOTLOADER PAUSE
138//#define MAGIC_KEY_LOCK CAPS
139//#define MAGIC_KEY_EEPROM E
140//#define MAGIC_KEY_NKRO N
141//#define MAGIC_KEY_SLEEP_LED Z
142
143/*
144 * Feature disable options
145 * These options are also useful to firmware size reduction.
146 */
147
148/* disable debug print */
149//#define NO_DEBUG
150
151/* disable print */
152//#define NO_PRINT
153
154/* disable action features */
155//#define NO_ACTION_LAYER
156//#define NO_ACTION_TAPPING
157//#define NO_ACTION_ONESHOT
158//#define NO_ACTION_MACRO
159//#define NO_ACTION_FUNCTION
160
161#endif
diff --git a/keyboard/kc60_v2/kc60.c b/keyboard/kc60_v2/kc60.c
new file mode 100644
index 000000000..0a578b2b8
--- /dev/null
+++ b/keyboard/kc60_v2/kc60.c
@@ -0,0 +1,111 @@
1#include "kc60.h"
2
3__attribute__ ((weak))
4 void matrix_init_user(void) {
5 // leave this function blank - it can be defined in a keymap file
6 };
7
8__attribute__ ((weak))
9 void matrix_scan_user(void) {
10 // leave this function blank - it can be defined in a keymap file
11 }
12
13__attribute__ ((weak))
14 bool process_action_user(keyrecord_t *record) {
15 // leave this function blank - it can be defined in a keymap file
16 return true;
17 }
18
19__attribute__ ((weak))
20 void led_set_user(uint8_t usb_led) {
21 // leave this function blank - it can be defined in a keymap file
22 }
23
24void matrix_init_kb(void) {
25 // put your keyboard start-up code here
26 // runs once when the firmware starts up
27
28#ifdef BACKLIGHT_ENABLE
29 backlight_init_ports();
30#endif
31
32 matrix_init_user();
33}
34
35void matrix_scan_kb(void) {
36 // put your looping keyboard code here
37 // runs every cycle (a lot)
38
39 matrix_scan_user();
40}
41
42bool process_action_kb(keyrecord_t *record) {
43 // put your per-action keyboard code here
44 // runs for every action, just before processing by the firmware
45
46 return process_action_user(record);
47}
48
49void led_set_kb(uint8_t usb_led) {
50 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
51
52 led_set_user(usb_led);
53}
54
55#ifdef BACKLIGHT_ENABLE
56#define CHANNEL OCR1B
57
58void backlight_init_ports()
59{
60
61 // Setup PB6 as output and output low.
62 DDRB |= (1<<6);
63 PORTB &= ~(1<<6);
64
65 // Use full 16-bit resolution.
66 ICR1 = 0xFFFF;
67
68 // I could write a wall of text here to explain... but TL;DW
69 // Go read the ATmega32u4 datasheet.
70 // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on
71
72 // Pin PB7 = OCR1C (Timer 1, Channel C)
73 // Compare Output Mode = Clear on compare match, Channel C = COM1B1=1 COM1C0=0
74 // (i.e. start high, go low when counter matches.)
75 // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0
76 // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1
77
78 TCCR1A = _BV(COM1B1) | _BV(WGM11); // = 0b00001010;
79 TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001;
80
81 backlight_init();
82}
83
84void backlight_set(uint8_t level)
85{
86 // Prevent backlight blink on lowest level
87 PORTB &= ~(_BV(PORTB6));
88
89 if ( level == 0 )
90 {
91 // Turn off PWM control on PB6, revert to output low.
92 TCCR1A &= ~(_BV(COM1B1));
93 CHANNEL = 0x0;
94 }
95 else if ( level == BACKLIGHT_LEVELS)
96 {
97 // Turn on PWM control of PB6
98 TCCR1A |= _BV(COM1B1);
99 // Set the brightness
100 CHANNEL = 0xFFFF;
101 }
102 else
103 {
104 // Turn on PWM control of PB6
105 TCCR1A |= _BV(COM1B1);
106 // Set the brightness
107 CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2));
108 }
109}
110
111#endif
diff --git a/keyboard/kc60_v2/kc60.h b/keyboard/kc60_v2/kc60.h
new file mode 100644
index 000000000..d346a5502
--- /dev/null
+++ b/keyboard/kc60_v2/kc60.h
@@ -0,0 +1,36 @@
1#ifndef KC60_H
2#define KC60_H
3
4#include "matrix.h"
5#include "keymap_common.h"
6#ifdef BACKLIGHT_ENABLE
7#include "backlight.h"
8#endif
9#include <avr/io.h>
10#include <stddef.h>
11
12// This a shortcut to help you visually see your layout.
13// The first section contains all of the arguements
14// The second converts the arguments into a multi-dimensional array
15#define KEYMAP( \
16 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
17 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
18 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \
19 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
20 K40, K41, K42, K45, K4A, K4B, K4C, K4D \
21 ) { \
22 { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \
23 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \
24 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \
25 { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \
26 { K40, K41, K42, KC_NO, KC_NO, K45, KC_NO, KC_NO, KC_NO, KC_NO,K4A, K4B, K4C, K4D } \
27}
28
29void matrix_init_user(void);
30void matrix_scan_user(void);
31bool process_action_user(keyrecord_t *record);
32
33void led_set_user(uint8_t usb_led);
34void backlight_init_ports(void);
35
36#endif
diff --git a/keyboard/kc60_v2/keymaps/default.c b/keyboard/kc60_v2/keymaps/default.c
new file mode 100644
index 000000000..6f8352c69
--- /dev/null
+++ b/keyboard/kc60_v2/keymaps/default.c
@@ -0,0 +1,24 @@
1// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
2// this is the style you want to emulate.
3
4#include "kc60.h"
5
6const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7 [0] = KEYMAP( /* Basic QWERTY */
8 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_BSPC, \
9 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, \
10 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_NO, KC_ENT, \
11 KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_NO, KC_RSFT, \
12 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, KC_RCTL, RESET \
13 ),
14};
15
16const uint16_t PROGMEM fn_actions[] = {
17
18};
19
20const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
21{
22 // MACRODOWN only works in this function
23 return MACRO_NONE;
24};
diff --git a/keyboard/planck/.gitignore b/keyboard/planck/.gitignore
new file mode 100644
index 000000000..6e92f57d4
--- /dev/null
+++ b/keyboard/planck/.gitignore
@@ -0,0 +1 @@
tags