diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..b0d06989 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "makefile.configureOnOpen": true +} \ No newline at end of file diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/oco9oco/config.h b/keyboards/bastardkb/charybdis/4x6/keymaps/oco9oco/config.h index 11d4790d..c4447ac6 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/oco9oco/config.h +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/oco9oco/config.h @@ -1,10 +1,11 @@ #define CHARYBDIS_CONFIG_SYNC -// #define POINTING_DEVICE_AUTO_MOUSE_ENABLE -// #define AUTO_MOUSE_DEFAULT_LAYER 10 -// #define AUTO_MOUSE_TIME 400 -// #define AUTO_MOUSE_DELAY TAPPING_TERM +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 10 +#define AUTO_MOUSE_TIME 400 +#define AUTO_MOUSE_DELAY TAPPING_TERM #define CHARYBDIS_DRAGSCROLL_REVERSE_Y #define TAPPING_TOGGLE 1 - +#undef POINTING_DEVICE_TASK_THROTTLE_MS +#define POINTING_DEVICE_TASK_THROTTLE_MS 5 diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/oco9oco/keymap.c b/keyboards/bastardkb/charybdis/4x6/keymaps/oco9oco/keymap.c index 81d3c789..6610af89 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/oco9oco/keymap.c +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/oco9oco/keymap.c @@ -43,24 +43,35 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, __________________NUMROW_L_________________, __________________NUMROW_R_________________, KC_MINS, KC_TAB, __________________QWERTY_L1________________, __________________QWERTY_R1________________, KC_EQL, SFT_CAPS,__________________QWERTY_SACS_L2___________, __________________QWERTY_R2________________, KC_QUOT, - KC_LGUI, KC_Z, KC_X, LT(_ONEHAND,KC_C),KC_V, KC_B, __________________QWERTY_HOME_R3___________, KC_BSLS, + KC_LGUI, KC_Z, KC_X, KC_C, KC_V, KC_B, __________________QWERTY_HOME_R3___________, KC_BSLS, // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ - THUMB_L1,THUMB_L2, THUMB_L3,/* */THUMB_R3,THUMB_R2, - USR_LNG, TT(_ONEHAND),/* */THUMB_R1 -// ╰───────────────────────────╯ ╰──────────────────╯qmk + THUMB_L1,THUMB_L2, USR_LNG,/* */THUMB_R3,THUMB_R2, + THUMB_L3, TT(_ONEHAND), THUMB_R1 +// ╰───────────────────────────╯ ╰──────────────────╯ ), [_IPC] = LAYOUT_charybdis_wrapper( // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ - ALT_F4, C(KC_F1),KC_P, KC_X, INV_DSP, TO(_ONEHAND), KC_LBRC, KC_RBRC, KC_LPRN, KC_RPRN, XXXXXXX, _______, - ALT_TAB, INV_DSP, KC_LEFT, KC_RGHT, CLASS_A, HWP_MACRO, KC_GRV, _________NUM_789_________, XXXXXXX, _______, - _______, IPC(A), IPC(S), IPC_MIN, IPC(F), KC_DOT, AT_IPC, _________NUM_456_________, KC_COLN, KC_DQUO, - KC_LGUI, SNIPING, HWP_CITE,KC_BTN2, KC_BTN1, DRGSCRL, IME_CHG, _________NUM_123_________, _______, KC_PIPE, + ALT_F4, C(KC_F1),KC_P, KC_X, INV_DSP, IME_CHG, KC_LBRC, KC_RBRC, KC_LPRN, KC_RPRN, XXXXXXX, _______, + ALT_TAB, INV_DSP, XXXXXXX, CLASS_A, SNIPING, KC_BTN2, KC_GRV, _________NUM_789_________, XXXXXXX, _______, + _______, IPC(A), IPC(S), IPC_D_, IPC(F), KC_BTN1, AT_IPC, _________NUM_456_________, KC_COLN, KC_DQUO, + KC_LGUI, IPC(Z), HWP_CITE, IPC(C), XXXXXXX, DRGSCRL, HWP_MACRO,_________NUM_123_________, _______, KC_PIPE, // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ - _______, _______, _______,/* */HWP_MACRO, LT(_NAV, KC_0), + _______, _______, _______,/* */_______, LT(_NAV, KC_0), QK_BOOT, _______,/* */IME_CHG // ╰───────────────────────────╯ ╰──────────────────╯ ), +// [_NUM] = LAYOUT_charybdis_wrapper( +// // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ +// XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, +// XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_7, KC_8, KC_9, XXXXXXX, XXXXXXX, +// XXXXXXX, XXXXXXX, KC_BTN2, NUM(D), KC_BTN1, XXXXXXX, XXXXXXX, KC_4, KC_5, KC_6, XXXXXXX, XXXXXXX, +// XXXXXXX, XXXXXXX, HWP_CITE,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_1, KC_2, KC_3, XXXXXXX, XXXXXXX, +// // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ +// _______, _______, _______,/* */_______, LT(_NUM, KC_0), +// _______, _______,/* */IME_CHG +// // ╰───────────────────────────╯ ╰──────────────────╯ +// ), [_NAV] = LAYOUT_charybdis_wrapper( // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ _______, CTRL_F1, KC_F2, KC_F3, ALT_F4, KC_F5, XXXXXXX, A(KC_7), A(KC_5), A(KC_9), A(KC_0), XXXXXXX, @@ -98,74 +109,78 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ONEHAND] = LAYOUT_charybdis_wrapper( // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ - ALT_F4, CTRL_F1, KC_LEFT, XXXXXXX, KC_RGHT, KC_F5, S_D_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT, - XXXXXXX, XXXXXXX, KC_WH_D, XXXXXXX, KC_WH_U, XXXXXXX, S_D_RMOD,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_MAKE, - XXXXXXX, KC_LCTL, KC_BTN2, KC_LSFT, KC_BTN1, DPI_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - DRG_TOG, DRGSCRL, KC_BTN2, _______, KC_BTN1, DPI_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, CTRL_F1, KC_LEFT, XXXXXXX, KC_RGHT, KC_F5, S_D_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT, + XXXXXXX, XXXXXXX, KC_WH_D, DRG_TOG, KC_WH_U, KC_F6, \S_D_RMOD,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_MAKE, + XXXXXXX, KC_LCTL, KC_BTN2, DRGSCRL, KC_BTN1, KC_F7, DPI_MOD, XXXXXXX, XXXXXXX, G(KC_6), XXXXXXX, XXXXXXX, + XXXXXXX, C(KC_Z), C(KC_X), C(KC_C), C(KC_V), XXXXXXX, DPI_RMOD,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ - THUMB_L1, SNIPING, TO(_BASE),/* */_______, _______, + DRGSCRL, SNIPING, TO(_BASE),/* */_______, _______, _______, _______,/* */_______ // ╰───────────────────────────╯ ╰──────────────────╯ ), }; -// in keymap.c: -// void pointing_device_init_user(void) { -// set_auto_mouse_layer(_ONEHAND); // only required if AUTO_MOUSE_DEFAULT_LAYER is not set to index of -// set_auto_mouse_enable(true); // always required before the auto mouse feature will work -// } -// layer_state_t layer_state_set_user(layer_state_t state) { -// // checks highest layer other than target layer -// switch(get_highest_layer(remove_auto_mouse_layer(state, true))) { -// case _MOUSE: -// case _NAV: -// case _IPC: -// // remove_auto_mouse_target must be called to adjust state *before* setting enable -// state = remove_auto_mouse_layer(state, false); -// set_auto_mouse_enable(false); -// break; +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + void pointing_device_init_user(void) { + set_auto_mouse_layer(_ONEHAND); // only required if AUTO_MOUSE_DEFAULT_LAYER is not set to index of + set_auto_mouse_enable(true); // always required before the auto mouse feature will work + } -// default: -// set_auto_mouse_enable(true); -// break; -// } -// // recommend that any code that makes adjustment based on auto mouse layer state would go here + layer_state_t layer_state_set_user(layer_state_t state) { + // checks highest layer other than target layer + switch(get_highest_layer(remove_auto_mouse_layer(state, true))) { + case _MOUSE: + case _NAV: + case _IPC: + // remove_auto_mouse_target must be called to adjust state *before* setting enable + state = remove_auto_mouse_layer(state, false); + set_auto_mouse_enable(false); + break; -// static bool mouse_layer_on = false; -// bool now_on = layer_state_cmp(state, _ONEHAND); -// //if (now_on && !mouse_layer_on) { -// // 마우스 레이어 진입 시 -// // tap_code(KC_LCTL); // 예: 음소거 키 입력 -// //} else -// if (!now_on && mouse_layer_on) { -// // 마우스 레이어 탈출 시 -// tap_code(KC_LCTL); -// } -// mouse_layer_on = now_on; -// return state; -// } + default: + set_auto_mouse_enable(true); + break; + } + // recommend that any code that makes adjustment based on auto mouse layer state would go here -// bool is_mouse_record_kb(uint16_t keycode, keyrecord_t* record) { -// switch(keycode) { -// case DRGSCRL: -// case SNIPING: -// case KC_LCTL: -// case KC_LALT: -// case KC_LSFT: -// return true; -// default: -// return false; -// } -// return is_mouse_record_user(keycode, record); -// } + static bool mouse_layer_on = false; + bool now_on = layer_state_cmp(state, _ONEHAND); + if (now_on && !mouse_layer_on) { + // 마우스 레이어 진입 시 + register_code(KC_F13); // 예: 음소거 키 입력 + } else + if (!now_on && mouse_layer_on) { + // 마우스 레이어 탈출 시 + unregister_code(KC_F13); + } + mouse_layer_on = now_on; + return state; + } -char chordal_hold_handedness(keypos_t key) { - if (key.col == 0 || key.col == MATRIX_COLS - 1) { - return '*'; // Exempt the outer columns. - } - // On split keyboards, typically, the first half of the rows are on the - // left, and the other half are on the right. - return key.row < MATRIX_ROWS / 2 ? 'L' : 'R'; -} + bool is_mouse_record_kb(uint16_t keycode, keyrecord_t* record) { + switch(keycode) { + case DRGSCRL: + case SNIPING: + case KC_LCTL: + case KC_LALT: + case KC_LSFT: + return true; + default: + return false; + } + return is_mouse_record_user(keycode, record); + } +#endif + +#ifdef CHORDAL_HOLD + char chordal_hold_handedness(keypos_t key) { + if (key.col == 0 || key.col == MATRIX_COLS - 1) { + return '*'; // Exempt the outer columns. + } + // On split keyboards, typically, the first half of the rows are on the + // left, and the other half are on the right. + return key.row < MATRIX_ROWS / 2 ? 'L' : 'R'; + } +#endif diff --git a/keyboards/bastardkb/tbkmini/keymaps/oco9oco/keymap.c b/keyboards/bastardkb/tbkmini/keymaps/oco9oco/keymap.c index 50c2443e..99321e58 100644 --- a/keyboards/bastardkb/tbkmini/keymaps/oco9oco/keymap.c +++ b/keyboards/bastardkb/tbkmini/keymaps/oco9oco/keymap.c @@ -33,10 +33,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_IPC] = LAYOUT_crkbd_wrapper( // |--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------| - A(KC_F4), C(KC_F1), SCRNSHOT, G(KC_E), CLASS_A, HWP_MACRO, KC_GRV, _________NUM_789_________, _______, KC_PLUS, - TO(_DOOM), IPC(A), IPC(S), IPC_MIN, IPC(F), KC_DOT, AT_IPC, _________NUM_456_________, KC_COLN, KC_DQUO, - TO(_BASE_NOMOD), IPC(Z), HWP_CITE, IPC(C), KC_EQL, KC_BSLS, XXXXXXX, _________NUM_123_________, _______, KC_PIPE, - TO(_BASE_NOMOD), _______, TO(_BASE), KC_LPRN, KC_RPRN, LT(_NAV,KC_0) + A(KC_F4), C(KC_F1), SCRNSHOT, G(KC_E), CLASS_A, HWP_MACRO, KC_GRV, _________NUM_789_________, _______, KC_PLUS, + TO(_DOOM), IPC(A), IPC(S), _IPC_MIN, IPC(F), KC_DOT, AT_IPC, _________NUM_456_________, KC_COLN, KC_DQUO, + XXXXXXX, IPC(Z), HWP_CITE, IPC(C), KC_EQL, KC_BSLS, XXXXXXX, _________NUM_123_________, _______, KC_PIPE, + TO(_BASE_SWAP), _______, TO(_BASE), KC_LPRN, KC_RPRN, LT(_NAV,KC_0) ), [_NUM] = LAYOUT_crkbd_wrapper( // |--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------|--------| diff --git a/users/oco9oco/config.h b/users/oco9oco/config.h index 46ab8808..9a96c750 100644 --- a/users/oco9oco/config.h +++ b/users/oco9oco/config.h @@ -16,14 +16,15 @@ along with this program. If not, see . /* Handedness. */ // #define MASTER_LEFT // #undef MASTER_RIGHT -#define MASTER_RIGHT +// #define MASTER_LEFT // TAP-HOLD OPTIONS #define TAPPING_TERM 200 #define QUICK_TAP_TERM 0 //#define PERMISSIVE_HOLD_PER_KEY #define HOLD_ON_OTHER_KEY_PRESS_PER_KEY -#define CHORDAL_HOLD +// #define CHORDAL_HOLD + // AUTO SHIFT OPTIONS #define NO_AUTO_SHIFT_ALPHA diff --git a/users/oco9oco/oco9oco.c b/users/oco9oco/oco9oco.c index d2bd459c..440f2fef 100644 --- a/users/oco9oco/oco9oco.c +++ b/users/oco9oco/oco9oco.c @@ -124,6 +124,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { cite_done = false; } break; +// +#ifdef CHARYBDIS_CONFIG_SYNC + case DRG_TOG: + if (__PRESSED__) { + register_code(KC_F15); + } else { + unregister_code(KC_F15); + } + return true; + break; +#endif + // appcmd function case JOINTBL: @@ -478,8 +490,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } - return true; +return true; }; uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { @@ -507,37 +519,32 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { } } // Get hold on other key press -bool get_permissive_hold(uint16_t keycode, keyrecord_t *record){ - switch (keycode) { - case SFTT_A: - return true; - default: - return false; - } -} +// bool get_permissive_hold(uint16_t keycode, keyrecord_t *record){ +// switch (keycode) { +// case SFTT_A: +// return true; +// default: +// return false; +// } +// } bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) { switch (keycode) { // case LSFT_T(KC_W): - case IPC(Z): case THUMB_L1: case THUMB_L2: case THUMB_L3: case THUMB_R1: case THUMB_R3: case SFT_CAPS: - case SFTT_A: - // case SFTT_Z: - // case GUIT_Z: - case SFTT_F: - // case SFTT_J: - // case ALTT_S: - // case CTLT_D: - // case GUIT_SCL: - // case ALTT_L: - // case CTLT_K: - // case GUIT_A: - // case LT(_NAV, KC_0): - // case IPC_COMM: + + // case THUMB_R2: + // case SFTT_A: + // case SFTT_F: + case IPC(A): + case IPC(S): + case IPC_D_: + case IPC(F): + case IPC(Z): return true; default: return false; @@ -553,13 +560,13 @@ void matrix_scan_user(void) { // The very important timer. } } } - +#ifdef CHORDAL_HOLD bool get_chordal_hold(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record, uint16_t other_keycode, keyrecord_t* other_record) { // Exceptionally allow some one-handed chords for hotkeys. switch (tap_hold_keycode) { case LSFT_T(KC_A): - if (other_keycode == KC_W || other_keycode == KC_E || other_keycode == KC_R || other_keycode == KC_T) { + if (other_keycode == KC_Q ||other_keycode == KC_W || other_keycode == KC_E || other_keycode == KC_R || other_keycode == KC_T) { return true; } else {return false;} break; @@ -583,70 +590,46 @@ case TT(_ONEHAND): case THUMB_R1: case THUMB_R2: case THUMB_R3: -case IPC(A): -case IPC(S): -case IPC_MIN: -case IPC(F): -case IPC(Z): return true; break; + + + case IPC(A): + case IPC(S): + case IPC_D_: + case IPC(F): + case IPC(Z): + if (other_keycode == IPC(A)||other_keycode == IPC(S)||other_keycode == IPC_D_||other_keycode == IPC(F)||other_keycode == IPC(Z)) { + return true; + } + } // Otherwise defer to the opposite hands rule. return get_chordal_hold_default(tap_hold_record, other_record); } - - -// charybdis trackball angular alignment calibration -// This code rotates the mouse report by 15 degrees counter-clockwise. - -// #include "math.h" - -// #define FIXED_POINT 256 -// #define COS_15 ((int16_t)(cosf(15.0 * M_PI / 180.0) * FIXED_POINT)) // 0.9659 -// #define SIN_15 ((int16_t)(sinf(15.0 * M_PI / 180.0) * FIXED_POINT)) // 0.2588 - -// report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { -// report_mouse_t new_report = mouse_report; - -// int16_t x = mouse_report.x; -// int16_t y = mouse_report.y; - -// int16_t new_x = (COS_15 * x - SIN_15 * y) / FIXED_POINT; -// int16_t new_y = (SIN_15 * x + COS_15 * y) / FIXED_POINT; - -// new_report.x = (int8_t)new_x; -// new_report.y = (int8_t)new_y; - -// return new_report; -// } - - +#endif // charybdis trackball angular alignment calibration(floating point) // This code rotates the mouse report by 15 degrees counter-clockwise. -#include "math.h" +// #include "math.h" -report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { - report_mouse_t new_report = mouse_report; +// report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { +// report_mouse_t new_report = mouse_report; - // 15도 회전 변환 공식 (반시계 방향) - // x' = cos(15°) * x - sin(15°) * y - // y' = sin(15°) * x + cos(15°) * y +// // 15도 회전 변환 공식 (반시계 방향) +// // x' = cos(15°) * x - sin(15°) * y +// // y' = sin(15°) * x + cos(15°) * y - float angle = 15.0 * M_PI / 180.0; // 라디안 변환 - float cos_a = cosf(angle); // 약 0.9659 - float sin_a = sinf(angle); // 약 0.2588 +// float old_x = (float)mouse_report.x; +// float old_y = (float)mouse_report.y; - float old_x = (float)mouse_report.x; - float old_y = (float)mouse_report.y; +// float new_x = COS15 * old_x - SIN15 * old_y; +// float new_y = SIN15 * old_x + COS15 * old_y; - float new_x = cos_a * old_x - sin_a * old_y; - float new_y = sin_a * old_x + cos_a * old_y; +// new_report.x = (int8_t)roundf(new_x); +// new_report.y = (int8_t)roundf(new_y); - new_report.x = (int8_t)roundf(new_x); - new_report.y = (int8_t)roundf(new_y); - - return new_report; -} \ No newline at end of file +// return new_report; +// } \ No newline at end of file diff --git a/users/oco9oco/oco9oco.h b/users/oco9oco/oco9oco.h index a322a80a..75b10f61 100644 --- a/users/oco9oco/oco9oco.h +++ b/users/oco9oco/oco9oco.h @@ -110,18 +110,14 @@ Z X C V B N M , . / #define _IPC_MIN LCTL_T(KC_MINS) #define IPC(x) LT(_IPC, KC_##x) -#define NAV(x) LT(_NAV, KC_##x) -#define IPC_MIN _IPC_MIN +#define IPC_D_ _IPC_MIN #define IPC_COMM LSFT_T(KC_COMM) -#define _NUM_A LT(_NUM, KC_A) -#define _NUM_S LT(_NUM, KC_S) -#define _NUM_D LT(_NUM, KC_D) -#define _NUM_F LT(_NUM, KC_F) +#define NAV(x) LT(_NAV, KC_##x) +#define NUM(x) LT(_NUM, KC_##x) #define _NUM_MIN LCTL_T(KC_MINS) #define IME_CHG G(C(KC_SPC)) #define INV_DSP G(C(KC_C)) #define USR_LNG LT(_BASE, KC_LNG1) -#define NUM(x) LT(_NUM, KC_##x) //#define DRGMT LT(_ONEHAND, KC_F22) #define BULLET_U C(S(KC_LBRC)) #define BULLET_D C(S(KC_RBRC)) @@ -339,3 +335,7 @@ enum layer_index { _ONEHAND, // _SETTINGS, }; + +//트랙볼 좔표계 보정용 상수 +static const float COS15 = 0.965925826f; // cos(15°) +static const float SIN15 = 0.258819045f; // sin(15°) \ No newline at end of file