Skip to content

Commit

Permalink
[Keymap] Corne keyap with tap dance Swedish support (qmk#6857)
Browse files Browse the repository at this point in the history
* Adding profile for Corne with tap dance Swedish support.

* Remove extern keymap_config_t keymap_config as no longer needed

* Changed to use tap_code over register_code

* Removed persistent_default_layer_set

* Moved macros to hvp user space ink tap dance code

* Removed not used functions

* Moved to an ifbased include statement

* Removed not needed characters
  • Loading branch information
hvpkod authored and drashna committed Oct 16, 2019
1 parent df76955 commit 8d774da
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
2 changes: 2 additions & 0 deletions users/hvp/hvp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

#include "hvp.h"
6 changes: 6 additions & 0 deletions users/hvp/hvp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

#ifdef TAP_DANCE_ENABLE
# include "tap_dances.h"
#endif
#include "quantum.h"
1 change: 1 addition & 0 deletions users/hvp/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Personal user space for hvpcode / cablegore at discord
4 changes: 4 additions & 0 deletions users/hvp/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SRC += hvp.c
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
SRC += tap_dances.c
endif
75 changes: 75 additions & 0 deletions users/hvp/tap_dances.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include "tap_dances.h"

// Tap dance function for enable swedish characters on first layer. Unregister to not let tap bleed over to next keypress.
// Tap dance 1
void dance_1_finished(qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 2) {
tap_code(KC_SCLN);
} else {
register_code(KC_RALT);
register_code(KC_O);
unregister_code(KC_RALT);
unregister_code(KC_O);
}
}

void dance_1_reset(qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 2) {
unregister_code(KC_SCLN);
} else {
unregister_code(KC_RALT);
unregister_code(KC_O);
}
}

// Tap dance 2
void dance_2_finished(qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 2) {
tap_code(KC_QUOT);
} else {
register_code(KC_RALT);
register_code(KC_A);
unregister_code(KC_RALT);
unregister_code(KC_A);
}
}

void dance_2_reset(qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 2) {
unregister_code(KC_QUOT);
} else {
unregister_code(KC_RALT);
unregister_code(KC_A);
}
}

// Tap dance 3
void dance_3_finished(qk_tap_dance_state_t *state, void *user_data) {
// if (state->count == 2)
if (state->count == 2) {
tap_code(KC_SLSH);
} else {
register_code(KC_RALT);
register_code(KC_W);
unregister_code(KC_RALT);
unregister_code(KC_W);
}
}

void dance_3_reset(qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 2) {
unregister_code(KC_SLSH);
} else {
unregister_code(KC_RALT);
unregister_code(KC_W);
}
}

// Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
// simple tap dance
[TD1] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_1_finished, dance_1_reset),

[TD2] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_2_finished, dance_2_reset),

[TD3] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_3_finished, dance_3_reset)};
10 changes: 10 additions & 0 deletions users/hvp/tap_dances.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once
#include "hvp.h"

// Tap Dance Declarations
enum tapdance_id
{
TD1 = 0,
TD2,
TD3
};

0 comments on commit 8d774da

Please sign in to comment.