2019-05-15 01:02:22 +06:00
|
|
|
#include "pvinis.h"
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
#ifdef AUDIO_ENABLE
|
2020-04-14 00:59:04 +06:00
|
|
|
# include "audio.h"
|
2019-05-15 01:02:22 +06:00
|
|
|
|
2020-04-14 00:59:04 +06:00
|
|
|
float song_sonic_ring[][2] = SONG(SONIC_RING);
|
|
|
|
float song_coin_sound[][2] = SONG(COIN_SOUND);
|
|
|
|
float song_test[][2] = SONG(QWERTY_SOUND);
|
|
|
|
#endif
|
2019-05-15 01:02:22 +06:00
|
|
|
|
|
|
|
// SYMBOL + SYSCTL = KBCTL
|
2021-07-19 22:50:55 +06:00
|
|
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
2020-04-14 00:59:04 +06:00
|
|
|
uint32_t intermediate_state = update_tri_layer_state(state, LR_SYMBOL, LR_SYSCTL, LR_KBCTL);
|
|
|
|
intermediate_state = layer_state_set_user_keymap(intermediate_state);
|
|
|
|
return intermediate_state;
|
2019-05-15 01:02:22 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
// functions for the individual keymaps to implement if they need something extra
|
2020-04-14 00:59:04 +06:00
|
|
|
__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
|
2019-05-15 01:02:22 +06:00
|
|
|
|
2020-04-14 00:59:04 +06:00
|
|
|
// Handle my own keycodes.
|
2019-05-15 01:02:22 +06:00
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
2020-04-14 00:59:04 +06:00
|
|
|
switch (keycode) {
|
|
|
|
case PV_VRSN:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case PV_MAKE:
|
|
|
|
// make ergodox_ez:pvinis:teensy
|
|
|
|
if (!record->event.pressed) {
|
|
|
|
SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
|
2019-05-15 01:02:22 +06:00
|
|
|
#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
|
2020-04-14 00:59:04 +06:00
|
|
|
":dfu"
|
2019-05-15 01:02:22 +06:00
|
|
|
#elif defined(BOOTLOADER_HALFKAY)
|
2020-04-14 00:59:04 +06:00
|
|
|
":teensy"
|
2019-05-15 01:02:22 +06:00
|
|
|
#elif defined(BOOTLOADER_CATERINA)
|
2020-04-14 00:59:04 +06:00
|
|
|
":avrdude"
|
2019-05-15 01:02:22 +06:00
|
|
|
#endif
|
2020-04-14 00:59:04 +06:00
|
|
|
SS_TAP(X_ENTER));
|
|
|
|
}
|
|
|
|
return false;
|
2019-05-15 01:02:22 +06:00
|
|
|
|
2020-04-14 00:59:04 +06:00
|
|
|
case PV_FLSH:
|
|
|
|
reset_keyboard();
|
|
|
|
return false;
|
2019-05-15 01:02:22 +06:00
|
|
|
|
2020-04-14 00:59:04 +06:00
|
|
|
case PV_SSNC:
|
|
|
|
if (record->event.pressed) {
|
2019-05-15 01:02:22 +06:00
|
|
|
#ifdef AUDIO_ENABLE
|
2020-04-14 00:59:04 +06:00
|
|
|
PLAY_SONG(song_sonic_ring);
|
2019-05-15 01:02:22 +06:00
|
|
|
#endif
|
2020-04-14 00:59:04 +06:00
|
|
|
}
|
|
|
|
return false;
|
2019-05-15 01:02:22 +06:00
|
|
|
|
2020-04-14 00:59:04 +06:00
|
|
|
case PV_SCIN:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
PLAY_SONG(song_coin_sound);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case PV_TEST:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
PLAY_SONG(song_test);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return process_record_keymap(keycode, record);
|
|
|
|
}
|
2019-05-15 01:02:22 +06:00
|
|
|
|
|
|
|
#ifdef TAP_DANCE_ENABLE
|
2020-04-14 00:59:04 +06:00
|
|
|
qk_tap_dance_action_t tap_dance_actions[] = {};
|
|
|
|
#endif
|
2019-05-15 01:02:22 +06:00
|
|
|
|
2020-04-14 00:59:04 +06:00
|
|
|
void keyboard_post_init_rgb_light(void) {
|
|
|
|
rgblight_sethsv(HSV_GOLD);
|
|
|
|
rgblight_mode(RGBLIGHT_MODE_BREATHING);
|
|
|
|
// rgblight_mode(RGBLIGHT_MODE_KNIGHT+1);
|
|
|
|
}
|
2019-05-15 01:02:22 +06:00
|
|
|
|
2020-04-14 00:59:04 +06:00
|
|
|
// Init stuff.
|
2019-05-15 01:02:22 +06:00
|
|
|
void keyboard_post_init_user(void) {
|
2020-04-14 00:59:04 +06:00
|
|
|
#if defined(RGBLIGHT_ENABLE)
|
|
|
|
keyboard_post_init_rgb_light();
|
|
|
|
#endif
|
|
|
|
keyboard_post_init_user_keymap();
|
2019-05-15 01:02:22 +06:00
|
|
|
}
|
2019-05-16 22:38:28 +06:00
|
|
|
|
2020-04-14 00:59:04 +06:00
|
|
|
// Default functions.
|
|
|
|
__attribute__((weak)) void keyboard_post_init_user_keymap(void) {}
|
2019-05-16 22:38:28 +06:00
|
|
|
|
2022-06-19 03:37:51 +06:00
|
|
|
__attribute__((weak)) layer_state_t layer_state_set_user_keymap(layer_state_t state) { return state; }
|