Change helix:froggy keymap to use split_common (#16703)

* create LAYOUT_half() macro into helix/rev2/keymaps/froggy/keymap.c

* Makes QMK standerd OLED driver used by the helix:froggy keymap switchable.

* Change helix:froggy keymap to use split_common
This commit is contained in:
Takeshi ISHII 2022-04-11 18:09:37 +09:00 committed by GitHub
parent 84c9d6ff39
commit 3bde05c568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 237 additions and 109 deletions

View File

@ -26,6 +26,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped this number of times again. */ #define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped this number of times again. */
#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */ #define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */
// the froggy keymap does not use the right hand side, so sync_timer is not needed
#define DISABLE_SYNC_TIMER
// For the same reason, the following are also not needed
#undef SPLIT_LAYER_STATE_ENABLE
#undef SPLIT_LED_STATE_ENABLE
// If you need more program area, try select and reduce rgblight modes to use. // If you need more program area, try select and reduce rgblight modes to use.
// Selection of RGBLIGHT MODE to use. // Selection of RGBLIGHT MODE to use.

View File

@ -1,24 +1,31 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include "bootloader.h" #include <string.h>
#ifdef PROTOCOL_LUFA
#include "lufa.h" #define MIN(x, y) (((x) < (y)) ? (x) : (y))
#include "split_util.h" #define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifdef AUDIO_ENABLE
#include "audio.h"
#endif
#ifdef SSD1306OLED #ifdef SSD1306OLED
#include "ssd1306.h" #include "ssd1306.h"
#endif #endif
extern keymap_config_t keymap_config; #define LAYOUT_half( \
L00, L01, L02, L03, L04, L05, \
#ifdef RGBLIGHT_ENABLE L10, L11, L12, L13, L14, L15, \
//Following line allows macro to read current RGB settings L20, L21, L22, L23, L24, L25, \
extern rgblight_config_t rgblight_config; L30, L31, L32, L33, L34, L35, L36, \
#endif L40, L41, L42, L43, L44, L45, L46 \
) { \
extern uint8_t is_master; { L00, L01, L02, L03, L04, L05, KC_NO }, \
{ L10, L11, L12, L13, L14, L15, KC_NO }, \
{ L20, L21, L22, L23, L24, L25, KC_NO }, \
{ L30, L31, L32, L33, L34, L35, L36 }, \
{ L40, L41, L42, L43, L44, L45, L46 }, \
{ _______, _______, _______, _______, _______, _______, KC_NO }, \
{ _______, _______, _______, _______, _______, _______, KC_NO }, \
{ _______, _______, _______, _______, _______, _______, KC_NO }, \
{ _______, _______, _______, _______, _______, _______, _______ }, \
{ _______, _______, _______, _______, _______, _______, _______ } \
}
#define DELAY_TIME 75 #define DELAY_TIME 75
static uint16_t key_timer; static uint16_t key_timer;
@ -68,108 +75,107 @@ enum macro_keycodes {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base /* Base
* ,-----------------------------------------. ,-----------------------------------------. * ,-----------------------------------------.
* | C+z | ; | [ | ( | < | { | | | | | | | | * | C+z | ; | [ | ( | < | { |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | KANA | P | K | R | A | F | | | | | | | | * | KANA | P | K | R | A | F |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | BS | D | T | H | E | O | | | | | | | | * | BS | D | T | H | E | O |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------.
* | Shift| Y | S | N | I | U |Space | | | | | | | | * | Shift| Y | S | N | I | U |Space |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------|
* | Ctrl | Alt | Gui | Sym | Num | OPT | Ent | | | | | | | | * | Ctrl | Alt | Gui | Sym | Num | OPT | Ent |
* `-------------------------------------------------------------------------------------------------' * `------------------------------------------------'
*/ */
[_BASE] = LAYOUT( \ [_BASE] = LAYOUT_half( \
LCTL(KC_Z), KC_SCLN, KC_LBRC, KC_LPRN, KC_LT, KC_LCBR, _______, _______, _______, _______, _______, _______, \ LCTL(KC_Z), KC_SCLN, KC_LBRC, KC_LPRN, KC_LT, KC_LCBR, \
KANA, KC_P, KC_K, KC_R, KC_A, KC_F, _______, _______, _______, _______, _______, _______, \ KANA, KC_P, KC_K, KC_R, KC_A, KC_F, \
KC_BSPC, KC_D, KC_T, KC_H, KC_E, KC_O, _______, _______, _______, _______, _______, _______, \ KC_BSPC, KC_D, KC_T, KC_H, KC_E, KC_O, \
OSM(MOD_LSFT), KC_Y, KC_S, KC_N, KC_I, KC_U, KC_SPC, _______, _______, _______, _______, _______, _______, _______, \ OSM(MOD_LSFT), KC_Y, KC_S, KC_N, KC_I, KC_U, KC_SPC, \
OSM(MOD_LCTL), OSM(MOD_LALT), OSM(MOD_LGUI), MO(_SYM), MO(_NUM), OPT_TAP_SP, KC_ENT, _______, _______, _______, _______, _______, _______, _______ \ OSM(MOD_LCTL), OSM(MOD_LALT), OSM(MOD_LGUI), MO(_SYM), MO(_NUM), OPT_TAP_SP, KC_ENT ),
),
/* Opt /* Opt
* ,-----------------------------------------. ,-----------------------------------------. * ,-----------------------------------------.
* | Esc | : | ] | ) | > | } | | | | | | | | * | Esc | : | ] | ) | > | } |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | EISU| J | M | B | ' | Tab | | | | | | | | * | EISU| J | M | B | ' | Tab |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | . | V | C | L | Z | Q | | | | | | | | * | . | V | C | L | Z | Q |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------.
* | | X | G | W | - | Del | Esc | | | | | | | | * | | X | G | W | - | Del | Esc |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------|
* | | | | , | DTOP | | | | | | | | | | * | | | | , | DTOP | | |
* `-------------------------------------------------------------------------------------------------' * `------------------------------------------------'
*/ */
[_OPT] = LAYOUT( \ [_OPT] = LAYOUT_half( \
KC_ESC, KC_COLN,KC_RBRC, KC_RPRN,KC_GT, KC_RCBR, _______, _______, _______, _______, _______, _______, \ KC_ESC, KC_COLN,KC_RBRC, KC_RPRN,KC_GT, KC_RCBR, \
EISU, KC_J, KC_M, KC_B, KC_QUOT, KC_TAB, _______, _______, _______, _______, _______, _______, \ EISU, KC_J, KC_M, KC_B, KC_QUOT, KC_TAB, \
KC_DOT, KC_V, KC_C, KC_L, KC_Z, KC_Q, _______, _______, _______, _______, _______, _______, \ KC_DOT, KC_V, KC_C, KC_L, KC_Z, KC_Q, \
_______, KC_X, KC_G, KC_W, KC_MINUS, KC_DEL, KC_ESC, _______, _______, _______, _______, _______, _______, _______, \ _______, KC_X, KC_G, KC_W, KC_MINUS, KC_DEL, KC_ESC, \
_______, _______,_______, KC_COMM,DESKTOP, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ _______, _______,_______, KC_COMM,DESKTOP, _______, _______ \
), ),
/* Func /* Func
* ,-----------------------------------------. ,-----------------------------------------. * ,-----------------------------------------.
* |RGBRST| Hue | | RST | Mac | Win | | | | | | | | * |RGBRST| Hue | | RST | Mac | Win |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | RGB1 | VAL+ | F7 | F8 | F9 | | | | | | | | | * | RGB1 | VAL+ | F7 | F8 | F9 | |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | RGB2 | VAL- | F4 | F5 | F6 | F12 | | | | | | | | * | RGB2 | VAL- | F4 | F5 | F6 | F12 |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------.
* | RGB3 | F10 | F1 | F2 | F3 | F11 | | | | | | | | | * | RGB3 | F10 | F1 | F2 | F3 | F11 | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------|
* |RGBOFF| | | | | | | | | | | | | | * |RGBOFF| | | | | | |
* `-------------------------------------------------------------------------------------------------' * `------------------------------------------------'
*/ */
[_FUNC] = LAYOUT( \ [_FUNC] = LAYOUT_half( \
RGBRST,RGB_HUI, _______, RESET, MAC, WIN, _______, _______, _______, _______, _______, _______, \ RGBRST,RGB_HUI, _______, RESET, MAC, WIN, \
RGB1, RGB_VAI, KC_F7, KC_F8, KC_F9, _______, _______, _______, _______, _______, _______, _______, \ RGB1, RGB_VAI, KC_F7, KC_F8, KC_F9, _______, \
RGB2, RGB_VAD, KC_F4, KC_F5, KC_F6, KC_F12, _______, _______, _______, _______, _______, _______, \ RGB2, RGB_VAD, KC_F4, KC_F5, KC_F6, KC_F12, \
RGB3, KC_F10, KC_F1, KC_F2, KC_F3, KC_F11, _______, _______, _______, _______, _______, _______, _______, _______, \ RGB3, KC_F10, KC_F1, KC_F2, KC_F3, KC_F11, _______, \
RGBOFF,_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ RGBOFF,_______, _______, _______, _______, _______, _______ \
), ),
/* Sym /* Sym
* ,-----------------------------------------. ,-----------------------------------------. * ,-----------------------------------------.
* | Ins | GRV | | PU | PD | ^ | | | | | | | | * | Ins | GRV | | PU | PD | ^ |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | | \ | # | = | ? | % | | | | | | | | * | | \ | # | = | ? | % |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | | $ | upA | @ | ! | | | | | | | | | | * | | $ | upA | @ | ! | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------.
* | CL | <- | dwA | -> | _ | & | | | | | | | | | * | CL | <- | dwA | -> | _ | & | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------|
* | | | PS | | ~ | | | | | | | | | | * | | | PS | | ~ | | |
* `-------------------------------------------------------------------------------------------------' * `------------------------------------------------'
*/ */
[_SYM] = LAYOUT( \ [_SYM] = LAYOUT_half( \
KC_INS, KC_GRV, _______, KC_PGUP, KC_PGDN, KC_CIRC, _______, _______, _______, _______, _______, _______, \ KC_INS, KC_GRV, _______, KC_PGUP, KC_PGDN, KC_CIRC, \
_______, KC_BSLS, KC_HASH, KC_EQL, KC_QUES, KC_PERC, _______, _______, _______, _______, _______, _______, \ _______, KC_BSLS, KC_HASH, KC_EQL, KC_QUES, KC_PERC, \
_______, KC_DLR, KC_UP, KC_AT, KC_EXLM, KC_PIPE, _______, _______, _______, _______, _______, _______, \ _______, KC_DLR, KC_UP, KC_AT, KC_EXLM, KC_PIPE, \
KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT,KC_UNDS, KC_AMPR, _______, _______, _______, _______, _______, _______, _______, _______, \ KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT,KC_UNDS, KC_AMPR, _______, \
_______, _______, KC_PSCR, _______, KC_TILD, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ _______, _______, KC_PSCR, _______, KC_TILD, _______, _______ \
), ),
/* Raise /* Raise
* ,-----------------------------------------. ,-----------------------------------------. * ,-----------------------------------------.
* | | | Func | home | End | | | | | | | | | * | | | Func | home | End | |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | | * | 7 | 8 | 9 | - | | | | | | | | * | | * | 7 | 8 | 9 | - |
* |------+------+------+------+------+------| |------+------+------+------+------+------| * |------+------+------+------+------+------|
* | . | / | 4 | 5 | 6 | + | | | | | | | | * | . | / | 4 | 5 | 6 | + |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------.
* | LN | 0 | 1 | 2 | 3 |C+S+F1| | | | | | | | | * | LN | 0 | 1 | 2 | 3 |C+S+F1| |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------|
* | | | | , | | | | | | | | | | | * | | | | , | | | |
* `-------------------------------------------------------------------------------------------------' * `------------------------------------------------'
*/ */
[_NUM] = LAYOUT( \ [_NUM] = LAYOUT_half( \
_______, _______, OSL(_FUNC), KC_HOME, KC_END, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, OSL(_FUNC), KC_HOME, KC_END, _______, \
_______, KC_ASTR, KC_P7, KC_P8, KC_P9, KC_MINS, _______, _______, _______, _______, _______, _______, \ _______, KC_ASTR, KC_P7, KC_P8, KC_P9, KC_MINS, \
KC_PDOT, KC_SLSH, KC_P4, KC_P5, KC_P6, KC_PLUS, _______, _______, _______, _______, _______, _______, \ KC_PDOT, KC_SLSH, KC_P4, KC_P5, KC_P6, KC_PLUS, \
KC_NLCK, KC_P0, KC_P1, KC_P2, KC_P3, LCTL(S(KC_F1)), _______, _______, _______, _______, _______, _______, _______, _______, \ KC_NLCK, KC_P0, KC_P1, KC_P2, KC_P3, LCTL(S(KC_F1)), _______, \
_______, _______, KC_PDOT, KC_COMM, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ _______, _______, KC_PDOT, KC_COMM, _______, _______, _______ \
) )
}; };
#else #else
@ -268,7 +274,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
col = record->event.key.col; col = record->event.key.col;
row = record->event.key.row; row = record->event.key.row;
if (record->event.pressed && ((row < 5 && is_master) || (row >= 5 && !is_master))) { if (record->event.pressed && ((row < 5 && is_keyboard_master()) || (row >= 5 && !is_keyboard_master()))) {
int end = keybuf_end; int end = keybuf_end;
keybufs[end].col = col; keybufs[end].col = col;
keybufs[end].row = row % 5; keybufs[end].row = row % 5;
@ -379,7 +385,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
eeconfig_update_rgblight_default(); eeconfig_update_rgblight_default();
rgblight_enable(); rgblight_enable();
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_get_mode();
RGBAnimation = false; RGBAnimation = false;
} }
#endif #endif
@ -396,7 +402,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
RGBAnimation = true; RGBAnimation = true;
rgblight_mode(RGBLIGHT_MODE_RAINBOW_MOOD); rgblight_mode(RGBLIGHT_MODE_RAINBOW_MOOD);
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_get_mode();
} }
#endif #endif
break; break;
@ -405,7 +411,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
RGBAnimation = true; RGBAnimation = true;
rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 1); rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 1);
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_get_mode();
} }
#endif #endif
break; break;
@ -414,7 +420,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
RGBAnimation = true; RGBAnimation = true;
rgblight_mode(RGBLIGHT_MODE_KNIGHT); rgblight_mode(RGBLIGHT_MODE_KNIGHT);
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_get_mode();
} }
#endif #endif
break; break;
@ -447,7 +453,7 @@ void matrix_init_user(void) {
startup_user(); startup_user();
#endif #endif
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
RGB_current_mode = rgblight_config.mode; RGB_current_mode = rgblight_get_mode();
#endif #endif
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
#ifdef SSD1306OLED #ifdef SSD1306OLED
@ -733,10 +739,117 @@ void iota_gfx_task_user(void) {
#endif #endif
matrix_clear(&matrix); matrix_clear(&matrix);
if(is_master){ if (is_keyboard_master()) {
render_status(&matrix); render_status(&matrix);
} }
matrix_update(&display, &matrix); matrix_update(&display, &matrix);
} }
#endif // end of SSD1306OLED
//OLED update loop
#ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_0;
}
// Render to OLED
void render_status(void) {
// froggy logo
static char logo[4][1][17]=
{
{
{0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0}
},
{
{0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0}
},
{
{0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0}
},
{
{0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0}
}
};
static char indctr[8][2][4]=
{
// white icon
{
{0x60,0x61,0x62,0},
{0x63,0x64,0}
},
{
{0x80,0x81,0x82,0},
{0x83,0x84,0}
},
{
{0xa0,0xa1,0xa2,0},
{0xa3,0xa4,0}
},
{
{0xc0,0xc1,0xc2,0},
{0xc3,0xc4,0}
},
// Black icon
{
{0x75,0x76,0x77,0},
{0x78,0x79,0}
},
{
{0x95,0x96,0x97,0},
{0x98,0x99,0}
},
{
{0xb5,0xb6,0xb7,0},
{0xb8,0xb9,0}
},
{
{0xd5,0xd6,0xd7,0},
{0xd8,0xd9,0}
},
};
int rown = 0;
int rowf = 0;
int rowa = 0;
int rows = 0;
//Set Indicator icon
if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; } else { rown = 0; }
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; } else { rowa = 0; }
if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; } else { rows = 0; }
if (layer_state == L_FUNC) { rowf = 4; }
oled_write(indctr[rown] [0], false);
oled_write(indctr[rowf] [1], false);
oled_write(logo [0] [0], false);
oled_write(indctr[rown+1][0], false);
oled_write(indctr[rowf+1][1], false);
oled_write(logo [1] [0], false);
oled_write(indctr[rowa+2][0], false);
oled_write(indctr[rows+2][1], false);
oled_write(logo [2] [0], false);
oled_write(indctr[rowa+3][0], false);
oled_write(indctr[rows+3][1], false);
oled_write(logo [3] [0], false);
}
bool oled_task_user(void) {
#if DEBUG_TO_SCREEN
if (debug_enable) {
return;
}
#endif #endif
if (is_keyboard_master()) {
render_status();
}
return false;
}
#endif // end of OLED_ENABLE

View File

@ -6,6 +6,7 @@
# See TOP/docs/config_options.md for more information. # See TOP/docs/config_options.md for more information.
# #
LTO_ENABLE = no # if firmware size over limit, try this option LTO_ENABLE = no # if firmware size over limit, try this option
SPLIT_KEYBOARD = yes
# Helix Spacific Build Options # Helix Spacific Build Options
# you can uncomment and edit follows 7 Variables # you can uncomment and edit follows 7 Variables
@ -17,3 +18,11 @@ LED_BACK_ENABLE = yes # LED backlight (Enable WS2812 RGB underlight.)
LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.)
LED_ANIMATIONS = yes # LED animations LED_ANIMATIONS = yes # LED animations
# IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) # IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
# OLED_ENABLE が yes のとき
# OLED_SELECT が core ならば QMK 標準の oled_dirver.c を使用します。
# OLED_SELECT が core 以外ならば従来どおり helix/local_drivers/ssd1306.c を使用します。
# If OLED_ENABLE is 'yes'
# If OLED_SELECT is 'core', use QMK standard oled_dirver.c.
# If OLED_SELECT is other than 'core', use helix/local_drivers/ssd1306.c.
OLED_SELECT = core