1
0
Fork 0
forked from forks/qmk_firmware

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_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.
// Selection of RGBLIGHT MODE to use.

View file

@ -1,24 +1,31 @@
#include QMK_KEYBOARD_H
#include "bootloader.h"
#ifdef PROTOCOL_LUFA
#include "lufa.h"
#include "split_util.h"
#endif
#ifdef AUDIO_ENABLE
#include "audio.h"
#endif
#include <string.h>
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#ifdef SSD1306OLED
#include "ssd1306.h"
#endif
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;
#define LAYOUT_half( \
L00, L01, L02, L03, L04, L05, \
L10, L11, L12, L13, L14, L15, \
L20, L21, L22, L23, L24, L25, \
L30, L31, L32, L33, L34, L35, L36, \
L40, L41, L42, L43, L44, L45, L46 \
) { \
{ 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
static uint16_t key_timer;
@ -68,108 +75,107 @@ enum macro_keycodes {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base
* ,-----------------------------------------. ,-----------------------------------------.
* | C+z | ; | [ | ( | < | { | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | KANA | P | K | R | A | F | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | BS | D | T | H | E | O | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Y | S | N | I | U |Space | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | Alt | Gui | Sym | Num | OPT | Ent | | | | | | | |
* `-------------------------------------------------------------------------------------------------'
* ,-----------------------------------------.
* | C+z | ; | [ | ( | < | { |
* |------+------+------+------+------+------|
* | KANA | P | K | R | A | F |
* |------+------+------+------+------+------|
* | BS | D | T | H | E | O |
* |------+------+------+------+------+------+------.
* | Shift| Y | S | N | I | U |Space |
* |------+------+------+------+------+------+------|
* | Ctrl | Alt | Gui | Sym | Num | OPT | Ent |
* `------------------------------------------------'
*/
[_BASE] = LAYOUT( \
LCTL(KC_Z), KC_SCLN, KC_LBRC, KC_LPRN, KC_LT, KC_LCBR, _______, _______, _______, _______, _______, _______, \
KANA, KC_P, KC_K, KC_R, KC_A, KC_F, _______, _______, _______, _______, _______, _______, \
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_LCTL), OSM(MOD_LALT), OSM(MOD_LGUI), MO(_SYM), MO(_NUM), OPT_TAP_SP, KC_ENT, _______, _______, _______, _______, _______, _______, _______ \
),
[_BASE] = LAYOUT_half( \
LCTL(KC_Z), KC_SCLN, KC_LBRC, KC_LPRN, KC_LT, KC_LCBR, \
KANA, KC_P, KC_K, KC_R, KC_A, KC_F, \
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_LCTL), OSM(MOD_LALT), OSM(MOD_LGUI), MO(_SYM), MO(_NUM), OPT_TAP_SP, KC_ENT ),
/* Opt
* ,-----------------------------------------. ,-----------------------------------------.
* | Esc | : | ] | ) | > | } | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | EISU| J | M | B | ' | Tab | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | . | V | C | L | Z | Q | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | | X | G | W | - | Del | Esc | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | , | DTOP | | | | | | | | | |
* `-------------------------------------------------------------------------------------------------'
* ,-----------------------------------------.
* | Esc | : | ] | ) | > | } |
* |------+------+------+------+------+------|
* | EISU| J | M | B | ' | Tab |
* |------+------+------+------+------+------|
* | . | V | C | L | Z | Q |
* |------+------+------+------+------+------+------.
* | | X | G | W | - | Del | Esc |
* |------+------+------+------+------+------+------|
* | | | | , | DTOP | | |
* `------------------------------------------------'
*/
[_OPT] = LAYOUT( \
KC_ESC, KC_COLN,KC_RBRC, KC_RPRN,KC_GT, KC_RCBR, _______, _______, _______, _______, _______, _______, \
EISU, KC_J, KC_M, KC_B, KC_QUOT, KC_TAB, _______, _______, _______, _______, _______, _______, \
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_COMM,DESKTOP, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
[_OPT] = LAYOUT_half( \
KC_ESC, KC_COLN,KC_RBRC, KC_RPRN,KC_GT, KC_RCBR, \
EISU, KC_J, KC_M, KC_B, KC_QUOT, KC_TAB, \
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_COMM,DESKTOP, _______, _______ \
),
/* Func
* ,-----------------------------------------. ,-----------------------------------------.
* |RGBRST| Hue | | RST | Mac | Win | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | RGB1 | VAL+ | F7 | F8 | F9 | | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | RGB2 | VAL- | F4 | F5 | F6 | F12 | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | RGB3 | F10 | F1 | F2 | F3 | F11 | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* |RGBOFF| | | | | | | | | | | | | |
* `-------------------------------------------------------------------------------------------------'
* ,-----------------------------------------.
* |RGBRST| Hue | | RST | Mac | Win |
* |------+------+------+------+------+------|
* | RGB1 | VAL+ | F7 | F8 | F9 | |
* |------+------+------+------+------+------|
* | RGB2 | VAL- | F4 | F5 | F6 | F12 |
* |------+------+------+------+------+------+------.
* | RGB3 | F10 | F1 | F2 | F3 | F11 | |
* |------+------+------+------+------+------+------|
* |RGBOFF| | | | | | |
* `------------------------------------------------'
*/
[_FUNC] = LAYOUT( \
RGBRST,RGB_HUI, _______, RESET, MAC, WIN, _______, _______, _______, _______, _______, _______, \
RGB1, RGB_VAI, KC_F7, KC_F8, KC_F9, _______, _______, _______, _______, _______, _______, _______, \
RGB2, RGB_VAD, KC_F4, KC_F5, KC_F6, KC_F12, _______, _______, _______, _______, _______, _______, \
RGB3, KC_F10, KC_F1, KC_F2, KC_F3, KC_F11, _______, _______, _______, _______, _______, _______, _______, _______, \
RGBOFF,_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
[_FUNC] = LAYOUT_half( \
RGBRST,RGB_HUI, _______, RESET, MAC, WIN, \
RGB1, RGB_VAI, KC_F7, KC_F8, KC_F9, _______, \
RGB2, RGB_VAD, KC_F4, KC_F5, KC_F6, KC_F12, \
RGB3, KC_F10, KC_F1, KC_F2, KC_F3, KC_F11, _______, \
RGBOFF,_______, _______, _______, _______, _______, _______ \
),
/* Sym
* ,-----------------------------------------. ,-----------------------------------------.
* | Ins | GRV | | PU | PD | ^ | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | \ | # | = | ? | % | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | $ | upA | @ | ! | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | CL | <- | dwA | -> | _ | & | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | | | PS | | ~ | | | | | | | | | |
* `-------------------------------------------------------------------------------------------------'
* ,-----------------------------------------.
* | Ins | GRV | | PU | PD | ^ |
* |------+------+------+------+------+------|
* | | \ | # | = | ? | % |
* |------+------+------+------+------+------|
* | | $ | upA | @ | ! | | |
* |------+------+------+------+------+------+------.
* | CL | <- | dwA | -> | _ | & | |
* |------+------+------+------+------+------+------|
* | | | PS | | ~ | | |
* `------------------------------------------------'
*/
[_SYM] = LAYOUT( \
KC_INS, KC_GRV, _______, KC_PGUP, KC_PGDN, KC_CIRC, _______, _______, _______, _______, _______, _______, \
_______, KC_BSLS, KC_HASH, KC_EQL, KC_QUES, KC_PERC, _______, _______, _______, _______, _______, _______, \
_______, KC_DLR, KC_UP, KC_AT, KC_EXLM, KC_PIPE, _______, _______, _______, _______, _______, _______, \
KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT,KC_UNDS, KC_AMPR, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, KC_PSCR, _______, KC_TILD, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
[_SYM] = LAYOUT_half( \
KC_INS, KC_GRV, _______, KC_PGUP, KC_PGDN, KC_CIRC, \
_______, KC_BSLS, KC_HASH, KC_EQL, KC_QUES, KC_PERC, \
_______, KC_DLR, KC_UP, KC_AT, KC_EXLM, KC_PIPE, \
KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT,KC_UNDS, KC_AMPR, _______, \
_______, _______, KC_PSCR, _______, KC_TILD, _______, _______ \
),
/* Raise
* ,-----------------------------------------. ,-----------------------------------------.
* | | | Func | home | End | | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | * | 7 | 8 | 9 | - | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | . | / | 4 | 5 | 6 | + | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | LN | 0 | 1 | 2 | 3 |C+S+F1| | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | , | | | | | | | | | | |
* `-------------------------------------------------------------------------------------------------'
* ,-----------------------------------------.
* | | | Func | home | End | |
* |------+------+------+------+------+------|
* | | * | 7 | 8 | 9 | - |
* |------+------+------+------+------+------|
* | . | / | 4 | 5 | 6 | + |
* |------+------+------+------+------+------+------.
* | LN | 0 | 1 | 2 | 3 |C+S+F1| |
* |------+------+------+------+------+------+------|
* | | | | , | | | |
* `------------------------------------------------'
*/
[_NUM] = LAYOUT( \
_______, _______, OSL(_FUNC), KC_HOME, KC_END, _______, _______, _______, _______, _______, _______, _______, \
_______, KC_ASTR, KC_P7, KC_P8, KC_P9, KC_MINS, _______, _______, _______, _______, _______, _______, \
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_PDOT, KC_COMM, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
[_NUM] = LAYOUT_half( \
_______, _______, OSL(_FUNC), KC_HOME, KC_END, _______, \
_______, KC_ASTR, KC_P7, KC_P8, KC_P9, KC_MINS, \
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_PDOT, KC_COMM, _______, _______, _______ \
)
};
#else
@ -268,7 +274,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef RGBLIGHT_ENABLE
col = record->event.key.col;
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;
keybufs[end].col = col;
keybufs[end].row = row % 5;
@ -379,7 +385,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
eeconfig_update_rgblight_default();
rgblight_enable();
RGB_current_mode = rgblight_config.mode;
RGB_current_mode = rgblight_get_mode();
RGBAnimation = false;
}
#endif
@ -396,7 +402,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
RGBAnimation = true;
rgblight_mode(RGBLIGHT_MODE_RAINBOW_MOOD);
RGB_current_mode = rgblight_config.mode;
RGB_current_mode = rgblight_get_mode();
}
#endif
break;
@ -405,7 +411,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
RGBAnimation = true;
rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 1);
RGB_current_mode = rgblight_config.mode;
RGB_current_mode = rgblight_get_mode();
}
#endif
break;
@ -414,7 +420,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
RGBAnimation = true;
rgblight_mode(RGBLIGHT_MODE_KNIGHT);
RGB_current_mode = rgblight_config.mode;
RGB_current_mode = rgblight_get_mode();
}
#endif
break;
@ -447,7 +453,7 @@ void matrix_init_user(void) {
startup_user();
#endif
#ifdef RGBLIGHT_ENABLE
RGB_current_mode = rgblight_config.mode;
RGB_current_mode = rgblight_get_mode();
#endif
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
#ifdef SSD1306OLED
@ -733,10 +739,117 @@ void iota_gfx_task_user(void) {
#endif
matrix_clear(&matrix);
if(is_master){
if (is_keyboard_master()) {
render_status(&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
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.
#
LTO_ENABLE = no # if firmware size over limit, try this option
SPLIT_KEYBOARD = yes
# Helix Spacific Build Options
# 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_ANIMATIONS = yes # LED animations
# 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