forked from mirrors/qmk_firmware
Keymap: Modified like-jis keymap for crkbd (#4577)
This commit is contained in:
parent
13ad650136
commit
11eaccdbce
5 changed files with 311 additions and 143 deletions
|
@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#define PREVENT_STUCK_MODIFIERS
|
||||
#define TAPPING_FORCE_HOLD
|
||||
#define TAPPING_TERM 150
|
||||
#define TAPPING_TERM 250
|
||||
|
||||
#undef RGBLED_NUM
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifdef SSD1306OLED
|
||||
#include "ssd1306.h"
|
||||
#endif
|
||||
#include "oled_helper.h"
|
||||
|
||||
extern keymap_config_t keymap_config;
|
||||
|
||||
|
@ -21,27 +22,35 @@ extern uint8_t is_master;
|
|||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
#define _QWERTY 0
|
||||
#define _LOWER 3
|
||||
#define _RAISE 4
|
||||
#define _ADJUST 16
|
||||
enum layer_number {
|
||||
_BASE = 0,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_ADJUST,
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
LOWER = SAFE_RANGE,
|
||||
RAISE,
|
||||
ADJUST,
|
||||
KANJI,
|
||||
RGBRST
|
||||
};
|
||||
|
||||
#define KC______ KC_TRNS
|
||||
#define KC_XXXXX KC_NO
|
||||
#define KC_KANJI KC_GRV
|
||||
enum tapdances{
|
||||
TD_CODO = 0,
|
||||
// TD_MNUB,
|
||||
};
|
||||
|
||||
// Layer Mode aliases
|
||||
#define KC_LOWER LOWER
|
||||
#define KC_RAISE RAISE
|
||||
|
||||
#define KC_RST RESET
|
||||
#define KC______ KC_TRNS
|
||||
#define KC_XXXXX KC_NO
|
||||
#define KC_KANJI KANJI
|
||||
|
||||
#define KC_RST RESET
|
||||
#define KC_LRST RGBRST
|
||||
#define KC_LTOG RGB_TOG
|
||||
#define KC_LHUI RGB_HUI
|
||||
|
@ -51,31 +60,41 @@ enum custom_keycodes {
|
|||
#define KC_LVAI RGB_VAI
|
||||
#define KC_LVAD RGB_VAD
|
||||
#define KC_LMOD RGB_MOD
|
||||
|
||||
#define KC_KNRM AG_NORM
|
||||
#define KC_KSWP AG_SWAP
|
||||
#define KC_GUAP LALT_T(KC_APP)
|
||||
|
||||
#define KC_TBSF LSFT_T(KC_TAB)
|
||||
// #define KC_SPSF LSFT_T(KC_SPC)
|
||||
#define KC_ALAP LALT_T(KC_APP)
|
||||
|
||||
#define KC_CODO TD(TD_CODO)
|
||||
// #define KC_MNUB TD(TD_MNUB)
|
||||
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[TD_CODO] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_DOT),
|
||||
// [TD_MNUB] = ACTION_TAP_DANCE_DOUBLE(KC_MINS, LSFT(KC_RO)),
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_QWERTY] = LAYOUT_kc( \
|
||||
[_BASE] = LAYOUT_kc( \
|
||||
//,-----------------------------------------. ,-----------------------------------------.
|
||||
ESC, Q, W, E, R, T, Y, U, I, O, P, MINS,\
|
||||
//|------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
LSFT, A, S, D, F, G, H, J, K, L, UP, ENT,\
|
||||
TBSF, A, S, D, F, G, H, J, K, L, UP, ENT,\
|
||||
//|------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
LCTRL, Z, X, C, V, B, N, M, COMM, LEFT, DOWN, RGHT,\
|
||||
LCTRL, Z, X, C, V, B, N, M, CODO, LEFT, DOWN, RGHT,\
|
||||
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
LGUI, LOWER, BSPC, SPC, RAISE, GUAP \
|
||||
LGUI, LOWER, BSPC, SPC, RAISE, ALAP \
|
||||
//`--------------------' `--------------------'
|
||||
),
|
||||
|
||||
[_LOWER] = LAYOUT_kc( \
|
||||
//,-----------------------------------------. ,-----------------------------------------.
|
||||
TAB, F1, F2, F3, F4, F5, XXXXX, MINS, EQL, JYEN, LBRC, RBRC,\
|
||||
_____, F1, F2, F3, F4, F5, XXXXX, MINS, EQL, JYEN, LBRC, RBRC,\
|
||||
//|------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
_____, F6, F7, F8, F9, F10, XXXXX, XXXXX, XXXXX, SCLN, QUOT, BSLS,\
|
||||
//|------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
_____, F11, F12, XXXXX, KANJI, ENT, XXXXX, XXXXX, COMM, DOT, SLSH, RO,\
|
||||
_____, F11, F12, TAB, KANJI, ENT, XXXXX, XXXXX, COMM, DOT, SLSH, RO,\
|
||||
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
_____, _____, DEL, _____, _____, APP \
|
||||
//`--------------------' `--------------------'
|
||||
|
@ -83,11 +102,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
[_RAISE] = LAYOUT_kc( \
|
||||
//,-----------------------------------------. ,-----------------------------------------.
|
||||
_____, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, XXXXX,\
|
||||
_____, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, PSLS,\
|
||||
//|------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
_____, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, 4, 5, 6, QUOT, XXXXX,\
|
||||
_____, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, QUOT, 4, 5, 6, PPLS, PAST,\
|
||||
//|------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
_____, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, 0, 1, 2, 3, DOT, XXXXX,\
|
||||
_____, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, 0, 1, 2, 3, DOT, PMNS,\
|
||||
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
_____, _____, BSPC, _____, _____, LALT \
|
||||
//`--------------------' `--------------------'
|
||||
|
@ -95,152 +114,182 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
[_ADJUST] = LAYOUT_kc( \
|
||||
//,-----------------------------------------. ,-----------------------------------------.
|
||||
_____, RST, LRST, KNRM, KSWP,XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
|
||||
_____, RST, LRST, KNRM, KSWP, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
|
||||
//|------+-------+------+------+------+-----| |------+------+------+------+------+------|
|
||||
_____, LTOG, LHUI, LSAI, LVAI,XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, PGUP, XXXXX,\
|
||||
_____, LTOG, LHUI, LSAI, LVAI, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, PGUP, XXXXX,\
|
||||
//|------+-------+------+------+------+-----| |------+------+------+------+------+------|
|
||||
_____, LMOD, LHUD, LSAD, LVAD,XXXXX, XXXXX, XXXXX, XXXXX, HOME, PGDN, END,\
|
||||
_____, LMOD, LHUD, LSAD, LVAD, XXXXX, XXXXX, XXXXX, XXXXX, HOME, PGDN, END,\
|
||||
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
_____, _____, XXXXX, _____, _____, XXXXX \
|
||||
//`--------------------' `--------------------'
|
||||
)
|
||||
};
|
||||
|
||||
int RGB_current_mode;
|
||||
#define L_BASE _BASE
|
||||
#define L_LOWER (1<<_LOWER)
|
||||
#define L_RAISE (1<<_RAISE)
|
||||
#define L_ADJUST (1<<_ADJUST)
|
||||
#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
|
||||
|
||||
// Setting ADJUST layer RGB back to default
|
||||
static inline void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
||||
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
|
||||
layer_on(layer3);
|
||||
} else {
|
||||
layer_off(layer3);
|
||||
#ifdef SSD1306OLED
|
||||
typedef struct {
|
||||
uint8_t state;
|
||||
char name[8];
|
||||
}LAYER_DISPLAY_NAME;
|
||||
|
||||
#define LAYER_DISPLAY_MAX 5
|
||||
const LAYER_DISPLAY_NAME layer_display_name[LAYER_DISPLAY_MAX] = {
|
||||
{L_BASE, "Base"},
|
||||
{L_BASE + 1, "Base"},
|
||||
{L_LOWER, "Lower"},
|
||||
{L_RAISE, "Raise"},
|
||||
{L_ADJUST_TRI, "Adjust"}
|
||||
};
|
||||
|
||||
static inline const char* get_leyer_status(void) {
|
||||
|
||||
for (uint8_t i = 0; i < LAYER_DISPLAY_MAX; ++i) {
|
||||
if (layer_state == 0 && layer_display_name[i].state == default_layer_state) {
|
||||
|
||||
return layer_display_name[i].name;
|
||||
} else if (layer_state != 0 && layer_display_name[i].state == layer_state) {
|
||||
|
||||
return layer_display_name[i].name;
|
||||
}
|
||||
}
|
||||
|
||||
return "?";
|
||||
}
|
||||
|
||||
static char layer_status_buf[24] = "Layer state ready.\n";
|
||||
static inline void update_keymap_status(void) {
|
||||
|
||||
snprintf(layer_status_buf, sizeof(layer_status_buf) - 1, "OS:%s Layer:%s\n",
|
||||
keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status());
|
||||
}
|
||||
|
||||
static inline void render_keymap_status(struct CharacterMatrix *matrix) {
|
||||
|
||||
matrix_write(matrix, layer_status_buf);
|
||||
}
|
||||
|
||||
#define UPDATE_KEYMAP_STATUS() update_keymap_status()
|
||||
#define RENDER_KEYMAP_STATUS(a) render_keymap_status(a)
|
||||
|
||||
#else
|
||||
|
||||
#define UPDATE_KEYMAP_STATUS()
|
||||
#define RENDER_KEYMAP_STATUS(a)
|
||||
|
||||
#endif
|
||||
|
||||
static inline void update_change_layer(bool pressed, uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
||||
|
||||
pressed ? layer_on(layer1) : layer_off(layer1);
|
||||
IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2) ? layer_on(layer3) : layer_off(layer3);
|
||||
}
|
||||
|
||||
int RGB_current_mode;
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
UPDATE_KEY_STATUS(keycode, record);
|
||||
|
||||
bool result = false;
|
||||
switch (keycode) {
|
||||
case LOWER:
|
||||
update_change_layer(record->event.pressed, _LOWER, _RAISE, _ADJUST);
|
||||
break;
|
||||
case RAISE:
|
||||
update_change_layer(record->event.pressed, _RAISE, _LOWER, _ADJUST);
|
||||
break;
|
||||
case KANJI:
|
||||
if (record->event.pressed) {
|
||||
if (keymap_config.swap_lalt_lgui == false) {
|
||||
register_code(KC_LANG2);
|
||||
} else {
|
||||
SEND_STRING(SS_LALT("`"));
|
||||
}
|
||||
} else {
|
||||
unregister_code(KC_LANG2);
|
||||
}
|
||||
break;
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
case RGB_MOD:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(RGB_current_mode);
|
||||
rgblight_step();
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
}
|
||||
break;
|
||||
case RGBRST:
|
||||
if (record->event.pressed) {
|
||||
eeconfig_update_rgblight_default();
|
||||
rgblight_enable();
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
UPDATE_KEYMAP_STATUS();
|
||||
return result;
|
||||
}
|
||||
|
||||
void matrix_init_user(void) {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
#endif
|
||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
||||
#ifdef SSD1306OLED
|
||||
iota_gfx_init(!has_usb()); // turns on the display
|
||||
#endif
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
#endif
|
||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
||||
#ifdef SSD1306OLED
|
||||
iota_gfx_init(!has_usb()); // turns on the display
|
||||
#endif
|
||||
}
|
||||
|
||||
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
|
||||
#ifdef SSD1306OLED
|
||||
|
||||
|
||||
// When add source files to SRC in rules.mk, you can use functions.
|
||||
const char *read_layer_state(void);
|
||||
const char *read_logo(void);
|
||||
void set_keylog(uint16_t keycode, keyrecord_t *record);
|
||||
const char *read_keylog(void);
|
||||
const char *read_keylogs(void);
|
||||
|
||||
// const char *read_mode_icon(bool swap);
|
||||
// const char *read_host_led_state(void);
|
||||
// void set_timelog(void);
|
||||
// const char *read_timelog(void);
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
const char *read_rgb_info(void);
|
||||
#define RENDER_RGB_INFO(m) matrix_write_ln(m, (const char*)read_rgb_info())
|
||||
#else
|
||||
#define RENDER_RGB_INFO(m)
|
||||
#endif
|
||||
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
iota_gfx_task();
|
||||
iota_gfx_task(); // this is what updates the display continuously
|
||||
}
|
||||
|
||||
static inline void matrix_render_user(struct CharacterMatrix *matrix) {
|
||||
if (is_master) {
|
||||
// If you want to change the display of OLED, you need to change here
|
||||
matrix_write_ln(matrix, read_layer_state());
|
||||
matrix_write_ln(matrix, read_keylog());
|
||||
RENDER_RGB_INFO(matrix);
|
||||
// matrix_write_ln(matrix, read_keylogs());
|
||||
// matrix_write_ln(matrix, read_host_led_state());
|
||||
|
||||
// matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui));
|
||||
// matrix_write_ln(matrix, read_timelog());
|
||||
} else {
|
||||
matrix_write(matrix, read_logo());
|
||||
}
|
||||
}
|
||||
|
||||
static inline void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
|
||||
static inline 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;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void render_status(struct CharacterMatrix *matrix) {
|
||||
|
||||
UPDATE_LED_STATUS();
|
||||
RENDER_LED_STATUS(matrix);
|
||||
RENDER_KEYMAP_STATUS(matrix);
|
||||
UPDATE_LOCK_STATUS();
|
||||
RENDER_LOCK_STATUS(matrix);
|
||||
RENDER_KEY_STATUS(matrix);
|
||||
}
|
||||
|
||||
void iota_gfx_task_user(void) {
|
||||
struct CharacterMatrix matrix;
|
||||
|
||||
#if DEBUG_TO_SCREEN
|
||||
if (debug_enable) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
matrix_clear(&matrix);
|
||||
matrix_render_user(&matrix);
|
||||
if (is_master) {
|
||||
render_status(&matrix);
|
||||
} else {
|
||||
RENDER_LOGO(&matrix);
|
||||
}
|
||||
|
||||
matrix_update(&display, &matrix);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
#ifdef SSD1306OLED
|
||||
if (record->event.pressed) {
|
||||
set_keylog(keycode, record);
|
||||
// set_timelog();
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (keycode) {
|
||||
case LOWER:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_LOWER);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
layer_off(_LOWER);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
break;
|
||||
case RAISE:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_RAISE);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
layer_off(_RAISE);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
break;
|
||||
case ADJUST:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_ADJUST);
|
||||
} else {
|
||||
layer_off(_ADJUST);
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
case RGB_MOD:
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(RGB_current_mode);
|
||||
rgblight_step();
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
}
|
||||
break;
|
||||
case RGBRST:
|
||||
if (record->event.pressed) {
|
||||
eeconfig_update_rgblight_default();
|
||||
rgblight_enable();
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
83
keyboards/crkbd/keymaps/like_jis/oled_helper.c
Normal file
83
keyboards/crkbd/keymaps/like_jis/oled_helper.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
#ifdef SSD1306OLED
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "ssd1306.h"
|
||||
|
||||
void render_logo(struct CharacterMatrix *matrix) {
|
||||
|
||||
const char logo_buf[]={
|
||||
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};
|
||||
|
||||
matrix_write(matrix, logo_buf);
|
||||
}
|
||||
|
||||
static char keylog_buf[24] = "Key state ready.";
|
||||
const char code_to_name[60] = {
|
||||
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
||||
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
||||
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
|
||||
'R', 'E', 'B', 'T', ' ', '-', ' ', '@', ' ', ' ',
|
||||
' ', ';', ':', ' ', ',', '.', '/', ' ', ' ', ' '};
|
||||
|
||||
void update_key_status(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
if (!record->event.pressed) return;
|
||||
|
||||
char name = (keycode < 60) ? code_to_name[keycode] : ' ';
|
||||
snprintf(keylog_buf, sizeof(keylog_buf) - 1, "Key:%dx%d %2x %c",
|
||||
record->event.key.row, record->event.key.col,
|
||||
(uint16_t)keycode, name);
|
||||
}
|
||||
|
||||
void render_key_status(struct CharacterMatrix *matrix) {
|
||||
|
||||
matrix_write(matrix, keylog_buf);
|
||||
}
|
||||
|
||||
static char lock_buf[24] = "Lock state ready.\n";
|
||||
void update_lock_status(void) {
|
||||
|
||||
uint8_t leds = host_keyboard_leds();
|
||||
char *num_lock = (leds & (1<<USB_LED_NUM_LOCK)) ? "Num" : "";
|
||||
char *caps_lock = (leds & (1<<USB_LED_CAPS_LOCK)) ? "Caps" : "";
|
||||
char *scrl_lock = (leds & (1<<USB_LED_SCROLL_LOCK)) ? "Scrn" : "";
|
||||
snprintf(lock_buf, sizeof(lock_buf) - 1, "Lock:%s %s %s\n",
|
||||
num_lock, caps_lock, scrl_lock);
|
||||
}
|
||||
|
||||
void render_lock_status(struct CharacterMatrix *matrix) {
|
||||
|
||||
matrix_write(matrix, lock_buf);
|
||||
}
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
extern rgblight_config_t rgblight_config;
|
||||
|
||||
static char led_buf[24] = "LED state ready.\n";
|
||||
rgblight_config_t rgblight_config_bak;
|
||||
void update_led_status(void) {
|
||||
|
||||
if (rgblight_config_bak.enable != rgblight_config.enable ||
|
||||
rgblight_config_bak.mode != rgblight_config.mode ||
|
||||
rgblight_config_bak.hue != rgblight_config.hue ||
|
||||
rgblight_config_bak.sat != rgblight_config.sat ||
|
||||
rgblight_config_bak.val != rgblight_config.val
|
||||
) {
|
||||
snprintf(led_buf, sizeof(led_buf) - 1, "LED%c:%2d hsv:%2d %2d %2d\n",
|
||||
rgblight_config.enable ? '*' : '.', (uint8_t)rgblight_config.mode,
|
||||
(uint8_t)(rgblight_config.hue / RGBLIGHT_HUE_STEP),
|
||||
(uint8_t)(rgblight_config.sat / RGBLIGHT_SAT_STEP),
|
||||
(uint8_t)(rgblight_config.val / RGBLIGHT_VAL_STEP));
|
||||
rgblight_config_bak = rgblight_config;
|
||||
}
|
||||
}
|
||||
|
||||
void render_led_status(struct CharacterMatrix *matrix) {
|
||||
|
||||
matrix_write(matrix, led_buf);
|
||||
}
|
||||
#endif
|
||||
#endif
|
35
keyboards/crkbd/keymaps/like_jis/oled_helper.h
Normal file
35
keyboards/crkbd/keymaps/like_jis/oled_helper.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifdef SSD1306OLED
|
||||
|
||||
void render_logo(struct CharacterMatrix *matrix);
|
||||
void update_key_status(uint16_t keycode, keyrecord_t *record);
|
||||
void render_key_status(struct CharacterMatrix *matrix);
|
||||
void update_lock_status(void);
|
||||
void render_lock_status(struct CharacterMatrix *matrix);
|
||||
|
||||
#define RENDER_LOGO(a) render_logo(a)
|
||||
#define UPDATE_KEY_STATUS(a, b) update_key_status(a, b)
|
||||
#define RENDER_KEY_STATUS(a) render_key_status(a)
|
||||
#define UPDATE_LOCK_STATUS() update_lock_status()
|
||||
#define RENDER_LOCK_STATUS(a) render_lock_status(a)
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
void update_led_status(void);
|
||||
void render_led_status(struct CharacterMatrix *matrix);
|
||||
#define UPDATE_LED_STATUS() update_led_status()
|
||||
#define RENDER_LED_STATUS(a) render_led_status(a)
|
||||
#else
|
||||
#define UPDATE_LED_STATUS()
|
||||
#define RENDER_LED_STATUS(a)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define RENDER_LOGO(a)
|
||||
#define UPDATE_KEY_STATUS(a, b)
|
||||
#define RENDER_KEY_STATUS(a)
|
||||
#define UPDATE_LOCK_STATUS()
|
||||
#define RENDER_LOCK_STATUS(a)
|
||||
#define UPDATE_LED_STATUS()
|
||||
#define RENDER_LED_STATUS(a)
|
||||
|
||||
#endif
|
|
@ -14,18 +14,19 @@ MIDI_ENABLE = no # MIDI controls
|
|||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
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
|
||||
TAP_DANCE_ENABLE = yes
|
||||
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
Link_Time_Optimization = yes # if firmware size over limit, try this option
|
||||
|
||||
ifeq ($(strip $(Link_Time_Optimization)),yes)
|
||||
EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization
|
||||
endif
|
||||
|
||||
# If you want to change the display of OLED, you need to change here
|
||||
SRC += ./lib/glcdfont.c \
|
||||
./lib/rgb_state_reader.c \
|
||||
./lib/layer_state_reader.c \
|
||||
./lib/logo_reader.c \
|
||||
./lib/keylogger.c \
|
||||
# ./lib/mode_icon_reader.c \
|
||||
# ./lib/host_led_state_reader.c \
|
||||
# ./lib/timelogger.c \
|
||||
oled_helper.c \
|
||||
|
|
Loading…
Reference in a new issue