2016-06-02 03:41:51 +02:00
|
|
|
|
2018-11-27 05:57:15 +01:00
|
|
|
#include QMK_KEYBOARD_H
|
2016-06-02 03:41:51 +02:00
|
|
|
#include "led.h"
|
|
|
|
|
2018-11-27 05:57:15 +01:00
|
|
|
enum layers {
|
|
|
|
LAYER_BASE,
|
|
|
|
LAYER_EDIT,
|
|
|
|
LAYER_FUNCTION
|
|
|
|
};
|
2016-06-02 03:41:51 +02:00
|
|
|
|
2018-11-27 05:57:15 +01:00
|
|
|
enum custom_keycodes {
|
|
|
|
M_COPY = SAFE_RANGE, // KC_FN5: MACRO_COPY_CUT
|
|
|
|
M_SHFCT, // KC_FN6: MACRO_SHIFT_CONTROL
|
|
|
|
M_CTALT // KC_FN7: MACRO_CONTROL_ALT
|
|
|
|
};
|
2016-06-02 03:41:51 +02:00
|
|
|
|
|
|
|
#define SC_UNDO LCTL(KC_Z)
|
|
|
|
#define SC_REDO LCTL(KC_Y)
|
|
|
|
#define SC_CUT LCTL(KC_X)
|
|
|
|
#define SC_COPY LCTL(KC_C)
|
|
|
|
#define SC_PSTE LCTL(KC_V)
|
|
|
|
#define SC_SELA LCTL(KC_A)
|
|
|
|
#define SC_SAVE LCTL(KC_S)
|
|
|
|
#define SC_OPEN LCTL(KC_O)
|
|
|
|
#define SC_ACLS LALT(KC_F4)
|
|
|
|
#define SC_CCLS LCTL(KC_F4)
|
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
|
2021-12-14 13:41:16 +01:00
|
|
|
[LAYER_BASE] = LAYOUT(
|
|
|
|
KC_ESC, KC_TAB, KC_BSLS, MO(2),
|
2022-10-15 23:29:43 +02:00
|
|
|
KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
|
2021-12-14 13:41:16 +01:00
|
|
|
KC_P7, KC_P8, KC_P9, KC_PEQL,
|
|
|
|
KC_P4, KC_P5, KC_P6, KC_PPLS,
|
|
|
|
KC_P1, KC_P2, KC_P3, XXXXXXX,
|
2016-06-02 03:41:51 +02:00
|
|
|
KC_P0, KC_PCMM, KC_PDOT, KC_PENT ),
|
|
|
|
|
2021-12-14 13:41:16 +01:00
|
|
|
[LAYER_EDIT] = LAYOUT(
|
|
|
|
KC_ESC, KC_TAB, KC_SPC, _______,
|
|
|
|
TG(1), SC_PSTE, SC_REDO, SC_UNDO,
|
|
|
|
KC_HOME, KC_UP, KC_PGUP, KC_LALT,
|
|
|
|
KC_LEFT, M_COPY, KC_RGHT, KC_LCTL,
|
|
|
|
KC_END, KC_DOWN, KC_PGDN, XXXXXXX,
|
2018-11-27 05:57:15 +01:00
|
|
|
KC_BSPC, KC_PENT, KC_DEL, M_SHFCT ),
|
2016-06-02 03:41:51 +02:00
|
|
|
|
2021-12-14 13:41:16 +01:00
|
|
|
[LAYER_FUNCTION] = LAYOUT(
|
2022-11-05 22:11:59 +01:00
|
|
|
BL_TOGG, BL_UP, BL_DOWN, _______,
|
2021-12-14 13:41:16 +01:00
|
|
|
TG(1), _______, _______, _______,
|
|
|
|
_______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______,
|
|
|
|
_______, _______, _______, XXXXXXX,
|
2022-08-22 00:55:30 +02:00
|
|
|
QK_BOOT, _______, _______, _______ ),
|
2016-06-02 03:41:51 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-11-27 05:57:15 +01:00
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t * record) {
|
|
|
|
// MACRODOWN only works in this function
|
|
|
|
switch (keycode) {
|
|
|
|
|
|
|
|
case M_COPY:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
register_code(KC_LCTL);
|
|
|
|
if (record->tap.count == 1) {
|
|
|
|
register_code(KC_C);
|
|
|
|
unregister_code(KC_C);
|
|
|
|
} else if (record->tap.count == 2) {
|
|
|
|
register_code(KC_X);
|
|
|
|
unregister_code(KC_X);
|
|
|
|
}
|
|
|
|
unregister_code(KC_LCTL);
|
|
|
|
}
|
|
|
|
break;
|
2016-06-02 03:41:51 +02:00
|
|
|
|
2018-11-27 05:57:15 +01:00
|
|
|
case M_SHFCT:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
if (record->tap.count <= 2) register_mods(MOD_BIT(KC_LSFT));
|
|
|
|
if (record->tap.count == 2) register_mods(MOD_BIT(KC_LCTL));
|
|
|
|
if (record->tap.count == 3) register_code(KC_PENT);;
|
|
|
|
} else {
|
|
|
|
unregister_mods(MOD_BIT(KC_LSFT) | MOD_BIT(KC_LCTL));
|
|
|
|
unregister_code(KC_PENT);
|
|
|
|
}
|
|
|
|
break;
|
2016-06-02 03:41:51 +02:00
|
|
|
|
2018-11-27 05:57:15 +01:00
|
|
|
case M_CTALT:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
if (record->tap.count < 2) register_mods(MOD_BIT(KC_LCTL));
|
|
|
|
if (record->tap.count >= 2) register_mods(MOD_BIT(KC_LALT));
|
|
|
|
} else {
|
|
|
|
unregister_mods(MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT));
|
2016-06-02 03:41:51 +02:00
|
|
|
}
|
2018-11-27 05:57:15 +01:00
|
|
|
break;
|
|
|
|
}
|
2016-06-02 03:41:51 +02:00
|
|
|
|
2018-11-27 05:57:15 +01:00
|
|
|
return true;
|
2016-06-02 03:41:51 +02:00
|
|
|
}
|
|
|
|
|
2023-07-02 20:35:41 +02:00
|
|
|
bool led_update_user(led_t led_state)
|
2016-06-02 03:41:51 +02:00
|
|
|
{
|
2023-07-02 20:35:41 +02:00
|
|
|
if (led_state.caps_lock) {
|
2016-06-02 03:41:51 +02:00
|
|
|
// output high
|
2024-05-02 11:48:49 +02:00
|
|
|
gpio_set_pin_output(D6);
|
|
|
|
gpio_write_pin_high(D6);
|
2016-06-02 03:41:51 +02:00
|
|
|
} else {
|
|
|
|
// Hi-Z
|
2024-05-02 11:48:49 +02:00
|
|
|
gpio_set_pin_input(D6);
|
2016-06-02 03:41:51 +02:00
|
|
|
}
|
2023-07-02 20:35:41 +02:00
|
|
|
if (led_state.num_lock) {
|
2016-06-02 03:41:51 +02:00
|
|
|
// output low
|
2024-05-02 11:48:49 +02:00
|
|
|
gpio_set_pin_output(C7);
|
|
|
|
gpio_write_pin_low(C7);
|
2016-06-02 03:41:51 +02:00
|
|
|
} else {
|
|
|
|
// Hi-Z
|
2024-05-02 11:48:49 +02:00
|
|
|
gpio_set_pin_input(C7);
|
2016-06-02 03:41:51 +02:00
|
|
|
}
|
2023-07-02 20:35:41 +02:00
|
|
|
return false;
|
2018-04-07 21:14:53 +02:00
|
|
|
}
|