[Keyboard] Fixup Crkbd default keymap (#20962)
This commit is contained in:
		
							parent
							
								
									ab8c5013c8
								
							
						
					
					
						commit
						b93f05dc35
					
				
					 22 changed files with 308 additions and 495 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,7 @@
 | 
			
		|||
{
 | 
			
		||||
    "features": {
 | 
			
		||||
        "rgb_matrix": true
 | 
			
		||||
    },
 | 
			
		||||
    "split": {
 | 
			
		||||
        "soft_serial_pin": "D2"
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			@ -110,5 +113,63 @@
 | 
			
		|||
                {"matrix": [7, 3], "x": 10, "y": 3.7}
 | 
			
		||||
            ]
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "rgb_matrix": {
 | 
			
		||||
        "layout": [
 | 
			
		||||
            {"x": 85, "y": 16, "flags": 2},
 | 
			
		||||
            {"x": 50, "y": 13, "flags": 2},
 | 
			
		||||
            {"x": 16, "y": 20, "flags": 2},
 | 
			
		||||
            {"x": 16, "y": 38, "flags": 2},
 | 
			
		||||
            {"x": 50, "y": 48, "flags": 2},
 | 
			
		||||
            {"x": 85, "y": 52, "flags": 2},
 | 
			
		||||
            {"matrix": [3, 5], "x": 95, "y": 63, "flags": 1},
 | 
			
		||||
            {"matrix": [2, 5], "x": 85, "y": 39, "flags": 4},
 | 
			
		||||
            {"matrix": [1, 5], "x": 85, "y": 21, "flags": 4},
 | 
			
		||||
            {"matrix": [0, 5], "x": 85, "y": 4, "flags": 4},
 | 
			
		||||
            {"matrix": [0, 4], "x": 68, "y": 2, "flags": 4},
 | 
			
		||||
            {"matrix": [1, 4], "x": 68, "y": 19, "flags": 4},
 | 
			
		||||
            {"matrix": [2, 4], "x": 68, "y": 37, "flags": 4},
 | 
			
		||||
            {"matrix": [3, 4], "x": 80, "y": 58, "flags": 1},
 | 
			
		||||
            {"matrix": [3, 3], "x": 60, "y": 55, "flags": 1},
 | 
			
		||||
            {"matrix": [2, 3], "x": 50, "y": 35, "flags": 4},
 | 
			
		||||
            {"matrix": [1, 3], "x": 50, "y": 13, "flags": 4},
 | 
			
		||||
            {"matrix": [0, 3], "x": 50, "y": 0, "flags": 4},
 | 
			
		||||
            {"matrix": [0, 2], "x": 33, "y": 3, "flags": 4},
 | 
			
		||||
            {"matrix": [1, 2], "x": 33, "y": 20, "flags": 4},
 | 
			
		||||
            {"matrix": [2, 2], "x": 33, "y": 37, "flags": 4},
 | 
			
		||||
            {"matrix": [2, 1], "x": 16, "y": 42, "flags": 4},
 | 
			
		||||
            {"matrix": [1, 1], "x": 16, "y": 24, "flags": 4},
 | 
			
		||||
            {"matrix": [0, 1], "x": 16, "y": 7, "flags": 4},
 | 
			
		||||
            {"matrix": [0, 0], "x": 0, "y": 7, "flags": 1},
 | 
			
		||||
            {"matrix": [1, 0], "x": 0, "y": 24, "flags": 1},
 | 
			
		||||
            {"matrix": [2, 0], "x": 0, "y": 41, "flags": 1},
 | 
			
		||||
            {"x": 139, "y": 16, "flags": 2},
 | 
			
		||||
            {"x": 174, "y": 13, "flags": 2},
 | 
			
		||||
            {"x": 208, "y": 20, "flags": 2},
 | 
			
		||||
            {"x": 208, "y": 38, "flags": 2},
 | 
			
		||||
            {"x": 174, "y": 48, "flags": 2},
 | 
			
		||||
            {"x": 139, "y": 52, "flags": 2},
 | 
			
		||||
            {"matrix": [7, 5], "x": 129, "y": 63, "flags": 1},
 | 
			
		||||
            {"matrix": [6, 5], "x": 139, "y": 39, "flags": 4},
 | 
			
		||||
            {"matrix": [5, 5], "x": 139, "y": 21, "flags": 4},
 | 
			
		||||
            {"matrix": [4, 5], "x": 139, "y": 4, "flags": 4},
 | 
			
		||||
            {"matrix": [4, 4], "x": 156, "y": 2, "flags": 4},
 | 
			
		||||
            {"matrix": [5, 4], "x": 156, "y": 19, "flags": 4},
 | 
			
		||||
            {"matrix": [6, 4], "x": 156, "y": 37, "flags": 4},
 | 
			
		||||
            {"matrix": [7, 4], "x": 144, "y": 58, "flags": 1},
 | 
			
		||||
            {"matrix": [7, 3], "x": 164, "y": 55, "flags": 1},
 | 
			
		||||
            {"matrix": [6, 3], "x": 174, "y": 35, "flags": 4},
 | 
			
		||||
            {"matrix": [5, 3], "x": 174, "y": 13, "flags": 4},
 | 
			
		||||
            {"matrix": [4, 3], "x": 174, "y": 0, "flags": 4},
 | 
			
		||||
            {"matrix": [4, 2], "x": 191, "y": 3, "flags": 4},
 | 
			
		||||
            {"matrix": [5, 2], "x": 191, "y": 20, "flags": 4},
 | 
			
		||||
            {"matrix": [6, 2], "x": 191, "y": 37, "flags": 4},
 | 
			
		||||
            {"matrix": [6, 1], "x": 208, "y": 42, "flags": 4},
 | 
			
		||||
            {"matrix": [5, 1], "x": 208, "y": 24, "flags": 4},
 | 
			
		||||
            {"matrix": [4, 1], "x": 208, "y": 7, "flags": 4},
 | 
			
		||||
            {"matrix": [4, 0], "x": 224, "y": 7, "flags": 1},
 | 
			
		||||
            {"matrix": [5, 0], "x": 224, "y": 24, "flags": 1},
 | 
			
		||||
            {"matrix": [6, 0], "x": 224, "y": 41, "flags": 1}
 | 
			
		||||
        ]
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -88,98 +88,7 @@ led_config_t g_led_config = { {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
 | 
			
		||||
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
 | 
			
		||||
  if (!is_keyboard_master()) {
 | 
			
		||||
    return OLED_ROTATION_180;  // flips the display 180 degrees if offhand
 | 
			
		||||
  }
 | 
			
		||||
  return rotation;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
enum Layers{
 | 
			
		||||
    L_BASE, L_LOWER, L_RAISE, L_ADJUST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void oled_render_layer_state_r2g(void) {
 | 
			
		||||
    oled_write_P(PSTR("Layer: "), false);
 | 
			
		||||
    switch (get_highest_layer(layer_state)) {
 | 
			
		||||
        case L_BASE:
 | 
			
		||||
            oled_write_ln_P(PSTR("Default"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        case L_LOWER:
 | 
			
		||||
            oled_write_ln_P(PSTR("Lower"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        case L_RAISE:
 | 
			
		||||
            oled_write_ln_P(PSTR("Raise"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        case L_ADJUST:
 | 
			
		||||
            oled_write_ln_P(PSTR("Adjust"), false);
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//char keylog_str_r2g[24] = {};
 | 
			
		||||
 | 
			
		||||
const char code_to_name_r2g[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', '_', '-', '=', '[', ']', '\\',
 | 
			
		||||
    '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
 | 
			
		||||
 | 
			
		||||
char key_name_r2g = ' ';
 | 
			
		||||
uint16_t last_keycode_r2g;
 | 
			
		||||
uint8_t last_row_r2g;
 | 
			
		||||
uint8_t last_col_r2g;
 | 
			
		||||
 | 
			
		||||
void set_keylog_r2g(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    key_name_r2g = ' ';
 | 
			
		||||
    last_keycode_r2g = keycode;
 | 
			
		||||
    if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
 | 
			
		||||
        (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { last_keycode_r2g = keycode & 0xFF; }
 | 
			
		||||
    if (keycode < 60) {
 | 
			
		||||
      key_name_r2g = code_to_name_r2g[keycode];
 | 
			
		||||
    }
 | 
			
		||||
    last_row_r2g = record->event.key.row;
 | 
			
		||||
    last_col_r2g = record->event.key.col;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *depad_str(const char *depad_str, char depad_char) {
 | 
			
		||||
    while (*depad_str == depad_char) ++depad_str;
 | 
			
		||||
    return depad_str;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void oled_render_keylog_r2g(void) {
 | 
			
		||||
    //oled_write(keylog_str_r2g, false);
 | 
			
		||||
    const char *last_row_r2g_str = get_u8_str(last_row_r2g, ' ');
 | 
			
		||||
    oled_write(depad_str(last_row_r2g_str, ' '), false);
 | 
			
		||||
    oled_write_P(PSTR("x"), false);
 | 
			
		||||
    const char *last_col_r2g_str = get_u8_str(last_col_r2g, ' ');
 | 
			
		||||
    oled_write(depad_str(last_col_r2g_str, ' '), false);
 | 
			
		||||
    oled_write_P(PSTR(", k"), false);
 | 
			
		||||
    const char *last_keycode_r2g_str = get_u16_str(last_keycode_r2g, ' ');
 | 
			
		||||
    oled_write(depad_str(last_keycode_r2g_str, ' '), false);
 | 
			
		||||
    oled_write_P(PSTR(":"), false);
 | 
			
		||||
    oled_write_char(key_name_r2g, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void render_bootmagic_status_r2g(bool status) {
 | 
			
		||||
    /* Show Ctrl-Gui Swap options */
 | 
			
		||||
    static const char PROGMEM logo[][2][3] = {
 | 
			
		||||
        {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
 | 
			
		||||
        {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
 | 
			
		||||
    };
 | 
			
		||||
    if (status) {
 | 
			
		||||
        oled_write_ln_P(logo[0][0], false);
 | 
			
		||||
        oled_write_ln_P(logo[0][1], false);
 | 
			
		||||
    } else {
 | 
			
		||||
        oled_write_ln_P(logo[1][0], false);
 | 
			
		||||
        oled_write_ln_P(logo[1][1], false);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void oled_render_logo_r2g(void) {
 | 
			
		||||
void oled_render_logo(void) {
 | 
			
		||||
    static const char PROGMEM mb_logo[] = {
 | 
			
		||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
 | 
			
		||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
 | 
			
		||||
| 
						 | 
				
			
			@ -218,23 +127,4 @@ void oled_render_logo_r2g(void) {
 | 
			
		|||
    //oled_set_cursor(oled_max_chars()/2,oled_max_lines()/2);
 | 
			
		||||
    //oled_write_P(PSTR("R2G"), false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool oled_task_kb(void) {
 | 
			
		||||
    if (!oled_task_user()) { return false; }
 | 
			
		||||
    if (is_keyboard_master()) {
 | 
			
		||||
        oled_render_layer_state_r2g();
 | 
			
		||||
        oled_render_keylog_r2g();
 | 
			
		||||
    } else {
 | 
			
		||||
        oled_render_logo_r2g();
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
  if (record->event.pressed) {
 | 
			
		||||
    set_keylog_r2g(keycode, record);
 | 
			
		||||
  }
 | 
			
		||||
  return process_record_user(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
#endif // OLED_ENABLE
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +0,0 @@
 | 
			
		|||
OLED_ENABLE     = yes
 | 
			
		||||
OLED_DRIVER     = SSD1306
 | 
			
		||||
LTO_ENABLE      = yes
 | 
			
		||||
RGBLIGHT_ENABLE = yes
 | 
			
		||||
 | 
			
		||||
SPLIT_KEYBOARD = yes
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue