summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/keycode.txt4
-rw-r--r--keyboards/chibios_test/Makefile14
-rw-r--r--keyboards/chibios_test/boards/GENERIC_STM32_F103/board.c (renamed from keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.c)0
-rw-r--r--keyboards/chibios_test/boards/GENERIC_STM32_F103/board.h (renamed from keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h)0
-rw-r--r--keyboards/chibios_test/boards/GENERIC_STM32_F103/board.mk (renamed from keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.mk)0
-rw-r--r--keyboards/chibios_test/boards/GENERIC_STM32_F103/mini_stm32_mapping.png (renamed from keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/mini_stm32_mapping.png)bin162908 -> 162908 bytes
-rw-r--r--keyboards/chibios_test/boards/maple_mini_mapping.png (renamed from keyboards/stm32_f103_onekey/boards/maple_mini_mapping.png)bin237977 -> 237977 bytes
-rw-r--r--keyboards/chibios_test/chibios_test.c1
-rw-r--r--keyboards/chibios_test/chibios_test.h6
-rw-r--r--keyboards/chibios_test/config.h (renamed from keyboards/teensy_lc_onekey/config.h)9
-rw-r--r--keyboards/chibios_test/keymaps/default/keymap.c (renamed from keyboards/stm32_f103_onekey/keymaps/default/keymap.c)2
-rw-r--r--keyboards/chibios_test/ld/MKL26Z64.ld (renamed from keyboards/teensy_lc_onekey/ld/MKL26Z64.ld)0
-rw-r--r--keyboards/chibios_test/ld/STM32F103x8_stm32duino_bootloader.ld (renamed from keyboards/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld)0
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/Makefile (renamed from keyboards/stm32_f072_onekey/Makefile)11
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/bootloader_defs.h (renamed from keyboards/stm32_f072_onekey/bootloader_defs.h)0
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/chconf.h (renamed from keyboards/stm32_f072_onekey/chconf.h)0
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/config.h7
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/halconf.h (renamed from keyboards/stm32_f072_onekey/halconf.h)0
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/led.c (renamed from keyboards/stm32_f072_onekey/led.c)0
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/matrix.c (renamed from keyboards/stm32_f072_onekey/matrix.c)0
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/mcuconf.h (renamed from keyboards/stm32_f072_onekey/mcuconf.h)0
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/stm32_f072_onekey.c (renamed from keyboards/stm32_f072_onekey/stm32_f072_onekey.c)0
-rw-r--r--keyboards/chibios_test/stm32_f072_onekey/stm32_f072_onekey.h (renamed from keyboards/stm32_f072_onekey/stm32_f072_onekey.h)2
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/Makefile (renamed from keyboards/stm32_f103_onekey/Makefile)14
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/bootloader_defs.h (renamed from keyboards/stm32_f103_onekey/bootloader_defs.h)0
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/chconf.h (renamed from keyboards/stm32_f103_onekey/chconf.h)0
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/config.h6
-rwxr-xr-xkeyboards/chibios_test/stm32_f103_onekey/flash.sh (renamed from keyboards/stm32_f103_onekey/flash.sh)0
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/halconf.h (renamed from keyboards/stm32_f103_onekey/halconf.h)0
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/led.c (renamed from keyboards/stm32_f103_onekey/led.c)0
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/matrix.c (renamed from keyboards/stm32_f103_onekey/matrix.c)0
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/mcuconf.h (renamed from keyboards/stm32_f103_onekey/mcuconf.h)0
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/stm32_f103_onekey.c (renamed from keyboards/stm32_f103_onekey/stm32_f103_onekey.c)0
-rw-r--r--keyboards/chibios_test/stm32_f103_onekey/stm32_f103_onekey.h (renamed from keyboards/stm32_f103_onekey/stm32_f103_onekey.h)2
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/Makefile (renamed from keyboards/teensy_lc_onekey/Makefile)17
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/Makefile.3.0 (renamed from keyboards/teensy_lc_onekey/Makefile.3.0)0
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/Makefile.3.2 (renamed from keyboards/teensy_lc_onekey/Makefile.3.2)0
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/chconf.h (renamed from keyboards/teensy_lc_onekey/chconf.h)0
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/config.h6
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/halconf.h (renamed from keyboards/teensy_lc_onekey/halconf.h)0
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/instructions.md (renamed from keyboards/teensy_lc_onekey/instructions.md)0
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/led.c (renamed from keyboards/teensy_lc_onekey/led.c)0
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/matrix.c (renamed from keyboards/teensy_lc_onekey/matrix.c)0
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/mcuconf.h (renamed from keyboards/teensy_lc_onekey/mcuconf.h)0
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/teensy_lc_onekey.c (renamed from keyboards/teensy_lc_onekey/teensy_lc_onekey.c)0
-rw-r--r--keyboards/chibios_test/teensy_lc_onekey/teensy_lc_onekey.h (renamed from keyboards/teensy_lc_onekey/teensy_lc_onekey.h)2
-rw-r--r--keyboards/ergodox_ez/config.h10
-rw-r--r--keyboards/ergodox_ez/matrix.c6
-rw-r--r--keyboards/kc60/keymaps/stanleylai/Makefile2
-rw-r--r--keyboards/kc60/keymaps/wigguno/Makefile24
-rw-r--r--keyboards/kc60/keymaps/wigguno/keymap.c62
-rw-r--r--keyboards/kc60/keymaps/wigguno/readme.md14
-rw-r--r--keyboards/kc60/keymaps/ws2812/Makefile2
-rw-r--r--keyboards/planck/keymaps/default/keymap.c16
-rw-r--r--keyboards/preonic/keymaps/default/keymap.c12
-rw-r--r--keyboards/stm32_f072_onekey/config.h76
-rw-r--r--keyboards/stm32_f072_onekey/keymaps/default/keymap.c25
-rw-r--r--keyboards/stm32_f103_onekey/config.h75
-rw-r--r--keyboards/teensy_lc_onekey/keymaps/default/keymap.c32
-rw-r--r--quantum/matrix.c292
-rw-r--r--tmk_core/common/avr/suspend.c6
-rw-r--r--tmk_core/common/bootmagic.c16
-rw-r--r--tmk_core/common/keyboard.c107
-rw-r--r--tmk_core/common/matrix.h57
64 files changed, 436 insertions, 501 deletions
diff --git a/doc/keycode.txt b/doc/keycode.txt
index 44d7e27cd..c1134f9bf 100644
--- a/doc/keycode.txt
+++ b/doc/keycode.txt
@@ -62,7 +62,7 @@ KC_NONUS_HASH KC_NUHS 32 Keyboard Non-US # and ~
KC_SCOLON KC_SCLN 33 Keyboard ; and :
KC_QUOTE KC_QUOT 34 Keyboard ‘ and “
KC_GRAVE KC_GRV 35 Keyboard Grave Accent and Tilde
-KC_COMMA KC_COMM 36 Keyboard, and <
+KC_COMMA KC_COMM 36 Keyboard , and <
KC_DOT 37 Keyboard . and >
KC_SLASH KC_SLSH 38 Keyboard / and ?
KC_CAPSLOCK KC_CAPS 39 Keyboard Caps Lock
@@ -92,7 +92,7 @@ KC_LEFT 50 Keyboard LeftArrow1
KC_DOWN 51 Keyboard DownArrow1
KC_UP 52 Keyboard UpArrow1
KC_NUMLOCK KC_NLCK 53 Keypad Num Lock and Clear11
-KC_KP_SLASH KC_PSLS 54 Keypad /1
+KC_KP_SLASH KC_PSLS 54 Keypad /
KC_KP_ASTERISK KC_PAST 55 Keypad *
KC_KP_MINUS KC_PMNS 56 Keypad -
KC_KP_PLUS KC_PPLS 57 Keypad +
diff --git a/keyboards/chibios_test/Makefile b/keyboards/chibios_test/Makefile
new file mode 100644
index 000000000..d9f2b8b83
--- /dev/null
+++ b/keyboards/chibios_test/Makefile
@@ -0,0 +1,14 @@
+SUBPROJECT_DEFAULT = stm32_f072_onekey
+
+#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
+MOUSEKEY_ENABLE ?= yes # Mouse keys
+EXTRAKEY_ENABLE ?= yes # Audio control and System control
+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
+CUSTOM_MATRIX ?= yes # Custom matrix file
+
+ifndef QUANTUM_DIR
+ include ../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.c b/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.c
index 31319ef57..31319ef57 100644
--- a/keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.c
+++ b/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.c
diff --git a/keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h b/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.h
index 7253e7782..7253e7782 100644
--- a/keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.h
+++ b/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.h
diff --git a/keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.mk b/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.mk
index d692c0ee4..d692c0ee4 100644
--- a/keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/board.mk
+++ b/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.mk
diff --git a/keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/mini_stm32_mapping.png b/keyboards/chibios_test/boards/GENERIC_STM32_F103/mini_stm32_mapping.png
index c44a7d9eb..c44a7d9eb 100644
--- a/keyboards/stm32_f103_onekey/boards/GENERIC_STM32_F103/mini_stm32_mapping.png
+++ b/keyboards/chibios_test/boards/GENERIC_STM32_F103/mini_stm32_mapping.png
Binary files differ
diff --git a/keyboards/stm32_f103_onekey/boards/maple_mini_mapping.png b/keyboards/chibios_test/boards/maple_mini_mapping.png
index 12cfa81db..12cfa81db 100644
--- a/keyboards/stm32_f103_onekey/boards/maple_mini_mapping.png
+++ b/keyboards/chibios_test/boards/maple_mini_mapping.png
Binary files differ
diff --git a/keyboards/chibios_test/chibios_test.c b/keyboards/chibios_test/chibios_test.c
new file mode 100644
index 000000000..efe2d4a5d
--- /dev/null
+++ b/keyboards/chibios_test/chibios_test.c
@@ -0,0 +1 @@
+#include "chibios_test.h"
diff --git a/keyboards/chibios_test/chibios_test.h b/keyboards/chibios_test/chibios_test.h
new file mode 100644
index 000000000..25b031771
--- /dev/null
+++ b/keyboards/chibios_test/chibios_test.h
@@ -0,0 +1,6 @@
+#ifndef KEYBOARDS_CHIBIOS_TEST_CHIBIOS_TEST_H_
+#define KEYBOARDS_CHIBIOS_TEST_CHIBIOS_TEST_H_
+
+#include "quantum.h"
+
+#endif /* KEYBOARDS_CHIBIOS_TEST_CHIBIOS_TEST_H_ */
diff --git a/keyboards/teensy_lc_onekey/config.h b/keyboards/chibios_test/config.h
index 19b14fe61..c32a77b37 100644
--- a/keyboards/teensy_lc_onekey/config.h
+++ b/keyboards/chibios_test/config.h
@@ -18,18 +18,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CONFIG_H
#define CONFIG_H
-
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6464
#define DEVICE_VER 0x0001
/* in python2: list(u"whatever".encode('utf-16-le')) */
/* at most 32 characters or the ugly hack in usb_main.c borks */
-#define MANUFACTURER "TMK"
+#define MANUFACTURER "QMK"
#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00'
-#define PRODUCT "ChibiOS TMK test"
-#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00'
-#define DESCRIPTION "TMK keyboard firmware over ChibiOS"
+#define PRODUCT "ChibiOS QMK test"
+#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'Q', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00'
+#define DESCRIPTION "QMK keyboard firmware test for ChibiOS"
/* key matrix size */
#define MATRIX_ROWS 1
diff --git a/keyboards/stm32_f103_onekey/keymaps/default/keymap.c b/keyboards/chibios_test/keymaps/default/keymap.c
index c3b0f0840..239d70007 100644
--- a/keyboards/stm32_f103_onekey/keymaps/default/keymap.c
+++ b/keyboards/chibios_test/keymaps/default/keymap.c
@@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stm32_f103_onekey.h"
+#include "chibios_test.h"
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{{KC_CAPS}}, // test with KC_CAPS, KC_A, KC_BTLD
diff --git a/keyboards/teensy_lc_onekey/ld/MKL26Z64.ld b/keyboards/chibios_test/ld/MKL26Z64.ld
index fb141f888..fb141f888 100644
--- a/keyboards/teensy_lc_onekey/ld/MKL26Z64.ld
+++ b/keyboards/chibios_test/ld/MKL26Z64.ld
diff --git a/keyboards/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboards/chibios_test/ld/STM32F103x8_stm32duino_bootloader.ld
index 00613328e..00613328e 100644
--- a/keyboards/stm32_f103_onekey/ld/STM32F103x8_stm32duino_bootloader.ld
+++ b/keyboards/chibios_test/ld/STM32F103x8_stm32duino_bootloader.ld
diff --git a/keyboards/stm32_f072_onekey/Makefile b/keyboards/chibios_test/stm32_f072_onekey/Makefile
index 24abcb0e0..eae38c4b2 100644
--- a/keyboards/stm32_f072_onekey/Makefile
+++ b/keyboards/chibios_test/stm32_f072_onekey/Makefile
@@ -36,15 +36,6 @@ ARMV = 6
# Build Options
# comment out to disable the options.
#
-#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
-MOUSEKEY_ENABLE ?= yes # Mouse keys
-EXTRAKEY_ENABLE ?= yes # Audio control and System control
-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
-CUSTOM_MATRIX ?= yes # Custom matrix file
-
ifndef QUANTUM_DIR
- include ../../Makefile
+ include ../../../Makefile
endif
diff --git a/keyboards/stm32_f072_onekey/bootloader_defs.h b/keyboards/chibios_test/stm32_f072_onekey/bootloader_defs.h
index 02c48c4e6..02c48c4e6 100644
--- a/keyboards/stm32_f072_onekey/bootloader_defs.h
+++ b/keyboards/chibios_test/stm32_f072_onekey/bootloader_defs.h
diff --git a/keyboards/stm32_f072_onekey/chconf.h b/keyboards/chibios_test/stm32_f072_onekey/chconf.h
index 99fa8ce39..99fa8ce39 100644
--- a/keyboards/stm32_f072_onekey/chconf.h
+++ b/keyboards/chibios_test/stm32_f072_onekey/chconf.h
diff --git a/keyboards/chibios_test/stm32_f072_onekey/config.h b/keyboards/chibios_test/stm32_f072_onekey/config.h
new file mode 100644
index 000000000..bbaf0dc4b
--- /dev/null
+++ b/keyboards/chibios_test/stm32_f072_onekey/config.h
@@ -0,0 +1,7 @@
+#ifndef KEYBOARDS_CHIBIOS_TEST_STM32_F072_ONEKEY_CONFIG_H_
+#define KEYBOARDS_CHIBIOS_TEST_STM32_F072_ONEKEY_CONFIG_H_
+
+#include "../config.h"
+
+
+#endif /* KEYBOARDS_CHIBIOS_TEST_STM32_F072_ONEKEY_CONFIG_H_ */
diff --git a/keyboards/stm32_f072_onekey/halconf.h b/keyboards/chibios_test/stm32_f072_onekey/halconf.h
index 1a450d632..1a450d632 100644
--- a/keyboards/stm32_f072_onekey/halconf.h
+++ b/keyboards/chibios_test/stm32_f072_onekey/halconf.h
diff --git a/keyboards/stm32_f072_onekey/led.c b/keyboards/chibios_test/stm32_f072_onekey/led.c
index 18edb8ba8..18edb8ba8 100644
--- a/keyboards/stm32_f072_onekey/led.c
+++ b/keyboards/chibios_test/stm32_f072_onekey/led.c
diff --git a/keyboards/stm32_f072_onekey/matrix.c b/keyboards/chibios_test/stm32_f072_onekey/matrix.c
index a05b38cd4..a05b38cd4 100644
--- a/keyboards/stm32_f072_onekey/matrix.c
+++ b/keyboards/chibios_test/stm32_f072_onekey/matrix.c
diff --git a/keyboards/stm32_f072_onekey/mcuconf.h b/keyboards/chibios_test/stm32_f072_onekey/mcuconf.h
index 3d877aaa2..3d877aaa2 100644
--- a/keyboards/stm32_f072_onekey/mcuconf.h
+++ b/keyboards/chibios_test/stm32_f072_onekey/mcuconf.h
diff --git a/keyboards/stm32_f072_onekey/stm32_f072_onekey.c b/keyboards/chibios_test/stm32_f072_onekey/stm32_f072_onekey.c
index 820d062ff..820d062ff 100644
--- a/keyboards/stm32_f072_onekey/stm32_f072_onekey.c
+++ b/keyboards/chibios_test/stm32_f072_onekey/stm32_f072_onekey.c
diff --git a/keyboards/stm32_f072_onekey/stm32_f072_onekey.h b/keyboards/chibios_test/stm32_f072_onekey/stm32_f072_onekey.h
index 1f798c825..0455ad342 100644
--- a/keyboards/stm32_f072_onekey/stm32_f072_onekey.h
+++ b/keyboards/chibios_test/stm32_f072_onekey/stm32_f072_onekey.h
@@ -1,5 +1,5 @@
#ifndef STM32_F072_ONEKEY_H
#define STM32_F072_ONEKEY_H
-#include "quantum.h"
+#include "chibios_test.h"
#endif
diff --git a/keyboards/stm32_f103_onekey/Makefile b/keyboards/chibios_test/stm32_f103_onekey/Makefile
index 5c1793c86..307ca5b19 100644
--- a/keyboards/stm32_f103_onekey/Makefile
+++ b/keyboards/chibios_test/stm32_f103_onekey/Makefile
@@ -46,19 +46,7 @@ ARMV = 7
# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800
-# Build Options
-# comment out to disable the options.
-#
-#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
-## BOOTMAGIC is not supported on STM32 chips yet.
-MOUSEKEY_ENABLE ?= yes # Mouse keys
-EXTRAKEY_ENABLE ?= yes # Audio control and System control
-# CONSOLE_ENABLE ?= yes # Console for debug
-COMMAND_ENABLE ?= yes # Commands for debug and configuration
-SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
-NKRO_ENABLE ?= yes # USB Nkey Rollover
-CUSTOM_MATRIX ?= yes # Custom matrix file
ifndef QUANTUM_DIR
- include ../../Makefile
+ include ../../../Makefile
endif
diff --git a/keyboards/stm32_f103_onekey/bootloader_defs.h b/keyboards/chibios_test/stm32_f103_onekey/bootloader_defs.h
index 0f45203cb..0f45203cb 100644
--- a/keyboards/stm32_f103_onekey/bootloader_defs.h
+++ b/keyboards/chibios_test/stm32_f103_onekey/bootloader_defs.h
diff --git a/keyboards/stm32_f103_onekey/chconf.h b/keyboards/chibios_test/stm32_f103_onekey/chconf.h
index dfb1f9dfb..dfb1f9dfb 100644
--- a/keyboards/stm32_f103_onekey/chconf.h
+++ b/keyboards/chibios_test/stm32_f103_onekey/chconf.h
diff --git a/keyboards/chibios_test/stm32_f103_onekey/config.h b/keyboards/chibios_test/stm32_f103_onekey/config.h
new file mode 100644
index 000000000..de0b906f3
--- /dev/null
+++ b/keyboards/chibios_test/stm32_f103_onekey/config.h
@@ -0,0 +1,6 @@
+#ifndef KEYBOARDS_CHIBIOS_TEST_STM32_F103_ONEKEY_CONFIG_H_
+#define KEYBOARDS_CHIBIOS_TEST_STM32_F103_ONEKEY_CONFIG_H_
+
+#include "../config.h"
+
+#endif /* KEYBOARDS_CHIBIOS_TEST_STM32_F103_ONEKEY_CONFIG_H_ */
diff --git a/keyboards/stm32_f103_onekey/flash.sh b/keyboards/chibios_test/stm32_f103_onekey/flash.sh
index 15501dfa5..15501dfa5 100755
--- a/keyboards/stm32_f103_onekey/flash.sh
+++ b/keyboards/chibios_test/stm32_f103_onekey/flash.sh
diff --git a/keyboards/stm32_f103_onekey/halconf.h b/keyboards/chibios_test/stm32_f103_onekey/halconf.h
index 1a450d632..1a450d632 100644
--- a/keyboards/stm32_f103_onekey/halconf.h
+++ b/keyboards/chibios_test/stm32_f103_onekey/halconf.h
diff --git a/keyboards/stm32_f103_onekey/led.c b/keyboards/chibios_test/stm32_f103_onekey/led.c
index f5c55f7d9..f5c55f7d9 100644
--- a/keyboards/stm32_f103_onekey/led.c
+++ b/keyboards/chibios_test/stm32_f103_onekey/led.c
diff --git a/keyboards/stm32_f103_onekey/matrix.c b/keyboards/chibios_test/stm32_f103_onekey/matrix.c
index ea9d8d057..ea9d8d057 100644
--- a/keyboards/stm32_f103_onekey/matrix.c
+++ b/keyboards/chibios_test/stm32_f103_onekey/matrix.c
diff --git a/keyboards/stm32_f103_onekey/mcuconf.h b/keyboards/chibios_test/stm32_f103_onekey/mcuconf.h
index 626332a6a..626332a6a 100644
--- a/keyboards/stm32_f103_onekey/mcuconf.h
+++ b/keyboards/chibios_test/stm32_f103_onekey/mcuconf.h
diff --git a/keyboards/stm32_f103_onekey/stm32_f103_onekey.c b/keyboards/chibios_test/stm32_f103_onekey/stm32_f103_onekey.c
index 7fa99bb28..7fa99bb28 100644
--- a/keyboards/stm32_f103_onekey/stm32_f103_onekey.c
+++ b/keyboards/chibios_test/stm32_f103_onekey/stm32_f103_onekey.c
diff --git a/keyboards/stm32_f103_onekey/stm32_f103_onekey.h b/keyboards/chibios_test/stm32_f103_onekey/stm32_f103_onekey.h
index e4d0dd9c4..89a62b2bb 100644
--- a/keyboards/stm32_f103_onekey/stm32_f103_onekey.h
+++ b/keyboards/chibios_test/stm32_f103_onekey/stm32_f103_onekey.h
@@ -1,4 +1,4 @@
#ifndef STM32_F103_ONEKEY_H
#define STM32_F103_ONEKEY_H
-#include "quantum.h"
+#include "chibios_test.h"
#endif
diff --git a/keyboards/teensy_lc_onekey/Makefile b/keyboards/chibios_test/teensy_lc_onekey/Makefile
index 064e61815..43ea9d82d 100644
--- a/keyboards/teensy_lc_onekey/Makefile
+++ b/keyboards/chibios_test/teensy_lc_onekey/Makefile
@@ -44,19 +44,6 @@ MCU = cortex-m0plus
# I.e. 6 for Teensy LC; 7 for Teensy 3.x
ARMV = 6
-# Build Options
-# comment out to disable the options.
-#
-BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration
-## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
-MOUSEKEY_ENABLE ?= yes # Mouse keys
-EXTRAKEY_ENABLE ?= yes # Audio control and System control
-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
-CUSTOM_MATRIX ?= yes # Custom matrix file
-
ifndef QUANTUM_DIR
- include ../../Makefile
-endif
+ include ../../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/teensy_lc_onekey/Makefile.3.0 b/keyboards/chibios_test/teensy_lc_onekey/Makefile.3.0
index dbf12c363..dbf12c363 100644
--- a/keyboards/teensy_lc_onekey/Makefile.3.0
+++ b/keyboards/chibios_test/teensy_lc_onekey/Makefile.3.0
diff --git a/keyboards/teensy_lc_onekey/Makefile.3.2 b/keyboards/chibios_test/teensy_lc_onekey/Makefile.3.2
index 41bfa41a0..41bfa41a0 100644
--- a/keyboards/teensy_lc_onekey/Makefile.3.2
+++ b/keyboards/chibios_test/teensy_lc_onekey/Makefile.3.2
diff --git a/keyboards/teensy_lc_onekey/chconf.h b/keyboards/chibios_test/teensy_lc_onekey/chconf.h
index cb36996c3..cb36996c3 100644
--- a/keyboards/teensy_lc_onekey/chconf.h
+++ b/keyboards/chibios_test/teensy_lc_onekey/chconf.h
diff --git a/keyboards/chibios_test/teensy_lc_onekey/config.h b/keyboards/chibios_test/teensy_lc_onekey/config.h
new file mode 100644
index 000000000..d9eb05d2a
--- /dev/null
+++ b/keyboards/chibios_test/teensy_lc_onekey/config.h
@@ -0,0 +1,6 @@
+#ifndef KEYBOARDS_CHIBIOS_TEST_TEENSY_LC_ONEKEY_CONFIG_H_
+#define KEYBOARDS_CHIBIOS_TEST_TEENSY_LC_ONEKEY_CONFIG_H_
+
+#include "../config.h"
+
+#endif /* KEYBOARDS_CHIBIOS_TEST_TEENSY_LC_ONEKEY_CONFIG_H_ */
diff --git a/keyboards/teensy_lc_onekey/halconf.h b/keyboards/chibios_test/teensy_lc_onekey/halconf.h
index b1d2cd550..b1d2cd550 100644
--- a/keyboards/teensy_lc_onekey/halconf.h
+++ b/keyboards/chibios_test/teensy_lc_onekey/halconf.h
diff --git a/keyboards/teensy_lc_onekey/instructions.md b/keyboards/chibios_test/teensy_lc_onekey/instructions.md
index 16886a015..16886a015 100644
--- a/keyboards/teensy_lc_onekey/instructions.md
+++ b/keyboards/chibios_test/teensy_lc_onekey/instructions.md
diff --git a/keyboards/teensy_lc_onekey/led.c b/keyboards/chibios_test/teensy_lc_onekey/led.c
index dfa60c107..dfa60c107 100644
--- a/keyboards/teensy_lc_onekey/led.c
+++ b/keyboards/chibios_test/teensy_lc_onekey/led.c
diff --git a/keyboards/teensy_lc_onekey/matrix.c b/keyboards/chibios_test/teensy_lc_onekey/matrix.c
index 7dab04f02..7dab04f02 100644
--- a/keyboards/teensy_lc_onekey/matrix.c
+++ b/keyboards/chibios_test/teensy_lc_onekey/matrix.c
diff --git a/keyboards/teensy_lc_onekey/mcuconf.h b/keyboards/chibios_test/teensy_lc_onekey/mcuconf.h
index c63659019..c63659019 100644
--- a/keyboards/teensy_lc_onekey/mcuconf.h
+++ b/keyboards/chibios_test/teensy_lc_onekey/mcuconf.h
diff --git a/keyboards/teensy_lc_onekey/teensy_lc_onekey.c b/keyboards/chibios_test/teensy_lc_onekey/teensy_lc_onekey.c
index b6c432793..b6c432793 100644
--- a/keyboards/teensy_lc_onekey/teensy_lc_onekey.c
+++ b/keyboards/chibios_test/teensy_lc_onekey/teensy_lc_onekey.c
diff --git a/keyboards/teensy_lc_onekey/teensy_lc_onekey.h b/keyboards/chibios_test/teensy_lc_onekey/teensy_lc_onekey.h
index f598bcf66..ea1c84e2f 100644
--- a/keyboards/teensy_lc_onekey/teensy_lc_onekey.h
+++ b/keyboards/chibios_test/teensy_lc_onekey/teensy_lc_onekey.h
@@ -1,4 +1,4 @@
#ifndef TEENSY_LC_ONEKEY_H
#define TEENSY_LC_ONEKEY_H
-#include "quantum.h"
+#include "chibios_test.h"
#endif
diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h
index 6a391ffb5..2bb56731b 100644
--- a/keyboards/ergodox_ez/config.h
+++ b/keyboards/ergodox_ez/config.h
@@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEVICE_VER 0x0001
#define MANUFACTURER ErgoDox EZ
#define PRODUCT ErgoDox EZ
-#define DESCRIPTION t.m.k. keyboard firmware for Ergodox
+#define DESCRIPTION QMK keyboard firmware for Ergodox EZ
/* key matrix size */
#define MATRIX_ROWS 14
@@ -40,12 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TAPPING_TOGGLE 1
-#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
-#define ROWS (int []){ D0, D5, B5, B6 }
-
-/* COL2ROW or ROW2COL */
-#define DIODE_DIRECTION COL2ROW
-
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
@@ -53,7 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define BACKLIGHT_LEVELS 3
/* Set 0 if debouncing isn't needed */
-#define DEBOUNCE 2
+#define DEBOUNCE 5
#define TAPPING_TERM 200
#define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.)
diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c
index b87fddbad..9c1efa1d0 100644
--- a/keyboards/ergodox_ez/matrix.c
+++ b/keyboards/ergodox_ez/matrix.c
@@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
-#include <util/delay.h>
+#include "wait.h"
#include "action_layer.h"
#include "print.h"
#include "debug.h"
@@ -166,6 +166,7 @@ uint8_t matrix_scan(void)
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
select_row(i);
+ wait_us(30); // without this wait read unstable value.
matrix_row_t cols = read_cols(i);
if (matrix_debouncing[i] != cols) {
matrix_debouncing[i] = cols;
@@ -179,7 +180,7 @@ uint8_t matrix_scan(void)
if (debouncing) {
if (--debouncing) {
- _delay_ms(1);
+ wait_us(1);
} else {
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
matrix[i] = matrix_debouncing[i];
@@ -267,7 +268,6 @@ static matrix_row_t read_cols(uint8_t row)
return data;
}
} else {
- _delay_us(30); // without this wait read unstable value.
// read from teensy
return
(PINF&(1<<0) ? 0 : (1<<0)) |
diff --git a/keyboards/kc60/keymaps/stanleylai/Makefile b/keyboards/kc60/keymaps/stanleylai/Makefile
index f7e4e2fe2..b8b2beda4 100644
--- a/keyboards/kc60/keymaps/stanleylai/Makefile
+++ b/keyboards/kc60/keymaps/stanleylai/Makefile
@@ -21,5 +21,5 @@ SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
NKRO_ENABLE ?= yes # USB Nkey Rollover
ifndef QUANTUM_DIR
- include ../../Makefile
+ include ../../../../Makefile
endif
diff --git a/keyboards/kc60/keymaps/wigguno/Makefile b/keyboards/kc60/keymaps/wigguno/Makefile
new file mode 100644
index 000000000..0d7d918d8
--- /dev/null
+++ b/keyboards/kc60/keymaps/wigguno/Makefile
@@ -0,0 +1,24 @@
+
+
+# Build Options
+# change yes to no to disable
+#
+BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE ?= no # Mouse keys(+4700)
+EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
+CONSOLE_ENABLE ?= no # Console for debug(+400)
+COMMAND_ENABLE ?= no # Commands for debug and configuration
+KEYBOARD_LOCK_ENABLE ?= yes # Allow locking of keyboard via magic key
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE ?= yes # USB Nkey Rollover
+BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality
+MIDI_ENABLE ?= no # MIDI controls
+UNICODE_ENABLE ?= no # Unicode
+BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
+AUDIO_ENABLE ?= no # Audio output on port C6
+
+ifndef QUANTUM_DIR
+ include ../../../../Makefile
+endif
diff --git a/keyboards/kc60/keymaps/wigguno/keymap.c b/keyboards/kc60/keymaps/wigguno/keymap.c
new file mode 100644
index 000000000..50b1d0f98
--- /dev/null
+++ b/keyboards/kc60/keymaps/wigguno/keymap.c
@@ -0,0 +1,62 @@
+// This keymap was designed to close to the default kc60 layout, with some useful changes, such as adding media keys.
+// It also moves the reset key off the base layer, as in the default kc60 layout for this firmware.
+// I have swapped FN and RGUI as my rainbow keyset has them in the opposite order.
+
+#include "kc60.h"
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ /* Basic QWERTY
+ * ,-----------------------------------------------------------.
+ * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |
+ * |-----------------------------------------------------------|
+ * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl|Gui |Alt | Space |Alt |FN |Gui |Ctrl |
+ * `-----------------------------------------------------------'
+ */
+ [0] = KEYMAP(
+ 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, \
+ 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_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, \
+ 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, \
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RGUI, KC_RCTL \
+ ),
+
+ /*
+ * ,-----------------------------------------------------------.
+ * | ` |F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| Del |
+ * |-----------------------------------------------------------|
+ * | | | Up| | | | | | | | PS| | | |
+ * |-----------------------------------------------------------|
+ * | |Lft|Dwn|Rgt| |BL-|BL+| | | | | | |
+ * |-----------------------------------------------------------|
+ * | |Prv| PP|Nxt| | | | |Hom|End| | |
+ * |-----------------------------------------------------------|
+ * | Rst| | | BL | | | | |
+ * `-----------------------------------------------------------'
+ * PS = Print Screen
+ * PP = Play/Pause
+ */
+ [1] = KEYMAP( /* Function Layer */
+ 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_DELETE, \
+ KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, \
+ KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, BL_DEC, BL_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
+ KC_TRNS, KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, \
+ RESET, KC_TRNS, KC_TRNS, BL_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ // MACRODOWN only works in this function
+ return MACRO_NONE;
+};
diff --git a/keyboards/kc60/keymaps/wigguno/readme.md b/keyboards/kc60/keymaps/wigguno/readme.md
new file mode 100644
index 000000000..55a9f60c7
--- /dev/null
+++ b/keyboards/kc60/keymaps/wigguno/readme.md
@@ -0,0 +1,14 @@
+Wigguno's KC60 Layout
+======================
+
+## Quantum MK Firmware
+For the full Quantum feature list, see [the parent readme.md](/readme.md).
+
+## Changes from default QMK layout
+The default QMK layout for KC60 does not have a function layer. It also has the bootloader-mode reset key bound. This keymap fixes both of these by adding a sensible function layer (including moving the reset key onto it, far away from the FN key).
+
+### Changes from the default KC60 layout
+The default KC60 layout is good, but it was missing media keys. I've added previous, play/pause and next. I've also removed some of the keys from the function layer I didn't use.
+
+### Build
+To enable NKRO you must be in the keymaps/wigguno directory when running make.
diff --git a/keyboards/kc60/keymaps/ws2812/Makefile b/keyboards/kc60/keymaps/ws2812/Makefile
index d97e4d9f8..891c44416 100644
--- a/keyboards/kc60/keymaps/ws2812/Makefile
+++ b/keyboards/kc60/keymaps/ws2812/Makefile
@@ -21,5 +21,5 @@ SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
NKRO_ENABLE ?= no # USB Nkey Rollover
ifndef QUANTUM_DIR
- include ../../Makefile
+ include ../../../../Makefile
endif
diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c
index 9b4b33f82..5f71ae7d1 100644
--- a/keyboards/planck/keymaps/default/keymap.c
+++ b/keyboards/planck/keymaps/default/keymap.c
@@ -197,8 +197,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
- break;
return false;
+ break;
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
@@ -206,8 +206,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
- break;
return false;
+ break;
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
@@ -215,8 +215,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_DVORAK);
}
- break;
return false;
+ break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
@@ -225,8 +225,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
- break;
return false;
+ break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
@@ -235,8 +235,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
- break;
return false;
+ break;
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
@@ -246,8 +246,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(KC_RSFT);
}
- break;
return false;
+ break;
case PLOVER:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
@@ -265,8 +265,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
}
- break;
return false;
+ break;
case EXT_PLV:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
@@ -274,8 +274,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
layer_off(_PLOVER);
}
- break;
return false;
+ break;
}
return true;
}
diff --git a/keyboards/preonic/keymaps/default/keymap.c b/keyboards/preonic/keymaps/default/keymap.c
index 6d8ef634d..9a957f7ee 100644
--- a/keyboards/preonic/keymaps/default/keymap.c
+++ b/keyboards/preonic/keymaps/default/keymap.c
@@ -191,8 +191,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
- break;
return false;
+ break;
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
@@ -200,8 +200,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
- break;
return false;
+ break;
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
@@ -209,8 +209,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
persistant_default_layer_set(1UL<<_DVORAK);
}
- break;
return false;
+ break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
@@ -219,8 +219,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
- break;
return false;
+ break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
@@ -229,8 +229,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
- break;
return false;
+ break;
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
@@ -240,8 +240,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(KC_RSFT);
}
- break;
return false;
+ break;
}
return true;
};
diff --git a/keyboards/stm32_f072_onekey/config.h b/keyboards/stm32_f072_onekey/config.h
deleted file mode 100644
index bb5251e1d..000000000
--- a/keyboards/stm32_f072_onekey/config.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-Copyright 2015 Jun Wako <wakojun@gmail.com>
-
-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/>.
-*/
-
-#ifndef CONFIG_H
-#define CONFIG_H
-
-#include "config_common.h"
-
-/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
-#define PRODUCT_ID 0x6464
-#define DEVICE_VER 0x0001
-/* in python2: list(u"whatever".encode('utf-16-le')) */
-/* at most 32 characters or the ugly hack in usb_main.c borks */
-#define MANUFACTURER "TMK"
-#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00'
-#define PRODUCT "ChibiOS TMK test"
-#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00'
-#define DESCRIPTION "TMK keyboard firmware over ChibiOS"
-
-/* key matrix size */
-#define MATRIX_ROWS 1
-#define MATRIX_COLS 1
-#define DIODE_DIRECTION COL2ROW
-
-/* define if matrix has ghost */
-//#define MATRIX_HAS_GHOST
-
-/* Set 0 if debouncing isn't needed */
-#define DEBOUNCE 5
-
-/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
-#define LOCKING_SUPPORT_ENABLE
-/* Locking resynchronize hack */
-#define LOCKING_RESYNC_ENABLE
-
-/* key combination for command */
-#define IS_COMMAND() ( \
- keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
-)
-
-
-
-/*
- * Feature disable options
- * These options are also useful to firmware size reduction.
- */
-
-/* disable debug print */
-//#define NO_DEBUG
-
-/* disable print */
-//#define NO_PRINT
-
-/* disable action features */
-//#define NO_ACTION_LAYER
-//#define NO_ACTION_TAPPING
-//#define NO_ACTION_ONESHOT
-//#define NO_ACTION_MACRO
-//#define NO_ACTION_FUNCTION
-
-#endif
diff --git a/keyboards/stm32_f072_onekey/keymaps/default/keymap.c b/keyboards/stm32_f072_onekey/keymaps/default/keymap.c
deleted file mode 100644
index 6c48149f8..000000000
--- a/keyboards/stm32_f072_onekey/keymaps/default/keymap.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
-
-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/>.
-*/
-
-#include "stm32_f072_onekey.h"
-
-const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- {{KC_CAPS}}, // test with KC_CAPS, KC_A, KC_BTLD
-};
-
-const uint16_t fn_actions[] = {
-};
diff --git a/keyboards/stm32_f103_onekey/config.h b/keyboards/stm32_f103_onekey/config.h
deleted file mode 100644
index 19b14fe61..000000000
--- a/keyboards/stm32_f103_onekey/config.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-Copyright 2015 Jun Wako <wakojun@gmail.com>
-
-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/>.
-*/
-
-#ifndef CONFIG_H
-#define CONFIG_H
-
-
-/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
-#define PRODUCT_ID 0x6464
-#define DEVICE_VER 0x0001
-/* in python2: list(u"whatever".encode('utf-16-le')) */
-/* at most 32 characters or the ugly hack in usb_main.c borks */
-#define MANUFACTURER "TMK"
-#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00'
-#define PRODUCT "ChibiOS TMK test"
-#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00'
-#define DESCRIPTION "TMK keyboard firmware over ChibiOS"
-
-/* key matrix size */
-#define MATRIX_ROWS 1
-#define MATRIX_COLS 1
-#define DIODE_DIRECTION COL2ROW
-
-/* define if matrix has ghost */
-//#define MATRIX_HAS_GHOST
-
-/* Set 0 if debouncing isn't needed */
-#define DEBOUNCE 5
-
-/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
-#define LOCKING_SUPPORT_ENABLE
-/* Locking resynchronize hack */
-#define LOCKING_RESYNC_ENABLE
-
-/* key combination for command */
-#define IS_COMMAND() ( \
- keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
-)
-
-
-
-/*
- * Feature disable options
- * These options are also useful to firmware size reduction.
- */
-
-/* disable debug print */
-//#define NO_DEBUG
-
-/* disable print */
-//#define NO_PRINT
-
-/* disable action features */
-//#define NO_ACTION_LAYER
-//#define NO_ACTION_TAPPING
-//#define NO_ACTION_ONESHOT
-//#define NO_ACTION_MACRO
-//#define NO_ACTION_FUNCTION
-
-#endif
diff --git a/keyboards/teensy_lc_onekey/keymaps/default/keymap.c b/keyboards/teensy_lc_onekey/keymaps/default/keymap.c
deleted file mode 100644
index a109b4960..000000000
--- a/keyboards/teensy_lc_onekey/keymaps/default/keymap.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
-
-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/>.
-*/
-
-#include "keycode.h"
-#include "action.h"
-#include "action_macro.h"
-#include "report.h"
-#include "host.h"
-#include "print.h"
-#include "debug.h"
-#include "keymap.h"
-
-const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- {{KC_A}},
-}; // to test: KC_CAPS, KT_BTLD, KC_A
-
-const uint16_t fn_actions[] = {
-};
diff --git a/quantum/matrix.c b/quantum/matrix.c
index a38c13f15..094917025 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -26,32 +26,46 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "matrix.h"
-#ifdef MATRIX_HAS_GHOST
-# error "The universal matrix.c file cannot be used for this keyboard."
-#endif
+/* Set 0 if debouncing isn't needed */
+/*
+ * This constant define not debouncing time in msecs, but amount of matrix
+ * scan loops which should be made to get stable debounced results.
+ *
+ * On Ergodox matrix scan rate is relatively low, because of slow I2C.
+ * Now it's only 317 scans/second, or about 3.15 msec/scan.
+ * According to Cherry specs, debouncing time is 5 msec.
+ *
+ * And so, there is no sense to have DEBOUNCE higher than 2.
+ */
#ifndef DEBOUNCING_DELAY
# define DEBOUNCING_DELAY 5
#endif
+static uint8_t debouncing = DEBOUNCING_DELAY;
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
-/* matrix state */
-#if DIODE_DIRECTION == COL2ROW
+
+/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
-#else
-static matrix_col_t matrix[MATRIX_COLS];
+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];
#endif
-static int8_t debouncing_delay = -1;
-#if DIODE_DIRECTION == COL2ROW
-static void toggle_row(uint8_t row);
-static matrix_row_t read_cols(void);
+#if MATRIX_COLS > 16
+ #define SHIFTER 1UL
#else
-static void toggle_col(uint8_t col);
-static matrix_col_t read_rows(void);
+ #define SHIFTER 1
#endif
+static matrix_row_t read_cols(void);
+static void init_cols(void);
+static void unselect_rows(void);
+static void select_row(uint8_t row);
+
__attribute__ ((weak))
void matrix_init_quantum(void) {
matrix_init_kb();
@@ -80,10 +94,12 @@ __attribute__ ((weak))
void matrix_scan_user(void) {
}
+inline
uint8_t matrix_rows(void) {
return MATRIX_ROWS;
}
+inline
uint8_t matrix_cols(void) {
return MATRIX_COLS;
}
@@ -113,161 +129,179 @@ uint8_t matrix_cols(void) {
// }
void matrix_init(void) {
- /* frees PORTF by setting the JTD bit twice within four cycles */
+ // To use PORTF disable JTAG with writing JTD bit twice within four cycles.
#ifdef __AVR_ATmega32U4__
MCUCR |= _BV(JTD);
MCUCR |= _BV(JTD);
#endif
- /* initializes the I/O pins */
-#if DIODE_DIRECTION == COL2ROW
- for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
- /* DDRxn */
- _SFR_IO8((row_pins[r] >> 4) + 1) |= _BV(row_pins[r] & 0xF);
- toggle_row(r);
- }
- for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
- /* PORTxn */
- _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF);
- }
-#else
- for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
- /* DDRxn */
- _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF);
- toggle_col(c);
- }
- for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
- /* PORTxn */
- _SFR_IO8((row_pins[r] >> 4) + 2) |= _BV(row_pins[r] & 0xF);
+
+ // 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;
}
-#endif
+
matrix_init_quantum();
}
+uint8_t matrix_scan(void)
+{
+
#if DIODE_DIRECTION == COL2ROW
-uint8_t matrix_scan(void) {
- static matrix_row_t debouncing_matrix[MATRIX_ROWS];
- for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
- toggle_row(r);
- matrix_row_t state = read_cols();
- if (debouncing_matrix[r] != state) {
- debouncing_matrix[r] = state;
- debouncing_delay = DEBOUNCING_DELAY;
- }
- toggle_row(r);
- }
- if (debouncing_delay >= 0) {
- dprintf("Debouncing delay remaining: %X\n", debouncing_delay);
- --debouncing_delay;
- if (debouncing_delay >= 0) {
- wait_ms(1);
- }
- else {
- for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
- matrix[r] = debouncing_matrix[r];
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ select_row(i);
+ wait_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 = DEBOUNCING_DELAY;
}
+ unselect_rows();
}
- matrix_scan_quantum();
- return 1;
-}
-
-static void toggle_row(uint8_t row) {
- /* PINxn */
- _SFR_IO8((row_pins[row] >> 4)) = _BV(row_pins[row] & 0xF);
-}
-static matrix_row_t read_cols(void) {
- matrix_row_t state = 0;
- for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
- /* PINxn */
- if (!(_SFR_IO8((col_pins[c] >> 4)) & _BV(col_pins[c] & 0xF))) {
- state |= (matrix_row_t)1 << c;
+ if (debouncing) {
+ if (--debouncing) {
+ wait_us(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
}
}
- return state;
-}
-
-matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
#else
-uint8_t matrix_scan(void) {
- static matrix_col_t debouncing_matrix[MATRIX_COLS];
- for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
- toggle_col(c);
- matrix_col_t state = read_rows();
- if (debouncing_matrix[c] != state) {
- debouncing_matrix[c] = state;
- debouncing_delay = DEBOUNCING_DELAY;
+ for (uint8_t i = 0; i < MATRIX_COLS; i++) {
+ select_row(i);
+ wait_us(30); // without this wait read unstable value.
+ matrix_row_t rows = read_cols();
+ if (matrix_reversed_debouncing[i] != rows) {
+ matrix_reversed_debouncing[i] = rows;
+ if (debouncing) {
+ debug("bounce!: "); debug_hex(debouncing); debug("\n");
+ }
+ debouncing = DEBOUNCING_DELAY;
}
- toggle_col(c);
+ unselect_rows();
}
- if (debouncing_delay >= 0) {
- dprintf("Debouncing delay remaining: %X\n", debouncing_delay);
- --debouncing_delay;
- if (debouncing_delay >= 0) {
- wait_ms(1);
- }
- else {
- for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
- matrix[c] = debouncing_matrix[c];
+
+ if (debouncing) {
+ if (--debouncing) {
+ wait_us(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_COLS; i++) {
+ matrix_reversed[i] = matrix_reversed_debouncing[i];
}
}
}
+ for (uint8_t y = 0; y < MATRIX_ROWS; y++) {
+ matrix_row_t row = 0;
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ row |= ((matrix_reversed[x] & (1<<y)) >> y) << x;
+ }
+ matrix[y] = row;
+ }
+#endif
+
matrix_scan_quantum();
+
return 1;
}
-static void toggle_col(uint8_t col) {
- /* PINxn */
- _SFR_IO8((col_pins[col] >> 4)) = _BV(col_pins[col] & 0xF);
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
}
-static matrix_col_t read_rows(void) {
- matrix_col_t state = 0;
- for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
- /* PINxn */
- if (!(_SFR_IO8((row_pins[r] >> 4)) & _BV(row_pins[r] & 0xF))) {
- state |= (matrix_col_t)1 << r;
- }
+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");
}
- return state;
}
-matrix_row_t matrix_get_row(uint8_t row) {
- matrix_row_t state = 0;
- matrix_col_t mask = (matrix_col_t)1 << row;
- for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
- if (matrix[c] & mask) {
- state |= (matrix_row_t)1 << c;
- }
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop16(matrix[i]);
}
- return state;
+ return count;
}
+static void init_cols(void)
+{
+#if DIODE_DIRECTION == COL2ROW
+ for(int x = 0; x < MATRIX_COLS; x++) {
+ int pin = col_pins[x];
+#else
+ for(int x = 0; x < MATRIX_ROWS; x++) {
+ int pin = row_pins[x];
#endif
-
-bool matrix_is_modified(void) {
- if (debouncing_delay >= 0) return false;
- return true;
+ _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF);
+ _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);
+ }
}
-bool matrix_is_on(uint8_t row, uint8_t col) {
- return matrix_get_row(row) & (matrix_row_t)1 << col;
-}
+static matrix_row_t read_cols(void)
+{
+ matrix_row_t result = 0;
-void matrix_print(void) {
- dprintln("Human-readable matrix state:");
- for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
- dprintf("State of row %X: %016b\n", r, bitrev16(matrix_get_row(r)));
+#if DIODE_DIRECTION == COL2ROW
+ for(int x = 0; x < MATRIX_COLS; x++) {
+ int pin = col_pins[x];
+#else
+ for(int x = 0; x < MATRIX_ROWS; x++) {
+ int pin = row_pins[x];
+#endif
+ result |= (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)) ? 0 : (SHIFTER << x);
}
+ return result;
}
-uint8_t matrix_key_count(void) {
- uint8_t count = 0;
- for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
- count += bitpop16(matrix_get_row(r));
+static void unselect_rows(void)
+{
+#if DIODE_DIRECTION == COL2ROW
+ for(int x = 0; x < MATRIX_ROWS; x++) {
+ int pin = row_pins[x];
+#else
+ for(int x = 0; x < MATRIX_COLS; x++) {
+ int pin = col_pins[x];
+#endif
+ _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF);
+ _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);
}
- return count;
+}
+
+static void select_row(uint8_t row)
+{
+
+#if DIODE_DIRECTION == COL2ROW
+ int pin = row_pins[row];
+#else
+ int pin = col_pins[row];
+#endif
+ _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF);
+ _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF);
}
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index a6f3c6441..8a7272bbc 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -114,8 +114,10 @@ bool suspend_wakeup_condition(void)
matrix_power_up();
matrix_scan();
matrix_power_down();
- if (matrix_key_count()) return true;
- return false;
+ for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
+ if (matrix_get_row(r)) return true;
+ }
+ return false;
}
// run immediately after wakeup
diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c
index 90275a18b..6730a2a4a 100644
--- a/tmk_core/common/bootmagic.c
+++ b/tmk_core/common/bootmagic.c
@@ -106,13 +106,15 @@ void bootmagic(void)
}
}
-static bool scan_keycode(uint8_t keycode) {
- for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
+static bool scan_keycode(uint8_t keycode)
+{
+ for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
matrix_row_t matrix_row = matrix_get_row(r);
- for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
- if (matrix_row & (matrix_row_t)1 << c) {
- keypos_t key = (keypos_t){ .row = r, .col = c };
- if (keycode == keymap_key_to_keycode(0, key)) return true;
+ for (uint8_t c = 0; c < MATRIX_COLS; c++) {
+ if (matrix_row & ((matrix_row_t)1<<c)) {
+ if (keycode == keymap_key_to_keycode(0, (keypos_t){ .row = r, .col = c })) {
+ return true;
+ }
}
}
}
@@ -124,4 +126,4 @@ bool bootmagic_scan_keycode(uint8_t keycode)
if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false;
return scan_keycode(keycode);
-}
+} \ No newline at end of file
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index 34e1ceeca..81df8eb73 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -51,17 +51,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
#ifdef MATRIX_HAS_GHOST
-static bool is_row_ghosting(uint8_t row){
- matrix_row_t state = matrix_get_row(row);
- /* no ghosting happens when only one key in the row is pressed */
- if (!(state - 1 & state)) return false;
- /* ghosting occurs when two keys in the same column are pressed */
- for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
- if (r != row && matrix_get_row(r) & state) return true;
+static bool has_ghost_in_row(uint8_t row)
+{
+ matrix_row_t matrix_row = matrix_get_row(row);
+ // No ghost exists when less than 2 keys are down on the row
+ if (((matrix_row - 1) & matrix_row) == 0)
+ return false;
+
+ // Ghost occurs when the row shares column line with other row
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ if (i != row && (matrix_get_row(i) & matrix_row))
+ return true;
}
return false;
}
-
#endif
__attribute__ ((weak))
@@ -100,72 +103,86 @@ void keyboard_init(void) {
#endif
}
-/* does routine keyboard jobs */
-void keyboard_task(void) {
- static uint8_t led_status;
+/*
+ * Do keyboard routine jobs: scan mantrix, light LEDs, ...
+ * This is repeatedly called as fast as possible.
+ */
+void keyboard_task(void)
+{
+ static matrix_row_t matrix_prev[MATRIX_ROWS];
+#ifdef MATRIX_HAS_GHOST
+ static matrix_row_t matrix_ghost[MATRIX_ROWS];
+#endif
+ static uint8_t led_status = 0;
+ matrix_row_t matrix_row = 0;
+ matrix_row_t matrix_change = 0;
+
matrix_scan();
- for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
- static matrix_row_t previous_matrix[MATRIX_ROWS];
- matrix_row_t state = matrix_get_row(r);
- matrix_row_t changes = state ^ previous_matrix[r];
- if (changes) {
+ for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
+ matrix_row = matrix_get_row(r);
+ matrix_change = matrix_row ^ matrix_prev[r];
+ if (matrix_change) {
#ifdef MATRIX_HAS_GHOST
- static matrix_row_t deghosting_matrix[MATRIX_ROWS];
- if (is_row_ghosting(r)) {
- /* debugs the deghosting mechanism */
- /* doesn't update previous_matrix until the ghosting has stopped
- * in order to prevent the last key from being lost
+ if (has_ghost_in_row(r)) {
+ /* Keep track of whether ghosted status has changed for
+ * debugging. But don't update matrix_prev until un-ghosted, or
+ * the last key would be lost.
*/
- if (debug_matrix && deghosting_matrix[r] != state) {
+ if (debug_matrix && matrix_ghost[r] != matrix_row) {
matrix_print();
}
- deghosting_matrix[r] = state;
+ matrix_ghost[r] = matrix_row;
continue;
}
- deghosting_matrix[r] = state;
+ matrix_ghost[r] = matrix_row;
#endif
if (debug_matrix) matrix_print();
- for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
- matrix_row_t mask = (matrix_row_t)1 << c;
- if (changes & mask) {
- keyevent_t event;
- event.key = (keypos_t){ .row = r, .col = c };
- event.pressed = state & mask;
- /* the time should not be 0 */
- event.time = timer_read() | 1;
- action_exec(event);
- /* records the processed key event */
- previous_matrix[r] ^= mask;
- /* processes one key event per call */
- goto event_processed;
+ for (uint8_t c = 0; c < MATRIX_COLS; c++) {
+ if (matrix_change & ((matrix_row_t)1<<c)) {
+ action_exec((keyevent_t){
+ .key = (keypos_t){ .row = r, .col = c },
+ .pressed = (matrix_row & ((matrix_row_t)1<<c)),
+ .time = (timer_read() | 1) /* time should not be 0 */
+ });
+ // record a processed key
+ matrix_prev[r] ^= ((matrix_row_t)1<<c);
+ // process a key per task call
+ goto MATRIX_LOOP_END;
}
}
}
}
- /* sends tick events when the keyboard is idle */
+ // call with pseudo tick event when no real key event.
action_exec(TICK);
-event_processed:
+
+MATRIX_LOOP_END:
+
#ifdef MOUSEKEY_ENABLE
- /* repeats and accelerates the mouse keys */
+ // mousekey repeat & acceleration
mousekey_task();
#endif
+
#ifdef PS2_MOUSE_ENABLE
ps2_mouse_task();
#endif
+
#ifdef SERIAL_MOUSE_ENABLE
- serial_mouse_task();
+ serial_mouse_task();
#endif
+
#ifdef ADB_MOUSE_ENABLE
- adb_mouse_task();
+ adb_mouse_task();
#endif
- /* updates the LEDs */
+
+ // update LED
if (led_status != host_keyboard_leds()) {
led_status = host_keyboard_leds();
keyboard_set_leds(led_status);
}
}
-void keyboard_set_leds(uint8_t leds) {
- if (debug_keyboard) dprintf("Keyboard LEDs state: %x\n", leds);
+void keyboard_set_leds(uint8_t leds)
+{
+ if (debug_keyboard) { debug("keyboard_set_led: "); debug_hex8(leds); debug("\n"); }
led_set(leds);
}
diff --git a/tmk_core/common/matrix.h b/tmk_core/common/matrix.h
index 5f2f831b4..71153a5f5 100644
--- a/tmk_core/common/matrix.h
+++ b/tmk_core/common/matrix.h
@@ -20,59 +20,48 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdint.h>
#include <stdbool.h>
-#if MATRIX_COLS <= 8
-typedef uint8_t matrix_row_t;
-#elif MATRIX_COLS <= 16
-typedef uint16_t matrix_row_t;
-#elif MATRIX_COLS <= 32
-typedef uint32_t matrix_row_t;
+
+#if (MATRIX_COLS <= 8)
+typedef uint8_t matrix_row_t;
+#elif (MATRIX_COLS <= 16)
+typedef uint16_t matrix_row_t;
+#elif (MATRIX_COLS <= 32)
+typedef uint32_t matrix_row_t;
#else
-# error "There are too many columns."
+#error "MATRIX_COLS: invalid value"
#endif
-#if DIODE_DIRECTION == ROW2COL
-# if MATRIX_ROWS <= 8
-typedef uint8_t matrix_col_t;
-# elif MATRIX_ROWS <= 16
-typedef uint16_t matrix_col_t;
-# elif MATRIX_ROWS <= 32
-typedef uint32_t matrix_col_t;
-# else
-# error "There are too many rows."
-# endif
-#endif
+#define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1<<col))
-typedef struct {
- uint8_t input_addr:4;
- uint8_t bit:4;
-} io_pin_t;
#ifdef __cplusplus
extern "C" {
#endif
-/* counts the number of rows in the matrix */
+
+/* number of matrix rows */
uint8_t matrix_rows(void);
-/* counts the number of columns in the matrix */
+/* number of matrix columns */
uint8_t matrix_cols(void);
-/* sets up the matrix before matrix_init */
+/* should be called at early stage of startup before matrix_init.(optional) */
void matrix_setup(void);
-/* intializes the matrix */
+/* intialize matrix for scaning. */
void matrix_init(void);
-/* scans the entire matrix */
+/* scan all key states on matrix */
uint8_t matrix_scan(void);
-/* checks if the matrix has been modified */
+/* whether modified from previous scan. used after matrix_scan. */
bool matrix_is_modified(void) __attribute__ ((deprecated));
-/* checks if a key is pressed */
+/* whether a swtich is on */
bool matrix_is_on(uint8_t row, uint8_t col);
-/* inspects the state of a row in the matrix */
+/* matrix state on row */
matrix_row_t matrix_get_row(uint8_t row);
-/* prints the matrix for debugging */
+/* print matrix for debug */
void matrix_print(void);
-/* counts the total number of keys pressed */
-uint8_t matrix_key_count(void);
-/* controls power to the matrix */
+
+
+/* power control */
void matrix_power_up(void);
void matrix_power_down(void);
+
/* executes code for Quantum */
void matrix_init_quantum(void);
void matrix_scan_quantum(void);