aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2015-10-26 14:49:46 -0400
committerJack Humbert <jack.humb@gmail.com>2015-10-26 14:49:46 -0400
commit46e7fb2d3ccd699c0a1b1fd9d02860b1f2a44141 (patch)
treef0b00f664ecdaf83e30f27baf20780eb5d91c39a
parentff8d8a50dfbb8502003a5181878c54a71b8c57d5 (diff)
downloadqmk_firmware-46e7fb2d3ccd699c0a1b1fd9d02860b1f2a44141.tar.gz
qmk_firmware-46e7fb2d3ccd699c0a1b1fd9d02860b1f2a44141.zip
quantum separated
-rw-r--r--common/matrix.h4
-rw-r--r--keyboard/planck/Makefile19
-rw-r--r--keyboard/planck/Makefile.pjrc116
-rw-r--r--keyboard/planck/keymaps/keymap_default.c3
-rw-r--r--keyboard/planck/matrix_steno.c234
-rw-r--r--keyboard/planck/planck.c29
-rw-r--r--keyboard/planck/planck.h38
-rw-r--r--protocol/lufa/lufa.c17
-rw-r--r--quantum.mk69
-rw-r--r--quantum/analog.c (renamed from keyboard/planck/analog.c)0
-rw-r--r--quantum/analog.h (renamed from keyboard/planck/analog.h)0
-rw-r--r--quantum/beeps.c (renamed from keyboard/planck/beeps.c)0
-rw-r--r--quantum/beeps.h (renamed from keyboard/planck/beeps.h)0
-rw-r--r--quantum/keymap_common.c (renamed from keyboard/planck/keymap_common.c)6
-rw-r--r--quantum/keymap_common.h (renamed from keyboard/planck/keymap_common.h)6
-rw-r--r--quantum/keymap_extras/keymap_colemak.h74
-rw-r--r--quantum/keymap_extras/keymap_dvorak.h72
-rw-r--r--quantum/keymap_extras/keymap_french.h (renamed from keyboard/planck/keymap_french.h)0
-rw-r--r--quantum/keymap_extras/keymap_nordic.h (renamed from keyboard/planck/keymap_nordic.h)0
-rw-r--r--quantum/keymap_extras/keymap_spanish.h (renamed from keyboard/planck/keymap_spanish.h)0
-rw-r--r--quantum/keymap_extras/keymap_uk.h36
-rw-r--r--quantum/keymap_midi.c (renamed from keyboard/planck/keymap_midi.c)0
-rw-r--r--quantum/keymap_midi.h (renamed from keyboard/planck/keymap_midi.h)0
-rw-r--r--quantum/keymap_unicode.c (renamed from keyboard/planck/keymap_unicode.c)0
-rw-r--r--quantum/led.c (renamed from keyboard/planck/led.c)0
-rw-r--r--quantum/matrix.c (renamed from keyboard/planck/matrix.c)20
26 files changed, 359 insertions, 384 deletions
diff --git a/common/matrix.h b/common/matrix.h
index 107ee7265..7c133f142 100644
--- a/common/matrix.h
+++ b/common/matrix.h
@@ -61,6 +61,10 @@ void matrix_print(void);
61void matrix_power_up(void); 61void matrix_power_up(void);
62void matrix_power_down(void); 62void matrix_power_down(void);
63 63
64void *matrix_init_kb(void);
65void *matrix_scan_kb(void);
66
67
64#ifdef __cplusplus 68#ifdef __cplusplus
65} 69}
66#endif 70#endif
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile
index 3ac4540e1..643646155 100644
--- a/keyboard/planck/Makefile
+++ b/keyboard/planck/Makefile
@@ -39,7 +39,7 @@
39#---------------------------------------------------------------------------- 39#----------------------------------------------------------------------------
40 40
41# Target file name (without extension). 41# Target file name (without extension).
42TARGET = planck_lufa 42TARGET = planck
43 43
44 44
45# Directory common source filess exist 45# Directory common source filess exist
@@ -49,9 +49,7 @@ TOP_DIR = ../..
49TARGET_DIR = . 49TARGET_DIR = .
50 50
51# # project specific files 51# # project specific files
52SRC = keymap_common.c \ 52SRC = planck.c \
53 matrix.c \
54 led.c \
55 backlight.c 53 backlight.c
56 54
57ifdef KEYMAP 55ifdef KEYMAP
@@ -128,14 +126,6 @@ MIDI_ENABLE = YES # MIDI controls
128# UNICODE_ENABLE = YES # Unicode 126# UNICODE_ENABLE = YES # Unicode
129BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID 127BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
130 128
131ifdef MIDI_ENABLE
132 SRC += keymap_midi.c \
133 beeps.c
134endif
135
136ifdef UNICODE_ENABLE
137 SRC += keymap_unicode.c
138endif
139 129
140# Optimize size but this may cause error "relocation truncated to fit" 130# Optimize size but this may cause error "relocation truncated to fit"
141#EXTRALDFLAGS = -Wl,--relax 131#EXTRALDFLAGS = -Wl,--relax
@@ -144,8 +134,5 @@ endif
144VPATH += $(TARGET_DIR) 134VPATH += $(TARGET_DIR)
145VPATH += $(TOP_DIR) 135VPATH += $(TOP_DIR)
146 136
147include $(TOP_DIR)/protocol/lufa.mk 137include $(TOP_DIR)/quantum.mk
148
149include $(TOP_DIR)/common.mk
150include $(TOP_DIR)/rules.mk
151 138
diff --git a/keyboard/planck/Makefile.pjrc b/keyboard/planck/Makefile.pjrc
deleted file mode 100644
index be83ba18b..000000000
--- a/keyboard/planck/Makefile.pjrc
+++ /dev/null
@@ -1,116 +0,0 @@
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 = gh60_pjrc
43
44# Directory common source filess exist
45TOP_DIR = ../..
46
47# Directory keyboard dependent files exist
48TARGET_DIR = .
49
50# project specific files
51SRC = keymap_common.c \
52 matrix.c \
53 led.c
54
55ifdef KEYMAP
56 SRC := keymap_$(KEYMAP).c $(SRC)
57else
58 SRC := keymap_jack.c $(SRC)
59endif
60
61CONFIG_H = config.h
62
63
64# MCU name, you MUST set this to match the board you are using
65# type "make clean" after changing this, so all files will be rebuilt
66MCU = atmega32u4
67#MCU = at90usb1286
68
69
70# Processor frequency.
71# Normally the first thing your program should do is set the clock prescaler,
72# so your program will run at the correct speed. You should also set this
73# variable to same clock speed. The _delay_ms() macro uses this, and many
74# examples use this variable to calculate timings. Do not add a "UL" here.
75F_CPU = 16000000
76
77
78# Boot Section Size in *bytes*
79# Teensy halfKay 512
80# Atmel DFU loader 4096
81# LUFA bootloader 4096
82OPT_DEFS += -DBOOTLOADER_SIZE=4096
83
84
85# Build Options
86# comment out to disable the options.
87#
88BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
89MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
90EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
91CONSOLE_ENABLE = yes # Console for debug
92COMMAND_ENABLE = yes # Commands for debug and configuration
93SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
94NKRO_ENABLE = yes # USB Nkey Rollover(+500)
95#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
96
97
98# Search Path
99VPATH += $(TARGET_DIR)
100VPATH += $(TOP_DIR)
101
102include $(TOP_DIR)/protocol/pjrc.mk
103include $(TOP_DIR)/common.mk
104include $(TOP_DIR)/rules.mk
105
106plain: OPT_DEFS += -DKEYMAP_PLAIN
107plain: all
108
109poker: OPT_DEFS += -DKEYMAP_POKER
110poker: all
111
112poker_set: OPT_DEFS += -DKEYMAP_POKER_SET
113poker_set: all
114
115poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT
116poker_bit: all
diff --git a/keyboard/planck/keymaps/keymap_default.c b/keyboard/planck/keymaps/keymap_default.c
index 3670be338..edfc21d0a 100644
--- a/keyboard/planck/keymaps/keymap_default.c
+++ b/keyboard/planck/keymaps/keymap_default.c
@@ -1,6 +1,5 @@
1#include "keymap_common.h" 1#include "planck.h"
2#include "backlight.h" 2#include "backlight.h"
3#include "debug.h"
4 3
5#define QWERTY_LAYER 0 4#define QWERTY_LAYER 0
6#define COLEMAK_LAYER 1 5#define COLEMAK_LAYER 1
diff --git a/keyboard/planck/matrix_steno.c b/keyboard/planck/matrix_steno.c
deleted file mode 100644
index 98ef55ed6..000000000
--- a/keyboard/planck/matrix_steno.c
+++ /dev/null
@@ -1,234 +0,0 @@
1/*
2Copyright 2012 Jun Wako
3Generated by planckkeyboard.com (2014 Jack Humbert)
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/*
20 * scan matrix
21 */
22#include <stdint.h>
23#include <stdbool.h>
24#include <avr/io.h>
25#include <util/delay.h>
26#include "print.h"
27#include "debug.h"
28#include "util.h"
29#include "matrix.h"
30
31#ifndef DEBOUNCE
32# define DEBOUNCE 10
33#endif
34static uint8_t debouncing = DEBOUNCE;
35
36/* matrix state(1:on, 0:off) */
37static matrix_row_t matrix[MATRIX_ROWS];
38static matrix_row_t matrix_debouncing[MATRIX_ROWS];
39
40static matrix_row_t read_cols(void);
41static void init_cols(void);
42static void unselect_rows(void);
43static void select_row(uint8_t row);
44
45inline
46uint8_t matrix_rows(void)
47{
48 return MATRIX_ROWS;
49}
50
51inline
52uint8_t matrix_cols(void)
53{
54 return MATRIX_COLS;
55}
56
57void matrix_init(void)
58{
59 // To use PORTF disable JTAG with writing JTD bit twice within four cycles.
60 MCUCR |= (1<<JTD);
61 MCUCR |= (1<<JTD);
62
63 backlight_init_ports();
64
65 // Turn status LED on
66 DDRE |= (1<<6);
67 PORTE |= (1<<6);
68
69 // initialize row and col
70 unselect_rows();
71 init_cols();
72
73 // initialize matrix state: all keys off
74 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
75 matrix[i] = 0;
76 matrix_debouncing[i] = 0;
77 }
78}
79
80
81uint8_t matrix_scan(void)
82{
83 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
84 select_row(i);
85 _delay_us(30); // without this wait read unstable value.
86 matrix_row_t cols = read_cols();
87 if (matrix_debouncing[i] != cols) {
88 matrix_debouncing[i] = cols;
89 if (debouncing) {
90 debug("bounce!: "); debug_hex(debouncing); debug("\n");
91 }
92 debouncing = DEBOUNCE;
93 }
94 unselect_rows();
95 }
96
97 if (debouncing) {
98 if (--debouncing) {
99 _delay_ms(1);
100 } else {
101 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
102 matrix[i] = matrix_debouncing[i];
103 }
104 }
105 }
106
107 return 1;
108}
109
110bool matrix_is_modified(void)
111{
112 if (debouncing) return false;
113 return true;
114}
115
116inline
117bool matrix_is_on(uint8_t row, uint8_t col)
118{
119 return (matrix[row] & ((matrix_row_t)1<col));
120}
121
122inline
123matrix_row_t matrix_get_row(uint8_t row)
124{
125 return matrix[row];
126}
127
128void matrix_print(void)
129{
130 print("\nr/c 0123456789ABCDEF\n");
131 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
132 phex(row); print(": ");
133 pbin_reverse16(matrix_get_row(row));
134 print("\n");
135 }
136}
137
138uint8_t matrix_key_count(void)
139{
140 uint8_t count = 0;
141 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
142 count += bitpop16(matrix[i]);
143 }
144 return count;
145}
146
147static void init_cols(void)
148{
149 int B = 0, C = 0, D = 0, E = 0, F = 0;
150 for(int x = 0; x < MATRIX_COLS; x++) {
151 int col = COLS[x];
152 if ((col & 0xF0) == 0x20) {
153 B |= (1<<(col & 0x0F));
154 } else if ((col & 0xF0) == 0x30) {
155 C |= (1<<(col & 0x0F));
156 } else if ((col & 0xF0) == 0x40) {
157 D |= (1<<(col & 0x0F));
158 } else if ((col & 0xF0) == 0x50) {
159 E |= (1<<(col & 0x0F));
160 } else if ((col & 0xF0) == 0x60) {
161 F |= (1<<(col & 0x0F));
162 }
163 }
164 DDRB &= ~(B); PORTB |= (B);
165 DDRC &= ~(C); PORTC |= (C);
166 DDRD &= ~(D); PORTD |= (D);
167 DDRE &= ~(E); PORTE |= (E);
168 DDRF &= ~(F); PORTF |= (F);
169}
170
171static matrix_row_t read_cols(void)
172{
173 matrix_row_t result = 0;
174 for(int x = 0; x < MATRIX_COLS; x++) {
175 int col = COLS[x];
176 if ((col & 0xF0) == 0x20) {
177 result |= (PINB&(1<<(col & 0x0F)) ? 0 : (1<<x));
178 } else if ((col & 0xF0) == 0x30) {
179 result |= (PINC&(1<<(col & 0x0F)) ? 0 : (1<<x));
180 } else if ((col & 0xF0) == 0x40) {
181 result |= (PIND&(1<<(col & 0x0F)) ? 0 : (1<<x));
182 } else if ((col & 0xF0) == 0x50) {
183 result |= (PINE&(1<<(col & 0x0F)) ? 0 : (1<<x));
184 } else if ((col & 0xF0) == 0x60) {
185 result |= (PINF&(1<<(col & 0x0F)) ? 0 : (1<<x));
186 }
187 }
188 return result;
189}
190
191static void unselect_rows(void)
192{
193 int B = 0, C = 0, D = 0, E = 0, F = 0;
194 for(int x = 0; x < MATRIX_ROWS; x++) {
195 int row = ROWS[x];
196 if ((row & 0xF0) == 0x20) {
197 B |= (1<<(row & 0x0F));
198 } else if ((row & 0xF0) == 0x30) {
199 C |= (1<<(row & 0x0F));
200 } else if ((row & 0xF0) == 0x40) {
201 D |= (1<<(row & 0x0F));
202 } else if ((row & 0xF0) == 0x50) {
203 E |= (1<<(row & 0x0F));
204 } else if ((row & 0xF0) == 0x60) {
205 F |= (1<<(row & 0x0F));
206 }
207 }
208 DDRB &= ~(B); PORTB |= (B);
209 DDRC &= ~(C); PORTC |= (C);
210 DDRD &= ~(D); PORTD |= (D);
211 DDRE &= ~(E); PORTE |= (E);
212 DDRF &= ~(F); PORTF |= (F);
213}
214
215static void select_row(uint8_t row)
216{
217 int row_pin = ROWS[row];
218 if ((row_pin & 0xF0) == 0x20) {
219 DDRB |= (1<<(row_pin & 0x0F));
220 PORTB &= ~(1<<(row_pin & 0x0F));
221 } else if ((row_pin & 0xF0) == 0x30) {
222 DDRC |= (1<<(row_pin & 0x0F));
223 PORTC &= ~(1<<(row_pin & 0x0F));
224 } else if ((row_pin & 0xF0) == 0x40) {
225 DDRD |= (1<<(row_pin & 0x0F));
226 PORTD &= ~(1<<(row_pin & 0x0F));
227 } else if ((row_pin & 0xF0) == 0x50) {
228 DDRE |= (1<<(row_pin & 0x0F));
229 PORTE &= ~(1<<(row_pin & 0x0F));
230 } else if ((row_pin & 0xF0) == 0x60) {
231 DDRF |= (1<<(row_pin & 0x0F));
232 PORTF &= ~(1<<(row_pin & 0x0F));
233 }
234} \ No newline at end of file
diff --git a/keyboard/planck/planck.c b/keyboard/planck/planck.c
new file mode 100644
index 000000000..9809a824c
--- /dev/null
+++ b/keyboard/planck/planck.c
@@ -0,0 +1,29 @@
1#include "planck.h"
2
3void * matrix_init_user(void) {
4
5};
6
7void * matrix_scan_user(void) {
8
9};
10
11void *matrix_init_kb(void) {
12 #ifdef BACKLIGHT_ENABLE
13 backlight_init_ports();
14 #endif
15
16 // Turn status LED on
17 DDRE |= (1<<6);
18 PORTE |= (1<<6);
19
20 if (matrix_init_user) {
21 (*matrix_init_user)();
22 }
23};
24
25void *matrix_scan_kb(void) {
26 if (matrix_scan_user) {
27 (*matrix_scan_user)();
28 }
29}; \ No newline at end of file
diff --git a/keyboard/planck/planck.h b/keyboard/planck/planck.h
new file mode 100644
index 000000000..4e59aef56
--- /dev/null
+++ b/keyboard/planck/planck.h
@@ -0,0 +1,38 @@
1#ifndef PLANCK_H
2#define PLANCK_H
3
4#include "matrix.h"
5#include "keymap_common.h"
6#include "backlight.h"
7#include <stddef.h>
8
9#define PLANCK_MIT( \
10 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
11 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
12 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
13 k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \
14) \
15{ \
16 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
17 { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
18 { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
19 { k30, k31, k32, k33, k34, k35, k35, k37, k38, k39, k3a, k3b } \
20}
21
22#define PLANCK_GRID( \
23 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
24 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
25 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
26 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \
27) \
28{ \
29 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
30 { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
31 { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
32 { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b } \
33}
34
35void * matrix_init_user(void);
36void * matrix_scan_user(void);
37
38#endif \ No newline at end of file
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c
index c9504483a..d310d4b80 100644
--- a/protocol/lufa/lufa.c
+++ b/protocol/lufa/lufa.c
@@ -908,13 +908,16 @@ int main(void)
908 908
909 print("Keyboard start.\n"); 909 print("Keyboard start.\n");
910 while (1) { 910 while (1) {
911 // while (USB_DeviceState == DEVICE_STATE_Suspended) { 911
912 // print("[s]"); 912#ifndef BLUETOOTH_ENABLE
913 // suspend_power_down(); 913 while (USB_DeviceState == DEVICE_STATE_Suspended) {
914 // if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { 914 print("[s]");
915 // USB_Device_SendRemoteWakeup(); 915 suspend_power_down();
916 // } 916 if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) {
917 // } 917 USB_Device_SendRemoteWakeup();
918 }
919 }
920#endif
918 921
919#ifdef MIDI_ENABLE 922#ifdef MIDI_ENABLE
920 midi_device_process(&midi_device); 923 midi_device_process(&midi_device);
diff --git a/quantum.mk b/quantum.mk
new file mode 100644
index 000000000..163728404
--- /dev/null
+++ b/quantum.mk
@@ -0,0 +1,69 @@
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
41QUANTUM_DIR = $(TOP_DIR)/quantum
42
43# # project specific files
44SRC += $(QUANTUM_DIR)/keymap_common.c \
45 $(QUANTUM_DIR)/matrix.c \
46 $(QUANTUM_DIR)/led.c
47
48ifdef MIDI_ENABLE
49 SRC += $(QUANTUM_DIR)/keymap_midi.c \
50 $(QUANTUM_DIR)/beeps.c
51endif
52
53ifdef UNICODE_ENABLE
54 SRC += $(QUANTUM_DIR)/keymap_unicode.c
55endif
56
57# Optimize size but this may cause error "relocation truncated to fit"
58#EXTRALDFLAGS = -Wl,--relax
59
60# Search Path
61VPATH += $(TARGET_DIR)
62VPATH += $(TOP_DIR)
63VPATH += $(QUANTUM_DIR)
64
65include $(TOP_DIR)/protocol/lufa.mk
66
67include $(TOP_DIR)/common.mk
68include $(TOP_DIR)/rules.mk
69
diff --git a/keyboard/planck/analog.c b/quantum/analog.c
index 49b84ee0e..49b84ee0e 100644
--- a/keyboard/planck/analog.c
+++ b/quantum/analog.c
diff --git a/keyboard/planck/analog.h b/quantum/analog.h
index 9b95a93be..9b95a93be 100644
--- a/keyboard/planck/analog.h
+++ b/quantum/analog.h
diff --git a/keyboard/planck/beeps.c b/quantum/beeps.c
index 8d1f81f21..8d1f81f21 100644
--- a/keyboard/planck/beeps.c
+++ b/quantum/beeps.c
diff --git a/keyboard/planck/beeps.h b/quantum/beeps.h
index 378983c60..378983c60 100644
--- a/keyboard/planck/beeps.h
+++ b/quantum/beeps.h
diff --git a/keyboard/planck/keymap_common.c b/quantum/keymap_common.c
index 93e91c792..66cf2883c 100644
--- a/keyboard/planck/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -73,6 +73,12 @@ action_t action_for_key(uint8_t layer, keypos_t key)
73 print("\nDEBUG: enabled.\n"); 73 print("\nDEBUG: enabled.\n");
74 debug_enable = true; 74 debug_enable = true;
75 return; 75 return;
76 } else if (keycode >= 0x5000 && keycode < 0x6000) {
77 int when = (keycode >> 0x9) & 0x3;
78 int layer = keycode & 0xFF;
79 action_t action;
80 action.code = ACTION_LAYER_SET(layer, when);
81 return action;
76 } else if (keycode >= 0x6000 && keycode < 0x7000) { 82 } else if (keycode >= 0x6000 && keycode < 0x7000) {
77 action_t action; 83 action_t action;
78 action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8); 84 action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
diff --git a/keyboard/planck/keymap_common.h b/quantum/keymap_common.h
index 21908a2be..091f7d8f3 100644
--- a/keyboard/planck/keymap_common.h
+++ b/quantum/keymap_common.h
@@ -108,8 +108,14 @@ extern const uint16_t fn_actions[];
108#define RESET 0x5000 108#define RESET 0x5000
109#define DEBUG 0x5001 109#define DEBUG 0x5001
110 110
111// ON_PRESS = 1
112// ON_RELEASE = 2
113// ON_BOTH = 3
114#define TO(layer, when) (layer | 0x5100 | (when << 0x9))
115
111#define MIDI(n) (n | 0x6000) 116#define MIDI(n) (n | 0x6000)
112 117
113#define UNI(n) (n | 0x8000) 118#define UNI(n) (n | 0x8000)
114 119
120
115#endif 121#endif
diff --git a/quantum/keymap_extras/keymap_colemak.h b/quantum/keymap_extras/keymap_colemak.h
new file mode 100644
index 000000000..c8066ea66
--- /dev/null
+++ b/quantum/keymap_extras/keymap_colemak.h
@@ -0,0 +1,74 @@
1#ifndef KEYMAP_COLEMAK_H
2#define KEYMAP_COLEMAK_H
3
4#include "keymap_common.h"
5// For software implementation of colemak
6#define CM_Q KC_Q
7#define CM_W KC_W
8#define CM_F KC_E
9#define CM_P KC_R
10#define CM_G KC_T
11#define CM_J KC_Y
12#define CM_L KC_U
13#define CM_U KC_I
14#define CM_Y KC_O
15#define CM_SCLN KC_P
16
17#define CM_A KC_A
18#define CM_R KC_S
19#define CM_S KC_D
20#define CM_T KC_F
21#define CM_D KC_G
22#define CM_H KC_H
23#define CM_N KC_J
24#define CM_E KC_K
25#define CM_I KC_L
26#define CM_O KC_SCLN
27
28#define CM_Z KC_Z
29#define CM_X KC_X
30#define CM_C KC_C
31#define CM_V KC_V
32#define CM_B KC_B
33#define CM_K KC_N
34#define CM_M KC_M
35#define CM_COMM KC_COMM
36#define CM_DOT KC_DOT
37#define CM_SLSH KC_SLSH
38
39// Make it easy to support these in macros
40// TODO: change macro implementation so these aren't needed
41#define KC_CM_Q CM_Q
42#define KC_CM_W CM_W
43#define KC_CM_F CM_F
44#define KC_CM_P CM_P
45#define KC_CM_G CM_G
46#define KC_CM_J CM_J
47#define KC_CM_L CM_L
48#define KC_CM_U CM_U
49#define KC_CM_Y CM_Y
50#define KC_CM_SCLN CM_SCLN
51
52#define KC_CM_A CM_A
53#define KC_CM_R CM_R
54#define KC_CM_S CM_S
55#define KC_CM_T CM_T
56#define KC_CM_D CM_D
57#define KC_CM_H CM_H
58#define KC_CM_N CM_N
59#define KC_CM_E CM_E
60#define KC_CM_I CM_I
61#define KC_CM_O CM_O
62
63#define KC_CM_Z CM_Z
64#define KC_CM_X CM_X
65#define KC_CM_C CM_C
66#define KC_CM_V CM_V
67#define KC_CM_B CM_B
68#define KC_CM_K CM_K
69#define KC_CM_M CM_M
70#define KC_CM_COMM CM_COMM
71#define KC_CM_DOT CM_DOT
72#define KC_CM_SLSH CM_SLSH
73
74#endif
diff --git a/quantum/keymap_extras/keymap_dvorak.h b/quantum/keymap_extras/keymap_dvorak.h
new file mode 100644
index 000000000..d172e0019
--- /dev/null
+++ b/quantum/keymap_extras/keymap_dvorak.h
@@ -0,0 +1,72 @@
1#ifndef KEYMAP_DVORAK_H
2#define KEYMAP_DVORAK_H
3
4#include "keymap_common.h"
5
6// Normal characters
7#define DV_GRV KC_GRV
8#define DV_1 KC_1
9#define DV_2 KC_2
10#define DV_3 KC_3
11#define DV_4 KC_4
12#define DV_5 KC_5
13#define DV_6 KC_6
14#define DV_7 KC_7
15#define DV_8 KC_8
16#define DV_9 KC_9
17#define DV_0 KC_0
18#define DV_LBRC KC_MINS
19#define DV_RBRC KC_EQL
20
21#define DV_QUOT KC_Q
22#define DV_COMM KC_W
23#define DV_DOT KC_E
24#define DV_P KC_R
25#define DV_Y KC_T
26#define DV_F KC_Y
27#define DV_G KC_U
28#define DV_C KC_I
29#define DV_R KC_O
30#define DV_L KC_P
31#define DV_SLSH KC_LBRC
32#define DV_EQL KC_RBRC
33
34#define DV_A KC_A
35#define DV_O KC_S
36#define DV_E KC_D
37#define DV_U KC_F
38#define DV_I KC_G
39#define DV_D KC_H
40#define DV_H KC_J
41#define DV_T KC_K
42#define DV_N KC_L
43#define DV_S KC_SCLN
44#define DV_MINS KC_QUOT
45
46#define DV_SCLN KC_Z
47#define DV_Q KC_X
48#define DV_J KC_C
49#define DV_K KC_V
50#define DV_X KC_B
51#define DV_B KC_N
52#define DV_M KC_M
53#define DV_W KC_COMM
54#define DV_V KC_DOT
55#define DV_Z KC_SLSH
56
57// Shifted characters
58#define DV_TILD LSFT(DV_GRV)
59#define DV_EXLM LSFT(DV_1)
60#define DV_AT LSFT(DV_2)
61#define DV_HASH LSFT(DV_3)
62#define DV_DLR LSFT(DV_4)
63#define DV_PERC LSFT(DV_5)
64#define DV_CIRC LSFT(DV_6)
65#define DV_AMPR LSFT(DV_7)
66#define DV_ASTR LSFT(DV_8)
67#define DV_LPRN LSFT(DV_9)
68#define DV_RPRN LSFT(DV_0)
69#define DV_LCBR LSFT(DV_LBRC)
70#define DV_RCBR LSFT(DV_RBRC)
71
72#endif \ No newline at end of file
diff --git a/keyboard/planck/keymap_french.h b/quantum/keymap_extras/keymap_french.h
index ccfaed8f0..ccfaed8f0 100644
--- a/keyboard/planck/keymap_french.h
+++ b/quantum/keymap_extras/keymap_french.h
diff --git a/keyboard/planck/keymap_nordic.h b/quantum/keymap_extras/keymap_nordic.h
index 02a704216..02a704216 100644
--- a/keyboard/planck/keymap_nordic.h
+++ b/quantum/keymap_extras/keymap_nordic.h
diff --git a/keyboard/planck/keymap_spanish.h b/quantum/keymap_extras/keymap_spanish.h
index 7f980afbc..7f980afbc 100644
--- a/keyboard/planck/keymap_spanish.h
+++ b/quantum/keymap_extras/keymap_spanish.h
diff --git a/quantum/keymap_extras/keymap_uk.h b/quantum/keymap_extras/keymap_uk.h
new file mode 100644
index 000000000..5b4bd3c0d
--- /dev/null
+++ b/quantum/keymap_extras/keymap_uk.h
@@ -0,0 +1,36 @@
1#ifndef KEYMAP_UK_H
2#define KEYMAP_UK_H
3
4#include "keymap_common.h"
5
6// Alt gr
7#define ALGR(kc) kc | 0x1400
8#define NO_ALGR KC_RALT
9
10// Normal characters
11#define UK_HASH KC_NUHS
12
13#define UK_BSLS KC_NUBS
14
15// Shifted characters
16#define UK_NOT LSFT(KC_GRV)
17#define UK_QUOT LSFT(KC_2)
18#define UK_PND LSFT(KC_3)
19
20#define UK_AT LSFT(KC_QUOT)
21#define UK_TILD LSFT(KC_NUHS)
22
23#define UK_PIPE LSFT(KC_NUBS)
24
25// Alt Gr-ed characters
26#define UK_BRKP ALGR(KC_GRV)
27#define UK_EURO ALGR(KC_4)
28
29#define UK_EACT ALGR(KC_E)
30#define UK_UACT ALGR(KC_U)
31#define UK_IACT ALGR(KC_I)
32#define UK_OACT ALGR(KC_O)
33
34#define UK_AACT ALGR(KC_A)
35
36#endif \ No newline at end of file
diff --git a/keyboard/planck/keymap_midi.c b/quantum/keymap_midi.c
index b7eba3ab7..b7eba3ab7 100644
--- a/keyboard/planck/keymap_midi.c
+++ b/quantum/keymap_midi.c
diff --git a/keyboard/planck/keymap_midi.h b/quantum/keymap_midi.h
index c5917f884..c5917f884 100644
--- a/keyboard/planck/keymap_midi.h
+++ b/quantum/keymap_midi.h
diff --git a/keyboard/planck/keymap_unicode.c b/quantum/keymap_unicode.c
index a9357edec..a9357edec 100644
--- a/keyboard/planck/keymap_unicode.c
+++ b/quantum/keymap_unicode.c
diff --git a/keyboard/planck/led.c b/quantum/led.c
index 2c0574660..2c0574660 100644
--- a/keyboard/planck/led.c
+++ b/quantum/led.c
diff --git a/keyboard/planck/matrix.c b/quantum/matrix.c
index 12a158543..97642a4a4 100644
--- a/keyboard/planck/matrix.c
+++ b/quantum/matrix.c
@@ -38,8 +38,8 @@ static matrix_row_t matrix[MATRIX_ROWS];
38static matrix_row_t matrix_debouncing[MATRIX_ROWS]; 38static matrix_row_t matrix_debouncing[MATRIX_ROWS];
39 39
40#if DIODE_DIRECTION == ROW2COL 40#if DIODE_DIRECTION == ROW2COL
41static matrix_row_t matrix_reversed[MATRIX_COLS]; 41 static matrix_row_t matrix_reversed[MATRIX_COLS];
42static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS]; 42 static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS];
43#endif 43#endif
44 44
45static matrix_row_t read_cols(void); 45static matrix_row_t read_cols(void);
@@ -65,13 +65,6 @@ void matrix_init(void)
65 MCUCR |= (1<<JTD); 65 MCUCR |= (1<<JTD);
66 MCUCR |= (1<<JTD); 66 MCUCR |= (1<<JTD);
67 67
68#ifdef BACKLIGHT_ENABLE
69 backlight_init_ports();
70#endif
71
72 // Turn status LED on
73 DDRE |= (1<<6);
74 PORTE |= (1<<6);
75 68
76 // initialize row and col 69 // initialize row and col
77 unselect_rows(); 70 unselect_rows();
@@ -82,11 +75,16 @@ void matrix_init(void)
82 matrix[i] = 0; 75 matrix[i] = 0;
83 matrix_debouncing[i] = 0; 76 matrix_debouncing[i] = 0;
84 } 77 }
78
79 if (matrix_init_kb) {
80 (*matrix_init_kb)();
81 }
85} 82}
86 83
87 84
88uint8_t matrix_scan(void) 85uint8_t matrix_scan(void)
89{ 86{
87
90#if DIODE_DIRECTION == COL2ROW 88#if DIODE_DIRECTION == COL2ROW
91 for (uint8_t i = 0; i < MATRIX_ROWS; i++) { 89 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
92 select_row(i); 90 select_row(i);
@@ -144,6 +142,10 @@ uint8_t matrix_scan(void)
144 } 142 }
145#endif 143#endif
146 144
145 if (matrix_scan_kb) {
146 (*matrix_scan_kb)();
147 }
148
147 return 1; 149 return 1;
148} 150}
149 151