summaryrefslogtreecommitdiff
path: root/quantum/template
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2016-04-03 11:14:08 +0200
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2016-04-03 11:23:00 +0200
commit47dd29513eeec7b7f639bef6df441a905ce8bacb (patch)
tree29170847273e786384bd3d7c7781e67dc4335bbb /quantum/template
parent8ef14d09b8451b3f2a77e6f019922eae0ac43642 (diff)
parent8d39263d2444f0273327902684c802b218efb7b6 (diff)
Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware into modifier-release-fix
Diffstat (limited to 'quantum/template')
-rw-r--r--quantum/template/Makefile23
-rw-r--r--quantum/template/README.md2
-rw-r--r--quantum/template/config.h92
-rw-r--r--quantum/template/template.c49
-rw-r--r--quantum/template/template.h10
5 files changed, 137 insertions, 39 deletions
diff --git a/quantum/template/Makefile b/quantum/template/Makefile
index 2efa691380..4fa195468d 100644
--- a/quantum/template/Makefile
+++ b/quantum/template/Makefile
@@ -113,18 +113,19 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512
# Build Options
# comment out to disable the options.
#
-BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
-EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
-CONSOLE_ENABLE = yes # Console for debug(+400)
-COMMAND_ENABLE = yes # Commands for debug and configuration
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
+CONSOLE_ENABLE = yes # Console for debug(+400)
+COMMAND_ENABLE = yes # 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 = yes # Breathing sleep LED during USB suspend
-# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
-# MIDI_ENABLE = YES # MIDI controls
-# UNICODE_ENABLE = YES # Unicode
-# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
+# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+# MIDI_ENABLE = YES # MIDI controls
+# UNICODE_ENABLE = YES # Unicode
+# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
# Optimize size but this may cause error "relocation truncated to fit"
diff --git a/quantum/template/README.md b/quantum/template/README.md
index dc163a2f4b..39f9f59d10 100644
--- a/quantum/template/README.md
+++ b/quantum/template/README.md
@@ -15,7 +15,7 @@ Depending on which keymap you would like to use, you will have to compile slight
To build with the default keymap, simply run `make`.
### Other Keymaps
-Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `<name>.c` and see keymap document (you can find in top README.md) and existent keymap files.
+Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `<name>.c` in the keymaps folder, and see keymap document (you can find in top README.md) and existent keymap files.
To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like:
```
diff --git a/quantum/template/config.h b/quantum/template/config.h
index 7d6149f436..e6fb7866c6 100644
--- a/quantum/template/config.h
+++ b/quantum/template/config.h
@@ -32,34 +32,110 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 2
#define MATRIX_COLS 3
-// Planck PCB default pin-out
-// Change this to how you wired your keyboard
-// COLS: Left to right, ROWS: Top to bottom
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+*/
#define COLS (int []){ F1, F0, B0 }
#define ROWS (int []){ D0, D5 }
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
-/* define if matrix has ghost */
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCE 5
+
+/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
#define BACKLIGHT_LEVELS 3
-/* 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 */
+/*
+ * Force NKRO
+ *
+ * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
+ * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
+ * makefile for this to work.)
+ *
+ * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
+ * until the next keyboard reset.
+ *
+ * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
+ * fully operational during normal computer usage.
+ *
+ * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
+ * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
+ * bootmagic, NKRO mode will always be enabled until it is toggled again during a
+ * power-up.
+ *
+ */
+//#define FORCE_NKRO
+
+/*
+ * Magic Key Options
+ *
+ * Magic keys are hotkey commands that allow control over firmware functions of
+ * the keyboard. They are best used in combination with the HID Listen program,
+ * found here: https://www.pjrc.com/teensy/hid_listen.html
+ *
+ * The options below allow the magic key functionality to be changed. This is
+ * useful if your keyboard/keypad is missing keys and you want magic key support.
+ *
+ */
+
+/* key combination for magic key command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
+/* control how magic key switches layers */
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
+
+/* override magic key keymap */
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
+//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
+//#define MAGIC_KEY_HELP1 H
+//#define MAGIC_KEY_HELP2 SLASH
+//#define MAGIC_KEY_DEBUG D
+//#define MAGIC_KEY_DEBUG_MATRIX X
+//#define MAGIC_KEY_DEBUG_KBD K
+//#define MAGIC_KEY_DEBUG_MOUSE M
+//#define MAGIC_KEY_VERSION V
+//#define MAGIC_KEY_STATUS S
+//#define MAGIC_KEY_CONSOLE C
+//#define MAGIC_KEY_LAYER0_ALT1 ESC
+//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
+//#define MAGIC_KEY_LAYER0 0
+//#define MAGIC_KEY_LAYER1 1
+//#define MAGIC_KEY_LAYER2 2
+//#define MAGIC_KEY_LAYER3 3
+//#define MAGIC_KEY_LAYER4 4
+//#define MAGIC_KEY_LAYER5 5
+//#define MAGIC_KEY_LAYER6 6
+//#define MAGIC_KEY_LAYER7 7
+//#define MAGIC_KEY_LAYER8 8
+//#define MAGIC_KEY_LAYER9 9
+//#define MAGIC_KEY_BOOTLOADER PAUSE
+//#define MAGIC_KEY_LOCK CAPS
+//#define MAGIC_KEY_EEPROM E
+//#define MAGIC_KEY_NKRO N
+//#define MAGIC_KEY_SLEEP_LED Z
+
/*
* Feature disable options
* These options are also useful to firmware size reduction.
diff --git a/quantum/template/template.c b/quantum/template/template.c
index 7be7dfc3d1..cc52e496ff 100644
--- a/quantum/template/template.c
+++ b/quantum/template/template.c
@@ -1,29 +1,48 @@
#include "%KEYBOARD%.h"
__attribute__ ((weak))
-void * matrix_init_user(void) {
- // leave these blank
+void matrix_init_user(void) {
+ // leave this function blank - it can be defined in a keymap file
};
__attribute__ ((weak))
-void * matrix_scan_user(void) {
- // leave these blank
-};
+void matrix_scan_user(void) {
+ // leave this function blank - it can be defined in a keymap file
+}
+
+__attribute__ ((weak))
+void process_action_user(keyrecord_t *record) {
+ // leave this function blank - it can be defined in a keymap file
+}
+
+__attribute__ ((weak))
+void led_set_user(uint8_t usb_led) {
+ // leave this function blank - it can be defined in a keymap file
+}
-void * matrix_init_kb(void) {
+void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
- if (matrix_init_user) {
- (*matrix_init_user)();
- }
-};
+ matrix_init_user();
+}
-void * matrix_scan_kb(void) {
+void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
- if (matrix_scan_user) {
- (*matrix_scan_user)();
- }
-}; \ No newline at end of file
+ matrix_scan_user();
+}
+
+void process_action_kb(keyrecord_t *record) {
+ // put your per-action keyboard code here
+ // runs for every action, just before processing by the firmware
+
+ process_action_user(record);
+}
+
+void led_set_kb(uint8_t usb_led) {
+ // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
+
+ led_set_user(usb_led);
+}
diff --git a/quantum/template/template.h b/quantum/template/template.h
index a15061b267..b1c34d3cbe 100644
--- a/quantum/template/template.h
+++ b/quantum/template/template.h
@@ -17,9 +17,11 @@
{ \
{ k00, k01, k02 }, \
{ k10, KC_NO, k11 }, \
-}
+}
-void * matrix_init_user(void);
-void * matrix_scan_user(void);
+void matrix_init_user(void);
+void matrix_scan_user(void);
+void process_action_user(keyrecord_t *record);
+void led_set_user(uint8_t usb_led);
-#endif \ No newline at end of file
+#endif