2021-12-30 10:17:34 +06:00
|
|
|
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-10-18 00:46:57 +06:00
|
|
|
|
2018-08-29 23:42:15 +06:00
|
|
|
#include "template.h"
|
|
|
|
|
2017-11-11 09:58:53 +06:00
|
|
|
// Add reconfigurable functions here, for keymap customization
|
|
|
|
// This allows for a global, userspace functions, and continued
|
|
|
|
// customization of the keymap. Use _keymap instead of _user
|
|
|
|
// functions in the keymaps
|
2019-11-21 02:37:24 +06:00
|
|
|
__attribute__((weak)) void matrix_init_keymap(void) {}
|
2017-11-11 09:58:53 +06:00
|
|
|
|
|
|
|
// Call user matrix init, then call the keymap's init function
|
2019-11-21 02:37:24 +06:00
|
|
|
void matrix_init_user(void) { matrix_init_keymap(); }
|
2017-11-11 09:58:53 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
__attribute__((weak)) void matrix_scan_keymap(void) {}
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2017-11-11 09:58:53 +06:00
|
|
|
// No global matrix scan code, so just run keymap's matix
|
|
|
|
// scan function
|
2019-11-21 02:37:24 +06:00
|
|
|
void matrix_scan_user(void) { matrix_scan_keymap(); }
|
2017-11-11 09:58:53 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2017-11-11 09:58:53 +06:00
|
|
|
// Defines actions tor my global custom keycodes. Defined in drashna.h file
|
|
|
|
// Then runs the _keymap's recod handier if not processed here,
|
|
|
|
// And use "NEWPLACEHOLDER" for new safe range
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
2019-11-21 02:37:24 +06:00
|
|
|
switch (keycode) {
|
|
|
|
case KC_MAKE:
|
|
|
|
if (!record->event.pressed) {
|
|
|
|
SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
|
|
|
|
#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
|
|
|
|
":dfu"
|
2017-11-29 23:49:33 +06:00
|
|
|
#elif defined(BOOTLOADER_HALFKAY)
|
2019-11-21 02:37:24 +06:00
|
|
|
":teensy"
|
2017-11-28 10:53:40 +06:00
|
|
|
#elif defined(BOOTLOADER_CATERINA)
|
2019-11-21 02:37:24 +06:00
|
|
|
":avrdude"
|
2017-11-11 09:58:53 +06:00
|
|
|
#endif
|
2019-11-21 02:37:24 +06:00
|
|
|
SS_TAP(X_ENTER));
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VRSN:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
break;
|
2017-11-11 09:58:53 +06:00
|
|
|
}
|
2019-11-21 02:37:24 +06:00
|
|
|
return process_record_keymap(keycode, record);
|
2017-11-11 09:58:53 +06:00
|
|
|
}
|
2017-12-06 08:45:42 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
layer_state_t layer_state_set_user(layer_state_t state) { return layer_state_set_keymap(state); }
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
__attribute__((weak)) void suspend_power_down_keymap(void) {}
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
void suspend_power_down_user(void) { suspend_power_down_keymap(); }
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
void suspend_wakeup_init_user(void) {
|
|
|
|
suspend_wakeup_init_keymap();
|
|
|
|
#ifdef KEYBOARD_ergodox_ez
|
|
|
|
wait_ms(10);
|
|
|
|
#endif
|
2018-08-29 23:42:15 +06:00
|
|
|
}
|
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
__attribute__((weak)) void startup_keymap(void) {}
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
void startup_user(void) {
|
|
|
|
#ifdef RGBLIGHT_ENABLE
|
2018-08-29 23:42:15 +06:00
|
|
|
matrix_init_rgb();
|
2019-11-21 02:37:24 +06:00
|
|
|
#endif // RGBLIGHT_ENABLE
|
|
|
|
startup_keymap();
|
2018-08-29 23:42:15 +06:00
|
|
|
}
|
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
__attribute__((weak)) void shutdown_keymap(void) {}
|
2018-08-29 23:42:15 +06:00
|
|
|
|
2019-11-21 02:37:24 +06:00
|
|
|
void shutdown_user(void) { shutdown_keymap(); }
|