From 3bde05c568afec6bbb45c7d07ab55a0c8b738cc0 Mon Sep 17 00:00:00 2001
From: Takeshi ISHII <2170248+mtei@users.noreply.github.com>
Date: Mon, 11 Apr 2022 18:09:37 +0900
Subject: 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
---
keyboards/helix/rev2/keymaps/froggy/config.h | 6 +
keyboards/helix/rev2/keymaps/froggy/keymap.c | 331 ++++++++++++++++++---------
keyboards/helix/rev2/keymaps/froggy/rules.mk | 9 +
3 files changed, 237 insertions(+), 109 deletions(-)
(limited to 'keyboards')
diff --git a/keyboards/helix/rev2/keymaps/froggy/config.h b/keyboards/helix/rev2/keymaps/froggy/config.h
index 517368ae94..fea362bcd6 100644
--- a/keyboards/helix/rev2/keymaps/froggy/config.h
+++ b/keyboards/helix/rev2/keymaps/froggy/config.h
@@ -26,6 +26,12 @@ along with this program. If not, see .
#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.
diff --git a/keyboards/helix/rev2/keymaps/froggy/keymap.c b/keyboards/helix/rev2/keymaps/froggy/keymap.c
index 15fe1afb0c..484a0a34b9 100644
--- a/keyboards/helix/rev2/keymaps/froggy/keymap.c
+++ b/keyboards/helix/rev2/keymaps/froggy/keymap.c
@@ -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
-#ifdef SSD1306OLED
- #include "ssd1306.h"
-#endif
+#include
-extern keymap_config_t keymap_config;
+#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+#define MAX(x, y) (((x) > (y)) ? (x) : (y))
-#ifdef RGBLIGHT_ENABLE
-//Following line allows macro to read current RGB settings
-extern rgblight_config_t rgblight_config;
+#ifdef SSD1306OLED
+ #include "ssd1306.h"
#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<