aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/crkbd/keymaps/thefrey/README.md16
-rw-r--r--keyboards/crkbd/keymaps/thefrey/config.h45
-rw-r--r--keyboards/crkbd/keymaps/thefrey/keymap.c244
-rw-r--r--keyboards/crkbd/keymaps/thefrey/rules.mk31
4 files changed, 336 insertions, 0 deletions
diff --git a/keyboards/crkbd/keymaps/thefrey/README.md b/keyboards/crkbd/keymaps/thefrey/README.md
new file mode 100644
index 000000000..69b20cfcd
--- /dev/null
+++ b/keyboards/crkbd/keymaps/thefrey/README.md
@@ -0,0 +1,16 @@
1![the-frey-layout](https://raw.githubusercontent.com/the-frey/the-frey.github.com/master/assets/images/keyboard-layout.jpg)
2
3# Keyboard layout by the-frey
4
5This is a layout that allows access to all the paren keys easily, has a tab on the lower layer (for SUPER-TAB app switching) and some utility features like PGUP/PGDOWN and HOME/END.
6
7In addition, the arrows are on the lower layer and are bound to the vim keys (h,j,k,l). I've found this a productive layout for programming in emacs and hopefully you will too.
8
9The layout image above shows the keymap, with each key marked with all three layers:
10
11- The top indicates the raise layer
12- The middle indicates the default layer
13- The bottom indicates the lower layer
14
15All the keys respond as you'd expect to the 'shift' key - i.e. on a UK/GB keyboard, `/` becomes `?` and so on.
16
diff --git a/keyboards/crkbd/keymaps/thefrey/config.h b/keyboards/crkbd/keymaps/thefrey/config.h
new file mode 100644
index 000000000..cee901fc8
--- /dev/null
+++ b/keyboards/crkbd/keymaps/thefrey/config.h
@@ -0,0 +1,45 @@
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#define FORCE_NKRO
25
26/* Select hand configuration */
27
28#define MASTER_LEFT
29// #define MASTER_RIGHT
30// #define EE_HANDS
31
32#define SSD1306OLED
33
34#define USE_SERIAL_PD2
35
36#define TAPPING_FORCE_HOLD
37#define TAPPING_TERM 100
38
39#undef RGBLED_NUM
40#define RGBLIGHT_ANIMATIONS
41#define RGBLED_NUM 27
42#define RGBLIGHT_LIMIT_VAL 120
43#define RGBLIGHT_HUE_STEP 10
44#define RGBLIGHT_SAT_STEP 17
45#define RGBLIGHT_VAL_STEP 17
diff --git a/keyboards/crkbd/keymaps/thefrey/keymap.c b/keyboards/crkbd/keymaps/thefrey/keymap.c
new file mode 100644
index 000000000..5077bfc87
--- /dev/null
+++ b/keyboards/crkbd/keymaps/thefrey/keymap.c
@@ -0,0 +1,244 @@
1#include QMK_KEYBOARD_H
2#include "bootloader.h"
3#ifdef PROTOCOL_LUFA
4 #include "lufa.h"
5 #include "split_util.h"
6#endif
7#ifdef SSD1306OLED
8 #include "ssd1306.h"
9#endif
10
11extern keymap_config_t keymap_config;
12
13#ifdef RGBLIGHT_ENABLE
14//Following line allows macro to read current RGB settings
15extern rgblight_config_t rgblight_config;
16#endif
17
18extern uint8_t is_master;
19
20// Each layer gets a name for readability, which is then used in the keymap matrix below.
21// The underscores don't mean anything - you can have a layer called STUFF or any other name.
22// Layer names don't all need to be of the same length, obviously, and you can also skip them
23// entirely and just use numbers.
24#define _QWERTY 0
25#define _LOWER 3
26#define _RAISE 4
27#define _ADJUST 16
28
29enum custom_keycodes {
30 QWERTY = SAFE_RANGE,
31 LOWER,
32 RAISE,
33 ADJUST,
34 BACKLIT,
35 RGBRST
36};
37
38enum macro_keycodes {
39 KC_SAMPLEMACRO,
40};
41
42#define KC______ KC_TRNS
43#define KC_XXXXX KC_NO
44#define KC_LOWER LOWER
45#define KC_RAISE RAISE
46#define KC_RST RESET
47#define KC_LRST RGBRST
48#define KC_LTOG RGB_TOG
49#define KC_LHUI RGB_HUI
50#define KC_LHUD RGB_HUD
51#define KC_LSAI RGB_SAI
52#define KC_LSAD RGB_SAD
53#define KC_LVAI RGB_VAI
54#define KC_LVAD RGB_VAD
55#define KC_LMOD RGB_MOD
56#define KC_CTLTB CTL_T(KC_TAB)
57#define KC_GUIEI GUI_T(KC_LANG2)
58#define KC_ALTKN ALT_T(KC_LANG1)
59
60const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
61 [_QWERTY] = LAYOUT_kc( \
62 //,-----------------------------------------. ,-----------------------------------------.
63 ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC,\
64 //|------+------+------+------+------+------| |------+------+------+------+------+------|
65 CTLTB, A, S, D, F, G, H, J, K, L, SCLN, QUOT,\
66 //|------+------+------+------+------+------| |------+------+------+------+------+------|
67 LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT,\
68 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
69 GUIEI, LOWER, SPC, ENT, RAISE, ALTKN \
70 //`--------------------' `--------------------'
71 ),
72
73 [_LOWER] = LAYOUT_kc( \
74 //,-----------------------------------------. ,-----------------------------------------.
75 TAB, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC,\
76 //|------+------+------+------+------+------| |------+------+------+------+------+------|
77 CTLTB, MUTE, VOLD, VOLU, PGUP, PGDN, LEFT, DOWN, UP, RIGHT, HOME, END,\
78 //|------+------+------+------+------+------| |------+------+------+------+------+------|
79 LSFT, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, XXXXX,\
80 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
81 GUIEI, LOWER, SPC, ENT, RAISE, ALTKN \
82 //`--------------------' `--------------------'
83 ),
84
85 [_RAISE] = LAYOUT_kc( \
86 //,-----------------------------------------. ,-----------------------------------------.
87 ESC, EXLM, AT, HASH, DLR, PERC, CIRC, AMPR, ASTR, LPRN, RPRN, BSPC,\
88 //|------+------+------+------+------+------| |------+------+------+------+------+------|
89 CTLTB, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, MINS, EQL, LCBR, RCBR, PIPE, GRV,\
90 //|------+------+------+------+------+------| |------+------+------+------+------+------|
91 LSFT, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, UNDS, PLUS, LBRC, RBRC, BSLS, TILD,\
92 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
93 GUIEI, LOWER, SPC, ENT, RAISE, ALTKN \
94 //`--------------------' `--------------------'
95 ),
96
97 [_ADJUST] = LAYOUT_kc( \
98 //,-----------------------------------------. ,-----------------------------------------.
99 RST, LRST, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
100 //|------+------+------+------+------+------| |------+------+------+------+------+------|
101 LTOG, LHUI, LSAI, LVAI, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
102 //|------+------+------+------+------+------| |------+------+------+------+------+------|
103 LMOD, LHUD, LSAD, LVAD, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
104 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
105 GUIEI, LOWER, SPC, ENT, RAISE, ALTKN \
106 //`--------------------' `--------------------'
107 )
108};
109
110int RGB_current_mode;
111
112// Setting ADJUST layer RGB back to default
113void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
114 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
115 layer_on(layer3);
116 } else {
117 layer_off(layer3);
118 }
119}
120
121void matrix_init_user(void) {
122 #ifdef RGBLIGHT_ENABLE
123 RGB_current_mode = rgblight_config.mode;
124 #endif
125 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
126 #ifdef SSD1306OLED
127 iota_gfx_init(!has_usb()); // turns on the display
128 #endif
129}
130
131//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
132#ifdef SSD1306OLED
133
134// When add source files to SRC in rules.mk, you can use functions.
135const char *read_layer_state(void);
136const char *read_logo(void);
137void set_keylog(uint16_t keycode, keyrecord_t *record);
138const char *read_keylog(void);
139const char *read_keylogs(void);
140
141// const char *read_mode_icon(bool swap);
142// const char *read_host_led_state(void);
143// void set_timelog(void);
144// const char *read_timelog(void);
145
146void matrix_scan_user(void) {
147 iota_gfx_task();
148}
149
150void matrix_render_user(struct CharacterMatrix *matrix) {
151 if (is_master) {
152 // If you want to change the display of OLED, you need to change here
153 matrix_write_ln(matrix, read_layer_state());
154 matrix_write_ln(matrix, read_keylog());
155 matrix_write_ln(matrix, read_keylogs());
156 //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui));
157 //matrix_write_ln(matrix, read_host_led_state());
158 //matrix_write_ln(matrix, read_timelog());
159 } else {
160 matrix_write(matrix, read_logo());
161 }
162}
163
164void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
165 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
166 memcpy(dest->display, source->display, sizeof(dest->display));
167 dest->dirty = true;
168 }
169}
170
171void iota_gfx_task_user(void) {
172 struct CharacterMatrix matrix;
173 matrix_clear(&matrix);
174 matrix_render_user(&matrix);
175 matrix_update(&display, &matrix);
176}
177#endif//SSD1306OLED
178
179bool process_record_user(uint16_t keycode, keyrecord_t *record) {
180 if (record->event.pressed) {
181#ifdef SSD1306OLED
182 set_keylog(keycode, record);
183#endif
184 // set_timelog();
185 }
186
187 switch (keycode) {
188 case QWERTY:
189 if (record->event.pressed) {
190 set_single_persistent_default_layer(_QWERTY);
191 }
192 return false;
193 break;
194 case LOWER:
195 if (record->event.pressed) {
196 layer_on(_LOWER);
197 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
198 } else {
199 layer_off(_LOWER);
200 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
201 }
202 return false;
203 break;
204 case RAISE:
205 if (record->event.pressed) {
206 layer_on(_RAISE);
207 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
208 } else {
209 layer_off(_RAISE);
210 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
211 }
212 return false;
213 break;
214 case ADJUST:
215 if (record->event.pressed) {
216 layer_on(_ADJUST);
217 } else {
218 layer_off(_ADJUST);
219 }
220 return false;
221 break;
222 case RGB_MOD:
223 #ifdef RGBLIGHT_ENABLE
224 if (record->event.pressed) {
225 rgblight_mode(RGB_current_mode);
226 rgblight_step();
227 RGB_current_mode = rgblight_config.mode;
228 }
229 #endif
230 return false;
231 break;
232 case RGBRST:
233 #ifdef RGBLIGHT_ENABLE
234 if (record->event.pressed) {
235 eeconfig_update_rgblight_default();
236 rgblight_enable();
237 RGB_current_mode = rgblight_config.mode;
238 }
239 #endif
240 break;
241 }
242 return true;
243}
244
diff --git a/keyboards/crkbd/keymaps/thefrey/rules.mk b/keyboards/crkbd/keymaps/thefrey/rules.mk
new file mode 100644
index 000000000..16deaf45d
--- /dev/null
+++ b/keyboards/crkbd/keymaps/thefrey/rules.mk
@@ -0,0 +1,31 @@
1
2# Build Options
3# change to "no" to disable the options, or define them in the Makefile in
4# the appropriate keymap folder that will get included automatically
5#
6BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
7MOUSEKEY_ENABLE = no # Mouse keys(+4700)
8EXTRAKEY_ENABLE = no # Audio control and System control(+450)
9CONSOLE_ENABLE = no # Console for debug(+400)
10COMMAND_ENABLE = no # Commands for debug and configuration
11NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
12BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
13MIDI_ENABLE = no # MIDI controls
14AUDIO_ENABLE = no # Audio output on port C6
15UNICODE_ENABLE = no # Unicode
16BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
17RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
18SWAP_HANDS_ENABLE = no # Enable one-hand typing
19
20# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
21SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
22
23# If you want to change the display of OLED, you need to change here
24SRC += ./lib/glcdfont.c \
25 ./lib/rgb_state_reader.c \
26 ./lib/layer_state_reader.c \
27 ./lib/logo_reader.c \
28 ./lib/keylogger.c \
29 # ./lib/mode_icon_reader.c \
30 # ./lib/host_led_state_reader.c \
31 # ./lib/timelogger.c \