quantum.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 "process_audio.h"
  54. #endif
  55. #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
  56. #include "process_music.h"
  57. #endif
  58. #ifndef DISABLE_LEADER
  59. #include "process_leader.h"
  60. #endif
  61. #define DISABLE_CHORDING
  62. #ifndef DISABLE_CHORDING
  63. #include "process_chording.h"
  64. #endif
  65. #ifdef UNICODE_ENABLE
  66. #include "process_unicode.h"
  67. #endif
  68. #ifdef UCIS_ENABLE
  69. #include "process_ucis.h"
  70. #endif
  71. #ifdef UNICODEMAP_ENABLE
  72. #include "process_unicodemap.h"
  73. #endif
  74. #include "process_tap_dance.h"
  75. #ifdef PRINTING_ENABLE
  76. #include "process_printer.h"
  77. #endif
  78. #ifdef COMBO_ENABLE
  79. #include "process_combo.h"
  80. #endif
  81. #define SEND_STRING(str) send_string(PSTR(str))
  82. extern const bool ascii_to_shift_lut[0x80];
  83. extern const uint8_t ascii_to_keycode_lut[0x80];
  84. void send_string(const char *str);
  85. void send_string_with_delay(const char *str, uint8_t interval);
  86. // For tri-layer
  87. void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
  88. void tap_random_base64(void);
  89. #define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
  90. #define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer)))
  91. void matrix_init_kb(void);
  92. void matrix_scan_kb(void);
  93. void matrix_init_user(void);
  94. void matrix_scan_user(void);
  95. bool process_action_kb(keyrecord_t *record);
  96. bool process_record_kb(uint16_t keycode, keyrecord_t *record);
  97. bool process_record_user(uint16_t keycode, keyrecord_t *record);
  98. void reset_keyboard(void);
  99. void startup_user(void);
  100. void shutdown_user(void);
  101. void register_code16 (uint16_t code);
  102. void unregister_code16 (uint16_t code);
  103. #ifdef BACKLIGHT_ENABLE
  104. void backlight_init_ports(void);
  105. void backlight_task(void);
  106. #ifdef BACKLIGHT_BREATHING
  107. void breathing_enable(void);
  108. void breathing_pulse(void);
  109. void breathing_disable(void);
  110. void breathing_self_disable(void);
  111. void breathing_toggle(void);
  112. bool is_breathing(void);
  113. void breathing_defaults(void);
  114. void breathing_intensity_default(void);
  115. void breathing_speed_default(void);
  116. void breathing_speed_set(uint8_t value);
  117. void breathing_speed_inc(uint8_t value);
  118. void breathing_speed_dec(uint8_t value);
  119. #endif
  120. #endif
  121. void send_dword(uint32_t number);
  122. void send_word(uint16_t number);
  123. void send_byte(uint8_t number);
  124. void send_nibble(uint8_t number);
  125. uint16_t hex_to_keycode(uint8_t hex);
  126. void led_set_user(uint8_t usb_led);
  127. void led_set_kb(uint8_t usb_led);
  128. void api_send_unicode(uint32_t unicode);
  129. #endif