From 641859df84bf40025b2c14319d1a168a435562e2 Mon Sep 17 00:00:00 2001 From: yoyoerx Date: Thu, 10 Mar 2016 11:28:34 -0500 Subject: Addressed void* return warning in all keymaps --- quantum/template/template.c | 26 ++++++++++---------------- quantum/template/template.h | 4 ++-- 2 files changed, 12 insertions(+), 18 deletions(-) (limited to 'quantum/template') diff --git a/quantum/template/template.c b/quantum/template/template.c index 7be7dfc3d1..7dcd67cfcf 100644 --- a/quantum/template/template.c +++ b/quantum/template/template.c @@ -1,29 +1,23 @@ #include "%KEYBOARD%.h" __attribute__ ((weak)) -void * matrix_init_user(void) { +void matrix_init_user(void) { // leave these blank -}; +} __attribute__ ((weak)) -void * matrix_scan_user(void) { +void matrix_scan_user(void) { // leave these blank -}; +} -void * matrix_init_kb(void) { +void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up + matrix_init_user(); +} - if (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(); +} \ No newline at end of file diff --git a/quantum/template/template.h b/quantum/template/template.h index a15061b267..1171dc8e0f 100644 --- a/quantum/template/template.h +++ b/quantum/template/template.h @@ -19,7 +19,7 @@ { k10, KC_NO, k11 }, \ } -void * matrix_init_user(void); -void * matrix_scan_user(void); +void matrix_init_user(void); +void matrix_scan_user(void); #endif \ No newline at end of file -- cgit v1.2.1 From eba9a7d74db0be548cddc107f0370dabf43b017f Mon Sep 17 00:00:00 2001 From: IBNobody Date: Tue, 15 Mar 2016 23:52:51 -0500 Subject: Adding LED function pointers --- quantum/template/template.c | 29 ++++++++++++++++++++++++----- quantum/template/template.h | 1 + 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'quantum/template') diff --git a/quantum/template/template.c b/quantum/template/template.c index 7be7dfc3d1..016e113007 100644 --- a/quantum/template/template.c +++ b/quantum/template/template.c @@ -2,28 +2,47 @@ __attribute__ ((weak)) void * matrix_init_user(void) { - // leave these blank + // leave this function blank - it can be defined in a keymap file + return NULL; }; __attribute__ ((weak)) void * matrix_scan_user(void) { - // leave these blank + // leave this function blank - it can be defined in a keymap file + return NULL; +}; + +__attribute__ ((weak)) +void * led_set_user(uint8_t usb_led) { + // leave this function blank - it can be defined in a keymap file + return NULL; }; 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)(); } + return NULL; }; void * matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) + // put your looping keyboard code here + // runs every cycle (a lot) if (matrix_scan_user) { (*matrix_scan_user)(); } + return NULL; +}; + +void * led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + if (led_set_user) { + (*led_set_user)(usb_led); + } + return NULL; }; \ No newline at end of file diff --git a/quantum/template/template.h b/quantum/template/template.h index a15061b267..ed17ca0016 100644 --- a/quantum/template/template.h +++ b/quantum/template/template.h @@ -21,5 +21,6 @@ void * matrix_init_user(void); void * matrix_scan_user(void); +void * led_set_user(uint8_t usb_led); #endif \ No newline at end of file -- cgit v1.2.1 From 3d56ec052ed485d4b717da930c4024b4a3f792e0 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Tue, 22 Mar 2016 21:06:22 -0500 Subject: Fixed extra semicolons. Fixed extra semicolons. --- quantum/template/template.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'quantum/template') diff --git a/quantum/template/template.c b/quantum/template/template.c index 828afb18c1..58e73cb09f 100644 --- a/quantum/template/template.c +++ b/quantum/template/template.c @@ -3,37 +3,34 @@ __attribute__ ((weak)) void matrix_init_user(void) { // leave this function blank - it can be defined in a keymap file - return NULL; }; __attribute__ ((weak)) void matrix_scan_user(void) { // leave this function blank - it can be defined in a keymap file - return NULL; -}; +} __attribute__ ((weak)) void led_set_user(uint8_t usb_led) { // leave this function blank - it can be defined in a keymap file - return NULL; -}; +} void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up matrix_init_user(); -}; +} void matrix_scan_kb(void) { // put your looping keyboard code here // runs every cycle (a lot) matrix_scan_user(); -}; +} 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); -}; \ No newline at end of file +} \ No newline at end of file -- cgit v1.2.1 From 577971ab07a49405e1dcd8e5f75b3ecb87e710b9 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Mon, 28 Mar 2016 00:03:21 -0500 Subject: Magic Key Overrides / Keyboard Lock / Forced NKRO Added Magic Key Overrides / Magic Key Cleanup / Added Keyboard Lock option to template / Added forced NKRO option to template (disabled by default) --- quantum/template/Makefile | 23 ++++++++++++----------- quantum/template/config.h | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 12 deletions(-) (limited to 'quantum/template') 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/config.h b/quantum/template/config.h index 7d6149f436..dae4b63130 100644 --- a/quantum/template/config.h +++ b/quantum/template/config.h @@ -55,11 +55,56 @@ along with this program. If not, see . /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE -/* key combination for command */ +/* Force NKRO Mode - If forced on, must be disabled via magic key (default = LShift+RShift+N) */ +//#define FORCE_NKRO + +/* + * Magic key options + * These options 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. -- cgit v1.2.1 From 2181be029e01d9cf46ae3cadcdf25f5bca02c631 Mon Sep 17 00:00:00 2001 From: Damien Pollet Date: Mon, 28 Mar 2016 16:13:37 +0200 Subject: Add action-preprocessing hook to keyboard template --- quantum/template/template.c | 20 ++++++++++++++++---- quantum/template/template.h | 5 +++-- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'quantum/template') diff --git a/quantum/template/template.c b/quantum/template/template.c index 58e73cb09f..cc52e496ff 100644 --- a/quantum/template/template.c +++ b/quantum/template/template.c @@ -10,6 +10,11 @@ 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 @@ -18,19 +23,26 @@ void led_set_user(uint8_t usb_led) { void matrix_init_kb(void) { // put your keyboard start-up code here // runs once when the firmware starts up - + matrix_init_user(); } void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) + // put your looping keyboard code here + // runs every cycle (a lot) 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); -} \ No newline at end of file +} diff --git a/quantum/template/template.h b/quantum/template/template.h index ba91abac3e..b1c34d3cbe 100644 --- a/quantum/template/template.h +++ b/quantum/template/template.h @@ -17,10 +17,11 @@ { \ { k00, k01, k02 }, \ { k10, KC_NO, k11 }, \ -} +} 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 -- cgit v1.2.1 From 1d13aa933bbb57bf0c1fe0196981b81233c3df97 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Mon, 28 Mar 2016 19:45:20 -0500 Subject: Minor Tweaks and Documentation Fixed compiler warning by including bootloader.h in keymap_common.c. Changed FORCE_NKRO to only be applied if NKRO_ENABLE is defined. Added extra documentation to the template config.h --- quantum/template/config.h | 53 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 11 deletions(-) (limited to 'quantum/template') diff --git a/quantum/template/config.h b/quantum/template/config.h index dae4b63130..e6fb7866c6 100644 --- a/quantum/template/config.h +++ b/quantum/template/config.h @@ -32,36 +32,67 @@ along with this program. If not, see . #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 -/* Force NKRO Mode - If forced on, must be disabled via magic key (default = LShift+RShift+N) */ +/* + * 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 - * These options allow the magic key functionality to be changed. This is useful - * if your keyboard/keypad is missing keys and you want magic key support. + * 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 */ -- cgit v1.2.1 From 95fba250ef2029ccdedb34500c5d1e96f6d065cf Mon Sep 17 00:00:00 2001 From: Noah Andrews Date: Tue, 29 Mar 2016 21:53:36 -0400 Subject: Updated several keyboard folders to use new keymap naming scheme --- quantum/template/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quantum/template') 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 `.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 `.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: ``` -- cgit v1.2.1