summaryrefslogtreecommitdiff
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)
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 107ee72653..7c133f142a 100644
--- a/common/matrix.h
+++ b/common/matrix.h
@@ -61,6 +61,10 @@ void matrix_print(void);
void matrix_power_up(void);
void matrix_power_down(void);
+void *matrix_init_kb(void);
+void *matrix_scan_kb(void);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile
index 3ac4540e16..643646155f 100644
--- a/keyboard/planck/Makefile
+++ b/keyboard/planck/Makefile
@@ -39,7 +39,7 @@
#----------------------------------------------------------------------------
# Target file name (without extension).
-TARGET = planck_lufa
+TARGET = planck
# Directory common source filess exist
@@ -49,9 +49,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# # project specific files
-SRC = keymap_common.c \
- matrix.c \
- led.c \
+SRC = planck.c \
backlight.c
ifdef KEYMAP
@@ -128,14 +126,6 @@ MIDI_ENABLE = YES # MIDI controls
# UNICODE_ENABLE = YES # Unicode
BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
-ifdef MIDI_ENABLE
- SRC += keymap_midi.c \
- beeps.c
-endif
-
-ifdef UNICODE_ENABLE
- SRC += keymap_unicode.c
-endif
# Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax
@@ -144,8 +134,5 @@ endif
VPATH += $(TARGET_DIR)
VPATH += $(TOP_DIR)
-include $(TOP_DIR)/protocol/lufa.mk
-
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+include $(TOP_DIR)/quantum.mk
diff --git a/keyboard/planck/Makefile.pjrc b/keyboard/planck/Makefile.pjrc
deleted file mode 100644
index be83ba18b1..0000000000
--- a/keyboard/planck/Makefile.pjrc
+++ /dev/null
@@ -1,116 +0,0 @@
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make all = Make software.
-#
-# make clean = Clean out built project files.
-#
-# make coff = Convert ELF to AVR COFF.
-#
-# make extcoff = Convert ELF to AVR Extended COFF.
-#
-# make program = Download the hex file to the device.
-# Please customize your programmer settings(PROGRAM_CMD)
-#
-# make teensy = Download the hex file to the device, using teensy_loader_cli.
-# (must have teensy_loader_cli installed).
-#
-# make dfu = Download the hex file to the device, using dfu-programmer (must
-# have dfu-programmer installed).
-#
-# make flip = Download the hex file to the device, using Atmel FLIP (must
-# have Atmel FLIP installed).
-#
-# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
-# (must have dfu-programmer installed).
-#
-# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
-# (must have Atmel FLIP installed).
-#
-# make debug = Start either simulavr or avarice as specified for debugging,
-# with avr-gdb or avr-insight as the front end for debugging.
-#
-# make filename.s = Just compile filename.c into the assembler code only.
-#
-# make filename.i = Create a preprocessed source file for use in submitting
-# bug reports to the GCC project.
-#
-# To rebuild project do "make clean" then "make all".
-#----------------------------------------------------------------------------
-
-# Target file name (without extension).
-TARGET = gh60_pjrc
-
-# Directory common source filess exist
-TOP_DIR = ../..
-
-# Directory keyboard dependent files exist
-TARGET_DIR = .
-
-# project specific files
-SRC = keymap_common.c \
- matrix.c \
- led.c
-
-ifdef KEYMAP
- SRC := keymap_$(KEYMAP).c $(SRC)
-else
- SRC := keymap_jack.c $(SRC)
-endif
-
-CONFIG_H = config.h
-
-
-# MCU name, you MUST set this to match the board you are using
-# type "make clean" after changing this, so all files will be rebuilt
-MCU = atmega32u4
-#MCU = at90usb1286
-
-
-# Processor frequency.
-# Normally the first thing your program should do is set the clock prescaler,
-# so your program will run at the correct speed. You should also set this
-# variable to same clock speed. The _delay_ms() macro uses this, and many
-# examples use this variable to calculate timings. Do not add a "UL" here.
-F_CPU = 16000000
-
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
-
-# Build Options
-# comment out to disable the options.
-#
-BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
-EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
-CONSOLE_ENABLE = yes # Console for debug
-COMMAND_ENABLE = yes # Commands for debug and configuration
-SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
-NKRO_ENABLE = yes # USB Nkey Rollover(+500)
-#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
-
-
-# Search Path
-VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
-
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
-
-plain: OPT_DEFS += -DKEYMAP_PLAIN
-plain: all
-
-poker: OPT_DEFS += -DKEYMAP_POKER
-poker: all
-
-poker_set: OPT_DEFS += -DKEYMAP_POKER_SET
-poker_set: all
-
-poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT
-poker_bit: all
diff --git a/keyboard/planck/keymaps/keymap_default.c b/keyboard/planck/keymaps/keymap_default.c
index 3670be338f..edfc21d0ab 100644
--- a/keyboard/planck/keymaps/keymap_default.c
+++ b/keyboard/planck/keymaps/keymap_default.c
@@ -1,6 +1,5 @@
-#include "keymap_common.h"
+#include "planck.h"
#include "backlight.h"
-#include "debug.h"
#define QWERTY_LAYER 0
#define COLEMAK_LAYER 1
diff --git a/keyboard/planck/matrix_steno.c b/keyboard/planck/matrix_steno.c
deleted file mode 100644
index 98ef55ed68..0000000000
--- a/keyboard/planck/matrix_steno.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
-Copyright 2012 Jun Wako
-Generated by planckkeyboard.com (2014 Jack Humbert)
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
- * scan matrix
- */
-#include <stdint.h>
-#include <stdbool.h>
-#include <avr/io.h>
-#include <util/delay.h>
-#include "print.h"
-#include "debug.h"
-#include "util.h"
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 10
-#endif
-static uint8_t debouncing = DEBOUNCE;
-
-/* matrix state(1:on, 0:off) */
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-static matrix_row_t read_cols(void);
-static void init_cols(void);
-static void unselect_rows(void);
-static void select_row(uint8_t row);
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
-
-void matrix_init(void)
-{
- // To use PORTF disable JTAG with writing JTD bit twice within four cycles.
- MCUCR |= (1<<JTD);
- MCUCR |= (1<<JTD);
-
- backlight_init_ports();
-
- // Turn status LED on
- DDRE |= (1<<6);
- PORTE |= (1<<6);
-
- // initialize row and col
- unselect_rows();
- init_cols();
-
- // initialize matrix state: all keys off
- for (uint8_t i=0; i < MATRIX_ROWS; i++) {
- matrix[i] = 0;
- matrix_debouncing[i] = 0;
- }
-}
-
-
-uint8_t matrix_scan(void)
-{
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- select_row(i);
- _delay_us(30); // without this wait read unstable value.
- matrix_row_t cols = read_cols();
- if (matrix_debouncing[i] != cols) {
- matrix_debouncing[i] = cols;
- if (debouncing) {
- debug("bounce!: "); debug_hex(debouncing); debug("\n");
- }
- debouncing = DEBOUNCE;
- }
- unselect_rows();
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- return 1;
-}
-
-bool matrix_is_modified(void)
-{
- if (debouncing) return false;
- return true;
-}
-
-inline
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & ((matrix_row_t)1<col));
-}
-
-inline
-matrix_row_t matrix_get_row(uint8_t row)
-{
- return matrix[row];
-}
-
-void matrix_print(void)
-{
- print("\nr/c 0123456789ABCDEF\n");
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- phex(row); print(": ");
- pbin_reverse16(matrix_get_row(row));
- print("\n");
- }
-}
-
-uint8_t matrix_key_count(void)
-{
- uint8_t count = 0;
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- count += bitpop16(matrix[i]);
- }
- return count;
-}
-
-static void init_cols(void)
-{
- int B = 0, C = 0, D = 0, E = 0, F = 0;
- for(int x = 0; x < MATRIX_COLS; x++) {
- int col = COLS[x];
- if ((col & 0xF0) == 0x20) {
- B |= (1<<(col & 0x0F));
- } else if ((col & 0xF0) == 0x30) {
- C |= (1<<(col & 0x0F));
- } else if ((col & 0xF0) == 0x40) {
- D |= (1<<(col & 0x0F));
- } else if ((col & 0xF0) == 0x50) {
- E |= (1<<(col & 0x0F));
- } else if ((col & 0xF0) == 0x60) {
- F |= (1<<(col & 0x0F));
- }
- }
- DDRB &= ~(B); PORTB |= (B);
- DDRC &= ~(C); PORTC |= (C);
- DDRD &= ~(D); PORTD |= (D);
- DDRE &= ~(E); PORTE |= (E);
- DDRF &= ~(F); PORTF |= (F);
-}
-
-static matrix_row_t read_cols(void)
-{
- matrix_row_t result = 0;
- for(int x = 0; x < MATRIX_COLS; x++) {
- int col = COLS[x];
- if ((col & 0xF0) == 0x20) {
- result |= (PINB&(1<<(col & 0x0F)) ? 0 : (1<<x));
- } else if ((col & 0xF0) == 0x30) {
- result |= (PINC&(1<<(col & 0x0F)) ? 0 : (1<<x));
- } else if ((col & 0xF0) == 0x40) {
- result |= (PIND&(1<<(col & 0x0F)) ? 0 : (1<<x));
- } else if ((col & 0xF0) == 0x50) {
- result |= (PINE&(1<<(col & 0x0F)) ? 0 : (1<<x));
- } else if ((col & 0xF0) == 0x60) {
- result |= (PINF&(1<<(col & 0x0F)) ? 0 : (1<<x));
- }
- }
- return result;
-}
-
-static void unselect_rows(void)
-{
- int B = 0, C = 0, D = 0, E = 0, F = 0;
- for(int x = 0; x < MATRIX_ROWS; x++) {
- int row = ROWS[x];
- if ((row & 0xF0) == 0x20) {
- B |= (1<<(row & 0x0F));
- } else if ((row & 0xF0) == 0x30) {
- C |= (1<<(row & 0x0F));
- } else if ((row & 0xF0) == 0x40) {
- D |= (1<<(row & 0x0F));
- } else if ((row & 0xF0) == 0x50) {
- E |= (1<<(row & 0x0F));
- } else if ((row & 0xF0) == 0x60) {
- F |= (1<<(row & 0x0F));
- }
- }
- DDRB &= ~(B); PORTB |= (B);
- DDRC &= ~(C); PORTC |= (C);
- DDRD &= ~(D); PORTD |= (D);
- DDRE &= ~(E); PORTE |= (E);
- DDRF &= ~(F); PORTF |= (F);
-}
-
-static void select_row(uint8_t row)
-{
- int row_pin = ROWS[row];
- if ((row_pin & 0xF0) == 0x20) {
- DDRB |= (1<<(row_pin & 0x0F));
- PORTB &= ~(1<<(row_pin & 0x0F));
- } else if ((row_pin & 0xF0) == 0x30) {
- DDRC |= (1<<(row_pin & 0x0F));
- PORTC &= ~(1<<(row_pin & 0x0F));
- } else if ((row_pin & 0xF0) == 0x40) {
- DDRD |= (1<<(row_pin & 0x0F));
- PORTD &= ~(1<<(row_pin & 0x0F));
- } else if ((row_pin & 0xF0) == 0x50) {
- DDRE |= (1<<(row_pin & 0x0F));
- PORTE &= ~(1<<(row_pin & 0x0F));
- } else if ((row_pin & 0xF0) == 0x60) {
- DDRF |= (1<<(row_pin & 0x0F));
- PORTF &= ~(1<<(row_pin & 0x0F));
- }
-} \ No newline at end of file
diff --git a/keyboard/planck/planck.c b/keyboard/planck/planck.c
new file mode 100644
index 0000000000..9809a824cb
--- /dev/null
+++ b/keyboard/planck/planck.c
@@ -0,0 +1,29 @@
+#include "planck.h"
+
+void * matrix_init_user(void) {
+
+};
+
+void * matrix_scan_user(void) {
+
+};
+
+void *matrix_init_kb(void) {
+ #ifdef BACKLIGHT_ENABLE
+ backlight_init_ports();
+ #endif
+
+ // Turn status LED on
+ DDRE |= (1<<6);
+ PORTE |= (1<<6);
+
+ if (matrix_init_user) {
+ (*matrix_init_user)();
+ }
+};
+
+void *matrix_scan_kb(void) {
+ if (matrix_scan_user) {
+ (*matrix_scan_user)();
+ }
+}; \ No newline at end of file
diff --git a/keyboard/planck/planck.h b/keyboard/planck/planck.h
new file mode 100644
index 0000000000..4e59aef566
--- /dev/null
+++ b/keyboard/planck/planck.h
@@ -0,0 +1,38 @@
+#ifndef PLANCK_H
+#define PLANCK_H
+
+#include "matrix.h"
+#include "keymap_common.h"
+#include "backlight.h"
+#include <stddef.h>
+
+#define PLANCK_MIT( \
+ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+ k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \
+) \
+{ \
+ { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
+ { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
+ { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
+ { k30, k31, k32, k33, k34, k35, k35, k37, k38, k39, k3a, k3b } \
+}
+
+#define PLANCK_GRID( \
+ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
+ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
+ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
+ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \
+) \
+{ \
+ { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
+ { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
+ { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
+ { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b } \
+}
+
+void * matrix_init_user(void);
+void * matrix_scan_user(void);
+
+#endif \ No newline at end of file
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c
index c9504483af..d310d4b807 100644
--- a/protocol/lufa/lufa.c
+++ b/protocol/lufa/lufa.c
@@ -908,13 +908,16 @@ int main(void)
print("Keyboard start.\n");
while (1) {
- // while (USB_DeviceState == DEVICE_STATE_Suspended) {
- // print("[s]");
- // suspend_power_down();
- // if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) {
- // USB_Device_SendRemoteWakeup();
- // }
- // }
+
+#ifndef BLUETOOTH_ENABLE
+ while (USB_DeviceState == DEVICE_STATE_Suspended) {
+ print("[s]");
+ suspend_power_down();
+ if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) {
+ USB_Device_SendRemoteWakeup();
+ }
+ }
+#endif
#ifdef MIDI_ENABLE
midi_device_process(&midi_device);
diff --git a/quantum.mk b/quantum.mk
new file mode 100644
index 0000000000..1637284047
--- /dev/null
+++ b/quantum.mk
@@ -0,0 +1,69 @@
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device.
+# Please customize your programmer settings(PROGRAM_CMD)
+#
+# make teensy = Download the hex file to the device, using teensy_loader_cli.
+# (must have teensy_loader_cli installed).
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+QUANTUM_DIR = $(TOP_DIR)/quantum
+
+# # project specific files
+SRC += $(QUANTUM_DIR)/keymap_common.c \
+ $(QUANTUM_DIR)/matrix.c \
+ $(QUANTUM_DIR)/led.c
+
+ifdef MIDI_ENABLE
+ SRC += $(QUANTUM_DIR)/keymap_midi.c \
+ $(QUANTUM_DIR)/beeps.c
+endif
+
+ifdef UNICODE_ENABLE
+ SRC += $(QUANTUM_DIR)/keymap_unicode.c
+endif
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+VPATH += $(QUANTUM_DIR)
+
+include $(TOP_DIR)/protocol/lufa.mk
+
+include $(TOP_DIR)/common.mk
+include $(TOP_DIR)/rules.mk
+
diff --git a/keyboard/planck/analog.c b/quantum/analog.c
index 49b84ee0e8..49b84ee0e8 100644
--- a/keyboard/planck/analog.c
+++ b/quantum/analog.c
diff --git a/keyboard/planck/analog.h b/quantum/analog.h
index 9b95a93bef..9b95a93bef 100644
--- a/keyboard/planck/analog.h
+++ b/quantum/analog.h
diff --git a/keyboard/planck/beeps.c b/quantum/beeps.c
index 8d1f81f210..8d1f81f210 100644
--- a/keyboard/planck/beeps.c
+++ b/quantum/beeps.c
diff --git a/keyboard/planck/beeps.h b/quantum/beeps.h
index 378983c605..378983c605 100644
--- a/keyboard/planck/beeps.h
+++ b/quantum/beeps.h
diff --git a/keyboard/planck/keymap_common.c b/quantum/keymap_common.c
index 93e91c792b..66cf2883c7 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)
print("\nDEBUG: enabled.\n");
debug_enable = true;
return;
+ } else if (keycode >= 0x5000 && keycode < 0x6000) {
+ int when = (keycode >> 0x9) & 0x3;
+ int layer = keycode & 0xFF;
+ action_t action;
+ action.code = ACTION_LAYER_SET(layer, when);
+ return action;
} else if (keycode >= 0x6000 && keycode < 0x7000) {
action_t action;
action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
diff --git a/keyboard/planck/keymap_common.h b/quantum/keymap_common.h
index 21908a2be3..091f7d8f3e 100644
--- a/keyboard/planck/keymap_common.h
+++ b/quantum/keymap_common.h
@@ -108,8 +108,14 @@ extern const uint16_t fn_actions[];
#define RESET 0x5000
#define DEBUG 0x5001
+// ON_PRESS = 1
+// ON_RELEASE = 2
+// ON_BOTH = 3
+#define TO(layer, when) (layer | 0x5100 | (when << 0x9))
+
#define MIDI(n) (n | 0x6000)
#define UNI(n) (n | 0x8000)
+
#endif
diff --git a/quantum/keymap_extras/keymap_colemak.h b/quantum/keymap_extras/keymap_colemak.h
new file mode 100644
index 0000000000..c8066ea666
--- /dev/null
+++ b/quantum/keymap_extras/keymap_colemak.h
@@ -0,0 +1,74 @@
+#ifndef KEYMAP_COLEMAK_H
+#define KEYMAP_COLEMAK_H
+
+#include "keymap_common.h"
+// For software implementation of colemak
+#define CM_Q KC_Q
+#define CM_W KC_W
+#define CM_F KC_E
+#define CM_P KC_R
+#define CM_G KC_T
+#define CM_J KC_Y
+#define CM_L KC_U
+#define CM_U KC_I
+#define CM_Y KC_O
+#define CM_SCLN KC_P
+
+#define CM_A KC_A
+#define CM_R KC_S
+#define CM_S KC_D
+#define CM_T KC_F
+#define CM_D KC_G
+#define CM_H KC_H
+#define CM_N KC_J
+#define CM_E KC_K
+#define CM_I KC_L
+#define CM_O KC_SCLN
+
+#define CM_Z KC_Z
+#define CM_X KC_X
+#define CM_C KC_C
+#define CM_V KC_V
+#define CM_B KC_B
+#define CM_K KC_N
+#define CM_M KC_M
+#define CM_COMM KC_COMM
+#define CM_DOT KC_DOT
+#define CM_SLSH KC_SLSH
+
+// Make it easy to support these in macros
+// TODO: change macro implementation so these aren't needed
+#define KC_CM_Q CM_Q
+#define KC_CM_W CM_W
+#define KC_CM_F CM_F
+#define KC_CM_P CM_P
+#define KC_CM_G CM_G
+#define KC_CM_J CM_J
+#define KC_CM_L CM_L
+#define KC_CM_U CM_U
+#define KC_CM_Y CM_Y
+#define KC_CM_SCLN CM_SCLN
+
+#define KC_CM_A CM_A
+#define KC_CM_R CM_R
+#define KC_CM_S CM_S
+#define KC_CM_T CM_T
+#define KC_CM_D CM_D
+#define KC_CM_H CM_H
+#define KC_CM_N CM_N
+#define KC_CM_E CM_E
+#define KC_CM_I CM_I
+#define KC_CM_O CM_O
+
+#define KC_CM_Z CM_Z
+#define KC_CM_X CM_X
+#define KC_CM_C CM_C
+#define KC_CM_V CM_V
+#define KC_CM_B CM_B
+#define KC_CM_K CM_K
+#define KC_CM_M CM_M
+#define KC_CM_COMM CM_COMM
+#define KC_CM_DOT CM_DOT
+#define KC_CM_SLSH CM_SLSH
+
+#endif
diff --git a/quantum/keymap_extras/keymap_dvorak.h b/quantum/keymap_extras/keymap_dvorak.h
new file mode 100644
index 0000000000..d172e0019b
--- /dev/null
+++ b/quantum/keymap_extras/keymap_dvorak.h
@@ -0,0 +1,72 @@
+#ifndef KEYMAP_DVORAK_H
+#define KEYMAP_DVORAK_H
+
+#include "keymap_common.h"
+
+// Normal characters
+#define DV_GRV KC_GRV
+#define DV_1 KC_1
+#define DV_2 KC_2
+#define DV_3 KC_3
+#define DV_4 KC_4
+#define DV_5 KC_5
+#define DV_6 KC_6
+#define DV_7 KC_7
+#define DV_8 KC_8
+#define DV_9 KC_9
+#define DV_0 KC_0
+#define DV_LBRC KC_MINS
+#define DV_RBRC KC_EQL
+
+#define DV_QUOT KC_Q
+#define DV_COMM KC_W
+#define DV_DOT KC_E
+#define DV_P KC_R
+#define DV_Y KC_T
+#define DV_F KC_Y
+#define DV_G KC_U
+#define DV_C KC_I
+#define DV_R KC_O
+#define DV_L KC_P
+#define DV_SLSH KC_LBRC
+#define DV_EQL KC_RBRC
+
+#define DV_A KC_A
+#define DV_O KC_S
+#define DV_E KC_D
+#define DV_U KC_F
+#define DV_I KC_G
+#define DV_D KC_H
+#define DV_H KC_J
+#define DV_T KC_K
+#define DV_N KC_L
+#define DV_S KC_SCLN
+#define DV_MINS KC_QUOT
+
+#define DV_SCLN KC_Z
+#define DV_Q KC_X
+#define DV_J KC_C
+#define DV_K KC_V
+#define DV_X KC_B
+#define DV_B KC_N
+#define DV_M KC_M
+#define DV_W KC_COMM
+#define DV_V KC_DOT
+#define DV_Z KC_SLSH
+
+// Shifted characters
+#define DV_TILD LSFT(DV_GRV)
+#define DV_EXLM LSFT(DV_1)
+#define DV_AT LSFT(DV_2)
+#define DV_HASH LSFT(DV_3)
+#define DV_DLR LSFT(DV_4)
+#define DV_PERC LSFT(DV_5)
+#define DV_CIRC LSFT(DV_6)
+#define DV_AMPR LSFT(DV_7)
+#define DV_ASTR LSFT(DV_8)
+#define DV_LPRN LSFT(DV_9)
+#define DV_RPRN LSFT(DV_0)
+#define DV_LCBR LSFT(DV_LBRC)
+#define DV_RCBR LSFT(DV_RBRC)
+
+#endif \ No newline at end of file
diff --git a/keyboard/planck/keymap_french.h b/quantum/keymap_extras/keymap_french.h
index ccfaed8f07..ccfaed8f07 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 02a704216a..02a704216a 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 7f980afbcf..7f980afbcf 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 0000000000..5b4bd3c0d4
--- /dev/null
+++ b/quantum/keymap_extras/keymap_uk.h
@@ -0,0 +1,36 @@
+#ifndef KEYMAP_UK_H
+#define KEYMAP_UK_H
+
+#include "keymap_common.h"
+
+// Alt gr
+#define ALGR(kc) kc | 0x1400
+#define NO_ALGR KC_RALT
+
+// Normal characters
+#define UK_HASH KC_NUHS
+
+#define UK_BSLS KC_NUBS
+
+// Shifted characters
+#define UK_NOT LSFT(KC_GRV)
+#define UK_QUOT LSFT(KC_2)
+#define UK_PND LSFT(KC_3)
+
+#define UK_AT LSFT(KC_QUOT)
+#define UK_TILD LSFT(KC_NUHS)
+
+#define UK_PIPE LSFT(KC_NUBS)
+
+// Alt Gr-ed characters
+#define UK_BRKP ALGR(KC_GRV)
+#define UK_EURO ALGR(KC_4)
+
+#define UK_EACT ALGR(KC_E)
+#define UK_UACT ALGR(KC_U)
+#define UK_IACT ALGR(KC_I)
+#define UK_OACT ALGR(KC_O)
+
+#define UK_AACT ALGR(KC_A)
+
+#endif \ No newline at end of file
diff --git a/keyboard/planck/keymap_midi.c b/quantum/keymap_midi.c
index b7eba3ab76..b7eba3ab76 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 c5917f884e..c5917f884e 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 a9357edec7..a9357edec7 100644
--- a/keyboard/planck/keymap_unicode.c
+++ b/quantum/keymap_unicode.c
diff --git a/keyboard/planck/led.c b/quantum/led.c
index 2c05746607..2c05746607 100644
--- a/keyboard/planck/led.c
+++ b/quantum/led.c
diff --git a/keyboard/planck/matrix.c b/quantum/matrix.c
index 12a1585436..97642a4a4e 100644
--- a/keyboard/planck/matrix.c
+++ b/quantum/matrix.c
@@ -38,8 +38,8 @@ static matrix_row_t matrix[MATRIX_ROWS];
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
#if DIODE_DIRECTION == ROW2COL
-static matrix_row_t matrix_reversed[MATRIX_COLS];
-static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS];
+ static matrix_row_t matrix_reversed[MATRIX_COLS];
+ static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS];
#endif
static matrix_row_t read_cols(void);
@@ -65,13 +65,6 @@ void matrix_init(void)
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
-#ifdef BACKLIGHT_ENABLE
- backlight_init_ports();
-#endif
-
- // Turn status LED on
- DDRE |= (1<<6);
- PORTE |= (1<<6);
// initialize row and col
unselect_rows();
@@ -82,11 +75,16 @@ void matrix_init(void)
matrix[i] = 0;
matrix_debouncing[i] = 0;
}
+
+ if (matrix_init_kb) {
+ (*matrix_init_kb)();
+ }
}
uint8_t matrix_scan(void)
{
+
#if DIODE_DIRECTION == COL2ROW
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
select_row(i);
@@ -144,6 +142,10 @@ uint8_t matrix_scan(void)
}
#endif
+ if (matrix_scan_kb) {
+ (*matrix_scan_kb)();
+ }
+
return 1;
}