Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
b7b842da55
18
keyboards/bandominedoni/keymaps/led/config.h
Normal file
18
keyboards/bandominedoni/keymaps/led/config.h
Normal file
@ -0,0 +1,18 @@
|
||||
/* Copyright 2021 3araht
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 6
|
208
keyboards/chromatonemini/chromatonemini.c
Normal file
208
keyboards/chromatonemini/chromatonemini.c
Normal file
@ -0,0 +1,208 @@
|
||||
/* Copyright 2021 3araht
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "chromatonemini.h"
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
# define NO_LED 255
|
||||
|
||||
led_config_t g_led_config = {
|
||||
{
|
||||
#if 0
|
||||
// register bottom two rows
|
||||
{ 0, 4, 3, 2, 1, 41, 5, NO_LED },
|
||||
{ 40, 6, 39, 7, 38, 8, 37, NO_LED },
|
||||
{ 9, 36, 10, 35, 11, 34, 12, NO_LED },
|
||||
{ 33, 13, 32, 14, 31, 15, 30, NO_LED },
|
||||
{ 16, 29, 17, 28, 18, 27, 19, NO_LED },
|
||||
{ 26, 20, 25, 21, 24, 22, 23, NO_LED }
|
||||
|
||||
// register middle two rows
|
||||
{ 0, 4, 3, 2, 1, 78, 42, NO_LED },
|
||||
{ 77, 43, 76, 44, 75, 45, 74, NO_LED },
|
||||
{ 46, 73, 47, 72, 48, 71, 49, NO_LED },
|
||||
{ 70, 50, 69, 51, 68, 52, 67, NO_LED },
|
||||
{ 53, 66, 54, 65, 55, 64, 56, NO_LED },
|
||||
{ 63, 57, 62, 58, 61, 59, 60, NO_LED }
|
||||
|
||||
// register top and bottom rows
|
||||
{ 0, 4, 3, 2, 1, 115, 5, NO_LED },
|
||||
{ 114, 6, 113, 7, 112, 8, 111, NO_LED },
|
||||
{ 9, 110, 10, 109, 11, 108, 12, NO_LED },
|
||||
{ 107, 13, 106, 14, 105, 15, 104, NO_LED },
|
||||
{ 16, 103, 17, 102, 18, 101, 19, NO_LED },
|
||||
{ 100, 20, 99, 21, 98, 22, 97, NO_LED }
|
||||
#else
|
||||
// register top two rows
|
||||
{ 0, 4, 3, 2, 1, 115, 79, NO_LED },
|
||||
{ 114, 80, 113, 81, 112, 82, 111, NO_LED },
|
||||
{ 83, 110, 84, 109, 85, 108, 86, NO_LED },
|
||||
{ 107, 87, 106, 88, 105, 89, 104, NO_LED },
|
||||
{ 90, 103, 91, 102, 92, 101, 93, NO_LED },
|
||||
{ 100, 94, 99, 95, 98, 96, 97, NO_LED }
|
||||
#endif
|
||||
}, {
|
||||
{ 14, 12 },
|
||||
{ 14, 36 },
|
||||
{ 19, 48 }, { 9, 48 },
|
||||
{ 14, 60 },
|
||||
{ 39, 60 }, { 49, 60 }, { 59, 60 }, { 69, 60 }, { 79, 60 }, { 89, 60 }, { 99, 60 }, { 109, 60 }, { 119, 60 }, { 129, 60 }, { 139, 60 }, { 149, 60 }, { 159, 60 }, { 169, 60 }, { 179, 60 }, { 189, 60 }, { 199, 60 }, { 209, 60 },
|
||||
{ 214, 48 }, { 204, 48 }, { 194, 48 }, { 184, 48 }, { 174, 48 }, { 164, 48 }, { 154, 48 }, { 144, 48 }, { 134, 48 }, { 124, 48 }, { 114, 48 }, { 104, 48 }, { 94, 48 }, { 84, 48 }, { 74, 48 }, { 64, 48 }, { 54, 48 }, { 44, 48 }, { 34, 48 },
|
||||
{ 39, 36 }, { 49, 36 }, { 59, 36 }, { 69, 36 }, { 79, 36 }, { 89, 36 }, { 99, 36 }, { 109, 36 }, { 119, 36 }, { 129, 36 }, { 139, 36 }, { 149, 36 }, { 159, 36 }, { 169, 36 }, { 179, 36 }, { 189, 36 }, { 199, 36 }, { 209, 36 },
|
||||
{ 214, 24 }, { 204, 24 }, { 194, 24 }, { 184, 24 }, { 174, 24 }, { 164, 24 }, { 154, 24 }, { 144, 24 }, { 134, 24 }, { 124, 24 }, { 114, 24 }, { 104, 24 }, { 94, 24 }, { 84, 24 }, { 74, 24 }, { 64, 24 }, { 54, 24 }, { 44, 24 }, { 34, 24 },
|
||||
{ 39, 12 }, { 49, 12 }, { 59, 12 }, { 69, 12 }, { 79, 12 }, { 89, 12 }, { 99, 12 }, { 109, 12 }, { 119, 12 }, { 129, 12 }, { 139, 12 }, { 149, 12 }, { 159, 12 }, { 169, 12 }, { 179, 12 }, { 189, 12 }, { 199, 12 }, { 209, 12 },
|
||||
{ 214, 0 }, { 204, 0 }, { 194, 0 }, { 184, 0 }, { 174, 0 }, { 164, 0 }, { 154, 0 }, { 144, 0 }, { 134, 0 }, { 124, 0 }, { 114, 0 }, { 104, 0 }, { 94, 0 }, { 84, 0 }, { 74, 0 }, { 64, 0} , { 54, 0 }, { 44, 0 }, { 34, 0 }
|
||||
}, {
|
||||
1,
|
||||
4,
|
||||
4, 4,
|
||||
4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
|
||||
}
|
||||
};
|
||||
|
||||
// indicator
|
||||
const uint8_t led_scale_indicator[12][12] = {
|
||||
{23, 29, 35, 41, 60, 66, 72, 78, 97, 103, 109, 115}, // C
|
||||
{ 5, 11, 17, 42, 48, 54, 79, 85, 91, NO_LED, NO_LED, NO_LED}, // C#
|
||||
{28, 34, 40, 65, 71, 77, 102, 108, 114, NO_LED, NO_LED, NO_LED}, // D
|
||||
{ 6, 12, 18, 43, 49, 55, 80, 86, 92, NO_LED, NO_LED, NO_LED}, // D#
|
||||
{27, 33, 39, 64, 70, 76, 101, 107, 113, NO_LED, NO_LED, NO_LED}, // E
|
||||
{ 7, 13, 19, 44, 50, 56, 81, 87, 93, NO_LED, NO_LED, NO_LED}, // F
|
||||
{26, 32, 38, 63, 69, 75, 100, 106, 112, NO_LED, NO_LED, NO_LED}, // F#
|
||||
{ 8, 14, 20, 45, 51, 57, 82, 88, 94, NO_LED, NO_LED, NO_LED}, // G
|
||||
{25, 31, 37, 62, 68, 74, 99, 105, 111, NO_LED, NO_LED, NO_LED}, // G#
|
||||
{ 9, 15, 21, 46, 52, 58, 83, 89, 95, NO_LED, NO_LED, NO_LED}, // A
|
||||
{24, 30, 36, 61, 67, 73, 98, 104, 110, NO_LED, NO_LED, NO_LED}, // A#
|
||||
{10, 16, 22, 47, 53, 59, 84, 90, 96, NO_LED, NO_LED, NO_LED} // B
|
||||
};
|
||||
|
||||
const uint8_t led_single_col_indicator[37][3] = {
|
||||
{41, 78, 115}, // K01 = C1
|
||||
{ 5, 42, 79}, // K02 = C#1
|
||||
{40, 77, 114}, // K03 = D1
|
||||
{ 6, 43, 80}, // K04 = D#1
|
||||
{39, 76, 113}, // K05 = E1
|
||||
{ 7, 44, 81}, // K06 = F1
|
||||
{38, 75, 112}, // K07 = F#1
|
||||
{ 8, 45, 82}, // K08 = G1
|
||||
{37, 74, 111}, // K09 = G#1
|
||||
{ 9, 46, 83}, // K10 = A1
|
||||
{36, 73, 110}, // K11 = A#1
|
||||
{10, 47, 84}, // K12 = B1
|
||||
{35, 72, 109}, // K13 = C2
|
||||
{11, 48, 85}, // K14 = C#2
|
||||
{34, 71, 108}, // K15 = D2
|
||||
{12, 49, 86}, // K16 = D#2
|
||||
{33, 70, 107}, // K17 = E2
|
||||
{13, 50, 87}, // K18 = F2
|
||||
{32, 69, 106}, // K19 = F#2
|
||||
{14, 51, 88}, // K20 = G2
|
||||
{31, 68, 105}, // K21 = G#2
|
||||
{15, 52, 89}, // K22 = A2
|
||||
{30, 67, 104}, // K23 = A#2
|
||||
{16, 53, 90}, // K24 = B2
|
||||
{29, 66, 103}, // K25 = C3
|
||||
{17, 54, 91}, // K26 = C#3
|
||||
{28, 65, 102}, // K27 = D3
|
||||
{18, 55, 92}, // K28 = D#3
|
||||
{27, 64, 101}, // K29 = E3
|
||||
{19, 56, 93}, // K30 = F3
|
||||
{26, 63, 100}, // K31 = F#3
|
||||
{20, 57, 94}, // K32 = G3
|
||||
{25, 62, 99}, // K33 = G#3
|
||||
{21, 58, 95}, // K34 = A3
|
||||
{24, 61, 98}, // K35 = A#3
|
||||
{22, 59, 96}, // K36 = B3
|
||||
{23, 60, 97} // K37 = C4
|
||||
};
|
||||
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
|
||||
uint8_t shift_led_indicator_left(uint8_t scale_indicator_col){
|
||||
if (scale_indicator_col > 0) {
|
||||
scale_indicator_col--;
|
||||
} else {
|
||||
scale_indicator_col = 11;
|
||||
}
|
||||
return scale_indicator_col;
|
||||
}
|
||||
|
||||
uint8_t shift_led_indicator_right(uint8_t scale_indicator_col){
|
||||
if (scale_indicator_col < 11) {
|
||||
scale_indicator_col++;
|
||||
} else {
|
||||
scale_indicator_col = 0;
|
||||
}
|
||||
return scale_indicator_col;
|
||||
}
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
# ifdef ENCODERS
|
||||
static uint8_t encoder_state[ENCODERS] = {0};
|
||||
static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY;
|
||||
static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY;
|
||||
# endif
|
||||
|
||||
void encoder_action_unregister(void) {
|
||||
# ifdef ENCODERS
|
||||
for (int index = 0; index < ENCODERS; ++index) {
|
||||
if (encoder_state[index]) {
|
||||
keyevent_t encoder_event = (keyevent_t) {
|
||||
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
|
||||
.pressed = false,
|
||||
.time = (timer_read() | 1)
|
||||
};
|
||||
encoder_state[index] = 0;
|
||||
action_exec(encoder_event);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
void encoder_action_register(uint8_t index, bool clockwise) {
|
||||
# ifdef ENCODERS
|
||||
keyevent_t encoder_event = (keyevent_t) {
|
||||
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
|
||||
.pressed = true,
|
||||
.time = (timer_read() | 1)
|
||||
};
|
||||
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
|
||||
# ifdef CONSOLE_ENABLE
|
||||
uprintf("encoder_action_register index = %u, clockwise = %u, row = %u, col = %u\n", index, clockwise, encoder_event.key.row, encoder_event.key.col);
|
||||
# endif
|
||||
action_exec(encoder_event);
|
||||
# endif
|
||||
}
|
||||
|
||||
void matrix_scan_kb(void) {
|
||||
encoder_action_unregister();
|
||||
matrix_scan_user();
|
||||
}
|
||||
|
||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
encoder_action_register(index, clockwise);
|
||||
// don't return user actions, because they are in the keymap
|
||||
// encoder_update_user(index, clockwise);
|
||||
return true;
|
||||
};
|
||||
|
||||
#endif
|
122
keyboards/chromatonemini/chromatonemini.h
Normal file
122
keyboards/chromatonemini/chromatonemini.h
Normal file
@ -0,0 +1,122 @@
|
||||
/* Copyright 2021 3araht
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
/* This is a shortcut to help you visually see your layout.
|
||||
*
|
||||
* The first section contains all of the arguments representing the physical
|
||||
* layout of the board and position of the keys.
|
||||
*
|
||||
* The second converts the arguments into a two-dimensional array which
|
||||
* represents the switch matrix.
|
||||
*/
|
||||
#define LAYOUT( \
|
||||
enc, sustain, ccw, cw, \
|
||||
up, \
|
||||
left, right, k01, k03, k05, k07, k09, k11, k13, k15, k17, k19, k21, k23, k25, k27, k29, k31, k33, k35, k37, \
|
||||
down, k02, k04, k06, k08, k10, k12, k14, k16, k18, k20, k22, k24, k26, k28, k30, k32, k34, k36 \
|
||||
) { \
|
||||
{ enc, down, left, right, up, k01, k02, sustain }, \
|
||||
{ k03, k04, k05, k06, k07, k08, k09, ccw }, \
|
||||
{ k10, k11, k12, k13, k14, k15, k16, cw }, \
|
||||
{ k17, k18, k19, k20, k21, k22, k23, KC_NO }, \
|
||||
{ k24, k25, k26, k27, k28, k29, k30, KC_NO }, \
|
||||
{ k31, k32, k33, k34, k35, k36, k37, KC_NO } \
|
||||
}
|
||||
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
extern led_config_t g_led_config;
|
||||
extern const uint8_t led_scale_indicator[12][12];
|
||||
extern const uint8_t led_single_col_indicator[37][3];
|
||||
|
||||
// default base layer color
|
||||
# define BASE_LAYER_COLOR RGB_DARKGOLDENROD
|
||||
|
||||
// border color
|
||||
# define FLIP_BORDER_COLOR RGB_DARKRED
|
||||
|
||||
// flip entirely
|
||||
# define FLIPB_LAYER_COLOR RGB_DARKYELLOW
|
||||
|
||||
// channel separation group
|
||||
# define SEPALEFT_LAYER_COLOR RGB_DARKGREEN
|
||||
# define SEPAHALF_LAYER_COLOR RGB_DARKGREEN
|
||||
# define SEPARIGHT_LAYER_COLOR RGB_DARKGREEN
|
||||
|
||||
// Trans group
|
||||
# define TRANS_LAYER_COLOR RGB_DARKORANGE
|
||||
# define SEPALEFT_T_LAYER_COLOR RGB_DARKORANGE
|
||||
# define SEPAHALF_T_LAYER_COLOR RGB_DARKORANGE
|
||||
# define SEPARIGHT_T_LAYER_COLOR RGB_DARKORANGE
|
||||
# define FLIPT_LAYER_COLOR RGB_DARKORANGE
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
|
||||
// Defines names for use in _FN layer to specify which column to be used to turn on the LEDs.
|
||||
// use this with led_single_col_indicator[37][3], ex. led_single_col_indicator[_FN_C2][0].
|
||||
enum my_key_names {
|
||||
_KEY01= 0,
|
||||
_KEY02,
|
||||
_KEY03,
|
||||
_KEY04,
|
||||
_KEY05,
|
||||
_KEY06,
|
||||
_KEY07,
|
||||
_KEY08,
|
||||
_KEY09,
|
||||
_KEY10,
|
||||
_KEY11,
|
||||
_KEY12,
|
||||
_KEY13,
|
||||
_KEY14,
|
||||
_KEY15,
|
||||
_KEY16,
|
||||
_KEY17,
|
||||
_KEY18,
|
||||
_KEY19,
|
||||
_KEY20,
|
||||
_KEY21,
|
||||
_KEY22,
|
||||
_KEY23,
|
||||
_KEY24,
|
||||
_KEY25,
|
||||
_KEY26,
|
||||
_KEY27,
|
||||
_KEY28,
|
||||
_KEY29,
|
||||
_KEY30,
|
||||
_KEY31,
|
||||
_KEY32,
|
||||
_KEY33,
|
||||
_KEY34,
|
||||
_KEY35,
|
||||
_KEY36,
|
||||
_KEY37,
|
||||
};
|
||||
|
||||
#ifdef MIDI_ENABLE
|
||||
extern MidiDevice midi_device;
|
||||
#endif // MIDI_ENABLE
|
||||
|
||||
uint8_t shift_led_indicator_left(uint8_t scale_indicator_col);
|
||||
uint8_t shift_led_indicator_right(uint8_t scale_indicator_col);
|
||||
|
||||
void encoder_action_unregister(void);
|
||||
|
||||
void encoder_action_register(uint8_t index, bool clockwise);
|
283
keyboards/chromatonemini/config.h
Normal file
283
keyboards/chromatonemini/config.h
Normal file
@ -0,0 +1,283 @@
|
||||
/*
|
||||
Copyright 2021 3araht
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 6
|
||||
#define MATRIX_COLS 8
|
||||
|
||||
/*
|
||||
* 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 { E6, D7, C6, D4, D0, D1 }
|
||||
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
/* COL2ROW, ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/*
|
||||
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
|
||||
*/
|
||||
// #define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
|
||||
//#define LED_NUM_LOCK_PIN B0
|
||||
//#define LED_CAPS_LOCK_PIN B1
|
||||
//#define LED_SCROLL_LOCK_PIN B2
|
||||
//#define LED_COMPOSE_PIN B3
|
||||
//#define LED_KANA_PIN B4
|
||||
|
||||
//#define BACKLIGHT_PIN B7
|
||||
//#define BACKLIGHT_LEVELS 3
|
||||
//#define BACKLIGHT_BREATHING
|
||||
|
||||
/* ws2812 RGB LED */
|
||||
#define RGB_DI_PIN D3
|
||||
//#ifdef RGB_DI_PIN
|
||||
//# define RGBLED_NUM 16
|
||||
//# define RGBLIGHT_HUE_STEP 8
|
||||
//# define RGBLIGHT_SAT_STEP 8
|
||||
//# define RGBLIGHT_VAL_STEP 8
|
||||
//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
|
||||
//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
|
||||
/*== all animations enable ==*/
|
||||
//# define RGBLIGHT_ANIMATIONS
|
||||
/*== or choose animations ==*/
|
||||
//# define RGBLIGHT_EFFECT_BREATHING
|
||||
//# define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
//# define RGBLIGHT_EFFECT_SNAKE
|
||||
//# define RGBLIGHT_EFFECT_KNIGHT
|
||||
//# define RGBLIGHT_EFFECT_CHRISTMAS
|
||||
//# define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
//# define RGBLIGHT_EFFECT_RGB_TEST
|
||||
//# define RGBLIGHT_EFFECT_ALTERNATING
|
||||
/*== customize breathing effect ==*/
|
||||
/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
|
||||
//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
|
||||
/*==== use exp() and sin() ====*/
|
||||
//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
|
||||
//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
|
||||
//#endif
|
||||
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
|
||||
/* ws2812 RGB MATRIX */
|
||||
# define DRIVER_LED_TOTAL 116
|
||||
|
||||
// reacts to keypresses
|
||||
# define RGB_MATRIX_KEYPRESSES
|
||||
|
||||
// for all fingers used at once.
|
||||
# define LED_HITS_TO_REMEMBER 10
|
||||
|
||||
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50
|
||||
# define RGB_MATRIX_STARTUP_SPD 127
|
||||
# define RGB_MATRIX_CENTER { 124, 32 }
|
||||
// the above brighness setting has no effect on rgb_matrix_set_color().
|
||||
// Use darker colors instead.
|
||||
/* RGB darker COLORS */
|
||||
# define RGB_DARKWHITE 0x33, 0x33, 0x33
|
||||
# define RGB_DARKRED 0x33, 0x0, 0x0
|
||||
# define RGB_DARKCORAL 0x33, 0x18, 0xF
|
||||
# define RGB_DARKORANGE 0x33, 0x19, 0x0
|
||||
# define RGB_DARKGOLDENROD 0x2B, 0x21, 0x6
|
||||
# define RGB_DARKGOLD 0x33, 0x2B, 0x0
|
||||
# define RGB_DARKYELLOW 0x33, 0x33, 0x0
|
||||
# define RGB_DARKCHARTREUSE 0x19, 0x33, 0x0
|
||||
# define RGB_DARKGREEN 0x0, 0x33, 0x0
|
||||
# define RGB_DARKSPRINGGREEN 0x0, 0x33, 0x19
|
||||
# define RGB_DARKTURQUOISE 0xE, 0x16, 0x15
|
||||
# define RGB_DARKTEAL 0x0, 0x19, 0x19
|
||||
# define RGB_DARKCYAN 0x0, 0x33, 0x33
|
||||
# define RGB_DARKAZURE 0x1E, 0x31, 0x33
|
||||
# define RGB_DARKBLUE 0x0, 0x0, 0x33
|
||||
# define RGB_DARKPURPLE 0x18, 0x0, 0x33
|
||||
# define RGB_DARKMAGENTA 0x33, 0x0, 0x33
|
||||
# define RGB_DARKPINK 0x33, 0x19, 0x26
|
||||
|
||||
// https://docs.qmk.fm/#/feature_rgb_matrix
|
||||
// Enable suspend mode.
|
||||
# define RGB_DISABLE_WHEN_USB_SUSPENDED
|
||||
|
||||
# ifdef CONSOLE_ENABLE
|
||||
# define ENABLE_RGB_MATRIX_SOLID_COLOR
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
# else
|
||||
# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
|
||||
# define ENABLE_RGB_MATRIX_BREATHING
|
||||
# define ENABLE_RGB_MATRIX_BAND_SAT
|
||||
# define ENABLE_RGB_MATRIX_BAND_VAL
|
||||
# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
||||
# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
||||
# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
||||
# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_ALL
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
|
||||
# define ENABLE_RGB_MATRIX_DUAL_BEACON
|
||||
# define ENABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
# define ENABLE_RGB_MATRIX_RAINDROPS
|
||||
# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
# define ENABLE_RGB_MATRIX_HUE_BREATHING
|
||||
# define ENABLE_RGB_MATRIX_HUE_PENDULUM
|
||||
# define ENABLE_RGB_MATRIX_HUE_WAVE
|
||||
# define ENABLE_RGB_MATRIX_TYPING_HEATMAP
|
||||
# define ENABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
# define ENABLE_RGB_MATRIX_SPLASH
|
||||
# define ENABLE_RGB_MATRIX_MULTISPLASH
|
||||
# define ENABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
# endif // CONSOLE_ENABLE
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
|
||||
/* 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
|
||||
|
||||
// /* 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
|
||||
|
||||
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
|
||||
* This is useful for the Windows task manager shortcut (ctrl+shift+esc).
|
||||
*/
|
||||
//#define GRAVE_ESC_CTRL_OVERRIDE
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
/* Bootmagic Lite key configuration */
|
||||
//#define BOOTMAGIC_LITE_ROW 0
|
||||
//#define BOOTMAGIC_LITE_COLUMN 0
|
||||
|
||||
/* Audio */
|
||||
#ifdef AUDIO_ENABLE
|
||||
# define AUDIO_PIN B6 // use PB6 = PIN10 as Audio output
|
||||
// #define DAC_SAMPLE_MAX 32768U
|
||||
# define DAC_SAMPLE_MAX 65535U
|
||||
// #define AUDIO_CLICKY
|
||||
# define NO_MUSIC_MODE
|
||||
// #define STARTUP_SONG SONG(FANTASIE_IMPROMPTU)
|
||||
// #define STARTUP_SONG SONG(NOCTURNE_OP_9_NO_1)
|
||||
// #define STARTUP_SONG SONG(USSR_ANTHEM)
|
||||
// #define STARTUP_SONG SONG(CAMPANELLA)
|
||||
#endif // AUDIO_ENABLE
|
||||
|
||||
/*
|
||||
* MIDI options
|
||||
*/
|
||||
|
||||
/* enable basic MIDI features:
|
||||
- MIDI notes can be sent when in Music mode is on
|
||||
*/
|
||||
//#define MIDI_BASIC
|
||||
|
||||
/* enable advanced MIDI features:
|
||||
- MIDI notes can be added to the keymap
|
||||
- Octave shift and transpose
|
||||
- Virtual sustain, portamento, and modulation wheel
|
||||
- etc.
|
||||
*/
|
||||
#ifdef MIDI_ENABLE
|
||||
# define MIDI_ADVANCED
|
||||
// Initial velocity value (avoid using 127 since it is used as a special number in some sound sources.)
|
||||
# define MIDI_INITIAL_VELOCITY 117
|
||||
#endif // MIDI_ENABLE
|
||||
|
||||
/*
|
||||
* Encoder options
|
||||
*/
|
||||
#ifdef ENCODER_ENABLE
|
||||
# define ENCODERS_PAD_A { B5 }
|
||||
# define ENCODERS_PAD_B { B4 }
|
||||
# define ENCODER_RESOLUTION 4
|
||||
# define TAP_CODE_DELAY 10
|
||||
|
||||
#define ENCODERS 1
|
||||
#define ENCODERS_CW_KEY { {7, 2} }
|
||||
#define ENCODERS_CCW_KEY { {7, 1} }
|
||||
#endif // ENCODER_ENABLE
|
||||
|
||||
/* 2021/01/22 added to shrink firmware size */
|
||||
// NO_ACTION_TAPPING -1964 bytes, however, this disables Layer mods...
|
||||
// #define NO_ACTION_TAPPING
|
||||
// NO_ACTION_ONESHOT -388 bytes
|
||||
#define NO_ACTION_ONESHOT
|
61
keyboards/chromatonemini/info.json
Normal file
61
keyboards/chromatonemini/info.json
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"keyboard_name": "chromatonemini",
|
||||
"manufacturer": "3araht",
|
||||
"url": "https://github.com/3araht/chromatonemini",
|
||||
"maintainer": "3araht",
|
||||
"usb": {
|
||||
"vid": "0xFEED",
|
||||
"pid": "0xF4B4",
|
||||
"device_version": "0.0.1"
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"label":"enc", "x":0.5, "y":0},
|
||||
{"label":"sustain", "x":1.5, "y":0},
|
||||
{"label":"ccw", "x":2.5, "y":0},
|
||||
{"label":"cw", "x":3.5, "y":0},
|
||||
{"label":"up", "x":0.5, "y":1.5},
|
||||
{"label":"left", "x":0, "y":2.5},
|
||||
{"label":"right", "x":1, "y":2.5},
|
||||
{"label":"k01", "x":2.5, "y":2.5},
|
||||
{"label":"k03", "x":3.5, "y":2.5},
|
||||
{"label":"k05", "x":4.5, "y":2.5},
|
||||
{"label":"k07", "x":5.5, "y":2.5},
|
||||
{"label":"k09", "x":6.5, "y":2.5},
|
||||
{"label":"k11", "x":7.5, "y":2.5},
|
||||
{"label":"k13", "x":8.5, "y":2.5},
|
||||
{"label":"k15", "x":9.5, "y":2.5},
|
||||
{"label":"k17", "x":10.5, "y":2.5},
|
||||
{"label":"k19", "x":11.5, "y":2.5},
|
||||
{"label":"k21", "x":12.5, "y":2.5},
|
||||
{"label":"k23", "x":13.5, "y":2.5},
|
||||
{"label":"k25", "x":14.5, "y":2.5},
|
||||
{"label":"k27", "x":15.5, "y":2.5},
|
||||
{"label":"k29", "x":16.5, "y":2.5},
|
||||
{"label":"k31", "x":17.5, "y":2.5},
|
||||
{"label":"k33", "x":18.5, "y":2.5},
|
||||
{"label":"k35", "x":19.5, "y":2.5},
|
||||
{"label":"k37", "x":20.5, "y":2.5},
|
||||
{"label":"down", "x":0.5, "y":3.5},
|
||||
{"label":"k02", "x":3, "y":3.5},
|
||||
{"label":"k04", "x":4, "y":3.5},
|
||||
{"label":"k06", "x":5, "y":3.5},
|
||||
{"label":"k08", "x":6, "y":3.5},
|
||||
{"label":"k10", "x":7, "y":3.5},
|
||||
{"label":"k12", "x":8, "y":3.5},
|
||||
{"label":"k14", "x":9, "y":3.5},
|
||||
{"label":"k16", "x":10, "y":3.5},
|
||||
{"label":"k18", "x":11, "y":3.5},
|
||||
{"label":"k20", "x":12, "y":3.5},
|
||||
{"label":"k22", "x":13, "y":3.5},
|
||||
{"label":"k24", "x":14, "y":3.5},
|
||||
{"label":"k26", "x":15, "y":3.5},
|
||||
{"label":"k28", "x":16, "y":3.5},
|
||||
{"label":"k30", "x":17, "y":3.5},
|
||||
{"label":"k32", "x":18, "y":3.5},
|
||||
{"label":"k34", "x":19, "y":3.5},
|
||||
{"label":"k36", "x":20, "y":3.5}]
|
||||
}
|
||||
}
|
||||
}
|
106
keyboards/chromatonemini/keymaps/default/keymap.c
Normal file
106
keyboards/chromatonemini/keymaps/default/keymap.c
Normal file
@ -0,0 +1,106 @@
|
||||
/* Copyright 2021 3araht
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "version.h"
|
||||
|
||||
// Defines names for use in layer keycodes and the keymap
|
||||
enum layer_names {
|
||||
_BASE,
|
||||
_RESERVE,
|
||||
_FN
|
||||
};
|
||||
|
||||
// Defines the keycodes used by our macros in process_record_user
|
||||
enum custom_keycodes {
|
||||
L_BASE = SAFE_RANGE,
|
||||
L_RESERVE,
|
||||
VERSION
|
||||
};
|
||||
|
||||
// Long press: go to _FN layer, tap: MUTE
|
||||
#define FN_MUTE LT(_FN, KC_MUTE)
|
||||
|
||||
// Used to set octave to MI_OCT_0
|
||||
extern midi_config_t midi_config;
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Base */
|
||||
[_BASE] = LAYOUT(
|
||||
FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU,
|
||||
MI_BENDU,
|
||||
MI_TRNSD, MI_TRNSU, MI_C_2, MI_D_2, MI_E_2, MI_Fs_2, MI_Ab_2, MI_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
MI_BENDD, MI_Db_2, MI_Eb_2, MI_F_2, MI_G_2, MI_A_2, MI_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* RESERVE */
|
||||
[_RESERVE] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
[_FN] = LAYOUT(
|
||||
_______, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
MI_VELU,
|
||||
MI_OCTD, MI_OCTU, L_BASE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION, XXXXXXX, XXXXXXX,
|
||||
MI_VELD, L_RESERVE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, XXXXXXX, XXXXXXX
|
||||
)
|
||||
};
|
||||
|
||||
// commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
void my_init(void){
|
||||
// Set octave to MI_OCT_1
|
||||
midi_config.octave = MI_OCT_0 - MIDI_OCTAVE_MIN;
|
||||
// avoid using 127 since it is used as a special number in some sound sources.
|
||||
midi_config.velocity = MIDI_INITIAL_VELOCITY;
|
||||
default_layer_set(1UL << _BASE);
|
||||
}
|
||||
|
||||
void eeconfig_init_user(void) { // EEPROM is getting reset!
|
||||
midi_init();
|
||||
my_init(); // commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
}
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
my_init(); // commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
};
|
||||
|
||||
void reset_scale_indicator(void) {
|
||||
// reset transpose value and scale_indicator_col to default.
|
||||
midi_config.transpose = 0;
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case VERSION: // Output firmware info.
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " | " QMK_BUILDDATE);
|
||||
}
|
||||
break;
|
||||
|
||||
case L_BASE:
|
||||
reset_scale_indicator();
|
||||
default_layer_set(1UL << _BASE);
|
||||
break;
|
||||
|
||||
case L_RESERVE:
|
||||
reset_scale_indicator();
|
||||
default_layer_set(1UL << _RESERVE);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
1
keyboards/chromatonemini/keymaps/default/readme.md
Normal file
1
keyboards/chromatonemini/keymaps/default/readme.md
Normal file
@ -0,0 +1 @@
|
||||
# The default keymap for chromatonemini
|
682
keyboards/chromatonemini/keymaps/led/keymap.c
Normal file
682
keyboards/chromatonemini/keymaps/led/keymap.c
Normal file
@ -0,0 +1,682 @@
|
||||
/* Copyright 2021 3araht
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "version.h"
|
||||
|
||||
// define which MIDI ch to use.
|
||||
// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
|
||||
// ch1
|
||||
#define DEFAULT_MAIN_CH_NUMBER 0
|
||||
// ch3
|
||||
#define DEFAULT_SUB_CH_NUMBER 2
|
||||
// ch2
|
||||
#define ALT_MAIN_CH_NUMBER 1
|
||||
// ch4
|
||||
#define ALT_SUB_CH_NUMBER 3
|
||||
static uint8_t midi_left_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for left side when separated.
|
||||
|
||||
// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
|
||||
// When false, ALT ch group (ALT_MAIN_CH_NUMBER for entirely, or right side when separated, ALT_SUB_CH_NUMBER for left side) is used.
|
||||
static bool use_alt_ch_gr = false;
|
||||
|
||||
// Defines names for use in layer keycodes and the keymap
|
||||
enum layer_names {
|
||||
_BASE, // Base layer, shift mode, single channel.
|
||||
_SEPALEFTOCT, // 1st oct channel separated version. Shift mode.
|
||||
_SEPAHALF, // Half channel separated version. Shift mode.
|
||||
_SEPARIGHTOCT, // 2nd oct channel separated version. Shift mode.
|
||||
_TRANS, // Transpose feature is enabled instead of shift mode, single channel.
|
||||
_FLIPBASE, // Horizontal flipped version entirely. single channel.
|
||||
_FLIPTRANS, // Horizontal flipped version entirely. Transpose is used. single channel.
|
||||
_FN // FuNction layer. This must be at the end of the enumurate to use the range from _LS_FN ... _LS_FN_MAX for FN layer LED settings.
|
||||
};
|
||||
|
||||
// Layer State
|
||||
#define _LS_BASE (1UL << _BASE)
|
||||
#define _LS_SEPALEFTOCT (1UL << _SEPALEFTOCT)
|
||||
#define _LS_SEPAHALF (1UL << _SEPAHALF)
|
||||
#define _LS_SEPARIGHTOCT (1UL << _SEPARIGHTOCT)
|
||||
#define _LS_FLIPBASE (1UL << _FLIPBASE)
|
||||
|
||||
#define _LS_TRANS (1UL << _BASE | 1UL << _TRANS)
|
||||
#define _LS_SEPALEFTOCT_T (1UL << _SEPALEFTOCT | 1UL << _TRANS)
|
||||
#define _LS_SEPAHALF_T (1UL << _SEPAHALF | 1UL << _TRANS)
|
||||
#define _LS_SEPARIGHTOCT_T (1UL << _SEPARIGHTOCT | 1UL << _TRANS)
|
||||
#define _LS_FLIPTRANS (1UL << _FLIPBASE | 1UL << _FLIPTRANS)
|
||||
|
||||
#define _LS_FN (1UL << _FN)
|
||||
#define _LS_MAX (_LS_FN << 1)
|
||||
|
||||
// Don't change the DEFAULT_SCALE_COL value below. It must be 0.
|
||||
#define DEFAULT_SCALE_COL 0
|
||||
static uint8_t scale_indicator_col = DEFAULT_SCALE_COL;
|
||||
static bool trans_mode_indicator_loc_sel = true; // when it is true, the location is _KEY01, _KEY13, ...
|
||||
|
||||
// use led indicator or not.
|
||||
static bool led_indicator_enable = true;
|
||||
|
||||
// Defines the keycodes used by our macros in process_record_user
|
||||
enum custom_keycodes {
|
||||
SHIFT_L = SAFE_RANGE,
|
||||
SHIFT_R,
|
||||
TGLINDI, // ToGgLe INDIcator
|
||||
TGLINTR, // ToGgLe INdicator location {(_KEY01, _KEY13, _KEY25, _KEY37) or (_KEY02, _KEY14, _KEY26) / (_KEY12, _KEY24, _KEY36)}in TRans mode
|
||||
TGLTRNS, // ToGgLe TRaNS and shift
|
||||
TGLCHGR, // ToGgLe CH GRoup
|
||||
VERSION,
|
||||
|
||||
B_BASE, // border set to the left end.
|
||||
B_LEFT, // border set to the 1st left octave.
|
||||
B_CENTER, // border set to the center.
|
||||
B_RIGHT, // border set to the 1st right octave.
|
||||
B_FLIP, // border set to the right end.
|
||||
|
||||
// MY tone for _FLIPHALF and _FLIPLEFTOCT layers to distinguish the notes to avoid sustain effect, etc.
|
||||
// Since they are flipped, their subscripts are not MY_ but YM_, to make them easier to tell.
|
||||
YM_TONE_MIN,
|
||||
|
||||
YM_C = YM_TONE_MIN,
|
||||
YM_Cs,
|
||||
YM_Db = YM_Cs,
|
||||
YM_D,
|
||||
YM_Ds,
|
||||
YM_Eb = YM_Ds,
|
||||
YM_E,
|
||||
YM_F,
|
||||
YM_Fs,
|
||||
YM_Gb = YM_Fs,
|
||||
YM_G,
|
||||
YM_Gs,
|
||||
YM_Ab = YM_Gs,
|
||||
YM_A,
|
||||
YM_As,
|
||||
YM_Bb = YM_As,
|
||||
YM_B,
|
||||
|
||||
YM_C_1,
|
||||
YM_Cs_1,
|
||||
YM_Db_1 = YM_Cs_1,
|
||||
YM_D_1,
|
||||
YM_Ds_1,
|
||||
YM_Eb_1 = YM_Ds_1,
|
||||
YM_E_1,
|
||||
YM_F_1,
|
||||
YM_Fs_1,
|
||||
YM_Gb_1 = YM_Fs_1,
|
||||
YM_G_1,
|
||||
YM_Gs_1,
|
||||
YM_Ab_1 = YM_Gs_1,
|
||||
YM_A_1,
|
||||
YM_As_1,
|
||||
YM_Bb_1 = YM_As_1,
|
||||
YM_B_1,
|
||||
|
||||
YM_C_2,
|
||||
YM_Cs_2,
|
||||
YM_Db_2 = YM_Cs_2,
|
||||
YM_D_2,
|
||||
YM_Ds_2,
|
||||
YM_Eb_2 = YM_Ds_2,
|
||||
YM_E_2,
|
||||
YM_F_2,
|
||||
YM_Fs_2,
|
||||
YM_Gb_2 = YM_Fs_2,
|
||||
YM_G_2,
|
||||
YM_Gs_2,
|
||||
YM_Ab_2 = YM_Gs_2,
|
||||
YM_A_2,
|
||||
YM_As_2,
|
||||
YM_Bb_2 = YM_As_2,
|
||||
YM_B_2,
|
||||
|
||||
YM_C_3,
|
||||
YM_Cs_3,
|
||||
YM_Db_3 = YM_Cs_3,
|
||||
YM_D_3,
|
||||
YM_Ds_3,
|
||||
YM_Eb_3 = YM_Ds_3,
|
||||
YM_E_3,
|
||||
YM_F_3,
|
||||
YM_Fs_3,
|
||||
YM_Gb_3 = YM_Fs_3,
|
||||
YM_G_3,
|
||||
YM_Gs_3,
|
||||
YM_Ab_3 = YM_Gs_3,
|
||||
YM_A_3,
|
||||
YM_As_3,
|
||||
YM_Bb_3 = YM_As_3,
|
||||
YM_B_3,
|
||||
|
||||
YM_C_4,
|
||||
YM_Cs_4,
|
||||
YM_Db_4 = YM_Cs_4,
|
||||
YM_D_4,
|
||||
YM_Ds_4,
|
||||
YM_Eb_4 = YM_Ds_4,
|
||||
YM_E_4,
|
||||
YM_F_4,
|
||||
YM_Fs_4,
|
||||
YM_Gb_4 = YM_Fs_4,
|
||||
YM_G_4,
|
||||
YM_Gs_4,
|
||||
YM_Ab_4 = YM_Gs_4,
|
||||
YM_A_4,
|
||||
YM_As_4,
|
||||
YM_Bb_4 = YM_As_4,
|
||||
YM_B_4,
|
||||
|
||||
YM_C_5,
|
||||
YM_Cs_5,
|
||||
YM_Db_5 = YM_Cs_5,
|
||||
YM_D_5,
|
||||
YM_Ds_5,
|
||||
YM_Eb_5 = YM_Ds_5,
|
||||
YM_E_5,
|
||||
YM_F_5,
|
||||
YM_Fs_5,
|
||||
YM_Gb_5 = YM_Fs_5,
|
||||
YM_G_5,
|
||||
YM_Gs_5,
|
||||
YM_Ab_5 = YM_Gs_5,
|
||||
YM_A_5,
|
||||
YM_As_5,
|
||||
YM_Bb_5 = YM_As_5,
|
||||
YM_B_5,
|
||||
|
||||
YM_C_6,
|
||||
YM_TONE_MAX = YM_C_6
|
||||
};
|
||||
|
||||
#define MY_TONE_COUNT (YM_TONE_MAX - YM_TONE_MIN + 1)
|
||||
static uint8_t my_tone_status[MY_TONE_COUNT];
|
||||
|
||||
// Long press: go to _FN layer, tap: MUTE
|
||||
#define FN_MUTE LT(_FN, KC_MUTE)
|
||||
|
||||
// Used to set octave to MI_OCT_0
|
||||
extern midi_config_t midi_config;
|
||||
static bool is_trans_mode = false; // By default, shift mode is chosen.
|
||||
|
||||
static uint8_t key_separator_col = _KEY01; // (_KEY01 .. _KEY37). By default, _KEY01 (= _BASE layer) is chosen. _KEY13 = *LEFT, _KEY19 = *HALF, _KEY25 = *RIGHT, _KEY37 = _FLIPBASE and _FLIPTRANS.
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Base */
|
||||
[_BASE] = LAYOUT(
|
||||
FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU,
|
||||
MI_BENDU,
|
||||
SHIFT_L, SHIFT_R, MI_C_2, MI_D_2, MI_E_2, MI_Fs_2, MI_Ab_2, MI_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
MI_BENDD, MI_Db_2, MI_Eb_2, MI_F_2, MI_G_2, MI_A_2, MI_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* 1 octave on the left side is ch2, others are ch1 (normal) */
|
||||
[_SEPALEFTOCT] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
_______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* Half ch2, half ch1 (normal) */
|
||||
[_SEPAHALF] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, YM_C_3, YM_D_3, YM_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
_______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, YM_Db_3, YM_Eb_3, YM_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* 2 octave on the left side is ch2, others are ch1 (normal) */
|
||||
[_SEPARIGHTOCT] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, YM_C_3, YM_D_3, YM_E_3, YM_Fs_3, YM_Ab_3, YM_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
_______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, YM_Db_3, YM_Eb_3, YM_F_3, YM_G_3, YM_A_3, YM_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* TRANS This layer must locate 1 layer below _FN layer. */
|
||||
[_TRANS] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
MI_TRNSD, MI_TRNSU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
/* Flip Base SFIFTUP and SHIFT_L are swapped. */
|
||||
[_FLIPBASE] = LAYOUT(
|
||||
FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU,
|
||||
MI_BENDU,
|
||||
SHIFT_L, SHIFT_R, MI_C_5, MI_Bb_4, MI_Ab_4, MI_Fs_4, MI_E_4, MI_D_4, MI_C_4, MI_Bb_3, MI_Ab_3, MI_Fs_3, MI_E_3, MI_D_3, MI_C_3, MI_Bb_2, MI_Ab_2, MI_Fs_2, MI_E_2, MI_D_2, MI_C_2,
|
||||
MI_BENDD, MI_B_4, MI_A_4, MI_G_4, MI_F_4, MI_Eb_4, MI_Db_4, MI_B_3, MI_A_3, MI_G_3, MI_F_3, MI_Eb_3, MI_Db_3, MI_B_2, MI_A_2, MI_G_2, MI_F_2, MI_Eb_2, MI_Db_2
|
||||
),
|
||||
|
||||
/* Flip Trans This layer must locate 1 layer above _FLIPBASE layer. MI_TRNSU and MI_TRNSD are swapped. */
|
||||
[_FLIPTRANS] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
MI_TRNSU, MI_TRNSD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
[_FN] = LAYOUT(
|
||||
_______, XXXXXXX, RGB_RMOD, RGB_MOD,
|
||||
MI_VELU,
|
||||
MI_OCTD, MI_OCTU, B_BASE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, B_LEFT, XXXXXXX, XXXXXXX, B_CENTER, XXXXXXX, XXXXXXX, B_RIGHT, XXXXXXX, XXXXXXX, XXXXXXX, VERSION, XXXXXXX, B_FLIP,
|
||||
MI_VELD, TGLINTR, TGLTRNS, TGLCHGR, XXXXXXX, XXXXXXX, RGB_SAD, RGB_SAI, RGB_HUD, RGB_HUI, RGB_SPD, RGB_SPI, RGB_VAD, RGB_VAI, RGB_RMOD, RGB_MOD, EEP_RST, TGLINDI, RGB_TOG
|
||||
)
|
||||
};
|
||||
|
||||
// commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
void my_init(void){
|
||||
// Set octave to MI_OCT_1
|
||||
midi_config.octave = MI_OCT_0 - MIDI_OCTAVE_MIN;
|
||||
// avoid using 127 since it is used as a special number in some sound sources.
|
||||
midi_config.velocity = MIDI_INITIAL_VELOCITY;
|
||||
default_layer_set(_LS_BASE);
|
||||
layer_state_set(_LS_BASE);
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_sethsv(HSV_BLUE);
|
||||
rgb_matrix_mode(RGB_MATRIX_CUSTOM_my_solid_reactive_col);
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
}
|
||||
|
||||
void eeconfig_init_user(void) { // EEPROM is getting reset!
|
||||
midi_init();
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_enable();
|
||||
rgb_matrix_set_speed(RGB_MATRIX_STARTUP_SPD);
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
my_init(); // commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
}
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
for (uint8_t i = 0; i < MY_TONE_COUNT; i++) {
|
||||
my_tone_status[i] = MIDI_INVALID_NOTE;
|
||||
}
|
||||
my_init(); // commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
}
|
||||
|
||||
void reset_scale_indicator(void) {
|
||||
// reset transpose value and scale_indicator_col to default.
|
||||
midi_config.transpose = 0;
|
||||
scale_indicator_col = DEFAULT_SCALE_COL;
|
||||
trans_mode_indicator_loc_sel = true;
|
||||
}
|
||||
|
||||
void reset_all(void) {
|
||||
reset_scale_indicator();
|
||||
is_trans_mode = false; // trans mode is disabled by default.
|
||||
}
|
||||
|
||||
void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
|
||||
uint8_t mytone = keycode - YM_TONE_MIN;
|
||||
uint16_t mykeycode = mytone + MIDI_TONE_MIN;
|
||||
// uint16_t mykeycode = keycode - YM_TONE_MIN;
|
||||
// uint8_t mytone = mykeycode - MIDI_TONE_MIN;
|
||||
uint8_t velocity = midi_config.velocity;
|
||||
// uprintf("keycode=%u,mykeycode=%u,mytone =%u,velo = %u\n", keycode, mykeycode, mytone, velocity);
|
||||
if (record->event.pressed) {
|
||||
if (my_tone_status[mytone] == MIDI_INVALID_NOTE) {
|
||||
uint8_t note = midi_compute_note(mykeycode);
|
||||
midi_send_noteon(&midi_device, channel, note, velocity);
|
||||
dprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
|
||||
// uprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
|
||||
my_tone_status[mytone] = note; // store root_note status.
|
||||
}
|
||||
} else {
|
||||
uint8_t note = my_tone_status[mytone];
|
||||
if (note != MIDI_INVALID_NOTE) {
|
||||
midi_send_noteoff(&midi_device, channel, note, velocity);
|
||||
dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
|
||||
// uprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
|
||||
}
|
||||
my_tone_status[mytone] = MIDI_INVALID_NOTE;
|
||||
}
|
||||
}
|
||||
|
||||
void select_layer_state_set(void) {
|
||||
switch (key_separator_col) {
|
||||
case _KEY01:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_TRANS);
|
||||
} else {
|
||||
layer_state_set(_LS_BASE);
|
||||
}
|
||||
break;
|
||||
|
||||
case _KEY13:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_SEPALEFTOCT_T);
|
||||
} else {
|
||||
layer_state_set(_LS_SEPALEFTOCT);
|
||||
}
|
||||
break;
|
||||
|
||||
case _KEY19:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_SEPAHALF_T);
|
||||
} else {
|
||||
layer_state_set(_LS_SEPAHALF);
|
||||
}
|
||||
break;
|
||||
|
||||
case _KEY25:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_SEPARIGHTOCT_T);
|
||||
} else {
|
||||
layer_state_set(_LS_SEPARIGHTOCT);
|
||||
}
|
||||
break;
|
||||
|
||||
case _KEY37:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_FLIPTRANS);
|
||||
} else {
|
||||
layer_state_set(_LS_FLIPBASE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// uprintf("keycode=%u, YM_C_3=%u, YM_Db_2 =%u, YM_MIN = %u, YM_MAX = %u\n", keycode, YM_C_3, YM_Db_2, YM_TONE_MIN, YM_TONE_MAX);
|
||||
switch (keycode) {
|
||||
case VERSION: // Output firmware info.
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " | " QMK_BUILDDATE);
|
||||
}
|
||||
break;
|
||||
|
||||
// Layer-related settings.
|
||||
// reset_scale_indicator() first, followed by each modification, and then change the default layer.
|
||||
|
||||
// 1, separator column modification
|
||||
case B_BASE:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY01;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
case B_LEFT:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY13;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
case B_CENTER:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY19;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
case B_RIGHT:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY25;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
case B_FLIP:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY37;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
// 2, Toggle scale shift mode and transpose mode
|
||||
case TGLTRNS:
|
||||
if (record->event.pressed) {
|
||||
reset_scale_indicator();
|
||||
is_trans_mode = !is_trans_mode;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
// SHIFT_L and SHIFT_R can be pressed only when layer is either _BASE, _FLIPBASE.
|
||||
case SHIFT_L:
|
||||
if (record->event.pressed) {
|
||||
switch (layer_state) {
|
||||
case _LS_BASE:
|
||||
case _LS_SEPALEFTOCT:
|
||||
case _LS_SEPAHALF:
|
||||
case _LS_SEPARIGHTOCT:
|
||||
case _LS_FLIPBASE:
|
||||
scale_indicator_col = shift_led_indicator_left(scale_indicator_col);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SHIFT_R:
|
||||
if (record->event.pressed) {
|
||||
switch (layer_state) {
|
||||
case _LS_BASE:
|
||||
case _LS_SEPALEFTOCT:
|
||||
case _LS_SEPAHALF:
|
||||
case _LS_SEPARIGHTOCT:
|
||||
case _LS_FLIPBASE:
|
||||
scale_indicator_col = shift_led_indicator_right(scale_indicator_col);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TGLINDI:
|
||||
if (record->event.pressed) {
|
||||
led_indicator_enable = !led_indicator_enable;
|
||||
}
|
||||
break;
|
||||
|
||||
case TGLINTR:
|
||||
if (record->event.pressed) {
|
||||
switch (layer_state) {
|
||||
// main function of the TGLINTR part 1. alternate the status of trans_mode_indicator_loc_sel.
|
||||
case _LS_TRANS | (1UL << _FN):
|
||||
case _LS_SEPALEFTOCT_T | (1UL << _FN):
|
||||
case _LS_SEPAHALF_T | (1UL << _FN):
|
||||
case _LS_SEPARIGHTOCT_T | (1UL << _FN):
|
||||
trans_mode_indicator_loc_sel = !trans_mode_indicator_loc_sel;
|
||||
|
||||
// when trans_mode_indicator_loc_sel == false, change the scale indicator and transpose.
|
||||
scale_indicator_col = trans_mode_indicator_loc_sel ? 0:1;
|
||||
// when TGLINTR is pressed, it also change the initial transpose setting to follow the scale indicator.
|
||||
if (scale_indicator_col == 1) {
|
||||
midi_config.transpose = -1;
|
||||
} else {
|
||||
midi_config.transpose = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
// main function of the TGLINTR part 2. alternate the status of trans_mode_indicator_loc_sel.
|
||||
case _LS_FLIPTRANS | (1UL << _FN):
|
||||
trans_mode_indicator_loc_sel = !trans_mode_indicator_loc_sel;
|
||||
|
||||
// when trans_mode_indicator_loc_sel == false, change the scale indicator and transpose.
|
||||
scale_indicator_col = trans_mode_indicator_loc_sel ? 0:11;
|
||||
// when TGLINTR is pressed, it also change the initial transpose setting to follow the scale indicator.
|
||||
if (scale_indicator_col == 11) {
|
||||
midi_config.transpose = -1;
|
||||
} else {
|
||||
midi_config.transpose = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
// special treatment when TGLINTR is pressed in _LS_FLIPBASE layer.
|
||||
case _LS_FLIPBASE | (1UL << _FN): // when in FLIPBASE layer && non-Trans mode, change it to Trans mode.
|
||||
trans_mode_indicator_loc_sel = false;
|
||||
scale_indicator_col = 11;
|
||||
midi_config.transpose = -1;
|
||||
is_trans_mode = true;
|
||||
select_layer_state_set();
|
||||
break;
|
||||
|
||||
|
||||
// special treatment when TGLINTR is pressed in other non-Trans layer.
|
||||
default : // when other layers = non-Trans mode, change it to Trans mode.
|
||||
trans_mode_indicator_loc_sel = false;
|
||||
scale_indicator_col = 1;
|
||||
midi_config.transpose = -1;
|
||||
is_trans_mode = true;
|
||||
select_layer_state_set();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TGLCHGR:
|
||||
if (record->event.pressed) {
|
||||
use_alt_ch_gr = !use_alt_ch_gr;
|
||||
if (use_alt_ch_gr) {
|
||||
midi_config.channel = ALT_MAIN_CH_NUMBER;
|
||||
midi_left_ch = ALT_SUB_CH_NUMBER;
|
||||
} else { // default
|
||||
midi_config.channel = DEFAULT_MAIN_CH_NUMBER;
|
||||
midi_left_ch = DEFAULT_SUB_CH_NUMBER;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case YM_TONE_MIN ... YM_TONE_MAX: // MY tone
|
||||
// uprintf("keycode=%u, YM_C_3=%u, YM_Db_2 =%u, YM_MIN = %u, YM_MAX = %u\n", keycode, YM_C_3, YM_Db_2, YM_TONE_MIN, YM_TONE_MAX);
|
||||
// DO NOT THROW BELOW into 'if (record->event.pressed) {}' STATEMENT SINCE IT IS USED IN THE FUNCTION BELOW.
|
||||
my_process_midi4single_note(midi_left_ch, keycode, record, my_tone_status);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void set_led_scale_indicator(uint8_t r, uint8_t g, uint8_t b) {
|
||||
uint8_t max_scale_indicator_led_loop;
|
||||
uint8_t i;
|
||||
if (led_indicator_enable) { // turn on indicators when enabled.
|
||||
max_scale_indicator_led_loop = ( scale_indicator_col == DEFAULT_SCALE_COL ) ? 12 : 9;
|
||||
for (i = 0; i < max_scale_indicator_led_loop; i++) {
|
||||
rgb_matrix_set_color(led_scale_indicator[scale_indicator_col][i], r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_matrix_indicators_user(void) {
|
||||
// uint32_t mode = rgblight_get_mode();
|
||||
|
||||
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled.
|
||||
|
||||
// uint8_t max_scale_indicator_led_loop;
|
||||
uint8_t i;
|
||||
|
||||
switch (layer_state) {
|
||||
case _LS_BASE:
|
||||
set_led_scale_indicator(BASE_LAYER_COLOR);
|
||||
break;
|
||||
|
||||
case _LS_FLIPBASE:
|
||||
set_led_scale_indicator(FLIPB_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY37][i], FLIP_BORDER_COLOR); // right end
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_TRANS:
|
||||
set_led_scale_indicator(TRANS_LAYER_COLOR);
|
||||
break;
|
||||
|
||||
case _LS_SEPALEFTOCT_T:
|
||||
set_led_scale_indicator(SEPALEFT_T_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY13][i], FLIP_BORDER_COLOR); // Left
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPAHALF_T:
|
||||
set_led_scale_indicator(SEPAHALF_T_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY19][i], FLIP_BORDER_COLOR); // Center
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPARIGHTOCT_T:
|
||||
set_led_scale_indicator(SEPARIGHT_T_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY25][i], FLIP_BORDER_COLOR); // Right
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_FLIPTRANS:
|
||||
set_led_scale_indicator(FLIPT_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY37][i], FLIP_BORDER_COLOR); // right end
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPALEFTOCT:
|
||||
set_led_scale_indicator(SEPALEFT_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY13][i], FLIP_BORDER_COLOR); // Left
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPAHALF:
|
||||
set_led_scale_indicator(SEPAHALF_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY19][i], FLIP_BORDER_COLOR); // Center
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPARIGHTOCT:
|
||||
set_led_scale_indicator(SEPARIGHT_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY25][i], FLIP_BORDER_COLOR); // Right
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_FN ... _LS_MAX: // When Mute Button is long-pressed, the previous layers are still active.
|
||||
for (i = 1; i < 5; i++) {
|
||||
rgb_matrix_set_color(i, RGB_DARKSPRINGGREEN); // up(1) down(4) left(3) right(2) keys
|
||||
}
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY02][0], RGB_DARKSPRINGGREEN); // TGLTRNS
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY04][0], RGB_DARKSPRINGGREEN); // TGLINTR
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY06][0], RGB_DARKSPRINGGREEN); // TGLCHGR
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY01][i], BASE_LAYER_COLOR); // B_BASE
|
||||
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY13][i], SEPALEFT_LAYER_COLOR); // B_LEFT
|
||||
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY19][i], SEPAHALF_LAYER_COLOR); // B_CENTER
|
||||
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY25][i], SEPARIGHT_LAYER_COLOR); // B_RIGHT
|
||||
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY37][i], FLIPB_LAYER_COLOR); // B_FLIP
|
||||
}
|
||||
|
||||
for (i = _KEY12; i < _KEY37; i+=2){ // even numbers from _KEY12 to _KEY36 are LED related settings.
|
||||
// turn on the bottom row only to keep the visibility of the RGB MATRIX effects.
|
||||
rgb_matrix_set_color(led_single_col_indicator[i][0], RGB_DARKSPRINGGREEN); // // LED related settings.
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // RGB_MATRIX_ENABLE
|
1
keyboards/chromatonemini/keymaps/led/readme.md
Normal file
1
keyboards/chromatonemini/keymaps/led/readme.md
Normal file
@ -0,0 +1 @@
|
||||
# The LED enabled, customized keymap for chromatonemini
|
3
keyboards/chromatonemini/keymaps/led/rules.mk
Normal file
3
keyboards/chromatonemini/keymaps/led/rules.mk
Normal file
@ -0,0 +1,3 @@
|
||||
RGB_MATRIX_ENABLE = yes # Use RGB matrix (Don't enable this when RGBLIGHT_ENABLE is used.)
|
||||
RGB_MATRIX_CUSTOM_KB = yes #
|
||||
VIA_ENABLE = no # too many layers to use VIA...
|
684
keyboards/chromatonemini/keymaps/party/keymap.c
Normal file
684
keyboards/chromatonemini/keymaps/party/keymap.c
Normal file
@ -0,0 +1,684 @@
|
||||
/* Copyright 2021 3araht
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "version.h"
|
||||
|
||||
// define which MIDI ch to use.
|
||||
// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
|
||||
// ch1
|
||||
#define DEFAULT_MAIN_CH_NUMBER 0
|
||||
// ch3
|
||||
#define DEFAULT_SUB_CH_NUMBER 2
|
||||
// ch2
|
||||
#define ALT_MAIN_CH_NUMBER 1
|
||||
// ch4
|
||||
#define ALT_SUB_CH_NUMBER 3
|
||||
static uint8_t midi_left_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for left side when separated.
|
||||
|
||||
// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
|
||||
// When false, ALT ch group (ALT_MAIN_CH_NUMBER for entirely, or right side when separated, ALT_SUB_CH_NUMBER for left side) is used.
|
||||
static bool use_alt_ch_gr = false;
|
||||
|
||||
// Defines names for use in layer keycodes and the keymap
|
||||
enum layer_names {
|
||||
_BASE, // Base layer, shift mode, single channel.
|
||||
_SEPALEFTOCT, // 1st oct channel separated version. Shift mode.
|
||||
_SEPAHALF, // Half channel separated version. Shift mode.
|
||||
_SEPARIGHTOCT, // 2nd oct channel separated version. Shift mode.
|
||||
_TRANS, // Transpose feature is enabled instead of shift mode, single channel.
|
||||
_FLIPBASE, // Horizontal flipped version entirely. single channel.
|
||||
_FLIPTRANS, // Horizontal flipped version entirely. Transpose is used. single channel.
|
||||
_FN // FuNction layer. This must be at the end of the enumurate to use the range from _LS_FN ... _LS_FN_MAX for FN layer LED settings.
|
||||
};
|
||||
|
||||
// Layer State
|
||||
#define _LS_BASE (1UL << _BASE)
|
||||
#define _LS_SEPALEFTOCT (1UL << _SEPALEFTOCT)
|
||||
#define _LS_SEPAHALF (1UL << _SEPAHALF)
|
||||
#define _LS_SEPARIGHTOCT (1UL << _SEPARIGHTOCT)
|
||||
#define _LS_FLIPBASE (1UL << _FLIPBASE)
|
||||
|
||||
#define _LS_TRANS (1UL << _BASE | 1UL << _TRANS)
|
||||
#define _LS_SEPALEFTOCT_T (1UL << _SEPALEFTOCT | 1UL << _TRANS)
|
||||
#define _LS_SEPAHALF_T (1UL << _SEPAHALF | 1UL << _TRANS)
|
||||
#define _LS_SEPARIGHTOCT_T (1UL << _SEPARIGHTOCT | 1UL << _TRANS)
|
||||
#define _LS_FLIPTRANS (1UL << _FLIPBASE | 1UL << _FLIPTRANS)
|
||||
|
||||
#define _LS_FN (1UL << _FN)
|
||||
#define _LS_MAX (_LS_FN << 1)
|
||||
|
||||
// Don't change the DEFAULT_SCALE_COL value below. It must be 0.
|
||||
#define DEFAULT_SCALE_COL 0
|
||||
static uint8_t scale_indicator_col = DEFAULT_SCALE_COL;
|
||||
static bool trans_mode_indicator_loc_sel = true; // when it is true, the location is _KEY01, _KEY13, ...
|
||||
|
||||
// use led indicator or not.
|
||||
static bool led_indicator_enable = true;
|
||||
|
||||
// Defines the keycodes used by our macros in process_record_user
|
||||
enum custom_keycodes {
|
||||
SHIFT_L = SAFE_RANGE,
|
||||
SHIFT_R,
|
||||
TGLINDI, // ToGgLe INDIcator
|
||||
TGLINTR, // ToGgLe INdicator location {(_KEY01, _KEY13, _KEY25, _KEY37) or (_KEY02, _KEY14, _KEY26) / (_KEY12, _KEY24, _KEY36)}in TRans mode
|
||||
TGLTRNS, // ToGgLe TRaNS and shift
|
||||
TGLCHGR, // ToGgLe CH GRoup
|
||||
VERSION,
|
||||
|
||||
B_BASE, // border set to the left end.
|
||||
B_LEFT, // border set to the 1st left octave.
|
||||
B_CENTER, // border set to the center.
|
||||
B_RIGHT, // border set to the 1st right octave.
|
||||
B_FLIP, // border set to the right end.
|
||||
|
||||
// MY tone for _FLIPHALF and _FLIPLEFTOCT layers to distinguish the notes to avoid sustain effect, etc.
|
||||
// Since they are flipped, their subscripts are not MY_ but YM_, to make them easier to tell.
|
||||
YM_TONE_MIN,
|
||||
|
||||
YM_C = YM_TONE_MIN,
|
||||
YM_Cs,
|
||||
YM_Db = YM_Cs,
|
||||
YM_D,
|
||||
YM_Ds,
|
||||
YM_Eb = YM_Ds,
|
||||
YM_E,
|
||||
YM_F,
|
||||
YM_Fs,
|
||||
YM_Gb = YM_Fs,
|
||||
YM_G,
|
||||
YM_Gs,
|
||||
YM_Ab = YM_Gs,
|
||||
YM_A,
|
||||
YM_As,
|
||||
YM_Bb = YM_As,
|
||||
YM_B,
|
||||
|
||||
YM_C_1,
|
||||
YM_Cs_1,
|
||||
YM_Db_1 = YM_Cs_1,
|
||||
YM_D_1,
|
||||
YM_Ds_1,
|
||||
YM_Eb_1 = YM_Ds_1,
|
||||
YM_E_1,
|
||||
YM_F_1,
|
||||
YM_Fs_1,
|
||||
YM_Gb_1 = YM_Fs_1,
|
||||
YM_G_1,
|
||||
YM_Gs_1,
|
||||
YM_Ab_1 = YM_Gs_1,
|
||||
YM_A_1,
|
||||
YM_As_1,
|
||||
YM_Bb_1 = YM_As_1,
|
||||
YM_B_1,
|
||||
|
||||
YM_C_2,
|
||||
YM_Cs_2,
|
||||
YM_Db_2 = YM_Cs_2,
|
||||
YM_D_2,
|
||||
YM_Ds_2,
|
||||
YM_Eb_2 = YM_Ds_2,
|
||||
YM_E_2,
|
||||
YM_F_2,
|
||||
YM_Fs_2,
|
||||
YM_Gb_2 = YM_Fs_2,
|
||||
YM_G_2,
|
||||
YM_Gs_2,
|
||||
YM_Ab_2 = YM_Gs_2,
|
||||
YM_A_2,
|
||||
YM_As_2,
|
||||
YM_Bb_2 = YM_As_2,
|
||||
YM_B_2,
|
||||
|
||||
YM_C_3,
|
||||
YM_Cs_3,
|
||||
YM_Db_3 = YM_Cs_3,
|
||||
YM_D_3,
|
||||
YM_Ds_3,
|
||||
YM_Eb_3 = YM_Ds_3,
|
||||
YM_E_3,
|
||||
YM_F_3,
|
||||
YM_Fs_3,
|
||||
YM_Gb_3 = YM_Fs_3,
|
||||
YM_G_3,
|
||||
YM_Gs_3,
|
||||
YM_Ab_3 = YM_Gs_3,
|
||||
YM_A_3,
|
||||
YM_As_3,
|
||||
YM_Bb_3 = YM_As_3,
|
||||
YM_B_3,
|
||||
|
||||
YM_C_4,
|
||||
YM_Cs_4,
|
||||
YM_Db_4 = YM_Cs_4,
|
||||
YM_D_4,
|
||||
YM_Ds_4,
|
||||
YM_Eb_4 = YM_Ds_4,
|
||||
YM_E_4,
|
||||
YM_F_4,
|
||||
YM_Fs_4,
|
||||
YM_Gb_4 = YM_Fs_4,
|
||||
YM_G_4,
|
||||
YM_Gs_4,
|
||||
YM_Ab_4 = YM_Gs_4,
|
||||
YM_A_4,
|
||||
YM_As_4,
|
||||
YM_Bb_4 = YM_As_4,
|
||||
YM_B_4,
|
||||
|
||||
YM_C_5,
|
||||
YM_Cs_5,
|
||||
YM_Db_5 = YM_Cs_5,
|
||||
YM_D_5,
|
||||
YM_Ds_5,
|
||||
YM_Eb_5 = YM_Ds_5,
|
||||
YM_E_5,
|
||||
YM_F_5,
|
||||
YM_Fs_5,
|
||||
YM_Gb_5 = YM_Fs_5,
|
||||
YM_G_5,
|
||||
YM_Gs_5,
|
||||
YM_Ab_5 = YM_Gs_5,
|
||||
YM_A_5,
|
||||
YM_As_5,
|
||||
YM_Bb_5 = YM_As_5,
|
||||
YM_B_5,
|
||||
|
||||
YM_C_6,
|
||||
YM_TONE_MAX = YM_C_6
|
||||
};
|
||||
|
||||
#define MY_TONE_COUNT (YM_TONE_MAX - YM_TONE_MIN + 1)
|
||||
static uint8_t my_tone_status[MY_TONE_COUNT];
|
||||
|
||||
// Long press: go to _FN layer, tap: MUTE
|
||||
#define FN_MUTE LT(_FN, KC_MUTE)
|
||||
|
||||
// Used to set octave to MI_OCT_0
|
||||
extern midi_config_t midi_config;
|
||||
static bool is_trans_mode = false; // By default, shift mode is chosen.
|
||||
|
||||
static uint8_t key_separator_col = _KEY01; // (_KEY01 .. _KEY37). By default, _KEY01 (= _BASE layer) is chosen. _KEY13 = *LEFT, _KEY19 = *HALF, _KEY25 = *RIGHT, _KEY37 = _FLIPBASE and _FLIPTRANS.
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Base */
|
||||
[_BASE] = LAYOUT(
|
||||
FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU,
|
||||
MI_BENDU,
|
||||
SHIFT_L, SHIFT_R, MI_C_2, MI_D_2, MI_E_2, MI_Fs_2, MI_Ab_2, MI_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
MI_BENDD, MI_Db_2, MI_Eb_2, MI_F_2, MI_G_2, MI_A_2, MI_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* 1 octave on the left side is ch2, others are ch1 (normal) */
|
||||
[_SEPALEFTOCT] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
_______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* Half ch2, half ch1 (normal) */
|
||||
[_SEPAHALF] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, YM_C_3, YM_D_3, YM_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
_______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, YM_Db_3, YM_Eb_3, YM_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* 2 octave on the left side is ch2, others are ch1 (normal) */
|
||||
[_SEPARIGHTOCT] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
SHIFT_L, SHIFT_R, YM_C_2, YM_D_2, YM_E_2, YM_Fs_2, YM_Ab_2, YM_Bb_2, YM_C_3, YM_D_3, YM_E_3, YM_Fs_3, YM_Ab_3, YM_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
_______, YM_Db_2, YM_Eb_2, YM_F_2, YM_G_2, YM_A_2, YM_B_2, YM_Db_3, YM_Eb_3, YM_F_3, YM_G_3, YM_A_3, YM_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* TRANS This layer must locate 1 layer below _FN layer. */
|
||||
[_TRANS] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
MI_TRNSD, MI_TRNSU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
/* Flip Base SFIFTUP and SHIFT_L are swapped. */
|
||||
[_FLIPBASE] = LAYOUT(
|
||||
FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU,
|
||||
MI_BENDU,
|
||||
SHIFT_L, SHIFT_R, MI_C_5, MI_Bb_4, MI_Ab_4, MI_Fs_4, MI_E_4, MI_D_4, MI_C_4, MI_Bb_3, MI_Ab_3, MI_Fs_3, MI_E_3, MI_D_3, MI_C_3, MI_Bb_2, MI_Ab_2, MI_Fs_2, MI_E_2, MI_D_2, MI_C_2,
|
||||
MI_BENDD, MI_B_4, MI_A_4, MI_G_4, MI_F_4, MI_Eb_4, MI_Db_4, MI_B_3, MI_A_3, MI_G_3, MI_F_3, MI_Eb_3, MI_Db_3, MI_B_2, MI_A_2, MI_G_2, MI_F_2, MI_Eb_2, MI_Db_2
|
||||
),
|
||||
|
||||
/* Flip Trans This layer must locate 1 layer above _FLIPBASE layer. MI_TRNSU and MI_TRNSD are swapped. */
|
||||
[_FLIPTRANS] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
MI_TRNSU, MI_TRNSD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
[_FN] = LAYOUT(
|
||||
_______, XXXXXXX, RGB_RMOD, RGB_MOD,
|
||||
MI_VELU,
|
||||
MI_OCTD, MI_OCTU, B_BASE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, B_LEFT, XXXXXXX, XXXXXXX, B_CENTER, XXXXXXX, XXXXXXX, B_RIGHT, XXXXXXX, XXXXXXX, XXXXXXX, VERSION, XXXXXXX, B_FLIP,
|
||||
MI_VELD, TGLINTR, TGLTRNS, TGLCHGR, XXXXXXX, XXXXXXX, RGB_SAD, RGB_SAI, RGB_HUD, RGB_HUI, RGB_SPD, RGB_SPI, RGB_VAD, RGB_VAI, RGB_RMOD, RGB_MOD, EEP_RST, TGLINDI, RGB_TOG
|
||||
)
|
||||
};
|
||||
|
||||
// commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
void my_init(void){
|
||||
// Set octave to MI_OCT_1
|
||||
midi_config.octave = MI_OCT_0 - MIDI_OCTAVE_MIN;
|
||||
// avoid using 127 since it is used as a special number in some sound sources.
|
||||
midi_config.velocity = MIDI_INITIAL_VELOCITY;
|
||||
default_layer_set(_LS_BASE);
|
||||
layer_state_set(_LS_BASE);
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_sethsv(HSV_BLUE);
|
||||
// party mode (for LED soldering test. Enable rainbow color effect, and disable led_indicator to check all LEDs)
|
||||
rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
|
||||
led_indicator_enable = false;
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
}
|
||||
|
||||
void eeconfig_init_user(void) { // EEPROM is getting reset!
|
||||
midi_init();
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_enable();
|
||||
rgb_matrix_set_speed(RGB_MATRIX_STARTUP_SPD);
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
my_init(); // commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
}
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
for (uint8_t i = 0; i < MY_TONE_COUNT; i++) {
|
||||
my_tone_status[i] = MIDI_INVALID_NOTE;
|
||||
}
|
||||
my_init(); // commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
}
|
||||
|
||||
void reset_scale_indicator(void) {
|
||||
// reset transpose value and scale_indicator_col to default.
|
||||
midi_config.transpose = 0;
|
||||
scale_indicator_col = DEFAULT_SCALE_COL;
|
||||
trans_mode_indicator_loc_sel = true;
|
||||
}
|
||||
|
||||
void reset_all(void) {
|
||||
reset_scale_indicator();
|
||||
is_trans_mode = false; // trans mode is disabled by default.
|
||||
}
|
||||
|
||||
void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
|
||||
uint8_t mytone = keycode - YM_TONE_MIN;
|
||||
uint16_t mykeycode = mytone + MIDI_TONE_MIN;
|
||||
// uint16_t mykeycode = keycode - YM_TONE_MIN;
|
||||
// uint8_t mytone = mykeycode - MIDI_TONE_MIN;
|
||||
uint8_t velocity = midi_config.velocity;
|
||||
// uprintf("keycode=%u,mykeycode=%u,mytone =%u,velo = %u\n", keycode, mykeycode, mytone, velocity);
|
||||
if (record->event.pressed) {
|
||||
if (my_tone_status[mytone] == MIDI_INVALID_NOTE) {
|
||||
uint8_t note = midi_compute_note(mykeycode);
|
||||
midi_send_noteon(&midi_device, channel, note, velocity);
|
||||
dprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
|
||||
// uprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
|
||||
my_tone_status[mytone] = note; // store root_note status.
|
||||
}
|
||||
} else {
|
||||
uint8_t note = my_tone_status[mytone];
|
||||
if (note != MIDI_INVALID_NOTE) {
|
||||
midi_send_noteoff(&midi_device, channel, note, velocity);
|
||||
dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
|
||||
// uprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
|
||||
}
|
||||
my_tone_status[mytone] = MIDI_INVALID_NOTE;
|
||||
}
|
||||
}
|
||||
|
||||
void select_layer_state_set(void) {
|
||||
switch (key_separator_col) {
|
||||
case _KEY01:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_TRANS);
|
||||
} else {
|
||||
layer_state_set(_LS_BASE);
|
||||
}
|
||||
break;
|
||||
|
||||
case _KEY13:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_SEPALEFTOCT_T);
|
||||
} else {
|
||||
layer_state_set(_LS_SEPALEFTOCT);
|
||||
}
|
||||
break;
|
||||
|
||||
case _KEY19:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_SEPAHALF_T);
|
||||
} else {
|
||||
layer_state_set(_LS_SEPAHALF);
|
||||
}
|
||||
break;
|
||||
|
||||
case _KEY25:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_SEPARIGHTOCT_T);
|
||||
} else {
|
||||
layer_state_set(_LS_SEPARIGHTOCT);
|
||||
}
|
||||
break;
|
||||
|
||||
case _KEY37:
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_FLIPTRANS);
|
||||
} else {
|
||||
layer_state_set(_LS_FLIPBASE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// uprintf("keycode=%u, YM_C_3=%u, YM_Db_2 =%u, YM_MIN = %u, YM_MAX = %u\n", keycode, YM_C_3, YM_Db_2, YM_TONE_MIN, YM_TONE_MAX);
|
||||
switch (keycode) {
|
||||
case VERSION: // Output firmware info.
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " | " QMK_BUILDDATE);
|
||||
}
|
||||
break;
|
||||
|
||||
// Layer-related settings.
|
||||
// reset_scale_indicator() first, followed by each modification, and then change the default layer.
|
||||
|
||||
// 1, separator column modification
|
||||
case B_BASE:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY01;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
case B_LEFT:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY13;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
case B_CENTER:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY19;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
case B_RIGHT:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY25;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
case B_FLIP:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
key_separator_col = _KEY37;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
// 2, Toggle scale shift mode and transpose mode
|
||||
case TGLTRNS:
|
||||
if (record->event.pressed) {
|
||||
reset_scale_indicator();
|
||||
is_trans_mode = !is_trans_mode;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
// SHIFT_L and SHIFT_R can be pressed only when layer is either _BASE, _FLIPBASE.
|
||||
case SHIFT_L:
|
||||
if (record->event.pressed) {
|
||||
switch (layer_state) {
|
||||
case _LS_BASE:
|
||||
case _LS_SEPALEFTOCT:
|
||||
case _LS_SEPAHALF:
|
||||
case _LS_SEPARIGHTOCT:
|
||||
case _LS_FLIPBASE:
|
||||
scale_indicator_col = shift_led_indicator_left(scale_indicator_col);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SHIFT_R:
|
||||
if (record->event.pressed) {
|
||||
switch (layer_state) {
|
||||
case _LS_BASE:
|
||||
case _LS_SEPALEFTOCT:
|
||||
case _LS_SEPAHALF:
|
||||
case _LS_SEPARIGHTOCT:
|
||||
case _LS_FLIPBASE:
|
||||
scale_indicator_col = shift_led_indicator_right(scale_indicator_col);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TGLINDI:
|
||||
if (record->event.pressed) {
|
||||
led_indicator_enable = !led_indicator_enable;
|
||||
}
|
||||
break;
|
||||
|
||||
case TGLINTR:
|
||||
if (record->event.pressed) {
|
||||
switch (layer_state) {
|
||||
// main function of the TGLINTR part 1. alternate the status of trans_mode_indicator_loc_sel.
|
||||
case _LS_TRANS | (1UL << _FN):
|
||||
case _LS_SEPALEFTOCT_T | (1UL << _FN):
|
||||
case _LS_SEPAHALF_T | (1UL << _FN):
|
||||
case _LS_SEPARIGHTOCT_T | (1UL << _FN):
|
||||
trans_mode_indicator_loc_sel = !trans_mode_indicator_loc_sel;
|
||||
|
||||
// when trans_mode_indicator_loc_sel == false, change the scale indicator and transpose.
|
||||
scale_indicator_col = trans_mode_indicator_loc_sel ? 0:1;
|
||||
// when TGLINTR is pressed, it also change the initial transpose setting to follow the scale indicator.
|
||||
if (scale_indicator_col == 1) {
|
||||
midi_config.transpose = -1;
|
||||
} else {
|
||||
midi_config.transpose = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
// main function of the TGLINTR part 2. alternate the status of trans_mode_indicator_loc_sel.
|
||||
case _LS_FLIPTRANS | (1UL << _FN):
|
||||
trans_mode_indicator_loc_sel = !trans_mode_indicator_loc_sel;
|
||||
|
||||
// when trans_mode_indicator_loc_sel == false, change the scale indicator and transpose.
|
||||
scale_indicator_col = trans_mode_indicator_loc_sel ? 0:11;
|
||||
// when TGLINTR is pressed, it also change the initial transpose setting to follow the scale indicator.
|
||||
if (scale_indicator_col == 11) {
|
||||
midi_config.transpose = -1;
|
||||
} else {
|
||||
midi_config.transpose = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
// special treatment when TGLINTR is pressed in _LS_FLIPBASE layer.
|
||||
case _LS_FLIPBASE | (1UL << _FN): // when in FLIPBASE layer && non-Trans mode, change it to Trans mode.
|
||||
trans_mode_indicator_loc_sel = false;
|
||||
scale_indicator_col = 11;
|
||||
midi_config.transpose = -1;
|
||||
is_trans_mode = true;
|
||||
select_layer_state_set();
|
||||
break;
|
||||
|
||||
|
||||
// special treatment when TGLINTR is pressed in other non-Trans layer.
|
||||
default : // when other layers = non-Trans mode, change it to Trans mode.
|
||||
trans_mode_indicator_loc_sel = false;
|
||||
scale_indicator_col = 1;
|
||||
midi_config.transpose = -1;
|
||||
is_trans_mode = true;
|
||||
select_layer_state_set();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TGLCHGR:
|
||||
if (record->event.pressed) {
|
||||
use_alt_ch_gr = !use_alt_ch_gr;
|
||||
if (use_alt_ch_gr) {
|
||||
midi_config.channel = ALT_MAIN_CH_NUMBER;
|
||||
midi_left_ch = ALT_SUB_CH_NUMBER;
|
||||
} else { // default
|
||||
midi_config.channel = DEFAULT_MAIN_CH_NUMBER;
|
||||
midi_left_ch = DEFAULT_SUB_CH_NUMBER;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case YM_TONE_MIN ... YM_TONE_MAX: // MY tone
|
||||
// uprintf("keycode=%u, YM_C_3=%u, YM_Db_2 =%u, YM_MIN = %u, YM_MAX = %u\n", keycode, YM_C_3, YM_Db_2, YM_TONE_MIN, YM_TONE_MAX);
|
||||
// DO NOT THROW BELOW into 'if (record->event.pressed) {}' STATEMENT SINCE IT IS USED IN THE FUNCTION BELOW.
|
||||
my_process_midi4single_note(midi_left_ch, keycode, record, my_tone_status);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void set_led_scale_indicator(uint8_t r, uint8_t g, uint8_t b) {
|
||||
uint8_t max_scale_indicator_led_loop;
|
||||
uint8_t i;
|
||||
if (led_indicator_enable) { // turn on indicators when enabled.
|
||||
max_scale_indicator_led_loop = ( scale_indicator_col == DEFAULT_SCALE_COL ) ? 12 : 9;
|
||||
for (i = 0; i < max_scale_indicator_led_loop; i++) {
|
||||
rgb_matrix_set_color(led_scale_indicator[scale_indicator_col][i], r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_matrix_indicators_user(void) {
|
||||
// uint32_t mode = rgblight_get_mode();
|
||||
|
||||
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled.
|
||||
|
||||
// uint8_t max_scale_indicator_led_loop;
|
||||
uint8_t i;
|
||||
|
||||
switch (layer_state) {
|
||||
case _LS_BASE:
|
||||
set_led_scale_indicator(BASE_LAYER_COLOR);
|
||||
break;
|
||||
|
||||
case _LS_FLIPBASE:
|
||||
set_led_scale_indicator(FLIPB_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY37][i], FLIP_BORDER_COLOR); // right end
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_TRANS:
|
||||
set_led_scale_indicator(TRANS_LAYER_COLOR);
|
||||
break;
|
||||
|
||||
case _LS_SEPALEFTOCT_T:
|
||||
set_led_scale_indicator(SEPALEFT_T_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY13][i], FLIP_BORDER_COLOR); // Left
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPAHALF_T:
|
||||
set_led_scale_indicator(SEPAHALF_T_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY19][i], FLIP_BORDER_COLOR); // Center
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPARIGHTOCT_T:
|
||||
set_led_scale_indicator(SEPARIGHT_T_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY25][i], FLIP_BORDER_COLOR); // Right
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_FLIPTRANS:
|
||||
set_led_scale_indicator(FLIPT_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY37][i], FLIP_BORDER_COLOR); // right end
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPALEFTOCT:
|
||||
set_led_scale_indicator(SEPALEFT_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY13][i], FLIP_BORDER_COLOR); // Left
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPAHALF:
|
||||
set_led_scale_indicator(SEPAHALF_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY19][i], FLIP_BORDER_COLOR); // Center
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_SEPARIGHTOCT:
|
||||
set_led_scale_indicator(SEPARIGHT_LAYER_COLOR);
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY25][i], FLIP_BORDER_COLOR); // Right
|
||||
}
|
||||
break;
|
||||
|
||||
case _LS_FN ... _LS_MAX: // When Mute Button is long-pressed, the previous layers are still active.
|
||||
for (i = 1; i < 5; i++) {
|
||||
rgb_matrix_set_color(i, RGB_DARKSPRINGGREEN); // up(1) down(4) left(3) right(2) keys
|
||||
}
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY02][0], RGB_DARKSPRINGGREEN); // TGLTRNS
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY04][0], RGB_DARKSPRINGGREEN); // TGLINTR
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY06][0], RGB_DARKSPRINGGREEN); // TGLCHGR
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY01][i], BASE_LAYER_COLOR); // B_BASE
|
||||
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY13][i], SEPALEFT_LAYER_COLOR); // B_LEFT
|
||||
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY19][i], SEPAHALF_LAYER_COLOR); // B_CENTER
|
||||
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY25][i], SEPARIGHT_LAYER_COLOR); // B_RIGHT
|
||||
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY37][i], FLIPB_LAYER_COLOR); // B_FLIP
|
||||
}
|
||||
|
||||
for (i = _KEY12; i < _KEY37; i+=2){ // even numbers from _KEY12 to _KEY36 are LED related settings.
|
||||
// turn on the bottom row only to keep the visibility of the RGB MATRIX effects.
|
||||
rgb_matrix_set_color(led_single_col_indicator[i][0], RGB_DARKSPRINGGREEN); // // LED related settings.
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // RGB_MATRIX_ENABLE
|
6
keyboards/chromatonemini/keymaps/party/readme.md
Normal file
6
keyboards/chromatonemini/keymaps/party/readme.md
Normal file
@ -0,0 +1,6 @@
|
||||
# The LED enabled, party mode for testing LED soldering, customized keymap for chromatonemini.
|
||||
|
||||
The main differences between "led" and "party" are:
|
||||
// party mode (for LED soldering test. Enable rainbow color effect, and disable led_indicator to check all LEDs)
|
||||
rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
|
||||
led_indicator_enable = false;
|
3
keyboards/chromatonemini/keymaps/party/rules.mk
Normal file
3
keyboards/chromatonemini/keymaps/party/rules.mk
Normal file
@ -0,0 +1,3 @@
|
||||
RGB_MATRIX_ENABLE = yes # Use RGB matrix (Don't enable this when RGBLIGHT_ENABLE is used.)
|
||||
RGB_MATRIX_CUSTOM_KB = yes #
|
||||
VIA_ENABLE = no # too many layers to use VIA...
|
4
keyboards/chromatonemini/keymaps/via/config.h
Normal file
4
keyboards/chromatonemini/keymaps/via/config.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
// How many layers to use with VIA / Remap.
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 4 // default:4
|
275
keyboards/chromatonemini/keymaps/via/keymap.c
Normal file
275
keyboards/chromatonemini/keymaps/via/keymap.c
Normal file
@ -0,0 +1,275 @@
|
||||
/* Copyright 2021 3araht
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "version.h"
|
||||
|
||||
// Defines names for use in layer keycodes and the keymap
|
||||
enum layer_names {
|
||||
_BASE, // Base layer, shift mode, single channel.
|
||||
_TRANS, // Transpose feature is enabled instead of shift mode, single channel.
|
||||
_RESERVE, // RESERVE
|
||||
_FN // FuNction layer. This must be at the end of the enumurate to use the range from _LS_FN ... _LS_FN_MAX for FN layer LED settings.
|
||||
};
|
||||
|
||||
// Layer State
|
||||
#define _LS_BASE (1UL << _BASE)
|
||||
#define _LS_TRANS (1UL << _BASE | 1UL << _TRANS)
|
||||
|
||||
#define _LS_FN (1UL << _FN)
|
||||
#define _LS_MAX (_LS_FN << 1)
|
||||
|
||||
// Don't change the DEFAULT_SCALE_COL value below. It must be 0.
|
||||
#define DEFAULT_SCALE_COL 0
|
||||
static uint8_t scale_indicator_col = DEFAULT_SCALE_COL;
|
||||
static bool trans_mode_indicator_loc_sel = true; // when it is true, the location is _KEY01, _KEY13, ...
|
||||
|
||||
// use led indicator or not.
|
||||
static bool led_indicator_enable = true;
|
||||
|
||||
// Defines the keycodes used by our macros in process_record_user
|
||||
enum custom_keycodes {
|
||||
SHIFT_L = USER00,
|
||||
SHIFT_R,
|
||||
TGLINDI, // ToGgLe INDIcator
|
||||
TGLINTR, // ToGgLe INdicator location {(_KEY01, _KEY13, _KEY25, _KEY37) or (_KEY02, _KEY14, _KEY26) / (_KEY12, _KEY24, _KEY36)}in TRans mode
|
||||
TGLTRNS, // ToGgLe TRaNS and shift
|
||||
|
||||
B_BASE, // border set to the left end.
|
||||
VERSION
|
||||
};
|
||||
|
||||
// Long press: go to _FN layer, tap: MUTE
|
||||
#define FN_MUTE LT(_FN, KC_MUTE)
|
||||
|
||||
// Used to set octave to MI_OCT_0
|
||||
extern midi_config_t midi_config;
|
||||
static bool is_trans_mode = false; // By default, shift mode is chosen.
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Base */
|
||||
[_BASE] = LAYOUT(
|
||||
FN_MUTE, MI_SUS, KC_VOLD, KC_VOLU,
|
||||
MI_BENDU,
|
||||
SHIFT_L, SHIFT_R, MI_C_2, MI_D_2, MI_E_2, MI_Fs_2, MI_Ab_2, MI_Bb_2, MI_C_3, MI_D_3, MI_E_3, MI_Fs_3, MI_Ab_3, MI_Bb_3, MI_C_4, MI_D_4, MI_E_4, MI_Fs_4, MI_Ab_4, MI_Bb_4, MI_C_5,
|
||||
MI_BENDD, MI_Db_2, MI_Eb_2, MI_F_2, MI_G_2, MI_A_2, MI_B_2, MI_Db_3, MI_Eb_3, MI_F_3, MI_G_3, MI_A_3, MI_B_3, MI_Db_4, MI_Eb_4, MI_F_4, MI_G_4, MI_A_4, MI_B_4
|
||||
),
|
||||
|
||||
/* TRANS This layer must locate 1 layer below _FN layer. */
|
||||
[_TRANS] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
MI_TRNSD, MI_TRNSU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
/* RESERVE */
|
||||
[_RESERVE] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
[_FN] = LAYOUT(
|
||||
_______, XXXXXXX, RGB_RMOD, RGB_MOD,
|
||||
MI_VELU,
|
||||
MI_OCTD, MI_OCTU, B_BASE, DF(_RESERVE), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION, XXXXXXX, XXXXXXX,
|
||||
MI_VELD, TGLINTR, TGLTRNS, XXXXXXX, XXXXXXX, XXXXXXX, RGB_SAD, RGB_SAI, RGB_HUD, RGB_HUI, RGB_SPD, RGB_SPI, RGB_VAD, RGB_VAI, RGB_RMOD, RGB_MOD, EEP_RST, TGLINDI, RGB_TOG
|
||||
)
|
||||
};
|
||||
|
||||
// commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
void my_init(void){
|
||||
// Set octave to MI_OCT_1
|
||||
midi_config.octave = MI_OCT_0 - MIDI_OCTAVE_MIN;
|
||||
// avoid using 127 since it is used as a special number in some sound sources.
|
||||
midi_config.velocity = MIDI_INITIAL_VELOCITY;
|
||||
default_layer_set(_LS_BASE);
|
||||
layer_state_set(_LS_BASE);
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_mode(RGB_MATRIX_CUSTOM_my_solid_reactive_col);
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
}
|
||||
|
||||
void eeconfig_init_user(void) { // EEPROM is getting reset!
|
||||
midi_init();
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_enable();
|
||||
rgb_matrix_set_speed(RGB_MATRIX_STARTUP_SPD);
|
||||
rgb_matrix_sethsv(HSV_BLUE);
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
my_init(); // commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
}
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
my_init(); // commom codes called from eeconfig_init_user() and keyboard_post_init_user().
|
||||
}
|
||||
|
||||
void reset_scale_indicator(void) {
|
||||
// reset transpose value and scale_indicator_col to default.
|
||||
midi_config.transpose = 0;
|
||||
scale_indicator_col = DEFAULT_SCALE_COL;
|
||||
trans_mode_indicator_loc_sel = true;
|
||||
}
|
||||
|
||||
void reset_all(void) {
|
||||
reset_scale_indicator();
|
||||
is_trans_mode = false; // trans mode is disabled by default.
|
||||
}
|
||||
|
||||
void select_layer_state_set(void) {
|
||||
if (is_trans_mode) {
|
||||
layer_state_set(_LS_TRANS);
|
||||
} else {
|
||||
layer_state_set(_LS_BASE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// uprintf("keycode=%u, YM_C_3=%u, YM_Db_2 =%u, YM_MIN = %u, YM_MAX = %u\n", keycode, YM_C_3, YM_Db_2, YM_TONE_MIN, YM_TONE_MAX);
|
||||
switch (keycode) {
|
||||
case VERSION: // Output firmware info.
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " | " QMK_BUILDDATE);
|
||||
}
|
||||
break;
|
||||
|
||||
// Layer-related settings.
|
||||
// reset_scale_indicator() first, followed by each modification, and then change the default layer.
|
||||
|
||||
// 1, separator column modification
|
||||
case B_BASE:
|
||||
if (record->event.pressed) {
|
||||
reset_all();
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
// 2, Toggle scale shift mode and transpose mode
|
||||
case TGLTRNS:
|
||||
if (record->event.pressed) {
|
||||
reset_scale_indicator();
|
||||
is_trans_mode = !is_trans_mode;
|
||||
select_layer_state_set();
|
||||
}
|
||||
break;
|
||||
|
||||
// SHIFT_L and SHIFT_R can be pressed only when layer is either _BASE, _FLIPBASE.
|
||||
case SHIFT_L:
|
||||
if (record->event.pressed) {
|
||||
if (layer_state == _LS_BASE) {
|
||||
scale_indicator_col = shift_led_indicator_left(scale_indicator_col);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SHIFT_R:
|
||||
if (record->event.pressed) {
|
||||
if (layer_state == _LS_BASE ) {
|
||||
scale_indicator_col = shift_led_indicator_right(scale_indicator_col);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TGLINDI:
|
||||
if (record->event.pressed) {
|
||||
led_indicator_enable = !led_indicator_enable;
|
||||
}
|
||||
break;
|
||||
|
||||
case TGLINTR:
|
||||
if (record->event.pressed) {
|
||||
switch (layer_state) {
|
||||
// main function of the TGLINTR part 1. alternate the status of trans_mode_indicator_loc_sel.
|
||||
case _LS_TRANS | (1UL << _FN):
|
||||
trans_mode_indicator_loc_sel = !trans_mode_indicator_loc_sel;
|
||||
|
||||
// when trans_mode_indicator_loc_sel == false, change the scale indicator and transpose.
|
||||
scale_indicator_col = trans_mode_indicator_loc_sel ? 0:1;
|
||||
// when TGLINTR is pressed, it also change the initial transpose setting to follow the scale indicator.
|
||||
if (scale_indicator_col == 1) {
|
||||
midi_config.transpose = -1;
|
||||
} else {
|
||||
midi_config.transpose = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
// special treatment when TGLINTR is pressed in other non-Trans layer.
|
||||
default : // when other layers = non-Trans mode, change it to Trans mode.
|
||||
trans_mode_indicator_loc_sel = false;
|
||||
scale_indicator_col = 1;
|
||||
midi_config.transpose = -1;
|
||||
is_trans_mode = true;
|
||||
select_layer_state_set();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void set_led_scale_indicator(uint8_t r, uint8_t g, uint8_t b) {
|
||||
uint8_t max_scale_indicator_led_loop;
|
||||
uint8_t i;
|
||||
if (led_indicator_enable) { // turn on indicators when enabled.
|
||||
max_scale_indicator_led_loop = ( scale_indicator_col == DEFAULT_SCALE_COL ) ? 12 : 9;
|
||||
for (i = 0; i < max_scale_indicator_led_loop; i++) {
|
||||
rgb_matrix_set_color(led_scale_indicator[scale_indicator_col][i], r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_matrix_indicators_user(void) {
|
||||
// uint32_t mode = rgblight_get_mode();
|
||||
|
||||
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled.
|
||||
|
||||
// uint8_t max_scale_indicator_led_loop;
|
||||
uint8_t i;
|
||||
|
||||
switch (layer_state) {
|
||||
case _LS_BASE:
|
||||
set_led_scale_indicator(BASE_LAYER_COLOR);
|
||||
break;
|
||||
|
||||
case _LS_TRANS:
|
||||
set_led_scale_indicator(TRANS_LAYER_COLOR);
|
||||
break;
|
||||
|
||||
case _LS_FN ... _LS_MAX: // When Mute Button is long-pressed, the previous layers are still active.
|
||||
for (i = 1; i < 5; i++) {
|
||||
rgb_matrix_set_color(i, RGB_DARKSPRINGGREEN); // up(1) down(4) left(3) right(2) keys
|
||||
}
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY02][0], RGB_DARKSPRINGGREEN); // TGLTRNS
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY04][0], RGB_DARKSPRINGGREEN); // TGLINTR
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
rgb_matrix_set_color(led_single_col_indicator[_KEY01][i], BASE_LAYER_COLOR); // B_BASE
|
||||
}
|
||||
|
||||
for (i = _KEY12; i < _KEY37; i+=2){ // even numbers from _KEY12 to _KEY36 are LED related settings.
|
||||
// turn on the bottom row only to keep the visibility of the RGB MATRIX effects.
|
||||
rgb_matrix_set_color(led_single_col_indicator[i][0], RGB_DARKSPRINGGREEN); // // LED related settings.
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // RGB_MATRIX_ENABLE
|
1
keyboards/chromatonemini/keymaps/via/readme.md
Normal file
1
keyboards/chromatonemini/keymaps/via/readme.md
Normal file
@ -0,0 +1 @@
|
||||
# The via keymap for chromatonemini, RGB MATRIX enabled.
|
3
keyboards/chromatonemini/keymaps/via/rules.mk
Normal file
3
keyboards/chromatonemini/keymaps/via/rules.mk
Normal file
@ -0,0 +1,3 @@
|
||||
RGB_MATRIX_ENABLE = yes # Use RGB matrix (Don't enable this when RGBLIGHT_ENABLE is used.)
|
||||
RGB_MATRIX_CUSTOM_KB = yes #
|
||||
VIA_ENABLE = yes
|
19
keyboards/chromatonemini/readme.md
Normal file
19
keyboards/chromatonemini/readme.md
Normal file
@ -0,0 +1,19 @@
|
||||
# chromatonemini
|
||||
|
||||
![chromatonemini](https://github.com/3araht/chromatonemini/blob/main/pictures/chromatonemini_toppage.jpg)
|
||||
|
||||
chromatonemini keyboard is a simple-design Chromatone mini MIDI keyboard that covers 3 octaves (37 notes).
|
||||
|
||||
* Keyboard Maintainer: [3araht](https://github.com/3araht)
|
||||
* Hardware Supported: chromatone keyboard, a DIY MIDI keyboard.
|
||||
* Hardware Availability: [BOOTH](https://3araht.booth.pm/). Click [here](https://www.tenso.com/en/static/lp_shop_booth) for BOOTH overseas shipping!
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make chromatonemini:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make chromatonemini:default:flash
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
58
keyboards/chromatonemini/rgb_matrix_kb.inc
Normal file
58
keyboards/chromatonemini/rgb_matrix_kb.inc
Normal file
@ -0,0 +1,58 @@
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
RGB_MATRIX_EFFECT(my_solid_reactive_multiwide_col)
|
||||
RGB_MATRIX_EFFECT(my_solid_reactive_col)
|
||||
RGB_MATRIX_EFFECT(my_party_rocks)
|
||||
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV my_solid_reactive_multiwide_col_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick + dist;
|
||||
dx = dx < 0 ? dx * -1 : dx;
|
||||
dx = dx * 16 > 255 ? 255 : dx * 16;
|
||||
effect += dx;
|
||||
if (effect > 255) effect = 255;
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
// hsv.h += qsub8(130, effect);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool my_solid_reactive_multiwide_col(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &my_solid_reactive_multiwide_col_math);
|
||||
}
|
||||
|
||||
|
||||
bool my_solid_reactive_col(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
uint16_t tick = max_tick;
|
||||
// Reverse search to find most recent key hit
|
||||
for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) {
|
||||
if (g_last_hit_tracker.x[j] == g_led_config.point[i].x && g_last_hit_tracker.tick[j] < tick) {
|
||||
tick = g_last_hit_tracker.tick[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t offset = scale16by8(tick, rgb_matrix_config.speed);
|
||||
hsv.h += qsub8(130, offset);
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
bool my_party_rocks(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
HSV hsv = {rand() & 0xFF, rand() & 0xFF, rgb_matrix_config.hsv.v};
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
// rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
rgb_matrix_set_color_all(rgb.r, rgb.g, rgb.b);
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
22
keyboards/chromatonemini/rules.mk
Normal file
22
keyboards/chromatonemini/rules.mk
Normal file
@ -0,0 +1,22 @@
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = caterina
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = no # Enable N-Key Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
MIDI_ENABLE = yes # MIDI support
|
||||
ENCODER_ENABLE = yes # encoder on mute button
|
||||
RGB_MATRIX_DRIVER = WS2812 #
|
||||
LTO_ENABLE = yes
|
Loading…
Reference in New Issue
Block a user