From 827dc6c715f8099562ef8b9d9208afbb51f706b8 Mon Sep 17 00:00:00 2001 From: Martin Gondermann Date: Mon, 3 Jul 2017 20:43:32 +0200 Subject: Add octave lights for midi layer (#1457) --- keyboards/clueboard/keymaps/magicmonty/keymap.c | 45 +++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'keyboards/clueboard/keymaps/magicmonty/keymap.c') diff --git a/keyboards/clueboard/keymaps/magicmonty/keymap.c b/keyboards/clueboard/keymaps/magicmonty/keymap.c index 05ea1fa33..69772baf7 100644 --- a/keyboards/clueboard/keymaps/magicmonty/keymap.c +++ b/keyboards/clueboard/keymaps/magicmonty/keymap.c @@ -179,6 +179,47 @@ void clueboard_set_led(uint8_t id, uint8_t val) { } }; +const uint16_t oct_hues[10] = { + 0, + 30, + 60, + 90, + 120, + 150, + 180, + 210, + 240, + 300 +}; + +#define MAX_OCT 9 + +void clueboard_set_midi_led(uint8_t base_oct, uint8_t val) +{ + uint8_t sat = 255; + + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + sethsv(oct_hues[base_oct], sat, val, (LED_TYPE *)&led[i]); + } + + uint8_t next_oct = base_oct < MAX_OCT ? base_oct + 1 : base_oct; + + uint16_t next_hue = base_oct < MAX_OCT ? oct_hues[next_oct] : 0; + uint8_t next_val = base_oct < MAX_OCT ? val : 0; + uint8_t next_sat = base_oct < MAX_OCT ? sat : 0; + + + for (uint8_t i = 0; i < 3; i++) { + sethsv(next_hue, next_sat, next_val, (LED_TYPE *)&led[i]); + } + + for (uint8_t i = 11; i < 14; i++) { + sethsv(next_hue, next_sat, next_val, (LED_TYPE *)&led[i]); + } + + rgblight_set(); +} + void matrix_scan_user(void) { rgblight_config_t rgblight_config; rgblight_config.raw = eeconfig_read_rgblight(); @@ -197,10 +238,10 @@ void matrix_scan_user(void) { clueboard_set_led(LAYER_FUNCTION, val); } } else if (layer & (1<<_ML)) { - clueboard_set_led(LAYER_MOUSE, val); + clueboard_set_led(LAYER_MOUSE, val); #if defined(MIDI_ENABLE) } else if (layer & (1<<_MI)) { - clueboard_set_led(LAYER_MIDI, val); + clueboard_set_midi_led(midi_config.octave, val); #endif } else { clueboard_set_led(LAYER_BASE, val); -- cgit v1.2.3 From 34c8bf47a76c8a2dcd3b1a19dd608f8fb2fafb31 Mon Sep 17 00:00:00 2001 From: Martin Gondermann Date: Mon, 3 Jul 2017 20:48:48 +0200 Subject: Move Space Caded Parentheses to own layer (#1452) * Move Space Caded Parentheses to own layer The space cadet parentheses where too much distracting. Therefore they are now on the function layer. I also added two more layers for also having angle brackets and curly braces on the shift keys forr better access. Also updated the README * Fixed SHIFT+Function key conflict * Removed Angle Bracket and Curly Bracket layers, as they don't work corrrectly --- keyboards/clueboard/keymaps/magicmonty/keymap.c | 32 +++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'keyboards/clueboard/keymaps/magicmonty/keymap.c') diff --git a/keyboards/clueboard/keymaps/magicmonty/keymap.c b/keyboards/clueboard/keymaps/magicmonty/keymap.c index 69772baf7..3d00332b0 100644 --- a/keyboards/clueboard/keymaps/magicmonty/keymap.c +++ b/keyboards/clueboard/keymaps/magicmonty/keymap.c @@ -4,8 +4,6 @@ #define GRAVE_MODS (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)) #define _______ KC_TRNS #define xxxxxxx KC_NO -#define HPR_TAB ALL_T(KC_TAB) -#define CTL_ESC CTL_T(KC_ESC) // 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. @@ -23,14 +21,34 @@ #define TO_MIDI _______ #endif +// go back to base layer #define TO_BASE TO(_BL) + +// switch to function layer while helde #define MO_FUNC MO(_FL) + +// switch to media layer while held #define MEDIA MO(_ME) + +// switch to Control layer while helde #define MO_CTL MO(_CL) + +// switch to mouse layer if held, else space #define L_MOUSE LT(_ML, KC_SPC) + +// Function key when held, else ESC #define ESC_FUN LT(_FL, KC_ESC) +// Hyper (CTRL+ALT+SHIFT+SUPER) when held, TAB when tapped +#define HPR_TAB ALL_T(KC_TAB) + +// CTRL when held, ESC when tapped +#define CTL_ESC CTL_T(KC_ESC) + +// ESC/Grave mode #define ESC_GRV F(0) + +// Reset RGB mode to layer signalling #define RGB_RST F(1) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -39,15 +57,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ESC_GRV, 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_INS, \ HPR_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_DEL, \ ESC_FUN, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, \ - KC_LSPO, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, KC_RSPC, KC_UP, \ + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, KC_RSFT, KC_UP, \ KC_LCTL, KC_LGUI, KC_LALT,_______, L_MOUSE, L_MOUSE, _______, KC_RALT, KC_RCTL, MO_FUNC, KC_LEFT, KC_DOWN, KC_RGHT), - /* Keymap _FL: Function Layer */ + /* Keymap _FL: Function layer */ [_FL] = KEYMAP( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_STEP, \ _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, _______, KC_PAUS, _______, _______, _______, _______, \ _______, _______, MO_CTL, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, MEDIA, _______, _______, TO_MIDI, _______, _______, KC_PGUP, \ + KC_LSPO, _______, _______, _______, _______, _______, _______, _______, MEDIA, _______, _______, TO_MIDI, _______, KC_RSPC, KC_PGUP, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, MO_FUNC, KC_HOME, KC_PGDN, KC_END), /* Keymap _ME: Media layer */ @@ -70,9 +88,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ML] = KEYMAP( _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, KC_BTN3, KC_BTN2, KC_BTN1, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, _______, _______, _______, _______, \ + _______, _______, KC_BTN2, KC_BTN3, KC_BTN1, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, _______, _______, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_U, \ - _______, _______, _______, _______, L_MOUSE, L_MOUSE, _______, KC_BTN1, KC_BTN2, KC_BTN3, KC_MS_L, KC_MS_D, KC_MS_R), + _______, _______, _______, _______, L_MOUSE, L_MOUSE, _______, KC_BTN1, KC_BTN3, KC_BTN2, KC_MS_L, KC_MS_D, KC_MS_R), #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) /* Keymap _MI: MIDI layer (Advanced)*/ -- cgit v1.2.3