aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/crkbd/keymaps/hvp/config.h50
-rw-r--r--keyboards/crkbd/keymaps/hvp/keymap.c183
-rw-r--r--keyboards/crkbd/keymaps/hvp/readme.md5
-rw-r--r--keyboards/crkbd/keymaps/hvp/rules.mk14
-rw-r--r--users/hvp/hvp.c2
-rw-r--r--users/hvp/hvp.h6
-rw-r--r--users/hvp/readme.md1
-rw-r--r--users/hvp/rules.mk4
-rw-r--r--users/hvp/tap_dances.c75
-rw-r--r--users/hvp/tap_dances.h10
10 files changed, 350 insertions, 0 deletions
diff --git a/keyboards/crkbd/keymaps/hvp/config.h b/keyboards/crkbd/keymaps/hvp/config.h
new file mode 100644
index 000000000..c5c6d1cba
--- /dev/null
+++ b/keyboards/crkbd/keymaps/hvp/config.h
@@ -0,0 +1,50 @@
1/*
2This is the c configuration file for the keymap
3
4Copyright 2012 Jun Wako <wakojun@gmail.com>
5Copyright 2015 Jack Humbert
6
7This program is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#pragma once
22
23//#define USE_MATRIX_I2C
24
25/* Select hand configuration */
26
27#define MASTER_LEFT
28// #define MASTER_RIGHT
29// #define EE_HANDS
30
31#define SSD1306OLED
32
33#define USE_SERIAL_PD2
34
35//#define TAPPING_FORCE_HOLD
36//#define TAPPING_TERM 100
37
38#define TAPPING_TERM 150
39#define PERMISSIVE_HOLD
40#define IGNORE_MOD_TAP_INTERRUPT
41
42#ifdef RGBLIGHT_ENABLE
43# undef RGBLED_NUM
44# define RGBLIGHT_ANIMATIONS
45# define RGBLED_NUM 27
46# define RGBLIGHT_LIMIT_VAL 120
47# define RGBLIGHT_HUE_STEP 10
48# define RGBLIGHT_SAT_STEP 17
49# define RGBLIGHT_VAL_STEP 17
50#endif
diff --git a/keyboards/crkbd/keymaps/hvp/keymap.c b/keyboards/crkbd/keymaps/hvp/keymap.c
new file mode 100644
index 000000000..b66c360e1
--- /dev/null
+++ b/keyboards/crkbd/keymaps/hvp/keymap.c
@@ -0,0 +1,183 @@
1#include QMK_KEYBOARD_H
2#include "hvp.c"
3
4#ifdef RGBLIGHT_ENABLE
5//Following line allows macro to read current RGB settings
6extern rgblight_config_t rgblight_config;
7#endif
8
9extern uint8_t is_master;
10
11// Each layer gets a name for readability, which is then used in the keymap matrix below.
12// The underscores don't mean anything - you can have a layer called STUFF or any other name.
13// Layer names don't all need to be of the same length, obviously, and you can also skip them
14// entirely and just use numbers.
15#define _QWERTY 0
16#define _LOWER 1
17#define _RAISE 2
18#define _ADJUST 3
19
20enum custom_keycodes {
21 QWERTY = SAFE_RANGE,
22 LOWER,
23 RAISE,
24 ADJUST
25};
26
27const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
28 [_QWERTY] = LAYOUT( \
29 //,-----------------------------------------. ,-----------------------------------------.
30 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_BSPC,\
31 //|------+------+------+------+------+------| |------+------+------+------+------+------|
32 LT(_ADJUST, KC_ESC), KC_A, KC_S, KC_D, LT(_RAISE,KC_F), MT(MOD_LCTL,KC_G), KC_H, KC_J, KC_K, KC_L,TD(TD1),TD(TD2),\
33 //|------+------+------+------+------+------| |------+------+------+------+------+------|
34 KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM,KC_DOT,TD(TD3),KC_SFTENT,\
35 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
36 KC_LGUI, LOWER,MT(MOD_LSFT, KC_SPC), LT(_RAISE,KC_ENT), RAISE,KC_LALT \
37 //`--------------------' `--------------------'
38 ),
39
40 [_RAISE] = LAYOUT( \
41 //,-----------------------------------------. ,-----------------------------------------.
42 KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_BSPC,\
43 //|------+------+------+------+------+------| |------+------+------+------+------+------|
44 KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT,KC_DOWN,KC_UP, KC_RIGHT,KC_NO, KC_DEL,\
45 //|------+------+------+------+------+------| |------+------+------+------+------+------|
46 KC_LCTL, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NO, KC_NO,\
47 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
48 KC_LGUI, LOWER,MT(MOD_LSFT, KC_SPC), LT(_RAISE,KC_ENT), RAISE,KC_LALT \
49 //`--------------------' `--------------------'
50 ),
51
52 [_LOWER] = LAYOUT( \
53 //,-----------------------------------------. ,-----------------------------------------.
54 KC_TAB,KC_EXLM,KC_AT,KC_HASH,KC_DLR,KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,KC_BSPC,\
55 //|------+------+------+------+------+------| |------+------+------+------+------+------|
56 KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MINS,KC_EQL,KC_LCBR,KC_RCBR,KC_PIPE,KC_GRV,\
57 //|------+------+------+------+------+------| |------+------+------+------+------+------|
58 KC_LCTL, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_UNDS,KC_PLUS,KC_LBRC,KC_RBRC,KC_BSLS,KC_TILD,\
59 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
60 KC_LGUI, LOWER,MT(MOD_LSFT, KC_SPC), LT(_RAISE,KC_ENT), RAISE,KC_LALT \
61 //`--------------------' `--------------------'
62 ),
63
64 [_ADJUST] = LAYOUT( \
65 //,-----------------------------------------. ,-----------------------------------------.
66 KC_F1,KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,\
67 //|------+------+------+------+------+------| |------+------+------+------+------+------|
68 KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
69 //|------+------+------+------+------+------| |------+------+------+------+------+------|
70 RESET,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO, KC_MPLY, KC_MNXT, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,\
71 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
72 KC_LGUI, LOWER,MT(MOD_LSFT, KC_SPC), LT(_RAISE,KC_ENT), RAISE,KC_LALT \
73 //`--------------------' `--------------------'
74 )
75};
76
77int RGB_current_mode;
78
79// Setting ADJUST layer RGB back to default
80void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
81 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
82 layer_on(layer3);
83 } else {
84 layer_off(layer3);
85 }
86}
87
88void matrix_init_user(void) {
89 #ifdef RGBLIGHT_ENABLE
90 RGB_current_mode = rgblight_config.mode;
91 #endif
92 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
93 #ifdef SSD1306OLED
94 iota_gfx_init(!has_usb()); // turns on the display
95 #endif
96}
97
98//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
99#ifdef SSD1306OLED
100
101// When add source files to SRC in rules.mk, you can use functions.
102const char *read_layer_state(void);
103const char *read_logo(void);
104void set_keylog(uint16_t keycode, keyrecord_t *record);
105const char *read_keylog(void);
106const char *read_keylogs(void);
107
108// const char *read_mode_icon(bool swap);
109// const char *read_host_led_state(void);
110// void set_timelog(void);
111// const char *read_timelog(void);
112
113void matrix_scan_user(void) {
114 iota_gfx_task();
115}
116
117void matrix_render_user(struct CharacterMatrix *matrix) {
118 if (is_master) {
119 // If you want to change the display of OLED, you need to change here
120 matrix_write_ln(matrix, read_layer_state());
121 matrix_write_ln(matrix, read_keylog());
122 //matrix_write_ln(matrix, read_keylogs());
123 //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui));
124 //matrix_write_ln(matrix, read_host_led_state());
125 //matrix_write_ln(matrix, read_timelog());
126 } else {
127 matrix_write(matrix, read_logo());
128 }
129}
130
131void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
132 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
133 memcpy(dest->display, source->display, sizeof(dest->display));
134 dest->dirty = true;
135 }
136}
137
138void iota_gfx_task_user(void) {
139 struct CharacterMatrix matrix;
140 matrix_clear(&matrix);
141 matrix_render_user(&matrix);
142 matrix_update(&display, &matrix);
143}
144#endif//SSD1306OLED
145
146bool process_record_user(uint16_t keycode, keyrecord_t *record) {
147 if (record->event.pressed) {
148#ifdef SSD1306OLED
149 set_keylog(keycode, record);
150#endif
151 // set_timelog();
152 }
153
154 switch (keycode) {
155 case LOWER:
156 if (record->event.pressed) {
157 layer_on(_LOWER);
158 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
159 } else {
160 layer_off(_LOWER);
161 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
162 }
163 return false;
164 case RAISE:
165 if (record->event.pressed) {
166 layer_on(_RAISE);
167 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
168 } else {
169 layer_off(_RAISE);
170 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
171 }
172 return false;
173 case ADJUST:
174 if (record->event.pressed) {
175 layer_on(_ADJUST);
176 } else {
177 layer_off(_ADJUST);
178 }
179 return false;
180 break;
181 }
182 return true;
183} \ No newline at end of file
diff --git a/keyboards/crkbd/keymaps/hvp/readme.md b/keyboards/crkbd/keymaps/hvp/readme.md
new file mode 100644
index 000000000..33bb83b83
--- /dev/null
+++ b/keyboards/crkbd/keymaps/hvp/readme.md
@@ -0,0 +1,5 @@
1Keymap to be used with Eurkey for easy access to swedish characters on first layer.
2
3Links:
4
5- https://eurkey.steffen.bruentjen.eu/ \ No newline at end of file
diff --git a/keyboards/crkbd/keymaps/hvp/rules.mk b/keyboards/crkbd/keymaps/hvp/rules.mk
new file mode 100644
index 000000000..a651e528c
--- /dev/null
+++ b/keyboards/crkbd/keymaps/hvp/rules.mk
@@ -0,0 +1,14 @@
1
2# If you want to change the display of OLED, you need to change here
3SRC += ./lib/glcdfont.c \
4 ./lib/rgb_state_reader.c \
5 ./lib/layer_state_reader.c \
6 ./lib/logo_reader.c \
7 ./lib/keylogger.c \
8 # ./lib/mode_icon_reader.c \
9 # ./lib/host_led_state_reader.c \
10 # ./lib/timelogger.c \
11
12TAP_DANCE_ENABLE = yes
13EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
14# LOCAL_GLCDFONT = yes \ No newline at end of file
diff --git a/users/hvp/hvp.c b/users/hvp/hvp.c
new file mode 100644
index 000000000..7e484535c
--- /dev/null
+++ b/users/hvp/hvp.c
@@ -0,0 +1,2 @@
1
2#include "hvp.h"
diff --git a/users/hvp/hvp.h b/users/hvp/hvp.h
new file mode 100644
index 000000000..2b2210f87
--- /dev/null
+++ b/users/hvp/hvp.h
@@ -0,0 +1,6 @@
1#pragma once
2
3#ifdef TAP_DANCE_ENABLE
4# include "tap_dances.h"
5#endif
6#include "quantum.h"
diff --git a/users/hvp/readme.md b/users/hvp/readme.md
new file mode 100644
index 000000000..2d8f9d859
--- /dev/null
+++ b/users/hvp/readme.md
@@ -0,0 +1 @@
Personal user space for hvpcode / cablegore at discord
diff --git a/users/hvp/rules.mk b/users/hvp/rules.mk
new file mode 100644
index 000000000..0a7e67963
--- /dev/null
+++ b/users/hvp/rules.mk
@@ -0,0 +1,4 @@
1SRC += hvp.c
2ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
3 SRC += tap_dances.c
4endif \ No newline at end of file
diff --git a/users/hvp/tap_dances.c b/users/hvp/tap_dances.c
new file mode 100644
index 000000000..bb102b30a
--- /dev/null
+++ b/users/hvp/tap_dances.c
@@ -0,0 +1,75 @@
1#include "tap_dances.h"
2
3// Tap dance function for enable swedish characters on first layer. Unregister to not let tap bleed over to next keypress.
4// Tap dance 1
5void dance_1_finished(qk_tap_dance_state_t *state, void *user_data) {
6 if (state->count == 2) {
7 tap_code(KC_SCLN);
8 } else {
9 register_code(KC_RALT);
10 register_code(KC_O);
11 unregister_code(KC_RALT);
12 unregister_code(KC_O);
13 }
14}
15
16void dance_1_reset(qk_tap_dance_state_t *state, void *user_data) {
17 if (state->count == 2) {
18 unregister_code(KC_SCLN);
19 } else {
20 unregister_code(KC_RALT);
21 unregister_code(KC_O);
22 }
23}
24
25// Tap dance 2
26void dance_2_finished(qk_tap_dance_state_t *state, void *user_data) {
27 if (state->count == 2) {
28 tap_code(KC_QUOT);
29 } else {
30 register_code(KC_RALT);
31 register_code(KC_A);
32 unregister_code(KC_RALT);
33 unregister_code(KC_A);
34 }
35}
36
37void dance_2_reset(qk_tap_dance_state_t *state, void *user_data) {
38 if (state->count == 2) {
39 unregister_code(KC_QUOT);
40 } else {
41 unregister_code(KC_RALT);
42 unregister_code(KC_A);
43 }
44}
45
46// Tap dance 3
47void dance_3_finished(qk_tap_dance_state_t *state, void *user_data) {
48 // if (state->count == 2)
49 if (state->count == 2) {
50 tap_code(KC_SLSH);
51 } else {
52 register_code(KC_RALT);
53 register_code(KC_W);
54 unregister_code(KC_RALT);
55 unregister_code(KC_W);
56 }
57}
58
59void dance_3_reset(qk_tap_dance_state_t *state, void *user_data) {
60 if (state->count == 2) {
61 unregister_code(KC_SLSH);
62 } else {
63 unregister_code(KC_RALT);
64 unregister_code(KC_W);
65 }
66}
67
68// Tap Dance Definitions
69qk_tap_dance_action_t tap_dance_actions[] = {
70 // simple tap dance
71 [TD1] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_1_finished, dance_1_reset),
72
73 [TD2] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_2_finished, dance_2_reset),
74
75 [TD3] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_3_finished, dance_3_reset)}; \ No newline at end of file
diff --git a/users/hvp/tap_dances.h b/users/hvp/tap_dances.h
new file mode 100644
index 000000000..705985faa
--- /dev/null
+++ b/users/hvp/tap_dances.h
@@ -0,0 +1,10 @@
1#pragma once
2#include "hvp.h"
3
4// Tap Dance Declarations
5enum tapdance_id
6{
7 TD1 = 0,
8 TD2,
9 TD3
10};