You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.7 KiB

  1. #include "pvinis.h"
  2. #include "version.h"
  3. #ifdef AUDIO_ENABLE
  4. # include "audio.h"
  5. float song_sonic_ring[][2] = SONG(SONIC_RING);
  6. float song_coin_sound[][2] = SONG(COIN_SOUND);
  7. float song_test[][2] = SONG(QWERTY_SOUND);
  8. #endif
  9. // SYMBOL + SYSCTL = KBCTL
  10. layer_state_t layer_state_set_user(layer_state_t state) {
  11. uint32_t intermediate_state = update_tri_layer_state(state, LR_SYMBOL, LR_SYSCTL, LR_KBCTL);
  12. intermediate_state = layer_state_set_user_keymap(intermediate_state);
  13. return intermediate_state;
  14. }
  15. // functions for the individual keymaps to implement if they need something extra
  16. __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
  17. // Handle my own keycodes.
  18. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  19. switch (keycode) {
  20. case PV_VRSN:
  21. if (record->event.pressed) {
  22. SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
  23. }
  24. return false;
  25. case PV_MAKE:
  26. // make ergodox_ez:pvinis:teensy
  27. if (!record->event.pressed) {
  28. SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
  29. #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
  30. ":dfu"
  31. #elif defined(BOOTLOADER_HALFKAY)
  32. ":teensy"
  33. #elif defined(BOOTLOADER_CATERINA)
  34. ":avrdude"
  35. #endif
  36. SS_TAP(X_ENTER));
  37. }
  38. return false;
  39. case PV_FLSH:
  40. reset_keyboard();
  41. return false;
  42. case PV_SSNC:
  43. if (record->event.pressed) {
  44. #ifdef AUDIO_ENABLE
  45. PLAY_SONG(song_sonic_ring);
  46. #endif
  47. }
  48. return false;
  49. case PV_SCIN:
  50. if (record->event.pressed) {
  51. #ifdef AUDIO_ENABLE
  52. PLAY_SONG(song_coin_sound);
  53. #endif
  54. }
  55. return false;
  56. case PV_TEST:
  57. if (record->event.pressed) {
  58. #ifdef AUDIO_ENABLE
  59. PLAY_SONG(song_test);
  60. #endif
  61. }
  62. return false;
  63. }
  64. return process_record_keymap(keycode, record);
  65. }
  66. #ifdef TAP_DANCE_ENABLE
  67. qk_tap_dance_action_t tap_dance_actions[] = {};
  68. #endif
  69. void keyboard_post_init_rgb_light(void) {
  70. rgblight_sethsv(HSV_GOLD);
  71. rgblight_mode(RGBLIGHT_MODE_BREATHING);
  72. // rgblight_mode(RGBLIGHT_MODE_KNIGHT+1);
  73. }
  74. // Init stuff.
  75. void keyboard_post_init_user(void) {
  76. #if defined(RGBLIGHT_ENABLE)
  77. keyboard_post_init_rgb_light();
  78. #endif
  79. keyboard_post_init_user_keymap();
  80. }
  81. // Default functions.
  82. __attribute__((weak)) void keyboard_post_init_user_keymap(void) {}
  83. __attribute__((weak)) uint32_t layer_state_set_user_keymap(uint32_t state) { return state; }