[Keyboard] Fixup Crkbd default keymap (#20962)

This commit is contained in:
Drashna Jaelre 2023-05-20 05:13:39 -07:00 committed by GitHub
parent ab8c5013c8
commit b93f05dc35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 308 additions and 495 deletions

View File

@ -19,17 +19,145 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h" #include "quantum.h"
#ifdef SWAP_HANDS_ENABLE #ifdef SWAP_HANDS_ENABLE
__attribute__ ((weak)) __attribute__((weak)) const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { // Left
// Left {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}},
{{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}}, {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}},
{{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}}, {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}},
{{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}, {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}},
{{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}}, // Right
// Right {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}},
{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}, {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}},
{{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}}, {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}},
{{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}}, {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}
{{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}
}; };
#endif #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;
}
static void oled_render_layer_state(void) {
oled_write_P(PSTR("Layer: "), false);
switch (get_highest_layer(layer_state)) {
case 0:
oled_write_ln_P(PSTR("Default"), false);
break;
case 1:
oled_write_ln_P(PSTR("Lower"), false);
break;
case 2:
oled_write_ln_P(PSTR("Raise"), false);
break;
case 3:
oled_write_ln_P(PSTR("Adjust"), false);
break;
default:
oled_write_ln_P(PSTR("Undef"), false);
break;
}
}
char key_name = ' ';
uint16_t last_keycode;
uint8_t last_row;
uint8_t last_col;
static const char PROGMEM 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', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
static void set_keylog(uint16_t keycode, keyrecord_t *record) {
key_name = ' ';
last_keycode = keycode;
if (IS_QK_MOD_TAP(keycode)) {
if (record->tap.count) {
keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
} else {
keycode = 0xE0 + biton(QK_MOD_TAP_GET_MODS(keycode) & 0xF) + biton(QK_MOD_TAP_GET_MODS(keycode) & 0x10);
}
} else if (IS_QK_LAYER_TAP(keycode) && record->tap.count) {
keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
} else if (IS_QK_MODS(keycode)) {
keycode = QK_MODS_GET_BASIC_KEYCODE(keycode);
} else if (IS_QK_ONE_SHOT_MOD(keycode)) {
keycode = 0xE0 + biton(QK_ONE_SHOT_MOD_GET_MODS(keycode) & 0xF) + biton(QK_ONE_SHOT_MOD_GET_MODS(keycode) & 0x10);
}
if (keycode > ARRAY_SIZE(code_to_name)) {
return;
}
// update keylog
key_name = code_to_name[keycode];
last_row = record->event.key.row;
last_col = record->event.key.col;
}
static const char *depad_str(const char *depad_str, char depad_char) {
while (*depad_str == depad_char)
++depad_str;
return depad_str;
}
static void oled_render_keylog(void) {
const char *last_row_str = get_u8_str(last_row, ' ');
oled_write(depad_str(last_row_str, ' '), false);
oled_write_P(PSTR("x"), false);
const char *last_col_str = get_u8_str(last_col, ' ');
oled_write(depad_str(last_col_str, ' '), false);
oled_write_P(PSTR(", k"), false);
const char *last_keycode_str = get_u16_str(last_keycode, ' ');
oled_write(depad_str(last_keycode_str, ' '), false);
oled_write_P(PSTR(":"), false);
oled_write_char(key_name, false);
}
// static void render_bootmagic_status(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);
// }
// }
__attribute__((weak)) void oled_render_logo(void) {
// clang-format off
static const char PROGMEM crkbd_logo[] = {
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};
// clang-format on
oled_write_P(crkbd_logo, false);
}
bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
if (is_keyboard_master()) {
oled_render_layer_state();
oled_render_keylog();
} else {
oled_render_logo();
}
return false;
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
set_keylog(keycode, record);
}
return process_record_user(keycode, record);
}
#endif // OLED_ENABLE

View File

@ -1,21 +1,35 @@
{ {
"keyboard_name": "Corne", "keyboard_name": "Corne",
"manufacturer": "foostan", "manufacturer": "foostan",
"url": "", "url": "",
"maintainer": "qmk", "maintainer": "qmk",
"usb": { "usb": {
"vid": "0x4653", "vid": "0x4653",
"pid": "0x0001", "pid": "0x0001",
"device_version": "0.0.1" "device_version": "0.0.1"
}, },
"rgb_matrix": { "rgb_matrix": {
"driver": "WS2812" "driver": "WS2812"
}, },
"matrix_pins": { "features": {
"cols": ["F4", "F5", "F6", "F7", "B1", "B3"], "bootmagic": true,
"rows": ["D4", "C6", "D7", "E6"] "extrakey": true,
}, "lto": true,
"diode_direction": "COL2ROW", "mousekey": true,
"processor": "atmega32u4", "nkro": true,
"community_layouts": ["split_3x5_3", "split_3x6_3"] "oled": true
},
"build": {
"lto": true
},
"matrix_pins": {
"cols": [ "F4", "F5", "F6", "F7", "B1", "B3" ],
"rows": [ "D4", "C6", "D7", "E6" ]
},
"diode_direction": "COL2ROW",
"split": {
"enabled": true
},
"processor": "atmega32u4",
"community_layouts": [ "split_3x5_3", "split_3x6_3" ]
} }

View File

@ -47,5 +47,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_SAT_STEP 17 #define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17 #define RGBLIGHT_VAL_STEP 17
#endif #endif
#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c"

View File

@ -17,10 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include <stdio.h>
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_split_3x6_3( [0] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------. //,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
@ -33,7 +32,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
), ),
[1] = LAYOUT_split_3x6_3( [1] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------. //,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
@ -45,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//`--------------------------' `--------------------------' //`--------------------------' `--------------------------'
), ),
[2] = LAYOUT_split_3x6_3( [2] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------. //,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
@ -57,7 +56,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//`--------------------------' `--------------------------' //`--------------------------' `--------------------------'
), ),
[3] = LAYOUT_split_3x6_3( [3] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------. //,-----------------------------------------------------. ,-----------------------------------------------------.
QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
@ -69,108 +68,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//`--------------------------' `--------------------------' //`--------------------------' `--------------------------'
) )
}; };
#ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (!is_keyboard_master()) {
return OLED_ROTATION_180; // flips the display 180 degrees if offhand
}
return rotation;
}
#define L_BASE 0
#define L_LOWER 2
#define L_RAISE 4
#define L_ADJUST 8
void oled_render_layer_state(void) {
oled_write_P(PSTR("Layer: "), false);
switch (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:
case L_ADJUST|L_LOWER:
case L_ADJUST|L_RAISE:
case L_ADJUST|L_LOWER|L_RAISE:
oled_write_ln_P(PSTR("Adjust"), false);
break;
}
}
char keylog_str[24] = {};
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 set_keylog(uint16_t keycode, keyrecord_t *record) {
char name = ' ';
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
(keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; }
if (keycode < 60) {
name = code_to_name[keycode];
}
// update keylog
snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
record->event.key.row, record->event.key.col,
keycode, name);
}
void oled_render_keylog(void) {
oled_write(keylog_str, false);
}
void render_bootmagic_status(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(void) {
static const char PROGMEM crkbd_logo[] = {
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};
oled_write_P(crkbd_logo, false);
}
bool oled_task_user(void) {
if (is_keyboard_master()) {
oled_render_layer_state();
oled_render_keylog();
} else {
oled_render_logo();
}
return false;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
set_keylog(keycode, record);
}
return true;
}
#endif // OLED_ENABLE

View File

@ -1,5 +0,0 @@
MOUSEKEY_ENABLE = yes # Mouse keys
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
OLED_ENABLE = yes
OLED_DRIVER = SSD1306
LTO_ENABLE = yes

View File

@ -68,110 +68,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//`--------------------------' `--------------------------' //`--------------------------' `--------------------------'
) )
}; };
#ifdef OLED_ENABLE
#include <stdio.h>
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (!is_keyboard_master()) {
return OLED_ROTATION_180; // flips the display 180 degrees if offhand
}
return rotation;
}
#define L_BASE 0
#define L_LOWER 2
#define L_RAISE 4
#define L_ADJUST 8
void oled_render_layer_state(void) {
oled_write_P(PSTR("Layer: "), false);
switch (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:
case L_ADJUST|L_LOWER:
case L_ADJUST|L_RAISE:
case L_ADJUST|L_LOWER|L_RAISE:
oled_write_ln_P(PSTR("Adjust"), false);
break;
}
}
char keylog_str[24] = {};
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 set_keylog(uint16_t keycode, keyrecord_t *record) {
char name = ' ';
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
(keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; }
if (keycode < 60) {
name = code_to_name[keycode];
}
// update keylog
snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
record->event.key.row, record->event.key.col,
keycode, name);
}
void oled_render_keylog(void) {
oled_write(keylog_str, false);
}
void render_bootmagic_status(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(void) {
static const char PROGMEM crkbd_logo[] = {
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};
oled_write_P(crkbd_logo, false);
}
bool oled_task_user(void) {
if (is_keyboard_master()) {
oled_render_layer_state();
oled_render_keylog();
} else {
oled_render_logo();
}
return false;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
set_keylog(keycode, record);
}
return true;
}
#endif // OLED_ENABLE

View File

@ -1,6 +1,3 @@
MOUSEKEY_ENABLE = no # Mouse keys MOUSEKEY_ENABLE = no # Mouse keys
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
VIA_ENABLE = yes # Enable VIA VIA_ENABLE = yes # Enable VIA
OLED_ENABLE = yes
OLED_DRIVER = SSD1306
LTO_ENABLE = yes LTO_ENABLE = yes

View File

@ -1,5 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include "crkbd.h" #include "quantum.h"
char host_led_state_str[24]; char host_led_state_str[24];

View File

@ -1,5 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include "crkbd.h" #include "quantum.h"
char keylog_str[24] = {}; char keylog_str[24] = {};
char keylogs_str[21] = {}; char keylogs_str[21] = {};

View File

@ -1,4 +1,4 @@
#include "crkbd.h" #include "quantum.h"
const char *read_logo(void) { const char *read_logo(void) {
static char logo[] = { static char logo[] = {

View File

@ -1,5 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include "crkbd.h" #include "quantum.h"
char mode_icon[24]; char mode_icon[24];

View File

@ -1,6 +1,7 @@
#ifdef RGBLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE
#include <stdio.h> #include <stdio.h>
#include "quantum.h"
extern rgblight_config_t rgblight_config; extern rgblight_config_t rgblight_config;
char rbf_info_str[24]; char rbf_info_str[24];

View File

@ -1,5 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include "crkbd.h" #include "quantum.h"
char timelog_str[24] = {}; char timelog_str[24] = {};
int last_time = 0; int last_time = 0;

View File

@ -1,4 +1,7 @@
{ {
"features": {
"rgb_matrix": true
},
"split": { "split": {
"soft_serial_pin": "D2" "soft_serial_pin": "D2"
}, },
@ -110,5 +113,63 @@
{"matrix": [7, 3], "x": 10, "y": 3.7} {"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}
]
} }
} }

View File

@ -88,98 +88,7 @@ led_config_t g_led_config = { {
#endif #endif
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
void oled_render_logo(void) {
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) {
static const char PROGMEM mb_logo[] = { static const char PROGMEM mb_logo[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 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, 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_set_cursor(oled_max_chars()/2,oled_max_lines()/2);
//oled_write_P(PSTR("R2G"), false); //oled_write_P(PSTR("R2G"), false);
} }
#endif
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

View File

@ -1,6 +0,0 @@
OLED_ENABLE = yes
OLED_DRIVER = SSD1306
LTO_ENABLE = yes
RGBLIGHT_ENABLE = yes
SPLIT_KEYBOARD = yes

View File

@ -1 +0,0 @@
DEFAULT_FOLDER = crkbd/rev1

View File

@ -1,11 +1,72 @@
{ {
"features": {
"rgblight": true
},
"split": { "split": {
"soft_serial_pin": "D2" "soft_serial_pin": "D2"
}, },
"ws2812": { "ws2812": {
"pin": "D3" "pin": "D3"
}, },
"bootloader": "caterina", "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}
]
},
"development_board": "promicro",
"layout_aliases": { "layout_aliases": {
"LAYOUT": "LAYOUT_split_3x6_3" "LAYOUT": "LAYOUT_split_3x6_3"
}, },

View File

@ -1 +0,0 @@
DEFAULT_FOLDER = crkbd/rev1

View File

@ -1,96 +0,0 @@
/*
Copyright 2019 @foostan
Copyright 2020 Drashna Jaelre <@drashna>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
#ifdef RGB_MATRIX_ENABLE
// Logical Layout
// Columns
// Left
// 0 1 2 3 4 5
// ROWS
// 25 24 19 18 11 10 0
// 03 02 01
// 26 23 20 17 12 09 1
// 04 05 06
// 27 22 21 16 13 08 2
//
// 15 14 07 3
//
// Right
// 0 1 2 3 4 5
// ROWS
// 25 24 19 18 11 10 4
// 03 02 01
// 26 23 20 17 12 09 5
// 04 05 06
// 27 22 21 16 13 08 6
//
// 15 14 07 7
//
// Physical Layout
// Columns
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
// ROWS
// 25 24 19 18 11 10 10 11 18 19 24 25 0
// 03 02 01 01 02 03
// 26 23 20 17 12 09 09 12 17 20 23 26 1
// 04 04
// 27 22 21 16 13 08 08 13 16 21 22 27 2
// 05 06 06 05
// 15 14 07 07 14 15 3
led_config_t g_led_config = { {
{ 24, 23, 18, 17, 10, 9 },
{ 25, 22, 19, 16, 11, 8 },
{ 26, 21, 20, 15, 12, 7 },
{ NO_LED, NO_LED, NO_LED, 14, 13, 6 },
{ 51, 50, 45, 44, 37, 36 },
{ 52, 49, 46, 43, 38, 35 },
{ 53, 48, 47, 42, 39, 34 },
{ NO_LED, NO_LED, NO_LED, 41, 40, 33 }
}, {
{ 85, 16 }, { 50, 13 }, { 16, 20 }, { 16, 38 }, { 50, 48 }, { 85, 52 }, { 95, 63 },
{ 85, 39 }, { 85, 21 }, { 85, 4 }, { 68, 2 }, { 68, 19 }, { 68, 37 }, { 80, 58 },
{ 60, 55 }, { 50, 35 }, { 50, 13 }, { 50, 0 }, { 33, 3 }, { 33, 20 }, { 33, 37 },
{ 16, 42 }, { 16, 24 }, { 16, 7 }, { 0, 7 }, { 0, 24 }, { 0, 41 }, { 139, 16 },
{ 174, 13 }, { 208, 20 }, { 208, 38 }, { 174, 48 }, { 139, 52 }, { 129, 63 }, { 139, 39 },
{ 139, 21 }, { 139, 4 }, { 156, 2 }, { 156, 19 }, { 156, 37 }, { 144, 58 }, { 164, 55 },
{ 174, 35 }, { 174, 13 }, { 174, 0 }, { 191, 3 }, { 191, 20 }, { 191, 37 }, { 208, 42 },
{ 208, 24 }, { 208, 7 }, { 224, 7 }, { 224, 24 }, { 224, 41 }
}, {
2, 2, 2, 2, 2, 2, 1,
4, 4, 4, 4, 4, 4, 1,
1, 4, 4, 4, 4, 4, 4,
4, 4, 4, 1, 1, 1, 2,
2, 2, 2, 2, 2, 1, 4,
4, 4, 4, 4, 4, 1, 1,
4, 4, 4, 4, 4, 4, 4,
4, 4, 1, 1, 1
} };
void suspend_power_down_kb(void) {
rgb_matrix_set_suspend_state(true);
suspend_power_down_user();
}
void suspend_wakeup_init_kb(void) {
rgb_matrix_set_suspend_state(false);
suspend_wakeup_init_user();
}
#endif

View File

@ -1 +0,0 @@
SPLIT_KEYBOARD = yes

View File

@ -1,20 +1,6 @@
# Build Options # Build Options
# change yes to no to disable # change yes to no to disable
# #
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
RGB_MATRIX_ENABLE = no
LTO_ENABLE = yes
# if firmware size over limit, try this option
# LTO_ENABLE = yes
DEFAULT_FOLDER = crkbd/rev1 DEFAULT_FOLDER = crkbd/rev1