Skip to content

Commit

Permalink
Allow customization of the number of tone keycodes and add example ke…
Browse files Browse the repository at this point in the history
…ymap
  • Loading branch information
Gabriel Young committed Feb 20, 2017
1 parent ae0752d commit d1fe24a
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 0 deletions.
21 changes: 21 additions & 0 deletions keyboards/satan/keymaps/midi/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # 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
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

ifndef QUANTUM_DIR
include ../../../../Makefile
endif
11 changes: 11 additions & 0 deletions keyboards/satan/keymaps/midi/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H

#include "../../config.h"

// place overrides here

/* override number of MIDI tone keycodes (each octave adds 12 bytes) */
#define MIDI_TONE_KEYCODE_OCTAVES 2

#endif
60 changes: 60 additions & 0 deletions keyboards/satan/keymaps/midi/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include "satan.h"

// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _BL 0
#define _ML 1

// readability
#define _______ KC_TRNS
#define XXXXXXX KC_NO

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,-----------------------------------------------------------.
* |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
* |-----------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |
* |-----------------------------------------------------------|
* |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |
* |-----------------------------------------------------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
* |-----------------------------------------------------------|
* |Ctrl|Gui |Alt | Space |Alt |Gui |FN |Ctrl |
* `-----------------------------------------------------------'
*/
[_BL] = KEYMAP_ANSI(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSLS, \
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_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, \
KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, TG(_ML), KC_RCTL),

/* Keymap _ML: MIDI Layer
* ,------------------------------------------------------------------------.
* | Exit | | | | | | | | | | | | | |
* |------------------------------------------------------------------------|
* | Ch+ | | C# | D# | | F# | G# | A# | | C# | D# | | | |
* |------------------------------------------------------------------------|
* | Mod | C | D | E | F | G | A | B | C | D | E | F |>>OnStage|
* |------------------------------------------------------------------------|
* | Sustain |Oct-|Oct+|Mod-|Mod+| | | |Tns-|Tns+|Tns0| Sustain |
* |------------------------------------------------------------------------|
* | | | | All notes off | | | | |
* `------------------------------------------------------------------------'
*
* Foot switches:
* ,--------. ,--------.
* | | | |
* | | | |
* `--------' `--------'
*/
[_ML] = KEYMAP_ANSI(
TG(_ML), MI_VEL_1, MI_VEL_2, MI_VEL_3, MI_VEL_4, MI_VEL_5, MI_VEL_6, MI_VEL_7, MI_VEL_8, MI_VEL_9, MI_VEL_10, XXXXXXX, XXXXXXX, XXXXXXX, \
MI_CHU, XXXXXXX, MI_Cs, MI_Ds, XXXXXXX, MI_Fs, MI_Gs, MI_As, XXXXXXX, MI_Cs_1, MI_Ds_1, XXXXXXX, XXXXXXX, XXXXXXX, \
MI_MOD, MI_C, MI_D, MI_E, MI_F, MI_G, MI_A, MI_B, MI_C_1, MI_D_1, MI_E_1, MI_F_1, _______, \
MI_SUS, MI_OCTD, MI_OCTU, MI_MODSD, MI_MODSU, XXXXXXX, XXXXXXX, XXXXXXX, MI_TRNSD, MI_TRNSU, MI_TRNS_0, MI_SUS, \
_______, _______, _______, MI_OFF, _______, _______, _______, _______),
};
1 change: 1 addition & 0 deletions keyboards/satan/keymaps/midi/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Satan GH60 layout demonstrating MIDI key mapping
84 changes: 84 additions & 0 deletions quantum/quantum_keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#ifndef QUANTUM_KEYCODES_H
#define QUANTUM_KEYCODES_H

#ifdef MIDI_ENABLE
#ifndef MIDI_TONE_KEYCODE_OCTAVES
#define MIDI_TONE_KEYCODE_OCTAVES 3
#endif
#endif

enum quantum_keycodes {
// Ranges used in shortucuts - not to be used directly
QK_TMK = 0x0000,
Expand Down Expand Up @@ -112,6 +118,7 @@ enum quantum_keycodes {

MIDI_TONE_MIN,

#if MIDI_TONE_KEYCODE_OCTAVES > 0
MI_C = MIDI_TONE_MIN,
MI_Cs,
MI_Db = MI_Cs,
Expand All @@ -129,7 +136,9 @@ enum quantum_keycodes {
MI_As,
MI_Bb = MI_As,
MI_B,
#endif

#if MIDI_TONE_KEYCODE_OCTAVES > 1
MI_C_1,
MI_Cs_1,
MI_Db_1 = MI_Cs_1,
Expand All @@ -147,7 +156,9 @@ enum quantum_keycodes {
MI_As_1,
MI_Bb_1 = MI_As_1,
MI_B_1,
#endif

#if MIDI_TONE_KEYCODE_OCTAVES > 2
MI_C_2,
MI_Cs_2,
MI_Db_2 = MI_Cs_2,
Expand All @@ -165,8 +176,81 @@ enum quantum_keycodes {
MI_As_2,
MI_Bb_2 = MI_As_2,
MI_B_2,
#endif

#if MIDI_TONE_KEYCODE_OCTAVES > 3
MI_C_3,
MI_Cs_3,
MI_Db_3 = MI_Cs_3,
MI_D_3,
MI_Ds_3,
MI_Eb_3 = MI_Ds_3,
MI_E_3,
MI_F_3,
MI_Fs_3,
MI_Gb_3 = MI_Fs_3,
MI_G_3,
MI_Gs_3,
MI_Ab_3 = MI_Gs_3,
MI_A_3,
MI_As_3,
MI_Bb_3 = MI_As_3,
MI_B_3,
#endif

#if MIDI_TONE_KEYCODE_OCTAVES > 4
MI_C_4,
MI_Cs_4,
MI_Db_4 = MI_Cs_4,
MI_D_4,
MI_Ds_4,
MI_Eb_4 = MI_Ds_4,
MI_E_4,
MI_F_4,
MI_Fs_4,
MI_Gb_4 = MI_Fs_4,
MI_G_4,
MI_Gs_4,
MI_Ab_4 = MI_Gs_4,
MI_A_4,
MI_As_4,
MI_Bb_4 = MI_As_4,
MI_B_4,
#endif

#if MIDI_TONE_KEYCODE_OCTAVES > 5
MI_C_5,
MI_Cs_5,
MI_Db_5 = MI_Cs_5,
MI_D_5,
MI_Ds_5,
MI_Eb_5 = MI_Ds_5,
MI_E_5,
MI_F_5,
MI_Fs_5,
MI_Gb_5 = MI_Fs_5,
MI_G_5,
MI_Gs_5,
MI_Ab_5 = MI_Gs_5,
MI_A_5,
MI_As_5,
MI_Bb_5 = MI_As_5,
MI_B_5,
#endif

#if MIDI_TONE_KEYCODE_OCTAVES > 5
MIDI_TONE_MAX = MI_B_5,
#elif MIDI_TONE_KEYCODE_OCTAVES > 4
MIDI_TONE_MAX = MI_B_4,
#elif MIDI_TONE_KEYCODE_OCTAVES > 3
MIDI_TONE_MAX = MI_B_3,
#elif MIDI_TONE_KEYCODE_OCTAVES > 2
MIDI_TONE_MAX = MI_B_2,
#elif MIDI_TONE_KEYCODE_OCTAVES > 1
MIDI_TONE_MAX = MI_B_1,
#elif MIDI_TONE_KEYCODE_OCTAVES > 0
MIDI_TONE_MAX = MI_B,
#endif

MIDI_OCTAVE_MIN,
MI_OCT_N2 = MIDI_OCTAVE_MIN,
Expand Down
3 changes: 3 additions & 0 deletions quantum/template/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION

/* override number of MIDI tone keycodes (each octave adds 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 1

#endif

0 comments on commit d1fe24a

Please sign in to comment.