quantum.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /* Copyright 2016-2017 Erez Zukerman, Jack Humbert
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef QUANTUM_H
  17. #define QUANTUM_H
  18. #if defined(__AVR__)
  19. #include <avr/pgmspace.h>
  20. #include <avr/io.h>
  21. #include <avr/interrupt.h>
  22. #endif
  23. #include "wait.h"
  24. #include "matrix.h"
  25. #include "keymap.h"
  26. #ifdef BACKLIGHT_ENABLE
  27. #include "backlight.h"
  28. #endif
  29. #ifdef RGBLIGHT_ENABLE
  30. #include "rgblight.h"
  31. #endif
  32. #include "action_layer.h"
  33. #include "eeconfig.h"
  34. #include <stddef.h>
  35. #include "bootloader.h"
  36. #include "timer.h"
  37. #include "config_common.h"
  38. #include "led.h"
  39. #include "action_util.h"
  40. #include <stdlib.h>
  41. #include "print.h"
  42. extern uint32_t default_layer_state;
  43. #ifndef NO_ACTION_LAYER
  44. extern uint32_t layer_state;
  45. #endif
  46. #ifdef MIDI_ENABLE
  47. #include <lufa.h>
  48. #ifdef MIDI_ADVANCED
  49. #include "process_midi.h"
  50. #endif
  51. #endif // MIDI_ENABLE
  52. #ifdef AUDIO_ENABLE
  53. #include "audio.h"
  54. #include "process_audio.h"
  55. #endif
  56. #ifdef STENO_ENABLE
  57. #include "process_steno.h"
  58. #endif
  59. #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
  60. #include "process_music.h"
  61. #endif
  62. #ifndef DISABLE_LEADER
  63. #include "process_leader.h"
  64. #endif
  65. #define DISABLE_CHORDING
  66. #ifndef DISABLE_CHORDING
  67. #include "process_chording.h"
  68. #endif
  69. #ifdef UNICODE_ENABLE
  70. #include "process_unicode.h"
  71. #endif
  72. #ifdef UCIS_ENABLE
  73. #include "process_ucis.h"
  74. #endif
  75. #ifdef UNICODEMAP_ENABLE
  76. #include "process_unicodemap.h"
  77. #endif
  78. #include "process_tap_dance.h"
  79. #ifdef PRINTING_ENABLE
  80. #include "process_printer.h"
  81. #endif
  82. #ifdef COMBO_ENABLE
  83. #include "process_combo.h"
  84. #endif
  85. #ifdef KEY_LOCK_ENABLE
  86. #include "process_key_lock.h"
  87. #endif
  88. #define SEND_STRING(str) send_string(PSTR(str))
  89. extern const bool ascii_to_shift_lut[0x80];
  90. extern const uint8_t ascii_to_keycode_lut[0x80];
  91. void send_string(const char *str);
  92. void send_string_with_delay(const char *str, uint8_t interval);
  93. // For tri-layer
  94. void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
  95. void set_single_persistent_default_layer(uint8_t default_layer);
  96. void tap_random_base64(void);
  97. #define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
  98. #define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer)))
  99. void matrix_init_kb(void);
  100. void matrix_scan_kb(void);
  101. void matrix_init_user(void);
  102. void matrix_scan_user(void);
  103. bool process_action_kb(keyrecord_t *record);
  104. bool process_record_kb(uint16_t keycode, keyrecord_t *record);
  105. bool process_record_user(uint16_t keycode, keyrecord_t *record);
  106. void reset_keyboard(void);
  107. void startup_user(void);
  108. void shutdown_user(void);
  109. void register_code16 (uint16_t code);
  110. void unregister_code16 (uint16_t code);
  111. #ifdef BACKLIGHT_ENABLE
  112. void backlight_init_ports(void);
  113. void backlight_task(void);
  114. #ifdef BACKLIGHT_BREATHING
  115. void breathing_enable(void);
  116. void breathing_pulse(void);
  117. void breathing_disable(void);
  118. void breathing_self_disable(void);
  119. void breathing_toggle(void);
  120. bool is_breathing(void);
  121. void breathing_defaults(void);
  122. void breathing_intensity_default(void);
  123. void breathing_speed_default(void);
  124. void breathing_speed_set(uint8_t value);
  125. void breathing_speed_inc(uint8_t value);
  126. void breathing_speed_dec(uint8_t value);
  127. #endif
  128. #endif
  129. void send_dword(uint32_t number);
  130. void send_word(uint16_t number);
  131. void send_byte(uint8_t number);
  132. void send_nibble(uint8_t number);
  133. uint16_t hex_to_keycode(uint8_t hex);
  134. void led_set_user(uint8_t usb_led);
  135. void led_set_kb(uint8_t usb_led);
  136. void api_send_unicode(uint32_t unicode);
  137. #endif