aboutsummaryrefslogtreecommitdiff
path: root/keyboards/claw44/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/claw44/keymaps/default/keymap.c')
-rw-r--r--keyboards/claw44/keymaps/default/keymap.c199
1 files changed, 45 insertions, 154 deletions
diff --git a/keyboards/claw44/keymaps/default/keymap.c b/keyboards/claw44/keymaps/default/keymap.c
index 088087c77..65dbd67d9 100644
--- a/keyboards/claw44/keymaps/default/keymap.c
+++ b/keyboards/claw44/keymaps/default/keymap.c
@@ -1,168 +1,59 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2#ifdef PROTOCOL_LUFA
3 #include "lufa.h"
4 #include "split_util.h"
5#endif
6#ifdef SSD1306OLED
7 #include "ssd1306.h"
8#endif
9
10
11extern uint8_t is_master;
12 2
13// Each layer gets a name for readability, which is then used in the keymap matrix below. 3// Each layer gets a name for readability, which is then used in the keymap matrix below.
14// The underscores don't mean anything - you can have a layer called STUFF or any other name. 4// The underscores don't mean anything - you can have a layer called STUFF or any other name.
15// Layer names don't all need to be of the same length, obviously, and you can also skip them 5// Layer names don't all need to be of the same length, obviously, and you can also skip them
16// entirely and just use numbers. 6// entirely and just use numbers.
17 7
18enum custom_keycodes { 8enum layer_number {
19 QWERTY = SAFE_RANGE, 9 _QWERTY = 0,
20 LOWER, 10 _RAISE,
21 RAISE 11 _LOWER,
22};
23
24enum macro_keycodes {
25 KC_SAMPLEMACRO,
26}; 12};
27 13
28#define KC_ KC_TRNS 14#define KC_ KC_TRNS
29#define KC_RST RESET 15#define KC_RST RESET
30#define KC_L_SPC LT(_LOWER, KC_SPC) // lower 16#define KC_L_SPC LT(_LOWER, KC_SPC) // lower
31#define KC_R_ENT LT(_RAISE, KC_ENT) // raise 17#define KC_R_ENT LT(_RAISE, KC_ENT) // raise
32#define KC_G_JA LGUI_T(KC_LANG1) // cmd or win 18#define KC_G_JA LGUI_T(KC_LANG1) // cmd or win
33#define KC_G_EN LGUI_T(KC_LANG2) // cmd or win 19#define KC_G_EN LGUI_T(KC_LANG2) // cmd or win
34#define KC_C_BS LCTL_T(KC_BSPC) // ctrl 20#define KC_C_BS LCTL_T(KC_BSPC) // ctrl
35#define KC_A_DEL ALT_T(KC_DEL) // alt 21#define KC_A_DEL ALT_T(KC_DEL) // alt
36 22
37const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 23const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 24 [_QWERTY] = LAYOUT( \
39 [_QWERTY] = LAYOUT( \ 25 //,--------+--------+---------+--------+---------+--------. ,--------+---------+--------+---------+--------+--------.
40 //,--------+--------+---------+--------+---------+--------. ,--------+---------+--------+---------+--------+--------. 26 KC_ESC , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_MINS,
41 KC_ESC , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_MINS, 27 //|--------+--------+---------+--------+---------+--------| |--------+---------+--------+---------+--------+--------|
42 //|--------+--------+---------+--------+---------+--------| |--------+---------+--------+---------+--------+--------| 28 KC_TAB , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT,
43 KC_TAB , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, 29 //|--------+--------+---------+--------+---------+--------| |--------+---------+--------+---------+--------+--------|
44 //|--------+--------+---------+--------+---------+--------| |--------+---------+--------+---------+--------+--------| 30 KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT,
45 KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT, 31 //`--------+--------+---------+--------+---------+--------/ \--------+---------+--------+---------+--------+--------'
46 //`--------+--------+---------+--------+---------+--------/ \--------+---------+--------+---------+--------+--------' 32 KC_A_DEL, KC_G_EN, KC_L_SPC, KC_C_BS, KC_C_BS, KC_R_ENT, KC_G_JA, KC_A_DEL
47 KC_A_DEL, KC_G_EN, KC_L_SPC, KC_C_BS, KC_C_BS, KC_R_ENT, KC_G_JA, KC_A_DEL 33 // `----------+--------+---------+--------' `--------+---------+--------+---------'
48 // `----------+--------+---------+--------' `--------+---------+--------+---------' 34 ),
49 ), 35
50 36 [_RAISE] = LAYOUT( \
51 // \ ^ ! & | @ = + * % - 37 //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------.
52 // ( # $ " ' ~ ← ↓ ↑ → ` ) 38 _______, KC_BSLS, KC_CIRC, KC_EXLM, KC_AMPR, KC_PIPE, KC_AT , KC_EQL , KC_PLUS, KC_ASTR, KC_PERC, KC_MINS,
53 // { [ ] } 39 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
54 40 KC_LPRN, KC_HASH, KC_DLR , KC_DQT , KC_QUOT, KC_TILD, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, KC_GRV , KC_RPRN,
55 [_RAISE] = LAYOUT( \ 41 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
56 //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. 42 _______, _______, _______, _______, KC_LCBR, KC_LBRC, KC_RBRC, KC_RCBR, _______, _______, _______, _______,
57 _______, KC_BSLS, KC_CIRC, KC_EXLM, KC_AMPR, KC_PIPE, KC_AT , KC_EQL , KC_PLUS, KC_ASTR, KC_PERC, KC_MINS, 43 //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------'
58 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| 44 _______, _______, _______, _______, _______, _______, _______, RESET
59 KC_LPRN, KC_HASH, KC_DLR , KC_DQT , KC_QUOT, KC_TILD, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, KC_GRV , KC_RPRN, 45 // `--------+--------+--------+--------' `--------+--------+--------+--------'
60 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| 46 ),
61 _______, _______, _______, _______, KC_LCBR, KC_LBRC, KC_RBRC, KC_RCBR, _______, _______, _______, _______, 47
62 //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------' 48 [_LOWER] = LAYOUT( \
63 _______, _______, _______, _______, _______, _______, _______, RESET 49 //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------.
64 // `--------+--------+--------+--------' `--------+--------+--------+--------' 50 KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , _______, KC_EQL , KC_PLUS, KC_ASTR, KC_PERC, KC_MINS,
65 ), 51 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
66 52 _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , _______,
67 [_LOWER] = LAYOUT( \ 53 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
68 //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. 54 KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______, _______, KC_COMM, KC_DOT , KC_SLSH, _______,
69 KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , _______, KC_EQL , KC_PLUS, KC_ASTR, KC_PERC, KC_MINS, 55 //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------'
70 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| 56 RESET , _______, _______, _______, _______, _______, _______, _______
71 _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , _______, 57 // `--------+--------+--------+--------' `--------+--------+--------+--------'
72 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| 58 ),
73 KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______, _______, KC_COMM, KC_DOT , KC_SLSH, _______,
74 //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------'
75 RESET , _______, _______, _______, _______, _______, _______, _______
76 // `--------+--------+--------+--------' `--------+--------+--------+--------'
77 ),
78}; 59};
79
80void matrix_init_user(void) {
81 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
82 #ifdef SSD1306OLED
83 iota_gfx_init(!has_usb()); // turns on the display
84 #endif
85}
86
87//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
88#ifdef SSD1306OLED
89
90// When add source files to SRC in rules.mk, you can use functions.
91const char *read_layer_state(void);
92const char *read_logo(void);
93void set_keylog(uint16_t keycode, keyrecord_t *record);
94const char *read_keylog(void);
95const char *read_keylogs(void);
96
97// const char *read_mode_icon(bool swap);
98// const char *read_host_led_state(void);
99// void set_timelog(void);
100// const char *read_timelog(void);
101
102void matrix_scan_user(void) {
103 iota_gfx_task();
104}
105
106void matrix_render_user(struct CharacterMatrix *matrix) {
107 if (is_master) {
108 // If you want to change the display of OLED, you need to change here
109 matrix_write_ln(matrix, read_layer_state());
110 matrix_write_ln(matrix, read_keylog());
111 matrix_write_ln(matrix, read_keylogs());
112 //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui));
113 //matrix_write_ln(matrix, read_host_led_state());
114 //matrix_write_ln(matrix, read_timelog());
115 } else {
116 matrix_write(matrix, read_logo());
117 }
118}
119
120void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
121 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
122 memcpy(dest->display, source->display, sizeof(dest->display));
123 dest->dirty = true;
124 }
125}
126
127void iota_gfx_task_user(void) {
128 struct CharacterMatrix matrix;
129 matrix_clear(&matrix);
130 matrix_render_user(&matrix);
131 matrix_update(&display, &matrix);
132}
133#endif//SSD1306OLED
134
135bool process_record_user(uint16_t keycode, keyrecord_t *record) {
136 if (record->event.pressed) {
137#ifdef SSD1306OLED
138 set_keylog(keycode, record);
139#endif
140 // set_timelog();
141 }
142
143 switch (keycode) {
144 case QWERTY:
145 if (record->event.pressed) {
146 set_single_persistent_default_layer(_QWERTY);
147 }
148 return false;
149 break;
150 case LOWER:
151 if (record->event.pressed) {
152 layer_on(_LOWER);
153 } else {
154 layer_off(_LOWER);
155 }
156 return false;
157 break;
158 case RAISE:
159 if (record->event.pressed) {
160 layer_on(_RAISE);
161 } else {
162 layer_off(_RAISE);
163 }
164 return false;
165 break;
166 }
167 return true;
168}