diff options
author | Olivier Poitrey <rs@rhapsodyk.net> | 2019-05-07 10:43:08 -0700 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-05-07 10:43:08 -0700 |
commit | 2d5c16dfd4ef193c4f692722157aa2b526a4c877 (patch) | |
tree | 527c5e5f51cf75c4476616a3c6ed91e385f1e1b2 /keyboards/crkbd/keymaps | |
parent | 3b132599427a648b1f14aaf30312f05f855625ea (diff) | |
download | qmk_firmware-2d5c16dfd4ef193c4f692722157aa2b526a4c877.tar.gz |
[Keymap] crkbd/keymaps/rs: add rs keymap to corne keyboard and adapt others (#5181)
Update all my keymaps to work with 40 keys. Refactor code using
Userspace.
Diffstat (limited to 'keyboards/crkbd/keymaps')
-rw-r--r-- | keyboards/crkbd/keymaps/like_jis/keymap.c | 6 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/rs/config.h | 44 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/rs/keymap.c | 39 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/rs/oled.c | 104 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/rs/readme.md | 19 | ||||
-rw-r--r-- | keyboards/crkbd/keymaps/rs/rules.mk | 32 |
6 files changed, 239 insertions, 5 deletions
diff --git a/keyboards/crkbd/keymaps/like_jis/keymap.c b/keyboards/crkbd/keymaps/like_jis/keymap.c index b1b6c64b1..41df6330f 100644 --- a/keyboards/crkbd/keymaps/like_jis/keymap.c +++ b/keyboards/crkbd/keymaps/like_jis/keymap.c @@ -11,11 +11,6 @@ extern keymap_config_t keymap_config; -#ifdef RGBLIGHT_ENABLE -//Following line allows macro to read current RGB settings -extern rgblight_config_t rgblight_config; -#endif - extern uint8_t is_master; // Each layer gets a name for readability, which is then used in the keymap matrix below. @@ -241,6 +236,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { void matrix_init_user(void) { #ifdef RGBLIGHT_ENABLE RGB_current_mode = rgblight_config.mode; + UPDATE_KEYMAP_STATUS(); #endif //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h #ifdef SSD1306OLED diff --git a/keyboards/crkbd/keymaps/rs/config.h b/keyboards/crkbd/keymaps/rs/config.h new file mode 100644 index 000000000..9701c2b3f --- /dev/null +++ b/keyboards/crkbd/keymaps/rs/config.h @@ -0,0 +1,44 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +//#define USE_MATRIX_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +#define SSD1306OLED + +#define USE_SERIAL_PD2 + +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM 300 + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 27 +#define RGBLIGHT_LIMIT_VAL 120 +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 diff --git a/keyboards/crkbd/keymaps/rs/keymap.c b/keyboards/crkbd/keymaps/rs/keymap.c new file mode 100644 index 000000000..135ccb076 --- /dev/null +++ b/keyboards/crkbd/keymaps/rs/keymap.c @@ -0,0 +1,39 @@ +#include QMK_KEYBOARD_H +#include "rs.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_kc( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TAB , Q , W , E , R , T , Y , U , I , O , P ,EQL , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ESCC, A , S , D , F , G , H , J , K , L ,SCLN,QUOT, + //|----+----+----+----+----+----+ |----+----+----+----+----+----| + LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,ENTS, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + LALT,LGUI,SPC , BSPC,CODE,FN + // `----+----+----' `+---+----+----'c + ), + [_CODE] = LAYOUT_kc( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + GRV ,EXLM, AT ,HASH, DLR,PERC, CIRC,LPLT,ASTR,RPGT,NEQL, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , 1 , 2 , 3 , 4 , 5 , MINS,LBRC, UP ,RBRC, ,BSLS, + //|----+----+----+----+----+----+ |----+----+----+----+----+----| + , 6 , 7 , 8 , 9 , 0 , AMPR,LEFT,DOWN,RGHT, ,PIPE, + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + , ,DOT , , , + // `----+----+----' `----+----+----' + ), + [_FN] = LAYOUT_kc( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 , F10, F11, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LTOG,LHUI,LSAI,LVAI,LRST,BRMU, VOLU, ,PGUP, , , , + //|----+----+----+----+----+----+ |----+----+----+----+----+----| + LMOD,LHUD,LSAD,LVAD,RST ,BRMD, VOLD,CTRA,PGDN,CTRE, , , + //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' + , , , MUTE, , + // `----+----+----' `----+----+----' + ), +}; + diff --git a/keyboards/crkbd/keymaps/rs/oled.c b/keyboards/crkbd/keymaps/rs/oled.c new file mode 100644 index 000000000..c94dff9ed --- /dev/null +++ b/keyboards/crkbd/keymaps/rs/oled.c @@ -0,0 +1,104 @@ +#ifdef SSD1306OLED +#include QMK_KEYBOARD_H +#include "ssd1306.h" +#ifdef PROTOCOL_LUFA +#include "lufa.h" +#include "split_util.h" +#endif + +extern uint8_t is_master; + +// When add source files to SRC in rules.mk, you can use functions. +const char *read_logo(void); +const char *read_keylog(void); +const char *read_keylogs(void); +void set_keylog(uint16_t keycode, keyrecord_t *record); + +void matrix_scan_user(void) { iota_gfx_task(); } + +typedef struct { + uint8_t state; + char name[8]; +} LAYER_DISPLAY_NAME; + +#define LAYER_DISPLAY_MAX 5 +const LAYER_DISPLAY_NAME layer_display_name[LAYER_DISPLAY_MAX] = { + {0, "Base"}, + {2, "Code"}, + {4, "Fn"}, + {6, "Fn+Code"}, + {__UINT8_MAX__, "?"}, +}; +static uint8_t layer_name_idx; +static char layer_status_buf[24] = "Layer: Base\n"; + +#ifdef RGBLIGHT_ENABLE +// Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +void update_keymap_status(void) { + snprintf(layer_status_buf, sizeof(layer_status_buf) - 1, "Layer:%s RGB: %d\n", + layer_display_name[layer_name_idx].name, rgblight_config.mode); +} +#else +void update_keymap_status(void) { + snprintf(layer_status_buf, sizeof(layer_status_buf) - 1, "Layer:%s\n", + layer_display_name[layer_name_idx].name); +} +#endif + +void matrix_init_user(void) { + iota_gfx_init(!has_usb()); // turns on the display + update_keymap_status(); +} + +// declared in users/rs/rs.c +void rgb_mod_changed_keymap(void) { + update_keymap_status(); +} + +// declared in users/rs/rs.c +void keylog_set_keymap(uint16_t keycode, keyrecord_t *record) { + set_keylog(keycode, record); +} + +uint32_t layer_state_set_user(uint32_t state) { + for (layer_name_idx = 0; layer_name_idx < LAYER_DISPLAY_MAX; ++layer_name_idx) { + if (state == 0 && layer_display_name[layer_name_idx].state == default_layer_state) { + break; + } else if (state != 0 && layer_display_name[layer_name_idx].state == state) { + break; + } + } + update_keymap_status(); + return state; +} + +static inline void render_keymap_status(struct CharacterMatrix *matrix) { + matrix_write(matrix, layer_status_buf); +} + +void matrix_render_user(struct CharacterMatrix *matrix) { + if (is_master) { + render_keymap_status(matrix); + matrix_write_ln(matrix, read_keylog()); + matrix_write_ln(matrix, read_keylogs()); + } else { + matrix_write(matrix, read_logo()); + } +} + +void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +void iota_gfx_task_user(void) { + struct CharacterMatrix matrix; + matrix_clear(&matrix); + matrix_render_user(&matrix); + matrix_update(&display, &matrix); +} + +#endif diff --git a/keyboards/crkbd/keymaps/rs/readme.md b/keyboards/crkbd/keymaps/rs/readme.md new file mode 100644 index 000000000..d7f7bb645 --- /dev/null +++ b/keyboards/crkbd/keymaps/rs/readme.md @@ -0,0 +1,19 @@ +# RS40: Code Friendly 40% Keymap + +This keymap is an evolution of my previous keymap optimized for coding with a 60% keyboards like the Iris. I tried to keep the simplicity of my previous keymap with all the keys necessary for coding on a single layer in addition to the base one. + +Because I sometime have to use my internal keyboard I my macbook, a karabiner configuration is also provided to get most of the features of this keyboard, including the code layer / backspace on right command key etc. + +See [rs readme](../../../../users/rs/readme.md) for a list of other keyboards supported by this keymap. + +## Base Layer + +[![](http://poitr.us/moooMf+)](http://www.keyboard-layout-editor.com/##@_backcolor=%23d8c1f5&switchMount=cherry&pcb:false&plate:true%3B&@_x:3&c=%236750f2&t=%2344b8b8&a:7%3B&=E&_x:8%3B&=I%3B&@_y:-0.87&x:2%3B&=W&_x:1%3B&=R&_x:6%3B&=U&_x:1%3B&=O%3B&@_y:-0.8799999999999999&x:5%3B&=T&_x:4%3B&=Y%3B&@_y:-0.87&c=%233a1ee6&t=%23b84465%3B&=Tab&_c=%236750f2&t=%2344b8b8%3B&=Q&_x:12%3B&=P&_c=%233a1ee6&t=%23b84465&a:5%3B&=+%0A%2F=%3B&@_y:-0.3799999999999999&x:3&c=%236750f2&t=%2344b8b8&a:7%3B&=D&_x:8%3B&=K%3B&@_y:-0.8700000000000001&x:2%3B&=S&_x:1%3B&=F&_x:6%3B&=J&_x:1%3B&=L%3B&@_y:-0.8799999999999999&x:5%3B&=G&_x:4%3B&=H%3B&@_y:-0.8700000000000001&c=%233a1ee6&t=%23b84465&a:5%3B&=Esc%0ACtrl&_c=%236750f2&t=%2344b8b8&a:7%3B&=A&_x:12&a:5%3B&=%2F:%0A%2F%3B&_c=%233a1ee6&t=%23b84465%3B&=%22%0A'%3B&@_y:-0.3799999999999999&x:3&c=%236750f2&t=%2344b8b8&a:7%3B&=C&_x:8&a:5%3B&=%3C%0A,%3B&@_y:-0.8700000000000001&x:2&a:7%3B&=X&_x:1%3B&=V&_x:6%3B&=M&_x:1&a:5%3B&=%3E%0A.%3B&@_y:-0.8799999999999999&x:5&a:7%3B&=B&_x:4%3B&=N%3B&@_y:-0.8700000000000001&c=%233a1ee6&t=%23b84465%3B&=Shift&_c=%236750f2&t=%2344b8b8%3B&=Z&_x:12&a:5%3B&=%3F%0A%2F%2F&_c=%233a1ee6&t=%23b84465&a:7%3B&=Enter%3B&@_y:-0.17999999999999972&x:11.75%3B&=Fn%3B&@_ry:0.25&y:2.95&x:3.3%3B&=Alt%3B&@_r:12&ry:1.75&y:0.5&x:4.8%3B&=Cmd%3B&@_r:35&rx:6.5&ry:4.25&y:-0.75&x:-0.75&c=%23d12424&t=%23ffffff&h:1.5%3B&=Space%3B&@_r:-35&rx:13&y:-2.75&x:-3.0999999999999996&h:1.5%3B&=Back%20Space%3B&@_r:-12&rx:0&ry:0&y:5.55&x:9.55&c=%233a1ee6&t=%23b84465%3B&=Code) + +## Code Layer + +[![](http://poitr.us/GvljvC+)](http://www.keyboard-layout-editor.com/##@_backcolor=%23d8c1f5&switchMount=cherry&pcb:false&plate:true%3B&@_x:3&c=%236750f2&t=%2344b8b8&a:7%3B&=%23&_x:8%3B&=*%3B&@_y:-0.87&x:2%3B&=%2F@&_x:1%3B&=$&_x:6&a:5%3B&=%3C%0A(&_x:1%3B&=%3E%0A)%3B&@_y:-0.8799999999999999&x:5&a:7%3B&=%25&_x:4%3B&=%5E%3B&@_y:-0.87&c=%233a1ee6&t=%23b84465%3B&=Tab&_c=%236750f2&t=%2344b8b8%3B&=!&_x:12%3B&=!%2F=&_c=%233a1ee6&t=%23b84465&a:5%3B&=+%0A%2F=%3B&@_y:-0.3799999999999999&x:3&c=%236750f2&t=%2344b8b8&a:7%3B&=3&_x:8%3B&=↑%3B&@_y:-0.8700000000000001&x:2%3B&=2&_x:1%3B&=4&_x:6&a:5%3B&=%7B%0A%5B&_x:1%3B&=%7D%0A%5D%3B&@_y:-0.8799999999999999&x:5&a:7%3B&=5&_x:4&a:5%3B&=%2F_%0A-%3B&@_y:-0.8700000000000001&c=%233a1ee6&t=%23b84465%3B&=Esc%0ACtrl&_c=%236750f2&t=%2344b8b8&a:7%3B&=1&_x:12&a:5%3B&=%2F:%0A%2F%3B&_c=%233a1ee6&t=%23b84465%3B&=%7C%0A%5C%3B&@_y:-0.3799999999999999&x:3&c=%236750f2&t=%2344b8b8&a:7%3B&=8&_x:8%3B&=↓%3B&@_y:-0.8700000000000001&x:2%3B&=7&_x:1%3B&=9&_x:6%3B&=←&_x:1%3B&=→%3B&@_y:-0.8799999999999999&x:5%3B&=0&_x:4%3B&=%2F&%3B&@_y:-0.8700000000000001&c=%233a1ee6&t=%23b84465%3B&=Shift&_c=%236750f2&t=%2344b8b8%3B&=6&_x:12&a:5%3B&=%3F%0A%2F%2F&_c=%233a1ee6&t=%23b84465&a:7%3B&=Enter%3B&@_y:-0.17999999999999972&x:11.75%3B&=Fn%3B&@_ry:0.25&y:2.95&x:3.3%3B&=Alt%3B&@_r:12&ry:1.75&y:0.5&x:4.8%3B&=Cmd%3B&@_r:35&rx:6.5&ry:4.25&y:-0.75&x:-0.75&c=%23d12424&t=%23ffffff&h:1.5%3B&=.%3B&@_r:-35&rx:13&y:-2.75&x:-3.0999999999999996&h:1.5%3B&=Back%20Space%3B&@_r:-12&rx:0&ry:0&y:5.55&x:9.55&c=%233a1ee6&t=%23b84465%3B&=Code) + +## Fn Layer + +[![](http://poitr.us/OXwmBK+)](http://www.keyboard-layout-editor.com/##@_backcolor=%23d8c1f5&switchMount=cherry&pcb:false&plate:true%3B&@_x:3&c=%236750f2&t=%2344b8b8&a:7%3B&=F3&_x:8%3B&=F8%3B&@_y:-0.87&x:2%3B&=F2&_x:1%3B&=F4&_x:6%3B&=F7&_x:1%3B&=F9%3B&@_y:-0.8799999999999999&x:5%3B&=F5&_x:4%3B&=F6%3B&@_y:-0.87&c=%233a1ee6&t=%23b84465%3B&=&_c=%236750f2&t=%2344b8b8%3B&=F1&_x:12%3B&=F10&_c=%233a1ee6&t=%23b84465%3B&=F11%3B&@_y:-0.3799999999999999&x:3&c=%236750f2&t=%2344b8b8%3B&=RGB%20Value+&_x:8%3B&=Page%20Up%3B&@_y:-0.8700000000000001&x:2%3B&=RGB%20Sat+&_x:1%3B&=RGB%20Reset&_x:6%3B&=&_x:1%3B&=%3B&@_y:-0.8799999999999999&x:5%3B&=Bright+&_x:4%3B&=Vol+%3B&@_y:-0.8700000000000001&c=%233a1ee6&t=%23b84465%3B&=RGB%20Toggle&_c=%236750f2&t=%2344b8b8%3B&=RGB%20Hue+&_x:12%3B&=&_c=%233a1ee6&t=%23b84465%3B&=%3B&@_y:-0.3799999999999999&x:3&c=%236750f2&t=%2344b8b8%3B&=RGB%20Value-&_x:8%3B&=Page%20Down%3B&@_y:-0.8700000000000001&x:2%3B&=RGB%20Sat-&_x:1%3B&=Reset&_x:6%3B&=Ctrl+A&_x:1%3B&=Ctrl+E%3B&@_y:-0.8799999999999999&x:5%3B&=Bright-&_x:4%3B&=Vol-%3B&@_y:-0.8700000000000001&c=%233a1ee6&t=%23b84465%3B&=RGB%20Mode&_c=%236750f2&t=%2344b8b8%3B&=RGB%20Hue-&_x:12%3B&=&_c=%233a1ee6&t=%23b84465%3B&=%3B&@_y:-0.17999999999999972&x:11.75%3B&=Fn%3B&@_ry:0.25&y:2.95&x:3.3%3B&=%3B&@_r:12&ry:1.75&y:0.5&x:4.8%3B&=%3B&@_r:35&rx:6.5&ry:4.25&y:-0.75&x:-0.75&c=%23d12424&t=%23ffffff&h:1.5%3B&=%3B&@_r:-35&rx:13&y:-2.75&x:-3.0999999999999996&h:1.5%3B&=Mute%3B&@_r:-12&rx:0&ry:0&y:5.55&x:9.55&c=%233a1ee6&t=%23b84465%3B&=Code)
\ No newline at end of file diff --git a/keyboards/crkbd/keymaps/rs/rules.mk b/keyboards/crkbd/keymaps/rs/rules.mk new file mode 100644 index 000000000..683b4b70d --- /dev/null +++ b/keyboards/crkbd/keymaps/rs/rules.mk @@ -0,0 +1,32 @@ + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. +SWAP_HANDS_ENABLE = no # Enable one-hand typing +TAP_DANCE_ENABLE = no + +BOOTLOADER = atmel-dfu + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +# If you want to change the display of OLED, you need to change here +SRC += oled.c \ + ./lib/glcdfont.c \ + ./lib/rgb_state_reader.c \ + ./lib/layer_state_reader.c \ + ./lib/logo_reader.c \ + ./lib/keylogger.c \ |