diff options
22 files changed, 1081 insertions, 475 deletions
| @@ -473,7 +473,7 @@ if [ $$error_occured -gt 0 ]; then echo $$error_occured > $(ERROR_FILE); fi;  endef  define RUN_TEST  +error_occured=0;\ -$($(TEST)_COMMAND))\ +$($(TEST)_COMMAND)\  if [ $$error_occured -gt 0 ]; then echo $$error_occured > $(ERROR_FILE); fi;  endef @@ -485,11 +485,11 @@ $(SUBPROJECTS): %: %-allkm  # Let's match everything, we handle all the rule parsing ourselves  .PHONY: % -ifndef SKIP_GIT  %:  	# Check if we have the CMP tool installed  	cmp --version >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;  	# Check if the submodules are dirty, and display a warning if they are +ifndef SKIP_GIT  	git submodule status --recursive 2>/dev/null | \  	while IFS= read -r x; do \  		case "$$x" in \ @@ -497,6 +497,7 @@ ifndef SKIP_GIT  			*) printf "$(MSG_SUBMODULE_DIRTY)";break;; \  		esac \  	done +endif  	rm -f $(ERROR_FILE) > /dev/null 2>&1  	$(eval $(call PARSE_RULE,$@))  	$(eval $(call SET_SILENT_MODE)) @@ -508,22 +509,6 @@ ifndef SKIP_GIT  	if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi;  	$(foreach TEST,$(TESTS),$(RUN_TEST))  	if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi; -else -%: -	# Check if we have the CMP tool installed -	cmp --version >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi; -	rm -f $(ERROR_FILE) > /dev/null 2>&1 -	$(eval $(call PARSE_RULE,$@)) -	$(eval $(call SET_SILENT_MODE)) -	# Run all the commands in the same shell, notice the + at the first line -	# it has to be there to allow parallel execution of the submake -	# This always tries to compile everything, even if error occurs in the middle -	# But we return the error code at the end, to trigger travis failures -	$(foreach COMMAND,$(COMMANDS),$(RUN_COMMAND)) -	if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi; -	$(foreach TEST,$(TESTS),$(RUN_TEST)) -	if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi; -endif  # All should compile everything  .PHONY: all diff --git a/keyboards/ergodox/keymaps/algernon/NEWS.md b/keyboards/ergodox/keymaps/algernon/NEWS.md index e11998998c..ee9d606708 100644 --- a/keyboards/ergodox/keymaps/algernon/NEWS.md +++ b/keyboards/ergodox/keymaps/algernon/NEWS.md @@ -1,5 +1,19 @@  <!-- -*- mode: markdown; fill-column: 8192 -*- --> +## v1.10 + +*2016-12-28* + +### Miscellaneous + +* `µ` can now be entered with UCIS. +* `™` can now be entered with UCIS. + +### Tools + +* `tools/hid-commands` can now find Banshee, and prefers it over Kodi. +* `tools/hid-commands` can now find Chrome too, not juts Chromium. +  ## v1.9  *2016-10-16* diff --git a/keyboards/ergodox/keymaps/algernon/keymap.c b/keyboards/ergodox/keymaps/algernon/keymap.c index bad2403378..b615f3f5fd 100644 --- a/keyboards/ergodox/keymaps/algernon/keymap.c +++ b/keyboards/ergodox/keymaps/algernon/keymap.c @@ -96,8 +96,6 @@ enum {  uint16_t gui_timer = 0; -uint16_t kf_timers[12]; -  #if KEYLOGGER_ENABLE  # ifdef AUTOLOG_ENABLE  bool log_enable = true; @@ -786,7 +784,7 @@ static void ang_tap_dance_tmux_pane_select (qk_tap_dance_state_t *state, void *u    if (state->count >= 2) {      kc = KC_Z;    } -   +    register_code(KC_LALT);    register_code(KC_SPC);    unregister_code(KC_SPC); @@ -1040,7 +1038,9 @@ const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE   UCIS_SYM("heart", 0x2764),   UCIS_SYM("bolt", 0x26a1),   UCIS_SYM("pi", 0x03c0), - UCIS_SYM("mouse", 0x1f401) + UCIS_SYM("mouse", 0x1f401), + UCIS_SYM("micro", 0x00b5), + UCIS_SYM("tm", 0x2122)  );  bool process_record_user (uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/ergodox/keymaps/algernon/tools/hid-commands b/keyboards/ergodox/keymaps/algernon/tools/hid-commands index a29d38f414..54ca7556ab 100755 --- a/keyboards/ergodox/keymaps/algernon/tools/hid-commands +++ b/keyboards/ergodox/keymaps/algernon/tools/hid-commands @@ -16,7 +16,8 @@ _cmd_appsel () {  }  cmd_appsel_music () { -    wmctrl -x -a rhythmbox || wmctrl -x -a spotify || wmctrl -x -a kodi || true +    wmctrl -x -a rhythmbox || wmctrl -x -a spotify || \ +        wmctrl -x -a banshee || wmctrl -x -a kodi || true      xdotool key Escape  } @@ -33,7 +34,7 @@ cmd_appsel_term () {  }  cmd_appsel_chrome () { -    _cmd_appsel chromium +    _cmd_appsel chrom  }  cmd_appsel_start () { diff --git a/keyboards/gh60/gh60.h b/keyboards/gh60/gh60.h index 66bc2790d2..99ccf17574 100644 --- a/keyboards/gh60/gh60.h +++ b/keyboards/gh60/gh60.h @@ -72,4 +72,4 @@ inline void gh60_wasd_leds_off(void)   	{ DDRF &= ~(1<<7); PORTF &= ~(1<<7); }      { K40, K41, K42, KC_NO,    KC_NO,    K45, KC_NO,    KC_NO,    KC_NO,    K49, K4A, K4B, K4C, K4D }  \  } -#endif +#endif
\ No newline at end of file diff --git a/keyboards/gh60/keymaps/dbroqua/Makefile b/keyboards/gh60/keymaps/dbroqua/Makefile new file mode 100644 index 0000000000..f1644a8e49 --- /dev/null +++ b/keyboards/gh60/keymaps/dbroqua/Makefile @@ -0,0 +1,112 @@ +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device. +#                Please customize your programmer settings(PROGRAM_CMD) +# +# make teensy = Download the hex file to the device, using teensy_loader_cli. +#               (must have teensy_loader_cli installed). +# +# make dfu = Download the hex file to the device, using dfu-programmer (must +#            have dfu-programmer installed). +# +# make flip = Download the hex file to the device, using Atmel FLIP (must +#             have Atmel FLIP installed). +# +# make dfu-ee = Download the eeprom file to the device, using dfu-programmer +#               (must have dfu-programmer installed). +# +# make flip-ee = Download the eeprom file to the device, using Atmel FLIP +#                (must have Atmel FLIP installed). +# +# make debug = Start either simulavr or avarice as specified for debugging,  +#              with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +#                   bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +#     This will define a symbol, F_CPU, in all source code files equal to the +#     processor frequency in Hz. You can then use this symbol in your source code to +#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done +#     automatically to create a 32-bit value in your source code. +# +#     This will be an integer division of F_USB below, as it is sourced by +#     F_USB after it has run through any CPU prescalers. Note that this value +#     does not *change* the processor frequency - it should merely be updated to +#     reflect the processor speed set externally so that the code can use accurate +#     software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +#     This will define a symbol, F_USB, in all source code files equal to the +#     input clock frequency (before any prescaling is performed) in Hz. This value may +#     differ from F_CPU if prescaling is used on the latter, and is required as the +#     raw input clock is fed directly to the PLL sections of the AVR for high speed +#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +#     at the end, this will be done automatically to create a 32-bit value in your +#     source code. +# +#     If no clock division is performed on the input clock inside the AVR (via the +#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +#   Teensy halfKay   512 +#   Teensy++ halfKay 1024 +#   Atmel DFU loader 4096 +#   LUFA bootloader  4096 +#   USBaspLoader     2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +#   comment out to disable the options. +# +BOOTMAGIC_ENABLE ?= yes		# Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes		# Mouse keys(+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 +RGBLIGHT_ENABLE ?= yes    # Enable RGB Underglow + +ifndef QUANTUM_DIR +	include ../../../../Makefile +endif + diff --git a/keyboards/gh60/keymaps/dbroqua/config.h b/keyboards/gh60/keymaps/dbroqua/config.h new file mode 100644 index 0000000000..75ccec0973 --- /dev/null +++ b/keyboards/gh60/keymaps/dbroqua/config.h @@ -0,0 +1,187 @@ +/* +Copyright 2012 Jun Wako <[email protected]> + +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   0x6060 +#define DEVICE_VER   0x0001 +#define MANUFACTURER    geekhack +#define PRODUCT         GH60 +#define DESCRIPTION     t.m.k. keyboard firmware for GH60 + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 14 + +/* + * 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 MATRIX_ROW_PINS { D0, D1, D2, D3, D5 } +#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B6, D4, B1, B7, B5, B4, D7, D6, B3 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 3 + +/* 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 + * + * 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. + */ + +/* 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 + +/* + * RGB Underglow + * These settings are for the F4 by default: + *  + * + * #define ws2812_PORTREG  PORTF + * #define ws2812_DDRREG   DDRF + * #define ws2812_pin PF4 + * #define RGBLED_NUM 14     // Number of LEDs + * #define RGBLIGHT_HUE_STEP 10 + * #define RGBLIGHT_SAT_STEP 17 + * #define RGBLIGHT_VAL_STEP 17 + * + * The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects.  + * To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations.  + * For details, please check this keymap. keyboard/planck/keymaps/yang/keymap.c +*/ + +/* Deprecated code below +#define ws2812_PORTREG  PORTF  +#define ws2812_DDRREG   DDRF +#define ws2812_pin PF4 +*/  +#define RGB_DI_PIN F4 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 11         // Number of LEDs +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#endif diff --git a/keyboards/gh60/keymaps/dbroqua/keymap.c b/keyboards/gh60/keymaps/dbroqua/keymap.c new file mode 100644 index 0000000000..be88edc090 --- /dev/null +++ b/keyboards/gh60/keymaps/dbroqua/keymap.c @@ -0,0 +1,198 @@ +#include "gh60.h" +#include "action_layer.h" +#include "rgblight.h" + +#define _DEFAULT 0 +#define _FN 1 +#define _WASD 2 +#define _SFX 3 + +//bool esc_led_on; + +enum planck_keycodes { +  DEFAULT = SAFE_RANGE +}; + +// Fillers to make layering more clear +#define ______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Qwerty gui/alt/space/alt/gui + * ,-----------------------------------------------------------------------------------------. + * | Esc |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  -  |  =  |  \  |  `  | + * |-----------------------------------------------------------------------------------------+ + * | Tab    |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |  O  |  P  |  [  |  ]  |  Bksp  | + * |-----------------------------------------------------------------------------------------+ + * | Ctrl    |  A  |  S  |  D  |  F  |  G  |  H  |  J  |  K  |  L  |  ;  |  '  |    Enter    | + * |-----------------------------------------------------------------------------------------+ + * | Shift     |  Z  |  X  |  C  |  V  |  B  |  N  |  M  |  ,  |  .  |  /  | RShift    | FN  | + * |-----------------------------------------------------------------------------------------+ + *         |LGUI | LAlt  |               Space                | RAlt   |RGUI | + *         `-----------------------------------------------------------------' + */ +  [_DEFAULT] = KEYMAP_HHKB( /* Basic QWERTY */ +      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_BSLS, KC_GRV, \ +      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_BSPC,  \ +      KC_LCTL, KC_A,    KC_S,    KC_D, KC_F, KC_G,   KC_H, KC_J, KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_ENT,  \ +      KC_LSFT, KC_Z,    KC_X,    KC_C, KC_V, KC_B,   KC_N, KC_M, KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT, MO(_FN), \ +      ______,  KC_LGUI, KC_LALT,             KC_SPC,             KC_RALT, KC_RGUI, ______,  ______ \ +      ), + +/* FN Layer + * ,-----------------------------------------------------------------------------------------. + * |     | F1  | F2  | F3  | F4  | F5  | F6  | F7  | F8  | F9  | F10 | F11 | F12 | Ins | Del | + * |-----------------------------------------------------------------------------------------+ + * |  CAPS  |     |     |     |     |     |     |     | Psc | Slck| Paus| Up  |     |        | + * |-----------------------------------------------------------------------------------------+ + * |         | Vol-| Vol+| Mute|     |     | *   | /   | Home| PgUp| Left|Right|             | + * |-----------------------------------------------------------------------------------------+ + * |           | Prev| Play| Next|     |     | +   | -   | End  |PgDn| Down|           |     | + * |-----------------------------------------------------------------------------------------+ + *         |       |       |                                 | Stop  |       | + *         `-----------------------------------------------------------------' + */ +  [_FN] = KEYMAP_HHKB( /* Layer 1 */ +      TG(_SFX),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_INS,  KC_DEL, \ +      KC_CAPS, ______,  ______,  ______,  ______, ______, ______,  ______,  KC_PSCR, KC_SLCK, KC_PAUS, KC_UP,  ______, ______,  \ +      ______,  KC_VOLD, KC_VOLU, KC_MUTE, ______, ______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT,______,   \ +      ______,  KC_MPRV, KC_MPLY, KC_MNXT, ______, ______, KC_PPLS, KC_PMNS, KC_END,  KC_PGDN, KC_DOWN, ______, ______,  \ +      ______,  ______,  ______,                   TG(_WASD),                   KC_MSTP, ______,  ______,  ______ \ +      ), + +/* WASD Layer + * ,-----------------------------------------------------------------------------------------. + * |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     | + * |-----------------------------------------------------------------------------------------+ + * |        |     | Up  |     |     |     |     |     |     |     |     |     |     |        | + * |-----------------------------------------------------------------------------------------+ + * |         | Left| Down|Right|     |     |     |     |     |     |     |     |             | + * |-----------------------------------------------------------------------------------------+ + * |           |     |     |     |     |     |     |     |      |    |     |           |     | + * |-----------------------------------------------------------------------------------------+ + *         |       |       |                                 |       |       | + *         `-----------------------------------------------------------------' + */ +  [_WASD] = KEYMAP_HHKB( /* Layer 2 */ +      ______,   ______,  ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,  ______, \ +      ______,   ______,  KC_UP,  ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,  \ +      ______,   KC_LEFT, KC_DOWN,KC_RGHT,______, ______, ______, ______, ______, ______, ______, ______, ______,   \ +      ______,   ______,  ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,  \ +      ______,   ______,  ______,                ______,                 ______, ______, ______, ______ \ +      ), + +/* SFX Layer + * ,-----------------------------------------------------------------------------------------. + * |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     | + * |-----------------------------------------------------------------------------------------+ + * |        | BL- | BL+ | BL  |     |     |     |     |     |     |     |     |     |        | + * |-----------------------------------------------------------------------------------------+ + * |         | RGBT| RGBM|     |     |     |     |     |     |     |     |     |             | + * |-----------------------------------------------------------------------------------------+ + * |           | Hue+| Hue-| Sat+| Sat-| Val+| Val-|     |      |    |     |           |     | + * |-----------------------------------------------------------------------------------------+ + *         |       |       |                                 |       |       | + *         `-----------------------------------------------------------------' + */ +  [_SFX] = KEYMAP_HHKB( +      ______,   ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, \ +      ______,   ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,  \ +      ______,   F(0),   F(1),   ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,   \ +      ______,   F(2),   F(3),   F(4),   F(5),   F(6),   F(7),   ______, ______, ______, ______, ______, ______,  \ +      ______,   ______, ______,                 ______,                 ______, ______, ______, ______ \ +      ) +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ +  // MACRODOWN only works in this function +  return MACRO_NONE; +}; + +enum function_id { +    RGBLED_TOGGLE, +    RGBLED_STEP_MODE, +    RGBLED_INCREASE_HUE, +    RGBLED_DECREASE_HUE, +    RGBLED_INCREASE_SAT, +    RGBLED_DECREASE_SAT, +    RGBLED_INCREASE_VAL, +    RGBLED_DECREASE_VAL +}; + +const uint16_t PROGMEM fn_actions[] = { +  [0]  = ACTION_FUNCTION(RGBLED_TOGGLE), +  [1]  = ACTION_FUNCTION(RGBLED_STEP_MODE), +  [2]  = ACTION_FUNCTION(RGBLED_INCREASE_HUE), +  [3]  = ACTION_FUNCTION(RGBLED_DECREASE_HUE), +  [4]  = ACTION_FUNCTION(RGBLED_INCREASE_SAT), +  [5]  = ACTION_FUNCTION(RGBLED_DECREASE_SAT), +  [6]  = ACTION_FUNCTION(RGBLED_INCREASE_VAL), +  [7]  = ACTION_FUNCTION(RGBLED_DECREASE_VAL) +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { +  switch (id) { +    case RGBLED_TOGGLE: +      if (record->event.pressed) { +        rgblight_toggle(); +      } +      break; +    case RGBLED_INCREASE_HUE: +      if (record->event.pressed) { +        rgblight_increase_hue(); +      } +      break; +    case RGBLED_DECREASE_HUE: +      if (record->event.pressed) { +        rgblight_decrease_hue(); +      } +      break; +    case RGBLED_INCREASE_SAT: +      if (record->event.pressed) { +        rgblight_increase_sat(); +      } +      break; +    case RGBLED_DECREASE_SAT: +      if (record->event.pressed) { +        rgblight_decrease_sat(); +      } +      break; +    case RGBLED_INCREASE_VAL: +      if (record->event.pressed) { +        rgblight_increase_val(); +      } +      break; +    case RGBLED_DECREASE_VAL: +      if (record->event.pressed) { +        rgblight_decrease_val(); +      } +      break; +    case RGBLED_STEP_MODE: +      if (record->event.pressed) { +        rgblight_step(); +      } +      break; +  } +} + +void matrix_scan_user(void) { +    uint32_t layer = layer_state; + +    if (layer & (1<<1)) { +        gh60_fn_led_on(); +    } else { +        gh60_fn_led_off(); +    } + +    if (layer & (1<<2)) { +        gh60_wasd_leds_on(); +    } else { +        gh60_wasd_leds_off(); +    } + +    if (layer & (1<<3)) { +        gh60_esc_led_on(); +    } else { +        gh60_esc_led_off(); +    } +};
\ No newline at end of file diff --git a/keyboards/satan/keymaps/dbroqua/keymap.c b/keyboards/satan/keymaps/dbroqua/keymap.c new file mode 100644 index 0000000000..5b921e0210 --- /dev/null +++ b/keyboards/satan/keymaps/dbroqua/keymap.c @@ -0,0 +1,152 @@ +#include "satan.h" +#include "action_layer.h" +#include "rgblight.h" + +#define _DEFAULT 0 +#define _FN 1 +#define _SFX 2 + +enum planck_keycodes { +  DEFAULT = SAFE_RANGE +}; + +// Fillers to make layering more clear +#define ______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Qwerty gui/alt/space/alt/gui + * ,-----------------------------------------------------------------------------------------. + * | Esc |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  -  |  =  |  \  |  `  | + * |-----------------------------------------------------------------------------------------+ + * | Tab    |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |  O  |  P  |  [  |  ]  |  Bksp  | + * |-----------------------------------------------------------------------------------------+ + * | Ctrl    |  A  |  S  |  D  |  F  |  G  |  H  |  J  |  K  |  L  |  ;  |  '  |    Enter    | + * |-----------------------------------------------------------------------------------------+ + * | Shift     |  Z  |  X  |  C  |  V  |  B  |  N  |  M  |  ,  |  .  |  /  | RShift    | FN  | + * |-----------------------------------------------------------------------------------------+ + *         |LGUI | LAlt  |               Space                | RAlt   |RGUI | + *         `-----------------------------------------------------------------' + */ +  [_DEFAULT] = KEYMAP_HHKB( /* Basic QWERTY */ +      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_BSLS,    KC_GRV, \ +      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_BSPC,  \ +      KC_LCTL,  KC_A,   KC_S,   KC_D,   KC_F,   KC_G,   KC_H,   KC_J,   KC_K,    KC_L,   KC_SCLN,    KC_QUOT,    KC_ENT,   \ +      KC_LSFT,  KC_Z,   KC_X,   KC_C,   KC_V,   KC_B,   KC_N,   KC_M,   KC_COMM, KC_DOT, KC_SLSH,    KC_RSFT,    MO(_FN), \ +      ______,   KC_LGUI,KC_LALT,                KC_SPC,                          KC_RALT,KC_RGUI,    ______,     ______ \ +      ), + +/* FN Layer + * ,-----------------------------------------------------------------------------------------. + * |     | F1  | F2  | F3  | F4  | F5  | F6  | F7  | F8  | F9  | F10 | F11 | F12 | Ins | Del | + * |-----------------------------------------------------------------------------------------+ + * |  CAPS  | BL- | BL+ | BL  |     |     |     |     | Psc | Slck| Paus| Up  |     |        | + * |-----------------------------------------------------------------------------------------+ + * |         | Vol-| Vol+| Mute|     |     | *   | /   | Home| PgUp| Left|Right|             | + * |-----------------------------------------------------------------------------------------+ + * |           | Prev| Play| Next|     |     | +   | -   | End  |PgDn| Down|           |     | + * |-----------------------------------------------------------------------------------------+ + *         |       |       |                                 | Stop  |       | + *         `-----------------------------------------------------------------' + */ +  [_FN] = KEYMAP_HHKB( /* Layer 1 */ +      TG(_SFX), 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_INS,  KC_DEL, \ +      KC_CAPS,  ______, ______, ______, ______, ______, ______, ______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP,   ______, ______,  \ +      ______,   KC_VOLD,KC_VOLU,KC_MUTE,______, ______, KC_PAST,KC_PSLS,KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, ______,   \ +      ______,   KC_MPRV,KC_MPLY,KC_MNXT,______, ______, KC_PPLS,KC_PMNS,KC_END,  KC_PGDN, KC_DOWN, ______,  ______,  \ +      ______,   ______, ______,                 ______,                 KC_MSTP, ______,  ______,  ______ \ +      ), + +/* SFX Layer + * ,-----------------------------------------------------------------------------------------. + * |     |     |     |     |     |     |     |     |     |     |     |     |     |     |     | + * |-----------------------------------------------------------------------------------------+ + * |        | BL- | BL+ | BL  |     |     |     |     |     |     |     |     |     |        | + * |-----------------------------------------------------------------------------------------+ + * |         | RGBT| RGBM|     |     |     |     |     |     |     |     |     |             | + * |-----------------------------------------------------------------------------------------+ + * |           | Hue+| Hue-| Sat+| Sat-| Val+| Val-|     |      |    |     |           |     | + * |-----------------------------------------------------------------------------------------+ + *         |       |       |                                 |       |       | + *         `-----------------------------------------------------------------' + */ +  [_SFX] = KEYMAP_HHKB( +      ______,   ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, \ +      ______,   BL_DEC, BL_INC, BL_TOGG,______, ______, ______, ______, ______, ______, ______, ______, ______, ______,  \ +      ______,   F(0),   F(1),   ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,   \ +      ______,   F(2),   F(3),   F(4),   F(5),   F(6),   F(7),   ______, ______, ______, ______, ______, ______,  \ +      ______,   ______, ______,                 ______,                 ______, ______, ______, ______ \ +      ) +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ +  // MACRODOWN only works in this function +  return MACRO_NONE; +}; + +enum function_id { +    RGBLED_TOGGLE, +    RGBLED_STEP_MODE, +    RGBLED_INCREASE_HUE, +    RGBLED_DECREASE_HUE, +    RGBLED_INCREASE_SAT, +    RGBLED_DECREASE_SAT, +    RGBLED_INCREASE_VAL, +    RGBLED_DECREASE_VAL +}; + +const uint16_t PROGMEM fn_actions[] = { +  [0]  = ACTION_FUNCTION(RGBLED_TOGGLE), +  [1]  = ACTION_FUNCTION(RGBLED_STEP_MODE), +  [2]  = ACTION_FUNCTION(RGBLED_INCREASE_HUE), +  [3]  = ACTION_FUNCTION(RGBLED_DECREASE_HUE), +  [4]  = ACTION_FUNCTION(RGBLED_INCREASE_SAT), +  [5]  = ACTION_FUNCTION(RGBLED_DECREASE_SAT), +  [6]  = ACTION_FUNCTION(RGBLED_INCREASE_VAL), +  [7]  = ACTION_FUNCTION(RGBLED_DECREASE_VAL) +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { +  switch (id) { +    case RGBLED_TOGGLE: +      if (record->event.pressed) { +        rgblight_toggle(); +      } +      break; +    case RGBLED_INCREASE_HUE: +      if (record->event.pressed) { +        rgblight_increase_hue(); +      } +      break; +    case RGBLED_DECREASE_HUE: +      if (record->event.pressed) { +        rgblight_decrease_hue(); +      } +      break; +    case RGBLED_INCREASE_SAT: +      if (record->event.pressed) { +        rgblight_increase_sat(); +      } +      break; +    case RGBLED_DECREASE_SAT: +      if (record->event.pressed) { +        rgblight_decrease_sat(); +      } +      break; +    case RGBLED_INCREASE_VAL: +      if (record->event.pressed) { +        rgblight_increase_val(); +      } +      break; +    case RGBLED_DECREASE_VAL: +      if (record->event.pressed) { +        rgblight_decrease_val(); +      } +      break; +    case RGBLED_STEP_MODE: +      if (record->event.pressed) { +        rgblight_step(); +      } +      break; +  } +}
\ No newline at end of file diff --git a/keyboards/satan/keymaps/dbroqua_hhkb/readme.md b/keyboards/satan/keymaps/dbroqua/readme.md index 39e71beedd..39e71beedd 100644 --- a/keyboards/satan/keymaps/dbroqua_hhkb/readme.md +++ b/keyboards/satan/keymaps/dbroqua/readme.md diff --git a/keyboards/satan/keymaps/dbroqua_hhkb/keymap.c b/keyboards/satan/keymaps/dbroqua_hhkb/keymap.c deleted file mode 100644 index 98a298e762..0000000000 --- a/keyboards/satan/keymaps/dbroqua_hhkb/keymap.c +++ /dev/null @@ -1,110 +0,0 @@ -// This is the canonical layout file for the Quantum project. If you want to add another keyboard, -// this is the style you want to emulate. - -#include "satan.h" - -#define _DEFAULT 0 -#define _ALTDISP 1 -#define _FN 2 - -enum planck_keycodes { -  DEFAULT = SAFE_RANGE, -  ALTDISP -}; - -// Fillers to make layering more clear -#define ______ KC_TRNS - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -/* Qwerty alt/gui/space/gui/alt - * ,-----------------------------------------------------------------------------------------. - * | Esc |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  -  |  =  |  \  |  `  | - * |-----------------------------------------------------------------------------------------+ - * | Tab    |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |  O  |  P  |  [  |  ]  |  Bksp  | - * |-----------------------------------------------------------------------------------------+ - * | Ctrl    |  A  |  S  |  D  |  F  |  G  |  H  |  J  |  K  |  L  |  ;  |  '  |    Enter    | - * |-----------------------------------------------------------------------------------------+ - * | Shift     |  Z  |  X  |  C  |  V  |  B  |  N  |  M  |  ,  |  .  |  /  | RShift    | FN  | - * |-----------------------------------------------------------------------------------------+ - *         | LAlt| LGUI  |               Space                | RGUI  | RAlt | - *         `-----------------------------------------------------------------' - */ -  [_DEFAULT] = KEYMAP_HHKB( /* Basic QWERTY */ -      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_BSLS, KC_GRV, \ -      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_BSPC,  \ -      KC_LCTL,  KC_A,     KC_S,     KC_D,    KC_F,     KC_G,     KC_H,     KC_J,    KC_K,  KC_L,     KC_SCLN,  KC_QUOT,  KC_ENT,   \ -      KC_LSFT,  KC_Z,     KC_X,    KC_C,     KC_V,     KC_B,     KC_N,    KC_M,  KC_COMM,  KC_DOT,   KC_SLSH,  KC_RSFT,  MO(_FN), \ -      ______,  KC_LALT,  KC_LGUI,            KC_SPC,                                                 KC_RGUI,  KC_RALT, ______, ______ \ -      ), - -/* Qwerty gui/alt/space/alt/gui - * ,-----------------------------------------------------------------------------------------. - * | Esc |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  -  |  =  |  \  |  `  | - * |-----------------------------------------------------------------------------------------+ - * | Tab    |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |  O  |  P  |  [  |  ]  |  Bksp  | - * |-----------------------------------------------------------------------------------------+ - * | Ctrl    |  A  |  S  |  D  |  F  |  G  |  H  |  J  |  K  |  L  |  ;  |  '  |    Enter    | - * |-----------------------------------------------------------------------------------------+ - * | Shift     |  Z  |  X  |  C  |  V  |  B  |  N  |  M  |  ,  |  .  |  /  | RShift    | FN  | - * |-----------------------------------------------------------------------------------------+ - *         |LGUI | LAlt  |               Space                | RAlt   |RGUI | - *         `-----------------------------------------------------------------' - */ -  [_ALTDISP] = KEYMAP_HHKB( /* Basic QWERTY */ -      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_BSLS, KC_GRV, \ -      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_BSPC,  \ -      KC_LCTL,  KC_A,     KC_S,     KC_D,    KC_F,     KC_G,     KC_H,     KC_J,    KC_K,  KC_L,     KC_SCLN,  KC_QUOT,  KC_ENT,   \ -      KC_LSFT,  KC_Z,     KC_X,    KC_C,     KC_V,     KC_B,     KC_N,    KC_M,  KC_COMM,  KC_DOT,   KC_SLSH,  KC_RSFT,  MO(_FN), \ -      ______,  KC_LGUI,  KC_LALT,            KC_SPC,                                                 KC_RALT,  KC_RGUI, ______, ______ \ -      ), - -/* FN Layer - * ,-----------------------------------------------------------------------------------------. - * |     | F1  | F2  | F3  | F4  | F5  | F6  | F7  | F8  | F9  | F10 | F11 | F12 | Ins | Del | - * |-----------------------------------------------------------------------------------------+ - * |  CAPS  | BL- | BL+ | BL  |     |     |     |     | Psc | Slck| Paus| Up  |     |        | - * |-----------------------------------------------------------------------------------------+ - * |         | Vol-| Vol+| Mute|     |     | *   | /   | Home| PgUp| Left|Right|             | - * |-----------------------------------------------------------------------------------------+ - * |           | Prev| Play| Next|     |     | +   | -   | End  |PgDn| Down|           |     | - * |-----------------------------------------------------------------------------------------+ - *         |       |       |                                 | Stop  |       | - *         `-----------------------------------------------------------------' - */ -  [_FN] = KEYMAP_HHKB( /* Layer 1 */ -      ______,   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_INS,  KC_DEL, \ -      KC_CAPS,   BL_DEC, BL_INC, BL_TOGG, ______, ______, ______, ______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, ______, ______,  \ -      ______,   KC_VOLD, KC_VOLU, KC_MUTE, ______, ______, KC_PAST, KC_PSLS,KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, ______,   \ -      ______,   KC_MPRV, KC_MPLY, KC_MNXT,______,______,KC_PPLS,KC_PMNS,KC_END, KC_PGDN, KC_DOWN, ______,______,  \ -      ______,   DEFAULT, ALTDISP,                 ______,                 KC_MSTP, ______,    ______,    ______ \ -      ) -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ -  // MACRODOWN only works in this function -  return MACRO_NONE; -}; - -void persistant_default_layer_set(uint16_t default_layer) { -  eeconfig_update_default_layer(default_layer); -  default_layer_set(default_layer); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { -  switch (keycode) { -    case DEFAULT: -      if (record->event.pressed) { -        persistant_default_layer_set(1UL<<_DEFAULT); -      } -      return false; -      break; -    case ALTDISP: -      if (record->event.pressed) { -        persistant_default_layer_set(1UL<<_ALTDISP); -      } -      return false; -      break; -  } -  return true; -}
\ No newline at end of file diff --git a/quantum/api/api_sysex.c b/quantum/api/api_sysex.c index a4a554e764..868f854b92 100644 --- a/quantum/api/api_sysex.c +++ b/quantum/api/api_sysex.c @@ -1,4 +1,6 @@  #include "api_sysex.h" +#include "sysex_tools.h" +#include "print.h"  void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length) {      // SEND_STRING("\nTX: "); @@ -6,24 +8,50 @@ void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes,      //     send_byte(bytes[i]);      //     SEND_STRING(" ");      // } -    uint8_t * precode = malloc(sizeof(uint8_t) * (length + 2)); -    precode[0] = message_type; -    precode[1] = data_type; -    memcpy(precode + 2, bytes, length); -    uint8_t * encoded = malloc(sizeof(uint8_t) * (sysex_encoded_length(length + 2))); -    uint16_t encoded_length = sysex_encode(encoded, precode, length + 2); -    uint8_t * array = malloc(sizeof(uint8_t) * (encoded_length + 5)); -    array[0] = 0xF0; -    array[1] = 0x00; -    array[2] = 0x00; -    array[3] = 0x00; -    array[encoded_length + 4] = 0xF7; -    memcpy(array + 4, encoded, encoded_length); -    midi_send_array(&midi_device, encoded_length + 5, array); +    if (length > API_SYSEX_MAX_SIZE) { +        xprintf("Sysex msg too big %d %d %d", message_type, data_type, length); +        return; +    } + + +    // The buffer size required is calculated as the following +    // API_SYSEX_MAX_SIZE is the maximum length +    // In addition to that we have a two byte message header consisting of the message_type and data_type +    // This has to be encoded with an additional overhead of one byte for every starting 7 bytes +    // We just add one extra byte in case it's not divisible by 7 +    // Then we have an unencoded header consisting of 4 bytes +    // Plus a one byte terminator +    const unsigned message_header = 2; +    const unsigned unencoded_message = API_SYSEX_MAX_SIZE + message_header; +    const unsigned encoding_overhead = unencoded_message / 7 + 1; +    const unsigned encoded_size = unencoded_message + encoding_overhead; +    const unsigned unencoded_header = 4; +    const unsigned terminator = 1; +    const unsigned buffer_size = encoded_size + unencoded_header + terminator; +    uint8_t buffer[encoded_size + unencoded_header + terminator]; +    // The unencoded header +    buffer[0] = 0xF0; +    buffer[1] = 0x00; +    buffer[2] = 0x00; +    buffer[3] = 0x00; + +    // We copy the message to the end of the array, this way we can do an inplace encoding, using the same +    // buffer for both input and output +    const unsigned message_size = length + message_header; +    uint8_t* unencoded_start = buffer + buffer_size - message_size; +    uint8_t* ptr = unencoded_start; +    *(ptr++) = message_type; +    *(ptr++) = data_type; +    memcpy(ptr, bytes, length); + +    unsigned encoded_length = sysex_encode(buffer + unencoded_header, unencoded_start, message_size); +    unsigned final_size = unencoded_header + encoded_length + terminator; +    buffer[final_size - 1] = 0xF7; +    midi_send_array(&midi_device, final_size, buffer);      // SEND_STRING("\nTD: ");      // for (uint8_t i = 0; i < encoded_length + 5; i++) { -    //     send_byte(array[i]); +    //     send_byte(buffer[i]);      //     SEND_STRING(" ");      // } -}
\ No newline at end of file +} diff --git a/quantum/config_common.h b/quantum/config_common.h index 17c11faeb6..4bdb2065d9 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -80,4 +80,6 @@  #   endif  #endif +#define API_SYSEX_MAX_SIZE 32 +  #endif diff --git a/quantum/keymap.h b/quantum/keymap.h index ae56d16c75..c000d2da8e 100644 --- a/quantum/keymap.h +++ b/quantum/keymap.h @@ -38,317 +38,16 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  #define RESET QK_RESET  #endif -/* translates key to keycode */ +#include "quantum_keycodes.h" + +// translates key to keycode  uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); +// translates function id to action +uint16_t keymap_function_id_to_action( uint16_t function_id ); +  extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];  extern const uint16_t fn_actions[]; -enum quantum_keycodes { -    // Ranges used in shortucuts - not to be used directly -    QK_TMK                = 0x0000, -    QK_TMK_MAX            = 0x00FF, -    QK_MODS               = 0x0100, -    QK_LCTL               = 0x0100, -    QK_LSFT               = 0x0200, -    QK_LALT               = 0x0400, -    QK_LGUI               = 0x0800, -    QK_RCTL               = 0x1100, -    QK_RSFT               = 0x1200, -    QK_RALT               = 0x1400, -    QK_RGUI               = 0x1800, -    QK_MODS_MAX           = 0x1FFF, -    QK_FUNCTION           = 0x2000, -    QK_FUNCTION_MAX       = 0x2FFF, -    QK_MACRO              = 0x3000, -    QK_MACRO_MAX          = 0x3FFF, -    QK_LAYER_TAP          = 0x4000, -    QK_LAYER_TAP_MAX      = 0x4FFF, -    QK_TO                 = 0x5000, -    QK_TO_MAX             = 0x50FF, -    QK_MOMENTARY          = 0x5100, -    QK_MOMENTARY_MAX      = 0x51FF, -    QK_DEF_LAYER          = 0x5200, -    QK_DEF_LAYER_MAX      = 0x52FF, -    QK_TOGGLE_LAYER       = 0x5300, -    QK_TOGGLE_LAYER_MAX   = 0x53FF, -    QK_ONE_SHOT_LAYER     = 0x5400, -    QK_ONE_SHOT_LAYER_MAX = 0x54FF, -    QK_ONE_SHOT_MOD       = 0x5500, -    QK_ONE_SHOT_MOD_MAX   = 0x55FF, -#ifndef DISABLE_CHORDING -    QK_CHORDING           = 0x5600, -    QK_CHORDING_MAX       = 0x56FF, -#endif -    QK_MOD_TAP            = 0x6000, -    QK_MOD_TAP_MAX        = 0x6FFF, -    QK_TAP_DANCE          = 0x7100, -    QK_TAP_DANCE_MAX      = 0x71FF, -#ifdef UNICODEMAP_ENABLE -    QK_UNICODE_MAP        = 0x7800, -    QK_UNICODE_MAP_MAX    = 0x7FFF, -#endif -#ifdef UNICODE_ENABLE -    QK_UNICODE            = 0x8000, -    QK_UNICODE_MAX        = 0xFFFF, -#endif - -    // Loose keycodes - to be used directly - -    RESET = 0x7000, -    DEBUG, -    MAGIC_SWAP_CONTROL_CAPSLOCK, -    MAGIC_CAPSLOCK_TO_CONTROL, -    MAGIC_SWAP_LALT_LGUI, -    MAGIC_SWAP_RALT_RGUI, -    MAGIC_NO_GUI, -    MAGIC_SWAP_GRAVE_ESC, -    MAGIC_SWAP_BACKSLASH_BACKSPACE, -    MAGIC_HOST_NKRO, -    MAGIC_SWAP_ALT_GUI, -    MAGIC_UNSWAP_CONTROL_CAPSLOCK, -    MAGIC_UNCAPSLOCK_TO_CONTROL, -    MAGIC_UNSWAP_LALT_LGUI, -    MAGIC_UNSWAP_RALT_RGUI, -    MAGIC_UNNO_GUI, -    MAGIC_UNSWAP_GRAVE_ESC, -    MAGIC_UNSWAP_BACKSLASH_BACKSPACE, -    MAGIC_UNHOST_NKRO, -    MAGIC_UNSWAP_ALT_GUI, -    MAGIC_TOGGLE_NKRO, - -    // Leader key -#ifndef DISABLE_LEADER -    KC_LEAD, -#endif - -    // Audio on/off/toggle -    AU_ON, -    AU_OFF, -    AU_TOG, - -    // Music mode on/off/toggle -    MU_ON, -    MU_OFF, -    MU_TOG, - -    // Music voice iterate -    MUV_IN, -    MUV_DE, - -    // Midi mode on/off -    MIDI_ON, -    MIDI_OFF, - -    // Backlight functionality -    BL_0, -    BL_1, -    BL_2, -    BL_3, -    BL_4, -    BL_5, -    BL_6, -    BL_7, -    BL_8, -    BL_9, -    BL_10, -    BL_11, -    BL_12, -    BL_13, -    BL_14, -    BL_15, -    BL_DEC, -    BL_INC, -    BL_TOGG, -    BL_STEP, - -    // RGB functionality -    RGB_TOG, -    RGB_MOD, -    RGB_HUI, -    RGB_HUD, -    RGB_SAI, -    RGB_SAD, -    RGB_VAI, -    RGB_VAD, - -    // Left shift, open paren -    KC_LSPO, - -    // Right shift, close paren -    KC_RSPC, - -    // Printing -    PRINT_ON, -    PRINT_OFF, - -    // always leave at the end -    SAFE_RANGE -}; - -// Ability to use mods in layouts -#define LCTL(kc) (kc | QK_LCTL) -#define LSFT(kc) (kc | QK_LSFT) -#define LALT(kc) (kc | QK_LALT) -#define LGUI(kc) (kc | QK_LGUI) -#define RCTL(kc) (kc | QK_RCTL) -#define RSFT(kc) (kc | QK_RSFT) -#define RALT(kc) (kc | QK_RALT) -#define RGUI(kc) (kc | QK_RGUI) - -#define HYPR(kc) (kc | QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI) -#define MEH(kc)  (kc | QK_LCTL | QK_LSFT | QK_LALT) -#define LCAG(kc) (kc | QK_LCTL | QK_LALT | QK_LGUI) -#define ALTG(kc) (kc | QK_RCTL | QK_RALT) - -#define MOD_HYPR 0xf -#define MOD_MEH 0x7 - - -// Aliases for shifted symbols -// Each key has a 4-letter code, and some have longer aliases too. -// While the long aliases are descriptive, the 4-letter codes -// make for nicer grid layouts (everything lines up), and are -// the preferred style for Quantum. -#define KC_TILD LSFT(KC_GRV)    // ~ -#define KC_TILDE    KC_TILD - -#define KC_EXLM LSFT(KC_1)      // ! -#define KC_EXCLAIM  KC_EXLM - -#define KC_AT   LSFT(KC_2)      // @ - -#define KC_HASH LSFT(KC_3)      // # - -#define KC_DLR  LSFT(KC_4)      // $ -#define KC_DOLLAR   KC_DLR - -#define KC_PERC LSFT(KC_5)      // % -#define KC_PERCENT  KC_PERC - -#define KC_CIRC LSFT(KC_6)      // ^ -#define KC_CIRCUMFLEX   KC_CIRC - -#define KC_AMPR LSFT(KC_7)      // & -#define KC_AMPERSAND    KC_AMPR - -#define KC_ASTR LSFT(KC_8)      // * -#define KC_ASTERISK KC_ASTR - -#define KC_LPRN LSFT(KC_9)      // ( -#define KC_LEFT_PAREN   KC_LPRN - -#define KC_RPRN LSFT(KC_0)      // ) -#define KC_RIGHT_PAREN  KC_RPRN - -#define KC_UNDS LSFT(KC_MINS)   // _ -#define KC_UNDERSCORE   KC_UNDS - -#define KC_PLUS LSFT(KC_EQL)    // + - -#define KC_LCBR LSFT(KC_LBRC)   // { -#define KC_LEFT_CURLY_BRACE KC_LCBR - -#define KC_RCBR LSFT(KC_RBRC)   // } -#define KC_RIGHT_CURLY_BRACE    KC_RCBR - -#define KC_LABK LSFT(KC_COMM)   // < -#define KC_LEFT_ANGLE_BRACKET   KC_LABK - -#define KC_RABK LSFT(KC_DOT)    // > -#define KC_RIGHT_ANGLE_BRACKET  KC_RABK - -#define KC_COLN LSFT(KC_SCLN)   // : -#define KC_COLON    KC_COLN - -#define KC_PIPE LSFT(KC_BSLS)   // | - -#define KC_LT LSFT(KC_COMM)     // < - -#define KC_GT LSFT(KC_DOT)      // > - -#define KC_QUES LSFT(KC_SLSH)   // ? -#define KC_QUESTION KC_QUES - -#define KC_DQT LSFT(KC_QUOT)   // " -#define KC_DOUBLE_QUOTE KC_DQT -#define KC_DQUO KC_DQT - -#define KC_DELT KC_DELETE // Del key (four letter code) - -// Alias for function layers than expand past FN31 -#define FUNC(kc) (kc | QK_FUNCTION) - -// Aliases -#define S(kc) LSFT(kc) -#define F(kc) FUNC(kc) - -#define M(kc) (kc | QK_MACRO) - -#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) - -// L-ayer, T-ap - 256 keycode max, 16 layer max -#define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8)) - -#define AG_SWAP MAGIC_SWAP_ALT_GUI -#define AG_NORM MAGIC_UNSWAP_ALT_GUI - -#define BL_ON  BL_9 -#define BL_OFF BL_0 - -#define MI_ON MIDI_ON -#define MI_OFF MIDI_OFF - -// GOTO layer - 16 layers max -// when: -// ON_PRESS    = 1 -// ON_RELEASE  = 2 -// Unless you have a good reason not to do so, prefer  ON_PRESS (1) as your default. -// In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own -// keycode modeled after the old version, kept below for this. -/* #define TO(layer, when) (layer | QK_TO | (when << 0x4)) */ -#define TO(layer) (layer | QK_TO | (ON_PRESS << 0x4)) - -// Momentary switch layer - 256 layer max -#define MO(layer) (layer | QK_MOMENTARY) - -// Set default layer - 256 layer max -#define DF(layer) (layer | QK_DEF_LAYER) - -// Toggle to layer - 256 layer max -#define TG(layer) (layer | QK_TOGGLE_LAYER) - -// One-shot layer - 256 layer max -#define OSL(layer) (layer | QK_ONE_SHOT_LAYER) - -// One-shot mod -#define OSM(mod) (mod | QK_ONE_SHOT_MOD) - -// M-od, T-ap - 256 keycode max -#define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0xF) << 8)) -#define CTL_T(kc) MT(MOD_LCTL, kc) -#define SFT_T(kc) MT(MOD_LSFT, kc) -#define ALT_T(kc) MT(MOD_LALT, kc) -#define GUI_T(kc) MT(MOD_LGUI, kc) -#define C_S_T(kc) MT((MOD_LCTL | MOD_LSFT), kc) // Control + Shift e.g. for gnome-terminal -#define MEH_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT), kc) // Meh is a less hyper version of the Hyper key -- doesn't include Win or Cmd, so just alt+shift+ctrl -#define LCAG_T(kc) MT((MOD_LCTL | MOD_LALT | MOD_LGUI), kc) // Left control alt and gui -#define ALL_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI), kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/ - -// Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap -#define KC_HYPR HYPR(KC_NO) -#define KC_MEH  MEH(KC_NO) - -#ifdef UNICODE_ENABLE -    // For sending unicode codes. -    // You may not send codes over 7FFF -- this supports most of UTF8. -    // To have a key that sends out Œ, go UC(0x0152) -    #define UNICODE(n) (n | QK_UNICODE) -    #define UC(n) UNICODE(n) -#endif - -#ifdef UNICODEMAP_ENABLE -    #define X(n) (n | QK_UNICODE_MAP) -#endif  #endif diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 833e5a8f8d..eced3d2bba 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -48,12 +48,10 @@ action_t action_for_key(uint8_t layer, keypos_t key)      action_t action;      uint8_t action_layer, when, mod; -    // The arm-none-eabi compiler generates out of bounds warnings when using the fn_actions directly for some reason -    const uint16_t* actions = fn_actions;      switch (keycode) {          case KC_FN0 ... KC_FN31: -            action.code = pgm_read_word(&actions[FN_INDEX(keycode)]); +            action.code = keymap_function_id_to_action(FN_INDEX(keycode));              break;          case KC_A ... KC_EXSEL:          case KC_LCTRL ... KC_RGUI: @@ -79,7 +77,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)          case QK_FUNCTION ... QK_FUNCTION_MAX: ;              // Is a shortcut for function action_layer, pull last 12bits              // This means we have 4,096 FN macros at our disposal -            action.code = pgm_read_word(&actions[(int)keycode & 0xFFF]); +            action.code = keymap_function_id_to_action( (int)keycode & 0xFFF );              break;          case QK_MACRO ... QK_MACRO_MAX:              action.code = ACTION_MACRO(keycode & 0xFF); @@ -163,9 +161,17 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)  {  } -/* translates key to keycode */ +// translates key to keycode +__attribute__ ((weak))  uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)  {      // Read entire word (16bits)      return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);  } + +// translates function id to action +__attribute__ ((weak)) +uint16_t keymap_function_id_to_action( uint16_t function_id ) +{ +	return pgm_read_word(&fn_actions[function_id]); +} diff --git a/quantum/quantum.c b/quantum/quantum.c index f653564a67..63ffe2074e 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -21,6 +21,8 @@ static void do_code16 (uint16_t code, void (*f) (uint8_t)) {    if (code & QK_LGUI)      f(KC_LGUI); +  if (code < QK_RMODS_MIN) return; +    if (code & QK_RCTL)      f(KC_RCTL);    if (code & QK_RSFT) diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h new file mode 100644 index 0000000000..5cd3c8e780 --- /dev/null +++ b/quantum/quantum_keycodes.h @@ -0,0 +1,313 @@ + +#ifndef QUANTUM_KEYCODES_H +#define QUANTUM_KEYCODES_H + +enum quantum_keycodes { +    // Ranges used in shortucuts - not to be used directly +    QK_TMK                = 0x0000, +    QK_TMK_MAX            = 0x00FF, +    QK_MODS               = 0x0100, +    QK_LCTL               = 0x0100, +    QK_LSFT               = 0x0200, +    QK_LALT               = 0x0400, +    QK_LGUI               = 0x0800, +    QK_RMODS_MIN          = 0x1000, +    QK_RCTL               = 0x1100, +    QK_RSFT               = 0x1200, +    QK_RALT               = 0x1400, +    QK_RGUI               = 0x1800, +    QK_MODS_MAX           = 0x1FFF, +    QK_FUNCTION           = 0x2000, +    QK_FUNCTION_MAX       = 0x2FFF, +    QK_MACRO              = 0x3000, +    QK_MACRO_MAX          = 0x3FFF, +    QK_LAYER_TAP          = 0x4000, +    QK_LAYER_TAP_MAX      = 0x4FFF, +    QK_TO                 = 0x5000, +    QK_TO_MAX             = 0x50FF, +    QK_MOMENTARY          = 0x5100, +    QK_MOMENTARY_MAX      = 0x51FF, +    QK_DEF_LAYER          = 0x5200, +    QK_DEF_LAYER_MAX      = 0x52FF, +    QK_TOGGLE_LAYER       = 0x5300, +    QK_TOGGLE_LAYER_MAX   = 0x53FF, +    QK_ONE_SHOT_LAYER     = 0x5400, +    QK_ONE_SHOT_LAYER_MAX = 0x54FF, +    QK_ONE_SHOT_MOD       = 0x5500, +    QK_ONE_SHOT_MOD_MAX   = 0x55FF, +#ifndef DISABLE_CHORDING +    QK_CHORDING           = 0x5600, +    QK_CHORDING_MAX       = 0x56FF, +#endif +    QK_MOD_TAP            = 0x6000, +    QK_MOD_TAP_MAX        = 0x6FFF, +    QK_TAP_DANCE          = 0x7100, +    QK_TAP_DANCE_MAX      = 0x71FF, +#ifdef UNICODEMAP_ENABLE +    QK_UNICODE_MAP        = 0x7800, +    QK_UNICODE_MAP_MAX    = 0x7FFF, +#endif +#ifdef UNICODE_ENABLE +    QK_UNICODE            = 0x8000, +    QK_UNICODE_MAX        = 0xFFFF, +#endif + +    // Loose keycodes - to be used directly + +    RESET = 0x7000, +    DEBUG, +    MAGIC_SWAP_CONTROL_CAPSLOCK, +    MAGIC_CAPSLOCK_TO_CONTROL, +    MAGIC_SWAP_LALT_LGUI, +    MAGIC_SWAP_RALT_RGUI, +    MAGIC_NO_GUI, +    MAGIC_SWAP_GRAVE_ESC, +    MAGIC_SWAP_BACKSLASH_BACKSPACE, +    MAGIC_HOST_NKRO, +    MAGIC_SWAP_ALT_GUI, +    MAGIC_UNSWAP_CONTROL_CAPSLOCK, +    MAGIC_UNCAPSLOCK_TO_CONTROL, +    MAGIC_UNSWAP_LALT_LGUI, +    MAGIC_UNSWAP_RALT_RGUI, +    MAGIC_UNNO_GUI, +    MAGIC_UNSWAP_GRAVE_ESC, +    MAGIC_UNSWAP_BACKSLASH_BACKSPACE, +    MAGIC_UNHOST_NKRO, +    MAGIC_UNSWAP_ALT_GUI, +    MAGIC_TOGGLE_NKRO, + +    // Leader key +#ifndef DISABLE_LEADER +    KC_LEAD, +#endif + +    // Audio on/off/toggle +    AU_ON, +    AU_OFF, +    AU_TOG, + +    // Music mode on/off/toggle +    MU_ON, +    MU_OFF, +    MU_TOG, + +    // Music voice iterate +    MUV_IN, +    MUV_DE, + +    // Midi mode on/off +    MIDI_ON, +    MIDI_OFF, + +    // Backlight functionality +    BL_0, +    BL_1, +    BL_2, +    BL_3, +    BL_4, +    BL_5, +    BL_6, +    BL_7, +    BL_8, +    BL_9, +    BL_10, +    BL_11, +    BL_12, +    BL_13, +    BL_14, +    BL_15, +    BL_DEC, +    BL_INC, +    BL_TOGG, +    BL_STEP, + +    // RGB functionality +    RGB_TOG, +    RGB_MOD, +    RGB_HUI, +    RGB_HUD, +    RGB_SAI, +    RGB_SAD, +    RGB_VAI, +    RGB_VAD, + +    // Left shift, open paren +    KC_LSPO, + +    // Right shift, close paren +    KC_RSPC, + +    // Printing +    PRINT_ON, +    PRINT_OFF, + +    // always leave at the end +    SAFE_RANGE +}; + +// Ability to use mods in layouts +#define LCTL(kc) (kc | QK_LCTL) +#define LSFT(kc) (kc | QK_LSFT) +#define LALT(kc) (kc | QK_LALT) +#define LGUI(kc) (kc | QK_LGUI) +#define RCTL(kc) (kc | QK_RCTL) +#define RSFT(kc) (kc | QK_RSFT) +#define RALT(kc) (kc | QK_RALT) +#define RGUI(kc) (kc | QK_RGUI) + +#define HYPR(kc) (kc | QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI) +#define MEH(kc)  (kc | QK_LCTL | QK_LSFT | QK_LALT) +#define LCAG(kc) (kc | QK_LCTL | QK_LALT | QK_LGUI) +#define ALTG(kc) (kc | QK_RCTL | QK_RALT) + +#define MOD_HYPR 0xf +#define MOD_MEH 0x7 + + +// Aliases for shifted symbols +// Each key has a 4-letter code, and some have longer aliases too. +// While the long aliases are descriptive, the 4-letter codes +// make for nicer grid layouts (everything lines up), and are +// the preferred style for Quantum. +#define KC_TILD LSFT(KC_GRV)    // ~ +#define KC_TILDE    KC_TILD + +#define KC_EXLM LSFT(KC_1)      // ! +#define KC_EXCLAIM  KC_EXLM + +#define KC_AT   LSFT(KC_2)      // @ + +#define KC_HASH LSFT(KC_3)      // # + +#define KC_DLR  LSFT(KC_4)      // $ +#define KC_DOLLAR   KC_DLR + +#define KC_PERC LSFT(KC_5)      // % +#define KC_PERCENT  KC_PERC + +#define KC_CIRC LSFT(KC_6)      // ^ +#define KC_CIRCUMFLEX   KC_CIRC + +#define KC_AMPR LSFT(KC_7)      // & +#define KC_AMPERSAND    KC_AMPR + +#define KC_ASTR LSFT(KC_8)      // * +#define KC_ASTERISK KC_ASTR + +#define KC_LPRN LSFT(KC_9)      // ( +#define KC_LEFT_PAREN   KC_LPRN + +#define KC_RPRN LSFT(KC_0)      // ) +#define KC_RIGHT_PAREN  KC_RPRN + +#define KC_UNDS LSFT(KC_MINS)   // _ +#define KC_UNDERSCORE   KC_UNDS + +#define KC_PLUS LSFT(KC_EQL)    // + + +#define KC_LCBR LSFT(KC_LBRC)   // { +#define KC_LEFT_CURLY_BRACE KC_LCBR + +#define KC_RCBR LSFT(KC_RBRC)   // } +#define KC_RIGHT_CURLY_BRACE    KC_RCBR + +#define KC_LABK LSFT(KC_COMM)   // < +#define KC_LEFT_ANGLE_BRACKET   KC_LABK + +#define KC_RABK LSFT(KC_DOT)    // > +#define KC_RIGHT_ANGLE_BRACKET  KC_RABK + +#define KC_COLN LSFT(KC_SCLN)   // : +#define KC_COLON    KC_COLN + +#define KC_PIPE LSFT(KC_BSLS)   // | + +#define KC_LT LSFT(KC_COMM)     // < + +#define KC_GT LSFT(KC_DOT)      // > + +#define KC_QUES LSFT(KC_SLSH)   // ? +#define KC_QUESTION KC_QUES + +#define KC_DQT LSFT(KC_QUOT)   // " +#define KC_DOUBLE_QUOTE KC_DQT +#define KC_DQUO KC_DQT + +#define KC_DELT KC_DELETE // Del key (four letter code) + +// Alias for function layers than expand past FN31 +#define FUNC(kc) (kc | QK_FUNCTION) + +// Aliases +#define S(kc) LSFT(kc) +#define F(kc) FUNC(kc) + +#define M(kc) (kc | QK_MACRO) + +#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) + +// L-ayer, T-ap - 256 keycode max, 16 layer max +#define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8)) + +#define AG_SWAP MAGIC_SWAP_ALT_GUI +#define AG_NORM MAGIC_UNSWAP_ALT_GUI + +#define BL_ON  BL_9 +#define BL_OFF BL_0 + +#define MI_ON MIDI_ON +#define MI_OFF MIDI_OFF + +// GOTO layer - 16 layers max +// when: +// ON_PRESS    = 1 +// ON_RELEASE  = 2 +// Unless you have a good reason not to do so, prefer  ON_PRESS (1) as your default. +// In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own +// keycode modeled after the old version, kept below for this. +/* #define TO(layer, when) (layer | QK_TO | (when << 0x4)) */ +#define TO(layer) (layer | QK_TO | (ON_PRESS << 0x4)) + +// Momentary switch layer - 256 layer max +#define MO(layer) (layer | QK_MOMENTARY) + +// Set default layer - 256 layer max +#define DF(layer) (layer | QK_DEF_LAYER) + +// Toggle to layer - 256 layer max +#define TG(layer) (layer | QK_TOGGLE_LAYER) + +// One-shot layer - 256 layer max +#define OSL(layer) (layer | QK_ONE_SHOT_LAYER) + +// One-shot mod +#define OSM(mod) (mod | QK_ONE_SHOT_MOD) + +// M-od, T-ap - 256 keycode max +#define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0xF) << 8)) +#define CTL_T(kc) MT(MOD_LCTL, kc) +#define SFT_T(kc) MT(MOD_LSFT, kc) +#define ALT_T(kc) MT(MOD_LALT, kc) +#define GUI_T(kc) MT(MOD_LGUI, kc) +#define C_S_T(kc) MT((MOD_LCTL | MOD_LSFT), kc) // Control + Shift e.g. for gnome-terminal +#define MEH_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT), kc) // Meh is a less hyper version of the Hyper key -- doesn't include Win or Cmd, so just alt+shift+ctrl +#define LCAG_T(kc) MT((MOD_LCTL | MOD_LALT | MOD_LGUI), kc) // Left control alt and gui +#define ALL_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI), kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/ + +// Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap +#define KC_HYPR HYPR(KC_NO) +#define KC_MEH  MEH(KC_NO) + +#ifdef UNICODE_ENABLE +    // For sending unicode codes. +    // You may not send codes over 7FFF -- this supports most of UTF8. +    // To have a key that sends out Œ, go UC(0x0152) +    #define UNICODE(n) (n | QK_UNICODE) +    #define UC(n) UNICODE(n) +#endif + +#ifdef UNICODEMAP_ENABLE +    #define X(n) (n | QK_UNICODE_MAP) +#endif + +#endif // QUANTUM_KEYCODES_H diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 6e335a4831..52a09817a1 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -370,6 +370,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {    rgblight_set();  } +__attribute__ ((weak))  void rgblight_set(void) {    if (rgblight_config.enable) {      #ifdef RGBW diff --git a/quantum/rgblight.h b/quantum/rgblight.h index ceb624692a..726b8de72e 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -40,6 +40,8 @@  #include "eeconfig.h"  #include "light_ws2812.h" +extern LED_TYPE led[RGBLED_NUM]; +  extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM;  extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM;  extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM; diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 2f208c54e0..54e9c322c1 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -85,7 +85,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  #define KC_LCAP KC_LOCKING_CAPS  #define KC_LNUM KC_LOCKING_NUM  #define KC_LSCR KC_LOCKING_SCROLL -#define KC_ERAS KC_ALT_ERASE, +#define KC_ERAS KC_ALT_ERASE  #define KC_CLR  KC_CLEAR  /* Japanese specific */  #define KC_ZKHK KC_GRAVE diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 0971897706..6dd5959dc4 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -1252,28 +1252,40 @@ void cc_callback(MidiDevice * device,    // midi_send_cc(device, (chan + 1) % 16, num, val);  } +#ifdef API_SYSEX_ENABLE  uint8_t midi_buffer[MIDI_SYSEX_BUFFER] = {0}; +#endif  void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data) {      #ifdef API_SYSEX_ENABLE          // SEND_STRING("\n");          // send_word(start);          // SEND_STRING(": "); +        // Don't store the header +        int16_t pos = start - 4;          for (uint8_t place = 0; place < length; place++) {              // send_byte(*data); -            midi_buffer[start + place] = *data; -            if (*data == 0xF7) { -                // SEND_STRING("\nRD: "); -                // for (uint8_t i = 0; i < start + place + 1; i++){ -                //     send_byte(midi_buffer[i]); -                // SEND_STRING(" "); -                // } -                uint8_t * decoded = malloc(sizeof(uint8_t) * (sysex_decoded_length(start + place - 4))); -                uint16_t decode_length = sysex_decode(decoded, midi_buffer + 4, start + place - 4); -                process_api(decode_length, decoded); +            if (pos >= 0) { +                if (*data == 0xF7) { +                    // SEND_STRING("\nRD: "); +                    // for (uint8_t i = 0; i < start + place + 1; i++){ +                    //     send_byte(midi_buffer[i]); +                    // SEND_STRING(" "); +                    // } +                    const unsigned decoded_length = sysex_decoded_length(pos); +                    uint8_t decoded[API_SYSEX_MAX_SIZE]; +                    sysex_decode(decoded, midi_buffer, pos); +                    process_api(decoded_length, decoded); +                    return; +                } +                else if (pos >= MIDI_SYSEX_BUFFER) { +                    return; +                } +                midi_buffer[pos] = *data;              }              // SEND_STRING(" ");              data++; +            pos++;          }      #endif  } diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index b11854101d..a049fd43c9 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h @@ -70,7 +70,6 @@ typedef struct {  #ifdef MIDI_ENABLE    void MIDI_Task(void);    MidiDevice midi_device; -  #define MIDI_SYSEX_BUFFER 32   #endif  #ifdef API_ENABLE @@ -79,6 +78,9 @@ typedef struct {  #ifdef API_SYSEX_ENABLE    #include "api_sysex.h" +  // Allocate space for encoding overhead. +  //The header and terminator are not stored to save a few bytes of precious ram +  #define MIDI_SYSEX_BUFFER (API_SYSEX_MAX_SIZE + API_SYSEX_MAX_SIZE / 7 + (API_SYSEX_MAX_SIZE % 7 ? 1 : 0))  #endif  // #if LUFA_VERSION_INTEGER < 0x120730 | 
