diff --git a/keyboards/cornia/keymaps/fire/callback_record.c b/keyboards/cornia/keymaps/fire/callback_record.c index 43f441c9a64..6b9ea45da6e 100644 --- a/keyboards/cornia/keymaps/fire/callback_record.c +++ b/keyboards/cornia/keymaps/fire/callback_record.c @@ -17,6 +17,7 @@ #include QMK_KEYBOARD_H #include "./keymap.h" +#include "./tap_dances.h" bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { @@ -41,5 +42,34 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { set_scrolling = record->event.pressed; return false; } + /* Accented letters */ + if (accent_state != ACCENT_NONE && record->event.pressed) + { + switch (keycode) { + case KC_A: + SEND_STRING(SS_ACCENT_A_GRAVE); + return false; + case KC_C: + SEND_STRING(SS_ACCENT_C_CEDIL); + return false; + case KC_E: + switch (accent_state) { + case ACCENT_LEFT: + SEND_STRING(SS_ACCENT_E_ACUTE); break; + case ACCENT_RIGHT: + SEND_STRING(SS_ACCENT_E_GRAVE); break; + case ACCENT_NONE: + break; + } + return false; + case KC_O: + SEND_STRING(SS_ACCENT_O_CIRCU); + return false; + case KC_U: + SEND_STRING(SS_ACCENT_U_GRAVE); + return false; + } + accent_state = ACCENT_NONE; + } return true; } diff --git a/keyboards/cornia/keymaps/fire/keymap.c b/keyboards/cornia/keymaps/fire/keymap.c index f102ac19a7d..76d912682ee 100644 --- a/keyboards/cornia/keymaps/fire/keymap.c +++ b/keyboards/cornia/keymaps/fire/keymap.c @@ -24,21 +24,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_ESC, KC_P, KC_L, KC_D, KC_G, KC_V, KC_Q, KC_F, KC_O, KC_U, KC_COMM, KC_BSPC, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_TAB, KC_N, KC_R, KC_T, KC_S, KC_Y, KC_J, KC_H, KC_A, KC_E, KC_I, KC_RALT, + KC_TAB, KC_N, KC_R, KC_T, KC_S, KC_Y, KC_J, KC_H, KC_A, KC_E, KC_I, KC_LALT, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| KC_LCTL, KC_X, KC_K, KC_C, KC_W, KC_Z, KC_B, KC_M, KC_QUOT, KC_SCLN, KC_DOT, KC_RCTL, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - TD(TD_SFT_CAPSW), MO(_NAV), KC_SPC, KC_ENT, MO(_NUM), TD(TD_SFT_CAPSW) + TD(TD_SFT_CAPSW), TD(TD_NAV_ACCENT), KC_SPC, KC_ENT, TD(TD_NUM_ACCENT), TD(TD_SFT_CAPSW) //`--------------------------' `--------------------------' ), [_NAV] = LAYOUT_split_3x6_3( //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, XXXXXXX, XXXXXXX, CK_SCRL, C(KC_A), XXXXXXX, KC_BTN1, KC_BTN2, XXXXXXX, XXXXXXX, XXXXXXX, KC_DEL, + _______, G(KC_L), XXXXXXX, CK_SCRL, C(KC_A), XXXXXXX, KC_BTN1, KC_BTN2, KC_BTN3, XXXXXXX, XXXXXXX, KC_DEL, //|--------+--------+ GUI V +--------+--------+--------| |--------+--------+--------+--------+--------+--------| _______, C(KC_X), G(KC_V), C(KC_V), C(KC_C), C(KC_Z), KC_WH_U, KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT, _______, //|ALT LEFT+--------+ ALT SFT+scrnshot+--------+--------| |--------+--------+--------+--------+--------+--------| - A(KC_LEFT),C(KC_S),S(KC_LALT), CK_SSHT,C(KC_F), C(KC_Y), KC_WH_D, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, + A(KC_LEFT),C(KC_S),S(KC_LALT), CK_SSHT,C(KC_F), C(KC_Y), KC_WH_D, KC_HOME, CK_SELL, CK_SELR, KC_END, _______, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| KC_LGUI, _______, _______, _______,MO(_ADJUST),_______ //`--------------------------' `--------------------------' @@ -84,13 +84,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Warframe */ [_G1] = LAYOUT_split_3x6_3( //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_ESC, KC_TAB, KC_1, KC_2, KC_3, KC_4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_TAB, KC_ESC, KC_Q, KC_W, KC_1, KC_2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - XXXXXXX, KC_LSFT, KC_A, KC_W, KC_D, KC_R, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_F, KC_LSFT, KC_A, KC_S, KC_D, KC_3, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_LGUI, KC_LCTL, XXXXXXX, KC_S, KC_X, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_LGUI, KC_LCTL, KC_Z, KC_C, KC_X, KC_4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - CK_RKJMP, KC_SPC, XXXXXXX, XXXXXXX, TG(_G1), XXXXXXX + KC_SPC,CK_RKJMP, KC_5, XXXXXXX, TG(_G1), XXXXXXX //`--------------------------' `--------------------------' ), }; \ No newline at end of file diff --git a/keyboards/cornia/keymaps/fire/keymap.h b/keyboards/cornia/keymaps/fire/keymap.h index c9224b07620..225d2b2fd84 100644 --- a/keyboards/cornia/keymaps/fire/keymap.h +++ b/keyboards/cornia/keymaps/fire/keymap.h @@ -39,6 +39,8 @@ enum layers { #define CK_QMRK LSFT(KC_SLSH) #define CK_SSHT LSG(KC_S) #define CK_UNSC LSFT(KC_MINS) +#define CK_SELL LSFT(LCTL(KC_LEFT)) +#define CK_SELR LSFT(LCTL(KC_RIGHT)) typedef enum { CK_RKJMP = SAFE_RANGE, /* Warframe rocket/bullet jump */ @@ -46,3 +48,10 @@ typedef enum { CK_DPID, CK_SCRL, } cornia_custom_keycodes_t; + +#define SS_ACCENT_A_GRAVE SS_DOWN(X_LALT) SS_TAP(X_P1) SS_TAP(X_P3) SS_TAP(X_P3) SS_UP(X_LALT) /* à */ +#define SS_ACCENT_C_CEDIL SS_DOWN(X_LALT) SS_TAP(X_P1) SS_TAP(X_P3) SS_TAP(X_P5) SS_UP(X_LALT) /* ç */ +#define SS_ACCENT_E_ACUTE SS_DOWN(X_LALT) SS_TAP(X_P1) SS_TAP(X_P3) SS_TAP(X_P0) SS_UP(X_LALT) /* é */ +#define SS_ACCENT_E_GRAVE SS_DOWN(X_LALT) SS_TAP(X_P1) SS_TAP(X_P3) SS_TAP(X_P8) SS_UP(X_LALT) /* è */ +#define SS_ACCENT_O_CIRCU SS_DOWN(X_LALT) SS_TAP(X_P1) SS_TAP(X_P4) SS_TAP(X_P7) SS_UP(X_LALT) /* ô */ +#define SS_ACCENT_U_GRAVE SS_DOWN(X_LALT) SS_TAP(X_P0) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P9) SS_UP(X_LALT) /* ù */ diff --git a/keyboards/cornia/keymaps/fire/tap_dances.c b/keyboards/cornia/keymaps/fire/tap_dances.c index 7713cdceae3..63f99115497 100644 --- a/keyboards/cornia/keymaps/fire/tap_dances.c +++ b/keyboards/cornia/keymaps/fire/tap_dances.c @@ -17,6 +17,7 @@ #include QMK_KEYBOARD_H #include "./tap_dances.h" +#include "./keymap.h" /* define a type containing as many tapdance states as you need */ typedef enum { @@ -29,15 +30,18 @@ typedef enum { /* Create a global instance of the tapdance state type */ static td_state_t td_state; +accent_state_t accent_state = ACCENT_NONE; tap_dance_action_t tap_dance_actions[TAP_DANCE_ACTIONS_COUNT] = { - [TD_SFT_CAPSW] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_shift_capsword_finished, dance_shift_capsword_reset) + [TD_SFT_CAPSW] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_shift_capsword_finished, dance_shift_capsword_reset), + [TD_NAV_ACCENT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_nav_accent_finished, dance_nav_accent_reset), + [TD_NUM_ACCENT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_num_accent_finished, dance_num_accent_reset) }; int cur_dance (tap_dance_state_t *state) { if (state->count == 1) { if (state->interrupted || !state->pressed) - { + { return SINGLE_TAP; } else { return SINGLE_HOLD; @@ -85,4 +89,66 @@ void dance_shift_capsword_reset (tap_dance_state_t *state, void *user_data) case OTHER_TAP: break; } +} + +void dance_nav_accent_finished (tap_dance_state_t *state, void *user_data) +{ + td_state = cur_dance(state); + switch (td_state) { + case SINGLE_TAP: + case SINGLE_HOLD: + layer_on(_NAV); + break; + case DOUBLE_TAP: + case DOUBLE_HOLD: + accent_state = ACCENT_LEFT; + break; + case OTHER_TAP: + break; + } +} + +void dance_nav_accent_reset (tap_dance_state_t *state, void *user_data) +{ + switch (td_state) { + case SINGLE_TAP: + case SINGLE_HOLD: + layer_off(_NAV); + break; + case DOUBLE_TAP: + case DOUBLE_HOLD: + case OTHER_TAP: + break; + } +} + +void dance_num_accent_finished (tap_dance_state_t *state, void *user_data) +{ + td_state = cur_dance(state); + switch (td_state) { + case SINGLE_TAP: + case SINGLE_HOLD: + layer_on(_NUM); + break; + case DOUBLE_TAP: + case DOUBLE_HOLD: + accent_state = ACCENT_RIGHT; + break; + case OTHER_TAP: + break; + } +} + +void dance_num_accent_reset (tap_dance_state_t *state, void *user_data) +{ + switch (td_state) { + case SINGLE_TAP: + case SINGLE_HOLD: + layer_off(_NUM); + break; + case DOUBLE_TAP: + case DOUBLE_HOLD: + case OTHER_TAP: + break; + } } \ No newline at end of file diff --git a/keyboards/cornia/keymaps/fire/tap_dances.h b/keyboards/cornia/keymaps/fire/tap_dances.h index ae38f8522ac..082e81f3ce0 100644 --- a/keyboards/cornia/keymaps/fire/tap_dances.h +++ b/keyboards/cornia/keymaps/fire/tap_dances.h @@ -21,10 +21,27 @@ /* Tap dances definitions */ enum tap_dances { TD_SFT_CAPSW, + TD_NAV_ACCENT, + TD_NUM_ACCENT, TAP_DANCE_ACTIONS_COUNT /* Utility to get TD_xxx count */ }; +/* Accented letters */ +typedef enum { + ACCENT_NONE, + ACCENT_LEFT, + ACCENT_RIGHT +} accent_state_t; + +extern accent_state_t accent_state; + extern tap_dance_action_t tap_dance_actions[TAP_DANCE_ACTIONS_COUNT]; void dance_shift_capsword_finished (tap_dance_state_t *state, void *user_data); void dance_shift_capsword_reset (tap_dance_state_t *state, void *user_data); + +void dance_nav_accent_finished (tap_dance_state_t *state, void *user_data); +void dance_nav_accent_reset (tap_dance_state_t *state, void *user_data); + +void dance_num_accent_finished (tap_dance_state_t *state, void *user_data); +void dance_num_accent_reset (tap_dance_state_t *state, void *user_data); diff --git a/keyboards/cornia/readme.md b/keyboards/cornia/readme.md index fd35d071c96..772fdd66a97 100644 --- a/keyboards/cornia/readme.md +++ b/keyboards/cornia/readme.md @@ -5,7 +5,9 @@ A split keyboard with 3x6 column strongly staggered keys and 3 thumb keys Keyboard Maintainer: [Vaarai](https://github.com/Vaarai) + Hardware Supported: Cornia PCB, RP2040 / 0xCB-Helios + Hardware Availability: [PCB Data](https://github.com/Vaarai/Cornia) Make example for this keyboard (after setting up your build environment):