[Keymap] Remove LAYOUT_kc macros from edvorakjp keymaps (#12217)
parent
93e8a401df
commit
3dbb7f261d
|
@ -1,25 +1,25 @@
|
||||||
#ifndef CONFIG_USER_H
|
#pragma once
|
||||||
#define CONFIG_USER_H
|
|
||||||
|
|
||||||
/* Select hand configuration */
|
/* Select hand configuration */
|
||||||
|
|
||||||
// #define MASTER_LEFT
|
#define MASTER_LEFT
|
||||||
#define MASTER_RIGHT
|
// #define MASTER_RIGHT
|
||||||
// #define EE_HANDS
|
// #define EE_HANDS
|
||||||
|
|
||||||
#define SSD1306OLED
|
|
||||||
#define SWAP_SCLN
|
#define SWAP_SCLN
|
||||||
|
|
||||||
// #define TAPPING_FORCE_HOLD
|
// #define TAPPING_FORCE_HOLD
|
||||||
#define TAPPING_TERM 300
|
#define TAPPING_TERM 300
|
||||||
#define IGNORE_MOD_TAP_INTERRUPT
|
#define IGNORE_MOD_TAP_INTERRUPT
|
||||||
|
|
||||||
#undef RGBLED_NUM
|
#ifdef RGBLIGHT_ENABLE
|
||||||
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
# undef RGBLED_NUM
|
||||||
#define RGBLED_NUM 27
|
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||||
#define RGBLIGHT_LIMIT_VAL 100
|
# define RGBLED_NUM 27
|
||||||
#define RGBLIGHT_HUE_STEP 10
|
# define RGBLIGHT_LIMIT_VAL 100
|
||||||
#define RGBLIGHT_SAT_STEP 17
|
# define RGBLIGHT_HUE_STEP 10
|
||||||
#define RGBLIGHT_VAL_STEP 17
|
# define RGBLIGHT_SAT_STEP 17
|
||||||
|
# define RGBLIGHT_VAL_STEP 17
|
||||||
|
#endif // RGBLIGHT_ENABLE
|
||||||
|
|
||||||
#endif // CONFIG_USER_H
|
#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c"
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#ifdef PROTOCOL_LUFA
|
#ifdef PROTOCOL_LUFA
|
||||||
#include "split_util.h"
|
# include "split_util.h"
|
||||||
#endif
|
|
||||||
#ifdef SSD1306OLED
|
|
||||||
#include "oled.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "edvorakjp.h"
|
#include "edvorakjp.h"
|
||||||
|
@ -14,85 +11,63 @@
|
||||||
* };
|
* };
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KC_ KC_TRNS
|
#define LAYOUT_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__)
|
||||||
|
|
||||||
#define KC_TMB1 KC_LA(TAB)
|
|
||||||
#define KC_TMB2 KC_LS(SPC)
|
|
||||||
#define KC_TMB3 TD(TD_LOWER) // act as LOWER when hold, as KC_LANG2(=English) when tapped
|
|
||||||
#define KC_TMB4 TD(TD_RAISE) // act as RAISE when hold, as KC_LANG1(=Japanese) when tapped
|
|
||||||
#define KC_TMB5 KC_RC(BSPC)
|
|
||||||
#define KC_TMB6 KC_RG(ENT)
|
|
||||||
#define KC_TMB7 KC_RC(DEL)
|
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[L_EDVORAKJP_BASE] = LAYOUT_wrapper(
|
||||||
[_EDVORAK] = LAYOUT_kc(
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
KC_GRV, __EDVORAKJP_BASE_L1__ , __EDVORAKJP_BASE_R1__ , KC_BSLS,
|
||||||
GRV ,QUOT,COMM , DOT , Y , Q , F , G , R , W , P ,BSLS,
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
KC_EQL, __EDVORAKJP_BASE_L2__ , __EDVORAKJP_BASE_R2__ , KC_MINS,
|
||||||
EQL , A ,LA(O),LG(E),LC(I), U , D ,RS(T),RG(N),RA(S), M ,MINS,
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
KC_ESC, __EDVORAKJP_BASE_L3__ , __EDVORAKJP_BASE_R3__ , KC_SLSH,
|
||||||
ESC ,SCLN, X , C , V , Z , H , J , K , L , B ,SLSH,
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||||
//`----+----+-----+-----+-----+----+----| |----+----+-----+-----+-----+----+----'
|
LA_TAB, LS_SPC,LOWER_TD, RAISE_TD, RC_BSPC, RG_ENT
|
||||||
TMB1 ,TMB2,TMB3, TMB4,TMB5,TMB6
|
//`--------------------------' `--------------------------'
|
||||||
// `-----+----+----' `----+----+-----'
|
|
||||||
),
|
),
|
||||||
|
|
||||||
[_LOWER] = LAYOUT_kc(
|
[L_EDVORAKJP_LOWER] = LAYOUT_wrapper(
|
||||||
//|----+----+------+------+------+----| |----+------+------+-------+----+----|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||||
, , LCBR , LBRC , LPRN , , , RPRN , RBRC , RCBR , , ,
|
XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_L__ , XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_R__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+------+------+------+----| |----+------+------+-------+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
F1 , F2 ,LA(F3),LG(F4),LC(F5), F6 , F7 ,RS(F8),RG(F9),RA(F10),F11 ,F12 ,
|
__EDVORAKJP_FUNCTION_L__ , __EDVORAKJP_FUNCTION_R__ ,
|
||||||
//|----+----+------+------+------+----| |----+------+------+-------+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
PSCR, , HOME , PGDN , PGUP ,END , LEFT, DOWN , UP , RGHT , , ,
|
KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX,
|
||||||
//`----+----+------+------+------+----+----| |----+----+------+------+-------+----+----'
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||||
, , NO , MAC ,TMB7,
|
KC_TRNS, KC_TRNS, XXXXXXX, KC_MAC, RC_DEL, KC_TRNS
|
||||||
// `-----+----+----' `----+----+-----'
|
//`--------------------------' `--------------------------'
|
||||||
),
|
),
|
||||||
|
|
||||||
[_RAISE] = LAYOUT_kc(
|
[L_EDVORAKJP_RAISE] = LAYOUT_wrapper(
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||||
, ,EXLM , AT ,HASH ,DLR , PERC,CIRC ,AMPR ,ASTR , , ,
|
XXXXXXX, XXXXXXX, __EDVORAKJP_SYMBOL_L__ , __EDVORAKJP_SYMBOL_R__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
, 1 ,LA(2),LG(3),LC(4), 5 , 6 ,RS(7),RG(8),RA(9), 0 , ,
|
XXXXXXX, __EDVORAKJP_NUMBER_L__ , __EDVORAKJP_NUMBER_R__ , XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
PSCR, ,HOME ,PGDN ,PGUP ,END , LEFT,DOWN , UP ,RGHT , , ,
|
KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX,
|
||||||
//`----+----+-----+-----+-----+----+----| |----+----+-----+-----+-----+----+----'
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||||
, ,WIN , NO , ,
|
KC_TRNS, KC_TRNS, KC_WIN, XXXXXXX, KC_TRNS, KC_TRNS
|
||||||
// `-----+----+----' `----+----+----'
|
//`--------------------------' `--------------------------'
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
#ifdef SSD1306OLED
|
|
||||||
void matrix_init_keymap(void) {
|
|
||||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
|
||||||
#ifdef MASTER_RIGHT
|
|
||||||
iota_gfx_init(has_usb()); // turns on the display
|
|
||||||
#else
|
|
||||||
iota_gfx_init(!has_usb());
|
|
||||||
#endif // MASTER_RIGHT
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
iota_gfx_task(); // this is what updates the display continuously
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
|
#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||||
uint32_t layer_state_set_keymap(uint32_t state) {
|
uint32_t layer_state_set_keymap(uint32_t state) {
|
||||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||||
switch (biton32(state)) {
|
switch (biton32(state)) {
|
||||||
case _LOWER:
|
case L_EDVORAKJP_LOWER:
|
||||||
rgblight_sethsv_noeeprom_red();
|
rgblight_sethsv_noeeprom_red();
|
||||||
break;
|
break;
|
||||||
case _RAISE:
|
case L_EDVORAKJP_RAISE:
|
||||||
rgblight_sethsv_noeeprom_green();
|
rgblight_sethsv_noeeprom_green();
|
||||||
break;
|
break;
|
||||||
default: // for any other layers, or the default layer
|
default: // for any other layers, or the default layer
|
||||||
rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 3);
|
rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 3);
|
||||||
rgblight_sethsv_red();
|
rgblight_sethsv_red();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,76 +1,55 @@
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "oled.h"
|
#include "oled.h"
|
||||||
|
|
||||||
// NOTE: Redefined to avoid to use snprintf(); It makes size of firmware big.
|
#ifdef OLED_DRIVER_ENABLE
|
||||||
const char *read_mode_icon(bool windows_mode) {
|
void render_host_led_state(void) { oled_write(read_host_led_state(), false); }
|
||||||
static const char logo[][2][3] = {{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}};
|
|
||||||
static char mode_icon[10];
|
|
||||||
|
|
||||||
int mode_number = windows_mode ? 1 : 0;
|
void render_layer_state(void) {
|
||||||
strcpy(mode_icon, logo[mode_number][0]);
|
char layer_name[17];
|
||||||
|
oled_write_P(PSTR("Layer: "), false);
|
||||||
|
|
||||||
strcat(mode_icon, "\n");
|
switch (biton32(layer_state)) {
|
||||||
strcat(mode_icon, logo[mode_number][1]);
|
case L_EDVORAKJP_BASE:
|
||||||
|
oled_write_ln_P(PSTR("Default"), false);
|
||||||
return mode_icon;
|
break;
|
||||||
|
case L_EDVORAKJP_LOWER:
|
||||||
|
oled_write_ln_P(PSTR("Lower"), false);
|
||||||
|
break;
|
||||||
|
case L_EDVORAKJP_RAISE:
|
||||||
|
oled_write_ln_P(PSTR("Raise"), false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
snprintf(layer_name, sizeof(layer_name), "Undef-%ld", layer_state);
|
||||||
|
oled_write_ln(layer_name, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *read_layer_state(void) {
|
void render_logo(void) { oled_write(read_logo(), false); }
|
||||||
static char layer_state_str[24];
|
|
||||||
char layer_name[17];
|
|
||||||
|
|
||||||
switch (biton32(layer_state)) {
|
void render_mode_icon(bool is_windows) {
|
||||||
case L_BASE:
|
static const char logo[][2][3] = {
|
||||||
strcpy(layer_name, "Default");
|
{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
|
||||||
break;
|
{{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
|
||||||
case _RAISE:
|
};
|
||||||
strcpy(layer_name, "Raise");
|
static char mode_icon[10];
|
||||||
break;
|
|
||||||
case _LOWER:
|
|
||||||
strcpy(layer_name, "Lower");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
snprintf(layer_name, sizeof(layer_name), "Undef-%ld", layer_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy(layer_state_str, "Layer: ");
|
snprintf(mode_icon, sizeof(mode_icon), "%s\n%s ", logo[is_windows][0], logo[is_windows][1]);
|
||||||
|
oled_write(mode_icon, false);
|
||||||
strcat(layer_state_str, layer_name);
|
|
||||||
strcat(layer_state_str, "\n");
|
|
||||||
return layer_state_str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *read_host_led_state(void) {
|
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||||
static char led_str[24];
|
// flips the display 180 degrees if offhand
|
||||||
strcpy(led_str, (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NMLK" : " ");
|
return is_keyboard_left() ? rotation : rotation ^ OLED_ROTATION_180;
|
||||||
strcat(led_str, (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? " CAPS" : " ");
|
|
||||||
strcat(led_str, (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? " SCLK" : " ");
|
|
||||||
return led_str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_update(struct CharacterMatrix *dest,
|
void oled_task_user(void) {
|
||||||
const struct CharacterMatrix *source) {
|
if (is_keyboard_left()) {
|
||||||
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
render_mode_icon(!get_enable_kc_lang());
|
||||||
memcpy(dest->display, source->display, sizeof(dest->display));
|
render_layer_state();
|
||||||
dest->dirty = true;
|
render_host_led_state();
|
||||||
}
|
} else {
|
||||||
}
|
render_logo();
|
||||||
|
}
|
||||||
void iota_gfx_task_user(void) {
|
|
||||||
struct CharacterMatrix matrix;
|
|
||||||
|
|
||||||
matrix_clear(&matrix);
|
|
||||||
#ifdef MASTER_RIGHT
|
|
||||||
if (!is_master) {
|
|
||||||
#else
|
|
||||||
if (is_master) {
|
|
||||||
#endif // MASTER_RIGHT
|
|
||||||
matrix_write(&matrix, read_mode_icon(!get_enable_kc_lang()));
|
|
||||||
matrix_write(&matrix, " ");
|
|
||||||
matrix_write(&matrix, read_layer_state());
|
|
||||||
matrix_write(&matrix, read_host_led_state());
|
|
||||||
} else {
|
|
||||||
matrix_write(&matrix, read_logo());
|
|
||||||
}
|
|
||||||
matrix_update(&display, &matrix);
|
|
||||||
}
|
}
|
||||||
|
#endif // OLED_DRIVER_ENABLE
|
||||||
|
|
|
@ -1,24 +1,17 @@
|
||||||
#ifndef OLED_USER_H
|
#pragma once
|
||||||
#define OLED_USER_H
|
|
||||||
|
|
||||||
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
|
|
||||||
#include "ssd1306.h"
|
|
||||||
#include "edvorakjp.h"
|
#include "edvorakjp.h"
|
||||||
|
|
||||||
//assign the right code to your layers for OLED display
|
|
||||||
#define L_BASE 0
|
|
||||||
|
|
||||||
extern uint8_t is_master;
|
|
||||||
extern bool japanese_mode;
|
extern bool japanese_mode;
|
||||||
|
|
||||||
// method prototypes defined in crkbd/lib
|
// method prototypes defined in crkbd/lib
|
||||||
|
extern const char *read_host_led_state(void);
|
||||||
extern const char *read_logo(void);
|
extern const char *read_logo(void);
|
||||||
|
extern const char *read_mode_icon(bool swap);
|
||||||
|
|
||||||
const char *read_mode_icon(bool swap);
|
void render_host_led_state(void);
|
||||||
const char *read_layer_state(void);
|
void render_layer_state(void);
|
||||||
const char *read_host_led_state(void);
|
void render_logo(void);
|
||||||
void matrix_update(struct CharacterMatrix *dest,
|
void render_mode_icon(bool is_windows);
|
||||||
const struct CharacterMatrix *source);
|
oled_rotation_t oled_init_user(oled_rotation_t rotation);
|
||||||
void iota_gfx_task_user(void);
|
void oled_task_user(void);
|
||||||
|
|
||||||
#endif // OLED_CONFIG_USER_H
|
|
||||||
|
|
|
@ -16,17 +16,13 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
|
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
|
||||||
SWAP_HANDS_ENABLE = no # Enable one-hand typing
|
SWAP_HANDS_ENABLE = no # Enable one-hand typing
|
||||||
TAP_DANCE_ENABLE = yes
|
TAP_DANCE_ENABLE = yes
|
||||||
|
OLED_DRIVER_ENABLE = yes
|
||||||
|
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
# If you want to change the display of OLED, you need to change here
|
# If you want to change the display of OLED, you need to change here
|
||||||
SRC += ./lib/glcdfont.c \
|
SRC += ./lib/host_led_state_reader.c \
|
||||||
./lib/logo_reader.c \
|
./lib/logo_reader.c \
|
||||||
oled.c \
|
./lib/mode_icon_reader.c \
|
||||||
# ./lib/rgb_state_reader.c \
|
oled.c
|
||||||
# ./lib/layer_state_reader.c \
|
|
||||||
# ./lib/keylogger.c \
|
|
||||||
# ./lib/mode_icon_reader.c \
|
|
||||||
# ./lib/host_led_state_reader.c \
|
|
||||||
# ./lib/timelogger.c \
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#ifndef CONFIG_USER_H
|
#pragma once
|
||||||
#define CONFIG_USER_H
|
|
||||||
|
|
||||||
#define SWAP_SCLN
|
#define SWAP_SCLN
|
||||||
|
|
||||||
|
@ -12,15 +11,13 @@
|
||||||
|
|
||||||
// Selection of RGBLIGHT MODE to use.
|
// Selection of RGBLIGHT MODE to use.
|
||||||
#if defined(LED_ANIMATIONS)
|
#if defined(LED_ANIMATIONS)
|
||||||
//#define RGBLIGHT_EFFECT_BREATHING
|
//# define RGBLIGHT_EFFECT_BREATHING
|
||||||
//#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
//# define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||||
//#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||||
//#define RGBLIGHT_EFFECT_SNAKE
|
//# define RGBLIGHT_EFFECT_SNAKE
|
||||||
//#define RGBLIGHT_EFFECT_KNIGHT
|
//# define RGBLIGHT_EFFECT_KNIGHT
|
||||||
//#define RGBLIGHT_EFFECT_CHRISTMAS
|
//# define RGBLIGHT_EFFECT_CHRISTMAS
|
||||||
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||||
//#define RGBLIGHT_EFFECT_RGB_TEST
|
//# define RGBLIGHT_EFFECT_RGB_TEST
|
||||||
//#define RGBLIGHT_EFFECT_ALTERNATING
|
//# define RGBLIGHT_EFFECT_ALTERNATING
|
||||||
#endif
|
#endif // LED_ANIMATIONS
|
||||||
|
|
||||||
#endif /* CONFIG_USER_H */
|
|
||||||
|
|
|
@ -1,38 +1,24 @@
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
#include "keymap_xrows.h"
|
#include "keymap_xrows.h"
|
||||||
#ifdef SSD1306OLED
|
|
||||||
#include "oled.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// keymaps definitions are moved to keymap_Xrows.c.
|
// keymaps definitions are moved to keymap_Xrows.c.
|
||||||
|
|
||||||
#ifdef SSD1306OLED
|
|
||||||
void matrix_init_keymap(void) {
|
|
||||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
|
||||||
iota_gfx_init(!has_usb()); // turns on the display
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
iota_gfx_task(); // this is what updates the display continuously
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
uint32_t layer_state_set_keymap(uint32_t state) {
|
uint32_t layer_state_set_keymap(uint32_t state) {
|
||||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||||
switch (biton32(state)) {
|
switch (biton32(state)) {
|
||||||
case _LOWER:
|
case L_EDVORAKJP_LOWER:
|
||||||
rgblight_sethsv_noeeprom_red();
|
rgblight_sethsv_noeeprom_red();
|
||||||
break;
|
break;
|
||||||
case _RAISE:
|
case L_EDVORAKJP_RAISE:
|
||||||
rgblight_sethsv_noeeprom_blue();
|
rgblight_sethsv_noeeprom_green();
|
||||||
break;
|
break;
|
||||||
default: // for any other layers, or the default layer
|
default: // for any other layers, or the default layer
|
||||||
rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 3);
|
rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 3);
|
||||||
rgblight_sethsv_red();
|
rgblight_sethsv_red();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,41 +1,42 @@
|
||||||
#include "helix.h"
|
#include "helix.h"
|
||||||
#include "keymap_xrows.h"
|
#include "keymap_xrows.h"
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[L_EDVORAKJP_BASE] = LAYOUT_wrapper(
|
||||||
[_EDVORAK] = LAYOUT_kc(
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||||
//,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----.
|
KC_GRV, __EDVORAKJP_BASE_L1__ , __EDVORAKJP_BASE_R1__ , KC_BSLS,
|
||||||
GRV ,QUOT,COMM , DOT , Y , Q , F , G , R , W , P ,BSLS,
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
KC_EQL, __EDVORAKJP_BASE_L2__ , __EDVORAKJP_BASE_R2__ , KC_MINS,
|
||||||
EQL , A ,LA(O),LG(E),LC(I), U , D ,RS(T),RG(N),RA(S), M ,MINS,
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
KC_ESC, __EDVORAKJP_BASE_L3__ , __EDVORAKJP_BASE_R3__ , KC_SLSH,
|
||||||
ESC ,SCLN, X , C , V , Z , H , J , K , L , B ,SLSH,
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||||
//|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----|
|
__EDVORAKJP_PAGE__ , LA_TAB, LS_SPC,LOWER_TD, RAISE_TD, RC_BSPC, RG_ENT, __EDVORAKJP_CURSOR__
|
||||||
HOME,PGDN,PGUP , END ,TMB1 ,TMB2,TMB3, TMB4,TMB5,TMB6 ,LEFT ,DOWN , UP ,RGHT
|
//`--------------------------------------------------------------' `--------------------------------------------------------------'
|
||||||
//`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----'
|
|
||||||
),
|
),
|
||||||
|
|
||||||
[_LOWER] = LAYOUT_kc(
|
[L_EDVORAKJP_LOWER] = LAYOUT_wrapper(
|
||||||
//,----+----+------+------+------+----. ,----+------+------+-------+----+----.
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||||
, , LCBR , LBRC , LPRN , , , RPRN , RBRC , RCBR , , ,
|
XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_L__ , XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_R__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+------+------+------+----| |----+------+------+-------+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
F1 , F2 ,LA(F3),LG(F4),LC(F5), F6 , F7 ,RS(F8),RG(F9),RA(F10),F11 ,F12 ,
|
__EDVORAKJP_FUNCTION_L__ , __EDVORAKJP_FUNCTION_R__ ,
|
||||||
//|----+----+------+------+------+----| |----+------+------+-------+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
PSCR, , HOME , PGDN , PGUP ,END , LEFT, DOWN , UP , RGHT , , ,
|
KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+------+------+------+----+----. ,----+----+------+------+-------+----+----|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||||
, , , , , , NO , MAC ,TMB7, , , , ,
|
__KC_TRNS_x4__ , KC_TRNS, KC_TRNS, XXXXXXX, KC_MAC, RC_DEL, KC_TRNS, __KC_TRNS_x4__
|
||||||
//`----+----+------+------+------+----+----/ \----+----+------+------+-------+----+----'
|
//`--------------------------------------------------------------' `--------------------------------------------------------------'
|
||||||
),
|
),
|
||||||
|
|
||||||
[_RAISE] = LAYOUT_kc(
|
[L_EDVORAKJP_RAISE] = LAYOUT_wrapper(
|
||||||
//,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----.
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||||
, ,EXLM , AT ,HASH ,DLR , PERC,CIRC ,AMPR ,ASTR , , ,
|
XXXXXXX, XXXXXXX, __EDVORAKJP_SYMBOL_L__ , __EDVORAKJP_SYMBOL_R__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
, 1 ,LA(2),LG(3),LC(4), 5 , 6 ,RS(7),RG(8),RA(9), 0 , ,
|
XXXXXXX, __EDVORAKJP_NUMBER_L__ , __EDVORAKJP_NUMBER_R__ , XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
PSCR, ,HOME ,PGDN ,PGUP ,END , LEFT,DOWN , UP ,RGHT , , ,
|
KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||||
, , , , , ,WIN , NO , , , , , ,
|
__KC_TRNS_x4__ , KC_TRNS, KC_TRNS, KC_WIN, XXXXXXX, KC_TRNS, KC_TRNS, __KC_TRNS_x4__
|
||||||
//`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----'
|
//`--------------------------------------------------------------' `--------------------------------------------------------------'
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
|
@ -1,47 +1,48 @@
|
||||||
#include "helix.h"
|
#include "helix.h"
|
||||||
#include "keymap_xrows.h"
|
#include "keymap_xrows.h"
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[L_EDVORAKJP_BASE] = LAYOUT_wrapper(
|
||||||
[_EDVORAK] = LAYOUT_kc(
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||||
//,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----.
|
KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24,
|
||||||
ESC ,EXLM, AT ,HASH , DLR ,PERC, CIRC,AMPR ,ASTR ,LPRN ,RPRN,BSPC,
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
KC_GRV, __EDVORAKJP_BASE_L1__ , __EDVORAKJP_BASE_R1__ , KC_BSLS,
|
||||||
GRV ,QUOT,COMM , DOT , Y , Q , F , G , R , W , P ,BSLS,
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
KC_EQL, __EDVORAKJP_BASE_L2__ , __EDVORAKJP_BASE_R2__ , KC_MINS,
|
||||||
EQL , A ,LA(O),LG(E),LC(I), U , D ,RS(T),RG(N),RA(S), M ,MINS,
|
//|--------+--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------+--------|
|
||||||
//|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----|
|
KC_ESC, __EDVORAKJP_BASE_L3__ , XXXXXXX, XXXXXXX, __EDVORAKJP_BASE_R3__ , KC_SLSH,
|
||||||
TAB ,SCLN, X , C , V , Z , NO , NO , H , J , K , L , B ,SLSH,
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||||
//|----+----+-----+-----+-----+----+----| |----+----+-----+-----+-----+----+----|
|
__EDVORAKJP_PAGE__ , LA_TAB, LS_SPC,LOWER_TD, RAISE_TD, RC_BSPC, RG_ENT, __EDVORAKJP_CURSOR__
|
||||||
HOME,PGDN,PGUP , END ,TMB1 ,TMB2,TMB3, TMB4,TMB5,TMB6 ,LEFT ,DOWN , UP ,RGHT
|
//`--------------------------------------------------------------' `--------------------------------------------------------------'
|
||||||
//`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----'
|
|
||||||
),
|
),
|
||||||
|
|
||||||
[_LOWER] = LAYOUT_kc(
|
[L_EDVORAKJP_LOWER] = LAYOUT_wrapper(
|
||||||
//,----+----+------+------+------+----. ,----+------+------+-------+----+----.
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||||
PSCR, , , , , , , , , , , ,
|
__KC_TRNS_x6__ , __KC_TRNS_x6__ ,
|
||||||
//|----+----+------+------+------+----| |----+------+------+-------+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
, , LCBR , LBRC , LPRN , , , RPRN , RBRC , RCBR , , ,
|
XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_L__ , XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_R__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+------+------+------+----| |----+------+------+-------+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
F1 , F2 ,LA(F3),LG(F4),LC(F5), F6 , F7 ,RS(F8),RG(F9),RA(F10),F11 ,F12 ,
|
__EDVORAKJP_FUNCTION_L__ , __EDVORAKJP_FUNCTION_R__ ,
|
||||||
//|----+----+------+------+------+----+----. ,----+----+------+------+-------+----+----|
|
//|--------+--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------+--------|
|
||||||
, , HOME , PGDN , PGUP ,END , , ,LEFT, DOWN , UP , RGHT , , ,
|
KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , KC_TRNS, KC_TRNS, __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+------+------+------+----+----| |----+----+------+------+-------+----+----|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||||
, , , , , , NO , MAC ,TMB7, , , , ,
|
__KC_TRNS_x4__ , KC_TRNS, KC_TRNS, XXXXXXX, KC_MAC, RC_DEL, KC_TRNS, __KC_TRNS_x4__
|
||||||
//`----+----+------+------+------+----+----/ \----+----+------+------+-------+----+----'
|
//`--------------------------------------------------------------' `--------------------------------------------------------------'
|
||||||
),
|
),
|
||||||
|
|
||||||
[_RAISE] = LAYOUT_kc(
|
[L_EDVORAKJP_RAISE] = LAYOUT_wrapper(
|
||||||
//,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----.
|
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||||
PSCR, , , , , , , , , , , ,
|
__KC_TRNS_x6__ , __KC_TRNS_x6__ ,
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
, ,EXLM , AT ,HASH ,DLR , PERC,CIRC ,AMPR ,ASTR , , ,
|
XXXXXXX, XXXXXXX, __EDVORAKJP_SYMBOL_L__ , __EDVORAKJP_SYMBOL_R__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||||
, 1 ,LA(2),LG(3),LC(4), 5 , 6 ,RS(7),RG(8),RA(9), 0 , ,
|
XXXXXXX, __EDVORAKJP_NUMBER_L__ , __EDVORAKJP_NUMBER_R__ , XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----|
|
//|--------+--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------+--------|
|
||||||
, ,HOME ,PGDN ,PGUP ,END , , ,LEFT,DOWN , UP ,RGHT , , ,
|
KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , KC_TRNS, KC_TRNS, __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----+----| |----+----+-----+-----+-----+----+----|
|
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||||
, , , , , ,WIN , NO , , , , , ,
|
__KC_TRNS_x4__ , KC_TRNS, KC_TRNS, KC_WIN, XXXXXXX, KC_TRNS, KC_TRNS, __KC_TRNS_x4__
|
||||||
//`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----'
|
//`--------------------------------------------------------------' `--------------------------------------------------------------'
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#ifndef KEYMAP_XROWS_H
|
#pragma once
|
||||||
#define KEYMAP_XROWS_H
|
|
||||||
|
|
||||||
#include "edvorakjp.h"
|
#include "edvorakjp.h"
|
||||||
/*
|
/*
|
||||||
|
@ -8,14 +7,7 @@
|
||||||
* };
|
* };
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KC_ KC_TRNS
|
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
|
||||||
|
|
||||||
#define KC_TMB1 KC_LA(TAB)
|
#define __KC_TRNS_x4__ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
#define KC_TMB2 KC_LS(SPC)
|
#define __KC_TRNS_x6__ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
#define KC_TMB3 TD(TD_LOWER) // act as LOWER when hold, as KC_LANG2(=English) when tapped
|
|
||||||
#define KC_TMB4 TD(TD_RAISE) // act as RAISE when hold, as KC_LANG1(=Japanese) when tapped
|
|
||||||
#define KC_TMB5 KC_RC(BSPC)
|
|
||||||
#define KC_TMB6 KC_RG(ENT)
|
|
||||||
#define KC_TMB7 KC_RC(DEL)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,72 +1,68 @@
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "oled.h"
|
#include "oled.h"
|
||||||
|
|
||||||
static void render_logo(struct CharacterMatrix *matrix) {
|
#ifdef OLED_DRIVER_ENABLE
|
||||||
|
void render_host_led_state(void) {
|
||||||
|
char led_state_str[24];
|
||||||
|
uint8_t leds = host_keyboard_leds();
|
||||||
|
|
||||||
static char logo[] = {
|
bool is_num_lock_enabled = leds & (1 << USB_LED_NUM_LOCK);
|
||||||
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
|
bool is_caps_lock_enabled = leds & (1 << USB_LED_CAPS_LOCK);
|
||||||
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
|
bool is_scroll_lock_enabled = leds & (1 << USB_LED_SCROLL_LOCK);
|
||||||
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
|
|
||||||
0};
|
snprintf(led_state_str, sizeof(led_state_str), "NL:%s CL:%s SL:%s", is_num_lock_enabled ? "on" : "- ", is_caps_lock_enabled ? "on" : "- ", is_scroll_lock_enabled ? "on" : "- ");
|
||||||
matrix_write(matrix, logo);
|
oled_write(led_state_str, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_update(struct CharacterMatrix *dest,
|
void render_layer_state(void) {
|
||||||
const struct CharacterMatrix *source) {
|
char layer_name[17];
|
||||||
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
oled_write_P(PSTR("Layer: "), false);
|
||||||
memcpy(dest->display, source->display, sizeof(dest->display));
|
|
||||||
dest->dirty = true;
|
switch (biton32(layer_state)) {
|
||||||
}
|
case L_EDVORAKJP_BASE:
|
||||||
|
oled_write_ln_P(PSTR("Default"), false);
|
||||||
|
break;
|
||||||
|
case L_EDVORAKJP_LOWER:
|
||||||
|
oled_write_ln_P(PSTR("Lower"), false);
|
||||||
|
break;
|
||||||
|
case L_EDVORAKJP_RAISE:
|
||||||
|
oled_write_ln_P(PSTR("Raise"), false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
snprintf(layer_name, sizeof(layer_name), "Undef-%ld", layer_state);
|
||||||
|
oled_write_ln(layer_name, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_status(struct CharacterMatrix *matrix) {
|
void render_logo(void) {
|
||||||
|
static const char helix_logo[] PROGMEM = {0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0};
|
||||||
// Render to mode icon
|
oled_write_P(helix_logo, false);
|
||||||
static char logo[][2][3] = {{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
|
|
||||||
int mode_number = get_enable_kc_lang() ? 0 : 1;
|
|
||||||
matrix_write(matrix, logo[mode_number][0]);
|
|
||||||
matrix_write(matrix, "\n");
|
|
||||||
matrix_write(matrix, logo[mode_number][1]);
|
|
||||||
|
|
||||||
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
|
||||||
char buf[40];
|
|
||||||
snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
|
|
||||||
matrix_write_P(matrix, PSTR("\nLayer: "));
|
|
||||||
switch (biton32(layer_state)) {
|
|
||||||
case L_BASE:
|
|
||||||
matrix_write_P(matrix, PSTR("Default"));
|
|
||||||
break;
|
|
||||||
case _RAISE:
|
|
||||||
matrix_write_P(matrix, PSTR("Raise"));
|
|
||||||
break;
|
|
||||||
case _LOWER:
|
|
||||||
matrix_write_P(matrix, PSTR("Lower"));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
matrix_write(matrix, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Host Keyboard LED Status
|
|
||||||
char led[40];
|
|
||||||
snprintf(led, sizeof(led), "\n%s %s %s",
|
|
||||||
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NMLK" : " ",
|
|
||||||
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
|
|
||||||
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
|
|
||||||
matrix_write(matrix, led);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void iota_gfx_task_user(void) {
|
void render_mode_icon(bool is_windows) {
|
||||||
struct CharacterMatrix matrix;
|
static const char logo[][2][3] = {
|
||||||
|
{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
|
||||||
|
{{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
|
||||||
|
};
|
||||||
|
static char mode_icon[10];
|
||||||
|
|
||||||
#if DEBUG_TO_SCREEN
|
snprintf(mode_icon, sizeof(mode_icon), "%s\n%s ", logo[is_windows][0], logo[is_windows][1]);
|
||||||
if (debug_enable) { return; }
|
oled_write(mode_icon, false);
|
||||||
#endif
|
|
||||||
|
|
||||||
matrix_clear(&matrix);
|
|
||||||
if (is_master) {
|
|
||||||
render_status(&matrix);
|
|
||||||
} else {
|
|
||||||
render_logo(&matrix);
|
|
||||||
}
|
|
||||||
matrix_update(&display, &matrix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||||
|
// flips the display 180 degrees if offhand
|
||||||
|
return is_keyboard_left() ? rotation : rotation ^ OLED_ROTATION_180;
|
||||||
|
}
|
||||||
|
|
||||||
|
void oled_task_user(void) {
|
||||||
|
if (is_keyboard_left()) {
|
||||||
|
render_mode_icon(!get_enable_kc_lang());
|
||||||
|
render_layer_state();
|
||||||
|
render_host_led_state();
|
||||||
|
} else {
|
||||||
|
render_logo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // OLED_DRIVER_ENABLE
|
||||||
|
|
|
@ -1,19 +1,12 @@
|
||||||
#ifndef OLED_USER_H
|
#pragma once
|
||||||
#define OLED_USER_H
|
|
||||||
|
|
||||||
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
|
|
||||||
#include "ssd1306.h"
|
|
||||||
#include "edvorakjp.h"
|
#include "edvorakjp.h"
|
||||||
|
|
||||||
//assign the right code to your layers for OLED display
|
|
||||||
#define L_BASE 0
|
|
||||||
|
|
||||||
extern uint8_t is_master;
|
|
||||||
extern bool japanese_mode;
|
extern bool japanese_mode;
|
||||||
|
|
||||||
void matrix_update(struct CharacterMatrix *dest,
|
void render_host_led_state(void);
|
||||||
const struct CharacterMatrix *source);
|
void render_layer_state(void);
|
||||||
void render_status(struct CharacterMatrix *matrix);
|
void render_logo(void);
|
||||||
void iota_gfx_task_user(void);
|
void render_mode_icon(bool is_windows);
|
||||||
|
oled_rotation_t oled_init_user(oled_rotation_t rotation);
|
||||||
#endif // OLED_CONFIG_USER_H
|
void oled_task_user(void);
|
||||||
|
|
|
@ -18,6 +18,7 @@ TAP_DANCE_ENABLE = yes
|
||||||
# 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_SELECT = core
|
||||||
|
|
||||||
# convert Helix-specific options (that represent combinations of standard options)
|
# convert Helix-specific options (that represent combinations of standard options)
|
||||||
# into QMK standard options.
|
# into QMK standard options.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#ifndef CONFIG_USER_H
|
#pragma once
|
||||||
#define CONFIG_USER_H
|
|
||||||
|
|
||||||
/* Use I2C or Serial, not both */
|
/* Use I2C or Serial, not both */
|
||||||
#define USE_SERIAL
|
#define USE_SERIAL
|
||||||
|
@ -22,5 +21,3 @@
|
||||||
#define RGBLIGHT_HUE_STEP 10
|
#define RGBLIGHT_HUE_STEP 10
|
||||||
#define RGBLIGHT_SAT_STEP 8
|
#define RGBLIGHT_SAT_STEP 8
|
||||||
#define RGBLIGHT_VAL_STEP 8
|
#define RGBLIGHT_VAL_STEP 8
|
||||||
|
|
||||||
#endif // CONFIG_USER_H
|
|
||||||
|
|
|
@ -7,79 +7,72 @@
|
||||||
* };
|
* };
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KC_ KC_TRNS
|
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
|
||||||
|
#define __KC_TRNS_x6__ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
#define KC_TMB1 KC_LA(TAB)
|
|
||||||
#define KC_TMB2 KC_LS(SPC)
|
|
||||||
#define KC_TMB3 TD(TD_LOWER) // act as LOWER when hold, as KC_LANG2(=English) when tapped
|
|
||||||
#define KC_TMB4 TD(TD_RAISE) // act as RAISE when hold, as KC_LANG1(=Japanese) when tapped
|
|
||||||
#define KC_TMB5 KC_RC(BSPC)
|
|
||||||
#define KC_TMB6 KC_RG(ENT)
|
|
||||||
#define KC_TMB7 KC_RC(DEL)
|
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[L_EDVORAKJP_BASE] = LAYOUT_wrapper(
|
||||||
[_EDVORAK] = LAYOUT_kc(
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
||||||
//,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----.
|
KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24,
|
||||||
GRV ,EXLM, AT ,HASH , DLR ,PERC, CIRC,AMPR ,ASTR ,LPRN ,RPRN,BSPC,
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
KC_GRV, __EDVORAKJP_BASE_L1__ , __EDVORAKJP_BASE_R1__ , KC_BSLS,
|
||||||
TAB ,QUOT,COMM , DOT , Y , Q , F , G , R , W , P ,BSLS,
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
KC_EQL, __EDVORAKJP_BASE_L2__ , __EDVORAKJP_BASE_R2__ , KC_MINS,
|
||||||
EQL , A ,LA(O),LG(E),LC(I), U , D ,RS(T),RG(N),RA(S), M ,MINS,
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
||||||
//|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----|
|
KC_ESC, __EDVORAKJP_BASE_L3__ , XXXXXXX, XXXXXXX, __EDVORAKJP_BASE_R3__ , KC_SLSH,
|
||||||
ESC ,SCLN, X , C , V , Z , NO , NO , H , J , K , L , B ,SLSH,
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
//`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----'
|
LA_TAB, LS_SPC,LOWER_TD, RAISE_TD, RC_BSPC, RG_ENT
|
||||||
TMB1,TMB2,TMB3, TMB4,TMB5,TMB6
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
||||||
// `----+----+----' `----+----+----'
|
|
||||||
),
|
),
|
||||||
|
|
||||||
[_LOWER] = LAYOUT_kc(
|
[L_EDVORAKJP_LOWER] = LAYOUT_wrapper(
|
||||||
//,----+----+------+------+------+----. ,----+------+------+-------+----+----.
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
||||||
, , , , , , , , , , , ,
|
__KC_TRNS_x6__ , __KC_TRNS_x6__ ,
|
||||||
//|----+----+------+------+------+----| |----+------+------+-------+----+----|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||||||
, , LCBR , LBRC , LPRN , , , RPRN , RBRC , RCBR , , ,
|
XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_L__ , XXXXXXX, XXXXXXX, __EDVORAKJP_BRACKET_R__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+------+------+------+----| |----+------+------+-------+----+----|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||||||
F1 , F2 ,LA(F3),LG(F4),LC(F5), F6 , F7 ,RS(F8),RG(F9),RA(F10),F11 ,F12 ,
|
__EDVORAKJP_FUNCTION_L__ , __EDVORAKJP_FUNCTION_R__ ,
|
||||||
//|----+----+------+------+------+----+----. ,----+----+------+------+-------+----+----|
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
||||||
PSCR, , HOME , PGDN , PGUP ,END , , ,LEFT, DOWN , UP , RGHT , , ,
|
KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , XXXXXXX, XXXXXXX, __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX,
|
||||||
//`----+----+------+------+------+----+----/ \----+----+------+------+-------+----+----'
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
, , NO , MAC ,TMB7,
|
KC_TRNS, KC_TRNS, XXXXXXX, KC_MAC, RC_DEL, KC_TRNS
|
||||||
// `----+----+----' `----+----+----'
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
||||||
),
|
),
|
||||||
|
|
||||||
[_RAISE] = LAYOUT_kc(
|
[L_EDVORAKJP_RAISE] = LAYOUT_wrapper(
|
||||||
//,----+----+-----+-----+-----+----. ,----+-----+-----+-----+----+----.
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
||||||
, , , , , , , , , , , ,
|
__KC_TRNS_x6__ , __KC_TRNS_x6__ ,
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||||||
, ,EXLM , AT ,HASH ,DLR , PERC,CIRC ,AMPR ,ASTR , , ,
|
XXXXXXX, XXXXXXX, __EDVORAKJP_SYMBOL_L__ , __EDVORAKJP_SYMBOL_R__ , XXXXXXX, XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----| |----+-----+-----+-----+----+----|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||||||
, 1 ,LA(2),LG(3),LC(4), 5 , 6 ,RS(7),RG(8),RA(9), 0 , ,
|
XXXXXXX, __EDVORAKJP_NUMBER_L__ , __EDVORAKJP_NUMBER_R__ , XXXXXXX,
|
||||||
//|----+----+-----+-----+-----+----+----. ,----+----+-----+-----+-----+----+----|
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
||||||
PSCR, ,HOME ,PGDN ,PGUP ,END , , ,LEFT,DOWN , UP ,RGHT , , ,
|
KC_PSCR, XXXXXXX, __EDVORAKJP_PAGE__ , XXXXXXX, XXXXXXX, __EDVORAKJP_CURSOR__ , XXXXXXX, XXXXXXX,
|
||||||
//`----+----+-----+-----+-----+----+----/ \----+----+-----+-----+-----+----+----'
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
, ,WIN , NO , ,
|
KC_TRNS, KC_TRNS, KC_WIN, XXXXXXX, KC_TRNS, KC_TRNS
|
||||||
// `----+----+----' `----+----+----'
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
void matrix_init_keymap() {
|
void matrix_init_keymap() {}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
|
#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||||
uint32_t layer_state_set_keymap(uint32_t state) {
|
uint32_t layer_state_set_keymap(uint32_t state) {
|
||||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||||
switch (biton32(state)) {
|
switch (biton32(state)) {
|
||||||
case _LOWER:
|
case L_EDVORAKJP_LOWER:
|
||||||
rgblight_sethsv_noeeprom_red();
|
rgblight_sethsv_noeeprom_red();
|
||||||
break;
|
break;
|
||||||
case _RAISE:
|
case L_EDVORAKJP_RAISE:
|
||||||
rgblight_sethsv_noeeprom_blue();
|
rgblight_sethsv_noeeprom_green();
|
||||||
break;
|
break;
|
||||||
default: // for any other layers, or the default layer
|
default: // for any other layers, or the default layer
|
||||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_GRADIENT + 3);
|
rgblight_mode(RGBLIGHT_MODE_STATIC_GRADIENT + 3);
|
||||||
get_japanese_mode() ? rgblight_sethsv_noeeprom_red() : rgblight_sethsv_noeeprom_green();
|
rgblight_sethsv_red();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,32 +1,22 @@
|
||||||
#include "edvorakjp.h"
|
#include "edvorakjp.h"
|
||||||
|
|
||||||
void matrix_init_user(void) {
|
void matrix_init_user(void) {
|
||||||
edvorakjp_status_init();
|
edvorakjp_status_init();
|
||||||
matrix_init_keymap();
|
matrix_init_keymap();
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__((weak)) void matrix_init_keymap() {}
|
||||||
void matrix_init_keymap() {}
|
|
||||||
|
|
||||||
uint32_t layer_state_set_user(uint32_t state) {
|
uint32_t layer_state_set_user(uint32_t state) {
|
||||||
state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
state = update_tri_layer_state(state, L_EDVORAKJP_LOWER, L_EDVORAKJP_RAISE, L_EDVORAKJP_ADJUST);
|
||||||
return layer_state_set_keymap(state);
|
return layer_state_set_keymap(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__((weak)) uint32_t layer_state_set_keymap(uint32_t state) { return state; }
|
||||||
uint32_t layer_state_set_keymap(uint32_t state) {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
return process_record_keymap(keycode, record) &&\
|
bool process_record_user_result = process_record_keymap(keycode, record) && process_record_edvorakjp_swap_scln(keycode, record) && process_record_edvorakjp_config(keycode, record) && process_record_layer(keycode, record) && process_record_ime(keycode, record);
|
||||||
process_record_edvorakjp_swap_scln(keycode, record) &&\
|
return process_record_user_result;
|
||||||
process_record_edvorakjp_config(keycode, record) &&\
|
|
||||||
process_record_layer(keycode, record) &&\
|
|
||||||
process_record_ime(keycode, record);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
|
||||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,54 +1,76 @@
|
||||||
#ifndef EDVORAKJP
|
#pragma once
|
||||||
#define EDVORAKJP
|
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "action_layer.h"
|
#include "action_layer.h"
|
||||||
|
|
||||||
#define EECONFIG_EDVORAK (uint8_t *)20
|
#define EECONFIG_EDVORAK (uint8_t *)20
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
#define __EDVORAKJP_BASE_L1__ KC_QUOTE, KC_COMMA, KC_DOT, KC_Y, KC_Q
|
||||||
|
#define __EDVORAKJP_BASE_L2__ KC_A, LALT_T(KC_O), LGUI_T(KC_E), LCTL_T(KC_I), KC_U
|
||||||
|
#define __EDVORAKJP_BASE_L3__ KC_SCOLON, KC_X, KC_C, KC_V, KC_Z
|
||||||
|
|
||||||
|
#define __EDVORAKJP_BASE_R1__ KC_F, KC_G, KC_R, KC_W, KC_P
|
||||||
|
#define __EDVORAKJP_BASE_R2__ KC_D, RSFT_T(KC_T), RGUI_T(KC_N), RALT_T(KC_S), KC_M
|
||||||
|
#define __EDVORAKJP_BASE_R3__ KC_H, KC_J, KC_K, KC_L, KC_B
|
||||||
|
|
||||||
|
#define __EDVORAKJP_NUMBER_L__ KC_1, LALT_T(KC_2), LGUI_T(KC_3), LCTL_T(KC_4), KC_5
|
||||||
|
#define __EDVORAKJP_NUMBER_R__ KC_6, RSFT_T(KC_7), RGUI_T(KC_8), RALT_T(KC_9), KC_0
|
||||||
|
|
||||||
|
#define __EDVORAKJP_FUNCTION_L__ KC_F1, KC_F2, LALT_T(KC_F3), LGUI_T(KC_F4), LCTL_T(KC_F5), KC_F6
|
||||||
|
#define __EDVORAKJP_FUNCTION_R__ KC_F7, RSFT_T(KC_F8), RGUI_T(KC_F9), RALT_T(KC_F10), KC_F11, KC_F12
|
||||||
|
|
||||||
|
#define __EDVORAKJP_SYMBOL_L__ KC_EXCLAIM, KC_AT, KC_HASH, KC_DOLLAR
|
||||||
|
#define __EDVORAKJP_SYMBOL_R__ KC_PERCENT, KC_CIRCUMFLEX, KC_AMPERSAND, KC_ASTERISK
|
||||||
|
|
||||||
|
#define __EDVORAKJP_BRACKET_L__ KC_LEFT_CURLY_BRACE, KC_LBRACKET, KC_LEFT_PAREN
|
||||||
|
#define __EDVORAKJP_BRACKET_R__ KC_RIGHT_PAREN, KC_RBRACKET, KC_RIGHT_CURLY_BRACE
|
||||||
|
|
||||||
|
#define __EDVORAKJP_PAGE__ KC_HOME, KC_PGDOWN, KC_PGUP, KC_END
|
||||||
|
#define __EDVORAKJP_CURSOR__ KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT
|
||||||
|
|
||||||
|
#define LA_TAB LALT_T(KC_TAB)
|
||||||
|
#define LS_SPC LSFT_T(KC_SPACE)
|
||||||
|
#define RC_BSPC RCTL_T(KC_BSPACE)
|
||||||
|
#define RC_DEL RCTL_T(KC_DELETE)
|
||||||
|
#define RG_ENT RGUI_T(KC_ENTER)
|
||||||
|
|
||||||
|
#define LOWER_TD TD(TD_EDVORAKJP_LOWER)
|
||||||
|
#define RAISE_TD TD(TD_EDVORAKJP_RAISE)
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
extern keymap_config_t keymap_config;
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
enum edvorakjp_layers {
|
enum edvorakjp_layers {
|
||||||
_EDVORAK = 0,
|
L_EDVORAKJP_BASE = 0,
|
||||||
_LOWER,
|
L_EDVORAKJP_LOWER,
|
||||||
_RAISE,
|
L_EDVORAKJP_RAISE,
|
||||||
_ADJUST,
|
L_EDVORAKJP_ADJUST,
|
||||||
_EXTRA,
|
L_EDVORAKJP_EXTRA,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum edvorakjp_keycodes {
|
enum edvorakjp_keycodes {
|
||||||
EDVORAK = SAFE_RANGE,
|
KC_EDVORAKJP_LOWER = SAFE_RANGE,
|
||||||
LOWER,
|
KC_EDVORAKJP_RAISE,
|
||||||
RAISE,
|
KC_MAC,
|
||||||
KC_MAC,
|
KC_WIN,
|
||||||
KC_WIN,
|
KC_JPN,
|
||||||
KC_JPN,
|
KC_ENG,
|
||||||
KC_ENG,
|
NEW_SAFE_RANGE,
|
||||||
NEW_SAFE_RANGE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define KC_LC(k) LCTL_T(KC_##k)
|
|
||||||
#define KC_LS(k) LSFT_T(KC_##k)
|
|
||||||
#define KC_LA(k) LALT_T(KC_##k)
|
|
||||||
#define KC_LG(k) LGUI_T(KC_##k)
|
|
||||||
#define KC_RC(k) RCTL_T(KC_##k)
|
|
||||||
#define KC_RS(k) RSFT_T(KC_##k)
|
|
||||||
#define KC_RG(k) RGUI_T(KC_##k)
|
|
||||||
#define KC_RA(k) RALT_T(KC_##k)
|
|
||||||
|
|
||||||
enum tap_dance_code {
|
enum tap_dance_code {
|
||||||
TD_LOWER = 0,
|
TD_EDVORAKJP_LOWER = 0,
|
||||||
TD_RAISE
|
TD_EDVORAKJP_RAISE,
|
||||||
};
|
};
|
||||||
|
|
||||||
// base
|
// base
|
||||||
void dvorakj_layer_off(void);
|
void matrix_init_user(void);
|
||||||
void matrix_init_user(void);
|
void matrix_init_keymap(void);
|
||||||
void matrix_init_keymap(void);
|
|
||||||
uint32_t layer_state_set_user(uint32_t state);
|
uint32_t layer_state_set_user(uint32_t state);
|
||||||
uint32_t layer_state_set_keymap(uint32_t state);
|
uint32_t layer_state_set_keymap(uint32_t state);
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record);
|
bool process_record_user(uint16_t keycode, keyrecord_t *record);
|
||||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
// status
|
// status
|
||||||
void edvorakjp_status_init(void);
|
void edvorakjp_status_init(void);
|
||||||
|
@ -66,5 +88,3 @@ bool process_record_edvorakjp_swap_scln(uint16_t keycode, keyrecord_t *record);
|
||||||
bool process_record_edvorakjp_config(uint16_t keycode, keyrecord_t *record);
|
bool process_record_edvorakjp_config(uint16_t keycode, keyrecord_t *record);
|
||||||
bool process_record_layer(uint16_t keycode, keyrecord_t *record);
|
bool process_record_layer(uint16_t keycode, keyrecord_t *record);
|
||||||
bool process_record_ime(uint16_t keycode, keyrecord_t *record);
|
bool process_record_ime(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
#endif // EDVORAKJP
|
|
||||||
|
|
|
@ -9,81 +9,81 @@ static uint16_t time_on_pressed;
|
||||||
*/
|
*/
|
||||||
bool process_record_edvorakjp_swap_scln(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_edvorakjp_swap_scln(uint16_t keycode, keyrecord_t *record) {
|
||||||
#ifdef SWAP_SCLN
|
#ifdef SWAP_SCLN
|
||||||
static const uint8_t shift_bits = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT);
|
static const uint8_t shift_bits = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT);
|
||||||
static uint8_t last_mods_status;
|
static uint8_t last_mods_status;
|
||||||
if (keycode == KC_SCLN) {
|
if (keycode == KC_SCLN) {
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
last_mods_status = get_mods();
|
last_mods_status = get_mods();
|
||||||
|
|
||||||
// invert shift_bits
|
// invert shift_bits
|
||||||
if (last_mods_status & shift_bits) {
|
if (last_mods_status & shift_bits) {
|
||||||
set_mods(last_mods_status & ~shift_bits);
|
set_mods(last_mods_status & ~shift_bits);
|
||||||
} else {
|
} else {
|
||||||
set_mods(last_mods_status | MOD_BIT(KC_LSFT));
|
set_mods(last_mods_status | MOD_BIT(KC_LSFT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
set_mods(last_mods_status);
|
set_mods(last_mods_status);
|
||||||
last_mods_status = 0;
|
last_mods_status = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_edvorakjp_config(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_edvorakjp_config(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case KC_MAC:
|
case KC_MAC:
|
||||||
case KC_WIN:
|
case KC_WIN:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
set_enable_kc_lang(keycode == KC_MAC);
|
set_enable_kc_lang(keycode == KC_MAC);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_layer(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_layer(uint16_t keycode, keyrecord_t *record) {
|
||||||
#if TAP_DANCE_ENABLE != yes
|
#if TAP_DANCE_ENABLE != yes
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case LOWER:
|
case KC_EDVORAKJP_LOWER:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
layer_on(_LOWER);
|
layer_on(L_EDVORAKJP_LOWER);
|
||||||
time_on_pressed = record->event.time;
|
time_on_pressed = record->event.time;
|
||||||
} else {
|
} else {
|
||||||
layer_off(_LOWER);
|
layer_off(L_EDVORAKJP_LOWER);
|
||||||
|
|
||||||
if (TIMER_DIFF_16(record->event.time, time_on_pressed) < TAPPING_TERM) {
|
if (TIMER_DIFF_16(record->event.time, time_on_pressed) < TAPPING_TERM) {
|
||||||
set_japanese_mode(false);
|
set_japanese_mode(false);
|
||||||
}
|
}
|
||||||
time_on_pressed = 0;
|
time_on_pressed = 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case RAISE:
|
case KC_EDVORAKJP_RAISE:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
layer_on(_RAISE);
|
layer_on(L_EDVORAKJP_RAISE);
|
||||||
time_on_pressed = record->event.time;
|
time_on_pressed = record->event.time;
|
||||||
} else {
|
} else {
|
||||||
layer_off(_RAISE);
|
layer_off(L_EDVORAKJP_RAISE);
|
||||||
|
|
||||||
if (TIMER_DIFF_16(record->event.time, time_on_pressed) < TAPPING_TERM) {
|
if (TIMER_DIFF_16(record->event.time, time_on_pressed) < TAPPING_TERM) {
|
||||||
set_japanese_mode(true);
|
set_japanese_mode(true);
|
||||||
}
|
}
|
||||||
time_on_pressed = 0;
|
time_on_pressed = 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_ime(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_ime(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case KC_JPN:
|
case KC_JPN:
|
||||||
case KC_ENG:
|
case KC_ENG:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
set_japanese_mode(keycode == KC_JPN);
|
set_japanese_mode(keycode == KC_JPN);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,63 +2,55 @@
|
||||||
#include "edvorakjp.h"
|
#include "edvorakjp.h"
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
uint8_t raw;
|
uint8_t raw;
|
||||||
struct {
|
struct {
|
||||||
bool enable_kc_lang; // for macOS
|
bool enable_kc_lang; // for macOS
|
||||||
};
|
};
|
||||||
} edvorakjp_config_t;
|
} edvorakjp_config_t;
|
||||||
static edvorakjp_config_t edvorakjp_config;
|
static edvorakjp_config_t edvorakjp_config;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool japanese_mode;
|
bool japanese_mode;
|
||||||
} edvorakjp_state_t;
|
} edvorakjp_state_t;
|
||||||
static edvorakjp_state_t edvorakjp_state;
|
static edvorakjp_state_t edvorakjp_state;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* private methods
|
* private methods
|
||||||
*/
|
*/
|
||||||
uint8_t eeconfig_read_edvorakjp(void) {
|
uint8_t eeconfig_read_edvorakjp(void) { return eeprom_read_byte(EECONFIG_EDVORAK); }
|
||||||
return eeprom_read_byte(EECONFIG_EDVORAK);
|
|
||||||
}
|
|
||||||
|
|
||||||
void eeconfig_update_edvorakjp(uint8_t val) {
|
void eeconfig_update_edvorakjp(uint8_t val) { eeprom_update_byte(EECONFIG_EDVORAK, val); }
|
||||||
eeprom_update_byte(EECONFIG_EDVORAK, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* public methods
|
* public methods
|
||||||
*/
|
*/
|
||||||
void edvorakjp_status_init(void) {
|
void edvorakjp_status_init(void) {
|
||||||
edvorakjp_state.japanese_mode = false;
|
edvorakjp_state.japanese_mode = false;
|
||||||
edvorakjp_config.raw = eeconfig_read_edvorakjp();
|
edvorakjp_config.raw = eeconfig_read_edvorakjp();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_enable_kc_lang(void) {
|
bool get_enable_kc_lang(void) { return edvorakjp_config.enable_kc_lang; }
|
||||||
return edvorakjp_config.enable_kc_lang;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_enable_kc_lang(bool new_state) {
|
void set_enable_kc_lang(bool new_state) {
|
||||||
edvorakjp_config.enable_kc_lang = new_state;
|
edvorakjp_config.enable_kc_lang = new_state;
|
||||||
eeconfig_update_edvorakjp(edvorakjp_config.raw);
|
eeconfig_update_edvorakjp(edvorakjp_config.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_japanese_mode(void) {
|
bool get_japanese_mode(void) { return edvorakjp_state.japanese_mode; }
|
||||||
return edvorakjp_state.japanese_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_japanese_mode(bool new_state) {
|
void set_japanese_mode(bool new_state) {
|
||||||
edvorakjp_state.japanese_mode = new_state;
|
edvorakjp_state.japanese_mode = new_state;
|
||||||
if (edvorakjp_state.japanese_mode) {
|
if (edvorakjp_state.japanese_mode) {
|
||||||
if (edvorakjp_config.enable_kc_lang) {
|
if (edvorakjp_config.enable_kc_lang) {
|
||||||
SEND_STRING(SS_TAP(X_LANG1));
|
SEND_STRING(SS_TAP(X_LANG1));
|
||||||
|
} else {
|
||||||
|
SEND_STRING(SS_LALT("`"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SEND_STRING(SS_LALT("`"));
|
if (edvorakjp_config.enable_kc_lang) {
|
||||||
|
SEND_STRING(SS_TAP(X_LANG2));
|
||||||
|
} else {
|
||||||
|
SEND_STRING(SS_LALT("`"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (edvorakjp_config.enable_kc_lang) {
|
|
||||||
SEND_STRING(SS_TAP(X_LANG2));
|
|
||||||
} else {
|
|
||||||
SEND_STRING(SS_LALT("`"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,72 +2,68 @@
|
||||||
#include "process_keycode/process_tap_dance.h"
|
#include "process_keycode/process_tap_dance.h"
|
||||||
|
|
||||||
enum tap_state {
|
enum tap_state {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
SINGLE_TAP = 1,
|
SINGLE_TAP = 1,
|
||||||
DOUBLE_TAP = 2,
|
DOUBLE_TAP = 2,
|
||||||
HOLD
|
HOLD,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t lower;
|
uint8_t lower;
|
||||||
uint8_t raise;
|
uint8_t raise;
|
||||||
} td_status_t;
|
} td_status_t;
|
||||||
static td_status_t td_status = {NONE, NONE};
|
static td_status_t td_status = {NONE, NONE};
|
||||||
|
|
||||||
int cur_dance(qk_tap_dance_state_t *state) {
|
uint8_t cur_dance(qk_tap_dance_state_t *state) {
|
||||||
if (state->interrupted || !state->pressed) {
|
if (state->interrupted || !state->pressed) {
|
||||||
return state->count == 1 ? SINGLE_TAP : DOUBLE_TAP;
|
return state->count == 1 ? SINGLE_TAP : DOUBLE_TAP;
|
||||||
} else {
|
} else {
|
||||||
return HOLD;
|
return HOLD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void td_lower_finished(qk_tap_dance_state_t *state, void *user_data) {
|
void td_lower_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||||
td_status.lower = cur_dance(state);
|
td_status.lower = cur_dance(state);
|
||||||
switch(td_status.lower) {
|
switch (td_status.lower) {
|
||||||
case SINGLE_TAP:
|
case SINGLE_TAP:
|
||||||
set_japanese_mode(false);
|
set_japanese_mode(false);
|
||||||
break;
|
break;
|
||||||
case DOUBLE_TAP:
|
case DOUBLE_TAP:
|
||||||
set_japanese_mode(false);
|
set_japanese_mode(false);
|
||||||
register_code(KC_ESC);
|
register_code(KC_ESC);
|
||||||
break;
|
break;
|
||||||
case HOLD:
|
}
|
||||||
break;
|
layer_on(L_EDVORAKJP_LOWER);
|
||||||
}
|
|
||||||
layer_on(_LOWER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void td_lower_reset(qk_tap_dance_state_t *state, void *user_data) {
|
void td_lower_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||||
if (td_status.lower == DOUBLE_TAP) {
|
switch (td_status.lower) {
|
||||||
unregister_code(KC_ESC);
|
case DOUBLE_TAP:
|
||||||
}
|
unregister_code(KC_ESC);
|
||||||
layer_off(_LOWER);
|
break;
|
||||||
td_status.lower = NONE;
|
}
|
||||||
|
layer_off(L_EDVORAKJP_LOWER);
|
||||||
|
td_status.lower = NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void td_raise_finished(qk_tap_dance_state_t *state, void *user_data) {
|
void td_raise_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||||
td_status.raise = cur_dance(state);
|
td_status.raise = cur_dance(state);
|
||||||
switch(td_status.raise) {
|
switch (td_status.raise) {
|
||||||
case DOUBLE_TAP:
|
case DOUBLE_TAP:
|
||||||
// same as single
|
// same as single
|
||||||
case SINGLE_TAP:
|
case SINGLE_TAP:
|
||||||
set_japanese_mode(true);
|
set_japanese_mode(true);
|
||||||
break;
|
break;
|
||||||
case HOLD:
|
}
|
||||||
break;
|
layer_on(L_EDVORAKJP_RAISE);
|
||||||
}
|
|
||||||
layer_on(_RAISE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void td_raise_reset(qk_tap_dance_state_t *state, void *user_data) {
|
void td_raise_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||||
layer_off(_RAISE);
|
layer_off(L_EDVORAKJP_RAISE);
|
||||||
td_status.raise = NONE;
|
td_status.raise = NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||||
[TD_LOWER] =
|
[TD_EDVORAKJP_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_lower_finished, td_lower_reset, 150),
|
||||||
ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_lower_finished, td_lower_reset, 100),
|
[TD_EDVORAKJP_RAISE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_raise_finished, td_raise_reset, 150),
|
||||||
[TD_RAISE] =
|
|
||||||
ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_raise_finished, td_raise_reset, 100)
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue