forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Keymap] Remove LAYOUT_kc macros from edvorakjp keymaps (qmk#12217)
- Loading branch information
1 parent
96ba77a
commit d8328c6
Showing
20 changed files
with
525 additions
and
627 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
#ifndef CONFIG_USER_H | ||
#define CONFIG_USER_H | ||
#pragma once | ||
|
||
/* Select hand configuration */ | ||
|
||
// #define MASTER_LEFT | ||
#define MASTER_RIGHT | ||
#define MASTER_LEFT | ||
// #define MASTER_RIGHT | ||
// #define EE_HANDS | ||
|
||
#define SSD1306OLED | ||
#define SWAP_SCLN | ||
|
||
// #define TAPPING_FORCE_HOLD | ||
#define TAPPING_TERM 300 | ||
#define IGNORE_MOD_TAP_INTERRUPT | ||
|
||
#undef RGBLED_NUM | ||
#define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
#define RGBLED_NUM 27 | ||
#define RGBLIGHT_LIMIT_VAL 100 | ||
#define RGBLIGHT_HUE_STEP 10 | ||
#define RGBLIGHT_SAT_STEP 17 | ||
#define RGBLIGHT_VAL_STEP 17 | ||
#ifdef RGBLIGHT_ENABLE | ||
# undef RGBLED_NUM | ||
# define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
# define RGBLED_NUM 27 | ||
# define RGBLIGHT_LIMIT_VAL 100 | ||
# define RGBLIGHT_HUE_STEP 10 | ||
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,55 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include "oled.h" | ||
|
||
// NOTE: Redefined to avoid to use snprintf(); It makes size of firmware big. | ||
const char *read_mode_icon(bool windows_mode) { | ||
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; | ||
strcpy(mode_icon, logo[mode_number][0]); | ||
|
||
strcat(mode_icon, "\n"); | ||
strcat(mode_icon, logo[mode_number][1]); | ||
|
||
return mode_icon; | ||
#ifdef OLED_DRIVER_ENABLE | ||
void render_host_led_state(void) { oled_write(read_host_led_state(), false); } | ||
|
||
void render_layer_state(void) { | ||
char layer_name[17]; | ||
oled_write_P(PSTR("Layer: "), false); | ||
|
||
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); | ||
} | ||
} | ||
|
||
const char *read_layer_state(void) { | ||
static char layer_state_str[24]; | ||
char layer_name[17]; | ||
|
||
switch (biton32(layer_state)) { | ||
case L_BASE: | ||
strcpy(layer_name, "Default"); | ||
break; | ||
case _RAISE: | ||
strcpy(layer_name, "Raise"); | ||
break; | ||
case _LOWER: | ||
strcpy(layer_name, "Lower"); | ||
break; | ||
default: | ||
snprintf(layer_name, sizeof(layer_name), "Undef-%ld", layer_state); | ||
} | ||
void render_logo(void) { oled_write(read_logo(), false); } | ||
|
||
strcpy(layer_state_str, "Layer: "); | ||
void render_mode_icon(bool is_windows) { | ||
static const char logo[][2][3] = { | ||
{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, | ||
{{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, | ||
}; | ||
static char mode_icon[10]; | ||
|
||
strcat(layer_state_str, layer_name); | ||
strcat(layer_state_str, "\n"); | ||
return layer_state_str; | ||
snprintf(mode_icon, sizeof(mode_icon), "%s\n%s ", logo[is_windows][0], logo[is_windows][1]); | ||
oled_write(mode_icon, false); | ||
} | ||
|
||
const char *read_host_led_state(void) { | ||
static char led_str[24]; | ||
strcpy(led_str, (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NMLK" : " "); | ||
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; | ||
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 matrix_update(struct CharacterMatrix *dest, | ||
const struct CharacterMatrix *source) { | ||
if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
memcpy(dest->display, source->display, sizeof(dest->display)); | ||
dest->dirty = true; | ||
} | ||
} | ||
|
||
void iota_gfx_task_user(void) { | ||
struct CharacterMatrix matrix; | ||
|
||
matrix_clear(&matrix); | ||
#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); | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,17 @@ | ||
#ifndef OLED_USER_H | ||
#define OLED_USER_H | ||
#pragma once | ||
|
||
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | ||
#include "ssd1306.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; | ||
|
||
// method prototypes defined in crkbd/lib | ||
extern const char *read_host_led_state(void); | ||
extern const char *read_logo(void); | ||
extern const char *read_mode_icon(bool swap); | ||
|
||
const char *read_mode_icon(bool swap); | ||
const char *read_layer_state(void); | ||
const char *read_host_led_state(void); | ||
void matrix_update(struct CharacterMatrix *dest, | ||
const struct CharacterMatrix *source); | ||
void iota_gfx_task_user(void); | ||
|
||
#endif // OLED_CONFIG_USER_H | ||
void render_host_led_state(void); | ||
void render_layer_state(void); | ||
void render_logo(void); | ||
void render_mode_icon(bool is_windows); | ||
oled_rotation_t oled_init_user(oled_rotation_t rotation); | ||
void oled_task_user(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.