QMK/keyboards/lily58/keymaps/drashna/keymap.c

115 lines
5.3 KiB
C
Raw Normal View History

// #include QMK_KEYBOARD_H
#include "drashna.h"
uint8_t is_master;
// #ifdef PROTOCOL_LUFA
// #include "lufa.h"
// #include "split_util.h"
// #endif
// #ifdef SSD1306OLED
// #include "ssd1306.h"
// #endif
// clang-format off
#define LAYOUT_lily58_base( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
) \
LAYOUT_wrapper( \
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, K01, K02, K03, K04, K05, /*----*/ K06, K07, K08, K09, K0A, KC_GRV, \
KC_LSFT, K11, K12, K13, K14, K15, /*----*/ K16, K17, K18, K19, K1A, KC_QUOT, \
KC_LCTRL, K21, K22, K23, K24, K25, KC_CCCV, /*----*/ KC_LEAD, K26, K27, K28, K29, K2A, KC_MINS, \
KC_LALT, MO(_LOWER), LT(_NAV, KC_SPC), KC_ENT, /*----*/ KC_DEL, LT(_NAV, KC_SPC), MO(_RAISE), KC_TAB \
)
/* Re-pass though to allow templates to be used */
#define LAYOUT_lily58_base_wrapper(...) LAYOUT_lily58_base(__VA_ARGS__)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_lily58_base_wrapper(
_________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
_________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
_________________QWERTY_L3_________________, _________________QWERTY_R3_________________
),
[_WORKMAN] = LAYOUT_lily58_base_wrapper(
_________________WORKMAN_L1________________, _________________WORKMAN_R1________________,
_________________WORKMAN_L2________________, _________________WORKMAN_R2________________,
_________________WORKMAN_L3________________, _________________WORKMAN_R3________________
),
[_LOWER] = LAYOUT_lily58_base_wrapper(
_________________LOWER_L1__________________, _________________LOWER_R1__________________,
_________________LOWER_L2__________________, _________________LOWER_R2__________________,
_________________LOWER_L3__________________, _________________LOWER_R3__________________
),
[_RAISE] = LAYOUT_lily58_base_wrapper(
_________________RAISE_L1__________________, _________________RAISE_R1__________________,
_________________RAISE_L2__________________, _________________RAISE_R2__________________,
_________________RAISE_L3__________________, _________________RAISE_R3__________________
),
[_ADJUST] = LAYOUT_lily58_base_wrapper(
_________________ADJUST_L1_________________, _________________ADJUST_R1_________________,
_________________ADJUST_L2_________________, _________________ADJUST_R2_________________,
_________________ADJUST_L3_________________, _________________ADJUST_R3_________________
),
[_NAV] = LAYOUT_lily58_base_wrapper(
___________________NAV_L1__________________, ___________________NAV_R1__________________,
___________________NAV_L2__________________, ___________________NAV_R2__________________,
___________________NAV_L3__________________, ___________________NAV_R3__________________
),
// [_LAYERINDEX] = LAYOUT_wrapper(
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
// ),
};
// clang-format on
// // Setting ADJUST layer RGB back to default
// 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);
// }
// }
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
#ifndef SPLIT_KEYBOARD
if (keycode == RESET && !is_master) {
return false;
}
#endif
}
return true;
}
void matrix_init_keymap(void) { is_master = (uint8_t)is_keyboard_master(); }
#ifdef OLED_DRIVER_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; }
// clang-format off
# ifndef SPLIT_TRANSPORT_MIRROR
void oled_driver_render_logo(void) {
static const char PROGMEM lily58_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(lily58_logo, false);
}
# endif
#endif