init.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // ....................................................................... Audio
  2. void matrix_init_user(void)
  3. {
  4. #ifdef STENO_ENABLE
  5. steno_set_mode(STENO_MODE_BOLT); // or STENO_MODE_GEMINI
  6. #endif
  7. #ifdef AUDIO_ENABLE
  8. startup_user();
  9. #endif
  10. }
  11. #ifdef AUDIO_ENABLE
  12. #ifdef BACKLIGHT_ENABLE
  13. void led_set_user(uint8_t usb_led)
  14. {
  15. static uint8_t old_usb_led = 0;
  16. _delay_ms(10); // gets rid of tick
  17. if (!is_playing_notes()) {
  18. if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) {
  19. // if capslock LED is turning on
  20. PLAY_SONG(song_caps_on);
  21. }
  22. else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) {
  23. // if capslock LED is turning off
  24. PLAY_SONG(song_caps_off);
  25. }
  26. }
  27. old_usb_led = usb_led;
  28. }
  29. #endif
  30. void startup_user(void)
  31. {
  32. _delay_ms(20); // gets rid of tick
  33. PLAY_SONG(song_startup);
  34. }
  35. void shutdown_user(void)
  36. {
  37. PLAY_SONG(song_goodbye);
  38. _delay_ms(150);
  39. stop_all_notes();
  40. }
  41. void music_on_user(void)
  42. {
  43. music_scale_user();
  44. }
  45. void music_scale_user(void)
  46. {
  47. PLAY_SONG(music_scale);
  48. }
  49. #endif