qmk-dactyl-manuform-a/keyboards/s60_x/keymaps/bluebear/keymap.c

225 lines
15 KiB
C
Raw Normal View History

2017-05-14 22:07:44 +02:00
#include "s60_x.h"
// Keyboard Layers
enum keyboard_layers {
BASE = 0, //Base Layer
ARROW, //Arrow/FN Layer
MOUSE, //Mouse Layer
MIDI, //Midi Layer
};
2017-05-16 04:56:33 +02:00
// Midi Chord Keycodes
/*
bool midi_chord(uint8_t mode, uint16_t root);
enum midi_chord_modes {
major = 0,
minor,
};
2017-05-16 04:56:33 +02:00
*/
2017-05-14 22:07:44 +02:00
enum midi_chord_keycodes {
//Major Chords
MI_CH_C = SAFE_RANGE,
MI_CH_Cs,
MI_CH_Db = MI_CH_Cs,
MI_CH_D,
MI_CH_Ds,
MI_CH_Eb = MI_CH_Ds,
MI_CH_E,
MI_CH_F,
MI_CH_Fs,
MI_CH_Gb = MI_CH_Fs,
MI_CH_G,
MI_CH_Gs,
MI_CH_Ab = MI_CH_Gs,
MI_CH_A,
MI_CH_As,
MI_CH_Bb = MI_CH_As,
MI_CH_B,
//Minor Chords
MI_CH_Cm,
MI_CH_Csm,
MI_CH_Dbm = MI_CH_Csm,
MI_CH_Dm,
MI_CH_Dsm,
MI_CH_Ebm = MI_CH_Dsm,
MI_CH_Em,
MI_CH_Fm,
MI_CH_Fsm,
MI_CH_Gbm = MI_CH_Fsm,
MI_CH_Gm,
MI_CH_Gsm,
MI_CH_Abm = MI_CH_Gsm,
MI_CH_Am,
MI_CH_Asm,
MI_CH_Bbm = MI_CH_Asm,
MI_CH_Bm,
};
//Keymaps
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: Custom Dvorak/HHKBish Base Layer
ESC 1 2 3 4 5 6 7 8 9 0 [ ] \ `
TAB ' , . P Y F G C R L / = BSPC
CT/ES A O E U I D H T N S - CT/EN
LSPO ; Q J K X B M W V Z RSPC
MO(2)L_GUIL_ALTSPFN1AG/APR_GUICT|S CT|AL
*/
[BASE] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSLS, KC_GRV, \
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSPC, \
CTL_T(KC_ESC), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_NO, MT(MOD_RCTL, KC_ENT), \
KC_LSPO, KC_NO, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_NO, KC_RSPC, KC_NO, \
MO(2), KC_LGUI, KC_LALT, LT(1, KC_SPACE), ALGR_T(KC_APP), KC_RGUI, OSM(MOD_LCTL | MOD_LSFT), OSM(MOD_LCTL | MOD_LALT)
),
/* 1: Arrow/Missing Keys Layer
TG(3) F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
CAPS PGUP UP HOME END INS DEL
LEFT DOWN RIGHT
SPACEPGDN PSCR SLCK PAUSE
*/
[ARROW] = KEYMAP(
TG(3), 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_NO, KC_NO, \
KC_CAPS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PGUP, KC_UP, KC_HOME, KC_END, KC_NO, KC_INS, KC_DEL, \
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_RIGHT, KC_NO, KC_NO, KC_NO, KC_TRNS, \
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPACE, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, KC_NO, KC_TRNS, KC_NO, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
/* 2: Mouse Keys Layer
RESET F1 F2 F3 F4 F5 F6 F7 F8 F9 F10
BTN1 MS_UPBTN2 WH_UP
MS_LTMS_DNMS_RTWH_DNBTN3
PWR
*/
[MOUSE] = KEYMAP(
RESET, 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_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BTN1, KC_MS_UP, KC_BTN2, KC_WH_U, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_WH_D, KC_BTN3, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_TRNS, KC_NO, KC_NO, KC_POWER, KC_NO, KC_NO, KC_NO, KC_NO
),
/* 3: Midi Layer
TG(0) Cmaj Gmaj Dmaj Amaj Emaj BmajGbmajDbmajAbmajEbmajBbmaj Fmaj
C# D# F# G# A# C# D#
OCT- C D E F G A B C D E F OCT+
Am Em Bm F#m C#m G#m D#m Bbm Fm Cm Gm Dm
A-OFF
*/
[MIDI] = KEYMAP(
TO(0), MI_CH_C, MI_CH_G, MI_CH_D, MI_CH_A, MI_CH_E, MI_CH_B, MI_CH_Gb, MI_CH_Db, MI_CH_Ab, MI_CH_Eb, MI_CH_Bb, MI_CH_F, KC_NO, KC_NO, \
KC_NO, KC_NO, MI_Cs, MI_Ds, KC_NO, MI_Fs, MI_Gs, MI_As, KC_NO, MI_Cs_1, MI_Ds_1, KC_NO, KC_NO, KC_NO, \
MI_OCTD, 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, KC_NO, MI_OCTU, \
MI_CH_Am, KC_NO, MI_CH_Em, MI_CH_Bm, MI_CH_Fsm, MI_CH_Csm, MI_CH_Gsm, MI_CH_Dsm, MI_CH_Bbm, MI_CH_Fm, MI_CH_Cm, MI_CH_Gm, KC_NO, MI_CH_Dm, KC_NO, \
KC_NO, KC_NO, KC_NO, MI_ALLOFF, KC_NO, KC_NO, KC_NO, KC_NO
),
};
2017-05-16 04:56:33 +02:00
/*
// Midi Chord Function
bool midi_chord(uint8_t mode, uint16_t root) {
switch (mode) {
case 0:
uint8_t channel = midi_config.channel;
uint8_t tone = root - MIDI_TONE_MIN;
uint8_t velocity = compute_velocity(midi_config.velocity);
if (record->event.pressed) {
uint8_t root_note = midi_compute_note(root);
uint8_t major_third = midi_compute_note(root) + 4;
uint8_t fifth = midi_compute_note(root) + 7;
midi_send_noteon(&midi_device, channel, root_note, velocity);
midi_send_noteon(&midi_device, channel, major_third, velocity);
midi_send_noteon(&midi_device, channel, fifth, velocity);
tone_status[tone] = root_note;
}
else {
uint8_t root_note = tone_status[tone];
uint8_t major_third = root_note + 4;
uint8_t fifth = root_note + 7;
if (root_note != MIDI_INVALID_NOTE)
{
midi_send_noteoff(&midi_device, channel, root_note, velocity);
midi_send_noteoff(&midi_device, channel, major_third, velocity);
midi_send_noteoff(&midi_device, channel, fifth, velocity);
}
tone_status[tone] = MIDI_INVALID_NOTE;
}
return false;
case 1:
uint8_t channel = midi_config.channel;
uint8_t tone = root - MIDI_TONE_MIN;
uint8_t velocity = compute_velocity(midi_config.velocity);
if (record->event.pressed) {
uint8_t root_note = midi_compute_note(root);
uint8_t minor_third = midi_compute_note(root) + 3;
uint8_t fifth = midi_compute_note(root) + 7;
midi_send_noteon(&midi_device, channel, root_note, velocity);
2017-05-16 04:56:33 +02:00
midi_send_noteon(&midi_device, channel, minor_third, velocity);
midi_send_noteon(&midi_device, channel, fifth, velocity);
tone_status[tone] = root_note;
}
else {
uint8_t root_note = tone_status[tone];
uint8_t minor_third = root_note + 3;
uint8_t fifth = root_note + 7;
if (root_note != MIDI_INVALID_NOTE)
{
midi_send_noteoff(&midi_device, channel, root_note, velocity);
midi_send_noteoff(&midi_device, channel, minor_third, velocity);
midi_send_noteoff(&midi_device, channel, fifth, velocity);
}
tone_status[tone] = MIDI_INVALID_NOTE;
}
return false;
};
return true;
};
2017-05-16 04:56:33 +02:00
*/