|
|
|
@ -0,0 +1,191 @@
|
|
|
|
|
// Copyright 2022 Tommy Oldfield (@oldfieldtc)
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
#include QMK_KEYBOARD_H
|
|
|
|
|
|
|
|
|
|
enum layer_number {
|
|
|
|
|
_QWERTY = 0,
|
|
|
|
|
_LOWER,
|
|
|
|
|
_RAISE,
|
|
|
|
|
_ADJUST,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void render_logo(void);
|
|
|
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
|
|
|
|
|
|
/* QWERTY
|
|
|
|
|
* ,-----------------------------------------. ,-----------------------------------------.
|
|
|
|
|
* | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |BackSP|
|
|
|
|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
|
|
|
* | Tab | Q | W | E | R | T | | Y | U | I | O | P | - |
|
|
|
|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
|
|
|
* |LCTRL | A | S | D | F | G |-------. ,-------| H | J | K | L | ; | ' |
|
|
|
|
|
* |------+------+------+------+------+------| [ | | ] |------+------+------+------+------+------|
|
|
|
|
|
* |LShift| Z | X | C | V | B |-------| |-------| N | M | , | . | / |RShift|
|
|
|
|
|
* `-----------------------------------------/ / \ \-----------------------------------------'
|
|
|
|
|
* |LAlt/⌥|LGUI/⌘|LOWER| /Space / \Enter \ |RAISE | Play |RGUI/⌘ |
|
|
|
|
|
* | | | |/ / \ \ | | | |
|
|
|
|
|
* `----------------------------' '------''--------------------'
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
[_QWERTY] = LAYOUT(
|
|
|
|
|
KC_ESC, 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_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS,
|
|
|
|
|
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
|
|
|
|
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
|
|
|
|
|
KC_LALT, KC_LGUI, MO(1), KC_SPC, KC_ENT, MO(2), KC_MPLY, KC_RGUI
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
/* LOWER
|
|
|
|
|
* ,-----------------------------------------. ,-----------------------------------------.
|
|
|
|
|
* | Mute |Vol - |Vol + | Play | Rwd | Fwd | | | | | | | DEL |
|
|
|
|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
|
|
|
* | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |
|
|
|
|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
|
|
|
* | ` | ! | @ | # | $ | % |-------. ,-------| ^ | & | * | ( | ) | ~ |
|
|
|
|
|
* |------+------+------+------+------+------| | | |------+------+------+------+------+------|
|
|
|
|
|
* | Caps | | | | | |-------| |-------| | _ | + | { | } | |\ |
|
|
|
|
|
* `-----------------------------------------/ / \ \-----------------------------------------'
|
|
|
|
|
* | | |LOWER | / / \ \ |RAISE | | |
|
|
|
|
|
* | | | |/ / \ \ | | | |
|
|
|
|
|
* `----------------------------' '------''--------------------'
|
|
|
|
|
*/
|
|
|
|
|
[_LOWER] = LAYOUT(
|
|
|
|
|
KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MRWD, KC_MFFD, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_DEL,
|
|
|
|
|
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
|
|
|
|
|
KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_NONUS_HASH,
|
|
|
|
|
KC_CAPS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_NONUS_BACKSLASH,
|
|
|
|
|
KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
/* RAISE
|
|
|
|
|
* ,-----------------------------------------. ,-----------------------------------------.
|
|
|
|
|
* | | | | | | | | | | | | | |
|
|
|
|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
|
|
|
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | |
|
|
|
|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
|
|
|
* | F1 | F2 | F3 | F4 | F5 | F6 |-------. ,-------| | Left | Down | Up |Right | |
|
|
|
|
|
* |------+------+------+------+------+------| | | |------+------+------+------+------+------|
|
|
|
|
|
* | F7 | F8 | F9 | F10 | F11 | F12 |-------| |-------| + | - | = | [ | ] | # |
|
|
|
|
|
* `-----------------------------------------/ / \ \-----------------------------------------'
|
|
|
|
|
* | | |LOWER | / / \ \ |RAISE | | |
|
|
|
|
|
* | | | |/ / \ \ | | | |
|
|
|
|
|
* `----------------------------' '------''--------------------'
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
[_RAISE] = LAYOUT(
|
|
|
|
|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
|
|
|
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_NO,
|
|
|
|
|
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO,
|
|
|
|
|
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, KC_PLUS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
|
|
|
|
|
KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
/* ADJUST
|
|
|
|
|
* ,-----------------------------------------. ,-----------------------------------------.
|
|
|
|
|
* | | | | | | | | | | | | | |
|
|
|
|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
|
|
|
* | | | | | | | | | | | | | |
|
|
|
|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
|
|
|
* | | | | | | |-------. ,-------| | |RGB ON| HUE+ | SAT+ | VAL+ |
|
|
|
|
|
* |------+------+------+------+------+------| | | |------+------+------+------+------+------|
|
|
|
|
|
* | | | | | | |-------| |-------| | | MODE | HUE- | SAT- | VAL- |
|
|
|
|
|
* `-----------------------------------------/ / \ \-----------------------------------------'
|
|
|
|
|
* | | |LOWER | / / \ \ |RAISE | | |
|
|
|
|
|
* | | | |/ / \ \ | | | |
|
|
|
|
|
* `----------------------------' '------''--------------------'
|
|
|
|
|
*/
|
|
|
|
|
[_ADJUST] = LAYOUT(
|
|
|
|
|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
|
|
|
|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
|
|
|
|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI,
|
|
|
|
|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD,
|
|
|
|
|
KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO)
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
|
|
|
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SSD1306 OLED update loop, make sure to enable OLED_ENABLE=yes in rules.mk
|
|
|
|
|
#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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// When you 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);
|
|
|
|
|
|
|
|
|
|
bool oled_task_user(void) {
|
|
|
|
|
if (is_keyboard_master()) {
|
|
|
|
|
// If you want to change the display of OLED, you need to change here
|
|
|
|
|
oled_write_ln(read_layer_state(), false);
|
|
|
|
|
oled_write_ln(read_keylog(), false);
|
|
|
|
|
oled_write_ln(read_keylogs(), false);
|
|
|
|
|
|
|
|
|
|
oled_write_P(PSTR("WPM: "), false);
|
|
|
|
|
oled_write_ln(get_u8_str(get_current_wpm(), '0'), false);
|
|
|
|
|
} else {
|
|
|
|
|
render_logo();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endif // OLED_ENABLE
|
|
|
|
|
|
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
|
if (record->event.pressed) {
|
|
|
|
|
#ifdef OLED_ENABLE
|
|
|
|
|
set_keylog(keycode, record);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void render_logo(void) {
|
|
|
|
|
static const char PROGMEM my_logo[] = {
|
|
|
|
|
// 'punpun 2', 128x32px
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x80, 0xe0, 0x70, 0x38, 0x1c, 0x0c, 0x06, 0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
|
|
|
|
0x02, 0x02, 0x02, 0x06, 0x06, 0x06, 0x04, 0x04, 0x0c, 0x0c, 0x08, 0x08, 0x18, 0x18, 0x18, 0x10,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x3f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0x1c, 0x18, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0c, 0x18, 0x10, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x70, 0x38, 0x1c, 0x06, 0x03,
|
|
|
|
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x02, 0x06, 0x04, 0x04, 0x0c, 0x08, 0x18, 0x18
|
|
|
|
|
};
|
|
|
|
|
oled_write_raw_P(my_logo, sizeof(my_logo));
|
|
|
|
|
}
|