diff options
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/audio.c | 3 | ||||
-rw-r--r-- | quantum/keymap_common.c | 1 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_german_osx.h | 156 | ||||
-rw-r--r-- | quantum/keymap_midi.c | 4 | ||||
-rw-r--r-- | quantum/template/Makefile | 23 | ||||
-rw-r--r-- | quantum/template/README.md | 2 | ||||
-rw-r--r-- | quantum/template/config.h | 92 | ||||
-rw-r--r-- | quantum/template/template.c | 20 | ||||
-rw-r--r-- | quantum/template/template.h | 5 |
9 files changed, 200 insertions, 106 deletions
diff --git a/quantum/audio.c b/quantum/audio.c index 3a3a1a4910..f29d941d7c 100644 --- a/quantum/audio.c +++ b/quantum/audio.c @@ -247,6 +247,9 @@ ISR(TIMER3_COMPA_vect) { if (note_frequency > 0) { ICR3 = (int)(((double)F_CPU) / note_frequency); // Set max to the period OCR3A = (int)(((double)F_CPU) / note_frequency) >> 1; // Set compare to half the period + } else { + ICR3 = 0; + OCR3A = 0; } #endif diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 7068ca4f31..2eef4f15a7 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "debug.h" #include "backlight.h" #include "keymap_midi.h" +#include "bootloader.h" #include <stdio.h> #include <inttypes.h> diff --git a/quantum/keymap_extras/keymap_german_osx.h b/quantum/keymap_extras/keymap_german_osx.h index da91b4bf46..d0b77fb803 100644 --- a/quantum/keymap_extras/keymap_german_osx.h +++ b/quantum/keymap_extras/keymap_german_osx.h @@ -9,92 +9,92 @@ // Alt gr // normal characters -#define DE_Z KC_Y -#define DE_Y KC_Z +#define DE_OSX_Z KC_Y +#define DE_OSX_Y KC_Z -#define DE_A KC_A -#define DE_B KC_B -#define DE_C KC_C -#define DE_D KC_D -#define DE_E KC_E -#define DE_F KC_F -#define DE_G KC_G -#define DE_H KC_H -#define DE_I KC_I -#define DE_J KC_J -#define DE_K KC_K -#define DE_L KC_L -#define DE_M KC_M -#define DE_N KC_N -#define DE_O KC_O -#define DE_P KC_P -#define DE_Q KC_Q -#define DE_R KC_R -#define DE_S KC_S -#define DE_T KC_T -#define DE_U KC_U -#define DE_V KC_V -#define DE_W KC_W -#define DE_X KC_X +#define DE_OSX_A KC_A +#define DE_OSX_B KC_B +#define DE_OSX_C KC_C +#define DE_OSX_D KC_D +#define DE_OSX_E KC_E +#define DE_OSX_F KC_F +#define DE_OSX_G KC_G +#define DE_OSX_H KC_H +#define DE_OSX_I KC_I +#define DE_OSX_J KC_J +#define DE_OSX_K KC_K +#define DE_OSX_L KC_L +#define DE_OSX_M KC_M +#define DE_OSX_N KC_N +#define DE_OSX_O KC_O +#define DE_OSX_P KC_P +#define DE_OSX_Q KC_Q +#define DE_OSX_R KC_R +#define DE_OSX_S KC_S +#define DE_OSX_T KC_T +#define DE_OSX_U KC_U +#define DE_OSX_V KC_V +#define DE_OSX_W KC_W +#define DE_OSX_X KC_X -#define DE_0 KC_0 -#define DE_1 KC_1 -#define DE_2 KC_2 -#define DE_3 KC_3 -#define DE_4 KC_4 -#define DE_5 KC_5 -#define DE_6 KC_6 -#define DE_7 KC_7 -#define DE_8 KC_8 -#define DE_9 KC_9 +#define DE_OSX_0 KC_0 +#define DE_OSX_1 KC_1 +#define DE_OSX_2 KC_2 +#define DE_OSX_3 KC_3 +#define DE_OSX_4 KC_4 +#define DE_OSX_5 KC_5 +#define DE_OSX_6 KC_6 +#define DE_OSX_7 KC_7 +#define DE_OSX_8 KC_8 +#define DE_OSX_9 KC_9 -#define DE_DOT KC_DOT -#define DE_COMM KC_COMM +#define DE_OSX_DOT KC_DOT +#define DE_OSX_COMM KC_COMM -#define DE_SS KC_MINS -#define DE_AE KC_QUOT -#define DE_UE KC_LBRC -#define DE_OE KC_SCLN +#define DE_OSX_SS KC_MINS +#define DE_OSX_AE KC_QUOT +#define DE_OSX_UE KC_LBRC +#define DE_OSX_OE KC_SCLN -#define DE_CIRC KC_NUBS // accent circumflex ^ and ring ° -#define DE_ACUT KC_EQL // accent acute ´ and grave ` -#define DE_PLUS KC_RBRC // + and * and ~ -#define DE_HASH KC_BSLS // # and ' -#define DE_LESS KC_GRV // < and > and | -#define DE_MINS KC_SLSH // - and _ +#define DE_OSX_CIRC KC_NUBS // accent circumflex ^ and ring ° +#define DE_OSX_ACUT KC_EQL // accent acute ´ and grave ` +#define DE_OSX_PLUS KC_RBRC // + and * and ~ +#define DE_OSX_HASH KC_BSLS // # and ' +#define DE_OSX_LESS KC_GRV // < and > and | +#define DE_OSX_MINS KC_SLSH // - and _ // shifted characters -#define DE_RING LSFT(DE_CIRC) // ° -#define DE_EXLM LSFT(KC_1) // ! -#define DE_DQOT LSFT(KC_2) // " -#define DE_PARA LSFT(KC_3) // § -#define DE_DLR LSFT(KC_4) // $ -#define DE_PERC LSFT(KC_5) // % -#define DE_AMPR LSFT(KC_6) // & -#define DE_SLSH LSFT(KC_7) // / -#define DE_LPRN LSFT(KC_8) // ( -#define DE_RPRN LSFT(KC_9) // ) -#define DE_EQL LSFT(KC_0) // = -#define DE_QST LSFT(DE_SS) // ? -#define DE_GRV LSFT(DE_ACUT) // ` -#define DE_ASTR LSFT(DE_PLUS) // * -#define DE_QUOT LSFT(DE_HASH) // ' -#define DE_MORE LSFT(DE_LESS) // > -#define DE_COLN LSFT(KC_DOT) // : -#define DE_SCLN LSFT(KC_COMM) // ; -#define DE_UNDS LSFT(DE_MINS) // _ +#define DE_OSX_RING LSFT(DE_OSX_CIRC) // ° +#define DE_OSX_EXLM LSFT(KC_1) // ! +#define DE_OSX_DQOT LSFT(KC_2) // " +#define DE_OSX_PARA LSFT(KC_3) // § +#define DE_OSX_DLR LSFT(KC_4) // $ +#define DE_OSX_PERC LSFT(KC_5) // % +#define DE_OSX_AMPR LSFT(KC_6) // & +#define DE_OSX_SLSH LSFT(KC_7) // / +#define DE_OSX_LPRN LSFT(KC_8) // ( +#define DE_OSX_RPRN LSFT(KC_9) // ) +#define DE_OSX_EQL LSFT(KC_0) // = +#define DE_OSX_QST LSFT(DE_OSX_SS) // ? +#define DE_OSX_GRV LSFT(DE_OSX_ACUT) // ` +#define DE_OSX_ASTR LSFT(DE_OSX_PLUS) // * +#define DE_OSX_QUOT LSFT(DE_OSX_HASH) // ' +#define DE_OSX_MORE LSFT(DE_OSX_LESS) // > +#define DE_OSX_COLN LSFT(KC_DOT) // : +#define DE_OSX_SCLN LSFT(KC_COMM) // ; +#define DE_OSX_UNDS LSFT(DE_OSX_MINS) // _ // Alt-ed characters -#define DE_SQ2 LALT(KC_2) // ² -#define DE_SQ3 LALT(KC_3) // ³ -#define DE_LCBR LALT(KC_8) // { -#define DE_LBRC LALT(KC_5) // [ -#define DE_RBRC LALT(KC_6) // ] -#define DE_RCBR LALT(KC_9) // } -#define DE_BSLS LALT(LSFT(KC_7)) // backslash -#define DE_AT LALT(DE_L) // @ -#define DE_EURO LALT(KC_E) // € -#define DE_TILD LALT(DE_N) // ~ -#define DE_PIPE LALT(DE_7) // | +#define DE_OSX_SQ2 LALT(KC_2) // ² +#define DE_OSX_SQ3 LALT(KC_3) // ³ +#define DE_OSX_LCBR LALT(KC_8) // { +#define DE_OSX_LBRC LALT(KC_5) // [ +#define DE_OSX_RBRC LALT(KC_6) // ] +#define DE_OSX_RCBR LALT(KC_9) // } +#define DE_OSX_BSLS LALT(LSFT(KC_7)) // backslash +#define DE_OSX_AT LALT(DE_OSX_L) // @ +#define DE_OSX_EURO LALT(KC_E) // € +#define DE_OSX_TILD LALT(DE_OSX_N) // ~ +#define DE_OSX_PIPE LALT(DE_OSX_7) // | #endif diff --git a/quantum/keymap_midi.c b/quantum/keymap_midi.c index e37ea31039..ac45d25892 100644 --- a/quantum/keymap_midi.c +++ b/quantum/keymap_midi.c @@ -99,11 +99,11 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { // midi_send_noteon(&midi_device, record->event.key.row, starting_note + SCALE[record->event.key.col], 127); - midi_send_noteon(&midi_device, 0, (starting_note + SCALE[record->event.key.col + offset])+12*(MATRIX_ROWS - record->event.key.row), 127); + // midi_send_noteon(&midi_device, 0, (starting_note + SCALE[record->event.key.col + offset])+12*(MATRIX_ROWS - record->event.key.row), 127); play_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); } else { // midi_send_noteoff(&midi_device, record->event.key.row, starting_note + SCALE[record->event.key.col], 127); - midi_send_noteoff(&midi_device, 0, (starting_note + SCALE[record->event.key.col + offset])+12*(MATRIX_ROWS - record->event.key.row), 127); + // midi_send_noteoff(&midi_device, 0, (starting_note + SCALE[record->event.key.col + offset])+12*(MATRIX_ROWS - record->event.key.row), 127); stop_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); } }
\ No newline at end of file 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 58e73cb09f..cc52e496ff 100644 --- a/quantum/template/template.c +++ b/quantum/template/template.c @@ -11,6 +11,11 @@ void matrix_scan_user(void) { } __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 |