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.

170 lines
5.0 KiB

7 years ago
Lets split eh (#3120) * Line ending stuff again * Added Let's Split Eh? Files and updated #USE_IC2 checks to also include th EH revision (can only be used in I2C) * Added personal keymap, updated some of the EH files * Created new keyboard file for testing "lets_split_eh" will merge into lets_split once fully functional * Added split code from lets_split, removed pro micro imports and LED code THIS IS WORKING CODE, WITHOUT RGB AND BACKLIGHT * Took back original Lets Slit files for the lets_split keyboard, working in the lets_split_eh folder for now * Updated eh.c * More rework of the I2C code, added global flags for split boards. * Introduced RGB over I2C, having weird edge case issues at the moment though * Fixed weird I2C edgecase with RGB, although still would like to track down route cause.. * Changed RGB keycodes (static ones) to activate on key-up instead of key-down to elimate weird ghosting issue over I2C * Lots of changes, mainly externalized the Split keyboard code and added logic for only including when needed. - Added makefile option "SPLIT_KEYBOARD" that when = yes will include the split keyboard files and custom matrix - Split keyboard files placed into quantum/split_common/ - Added define option for config files "SPLIT_HAND_PIN" FOr using high/low pin to determine handedness, low = right hand, high = left hand - Cleaned up split logic for RGB and Backlight so it is only exectuted / included when needed * Updated documentation for the new makefile options and #defines specific to split keyboards * Added a bit more info to docs, so people aren't confused * Modifed Let's Split to use externalized code, also added left and right hand eeprom files to the split_common folder * Removed some debugging from eh.c * Small changes to keyboard configs. Also added a default keymap (just a copy of my that_canadian keymap). * Added a README file to the Let's Split Eh? * Changed it so RGB static updates are done on key-up ONLY for split boards rather than all boards. Also fixed leftover un-used variable in rgblight.c * Updated default keymap and my keymap for Let's Split Eh? Updated the comments so it reflects RGB control, and removed audio functions. * Fixed lets_split_eh not having a default version * Removed "eh" references from lets_split folder for now * Took lets_split folder from master to fix travis build errors, weird my local was overriding. * Changed LAYOUT_ortho_4x12_kc -> LAYOUT_kc_ortho_4x12 to match bakingpy and others * Removed rules.mk from my lets_split keymap, not needed * Updated the config_options doc to better explain the usage of "#define SPLIT_HAND_PIN"
5 years ago
7 years ago
7 years ago
  1. /* Copyright 2017 Yang Liu
  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 RGBLIGHT_H
  17. #define RGBLIGHT_H
  18. #ifdef RGBLIGHT_ANIMATIONS
  19. #define RGBLIGHT_MODES 35
  20. #else
  21. #define RGBLIGHT_MODES 1
  22. #endif
  23. #ifndef RGBLIGHT_EFFECT_BREATHE_CENTER
  24. #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1-2.7
  25. #endif
  26. #ifndef RGBLIGHT_EFFECT_BREATHE_MAX
  27. #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255
  28. #endif
  29. #ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH
  30. #define RGBLIGHT_EFFECT_SNAKE_LENGTH 4
  31. #endif
  32. #ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH
  33. #define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3
  34. #endif
  35. #ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET
  36. #define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0
  37. #endif
  38. #ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM
  39. #define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM
  40. #endif
  41. #ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL
  42. #define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000
  43. #endif
  44. #ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP
  45. #define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2
  46. #endif
  47. #ifndef RGBLIGHT_HUE_STEP
  48. #define RGBLIGHT_HUE_STEP 10
  49. #endif
  50. #ifndef RGBLIGHT_SAT_STEP
  51. #define RGBLIGHT_SAT_STEP 17
  52. #endif
  53. #ifndef RGBLIGHT_VAL_STEP
  54. #define RGBLIGHT_VAL_STEP 17
  55. #endif
  56. #define RGBLED_TIMER_TOP F_CPU/(256*64)
  57. // #define RGBLED_TIMER_TOP 0xFF10
  58. #include <stdint.h>
  59. #include <stdbool.h>
  60. #include "eeconfig.h"
  61. #ifndef RGBLIGHT_CUSTOM_DRIVER
  62. #include "ws2812.h"
  63. #endif
  64. #include "rgblight_types.h"
  65. #include "rgblight_list.h"
  66. #if defined(__AVR__)
  67. #include <avr/pgmspace.h>
  68. #endif
  69. extern LED_TYPE led[RGBLED_NUM];
  70. extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM;
  71. extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM;
  72. extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM;
  73. extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM;
  74. extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM;
  75. extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM;
  76. typedef union {
  77. uint32_t raw;
  78. struct {
  79. bool enable :1;
  80. uint8_t mode :6;
  81. uint16_t hue :9;
  82. uint8_t sat :8;
  83. uint8_t val :8;
  84. uint8_t speed :8;//EECONFIG needs to be increased to support this
  85. };
  86. } rgblight_config_t;
  87. void rgblight_init(void);
  88. void rgblight_increase(void);
  89. void rgblight_decrease(void);
  90. void rgblight_toggle(void);
  91. void rgblight_enable(void);
  92. void rgblight_disable(void);
  93. void rgblight_step(void);
  94. void rgblight_step_reverse(void);
  95. uint32_t rgblight_get_mode(void);
  96. void rgblight_mode(uint8_t mode);
  97. void rgblight_set(void);
  98. void rgblight_update_dword(uint32_t dword);
  99. void rgblight_increase_hue(void);
  100. void rgblight_decrease_hue(void);
  101. void rgblight_increase_sat(void);
  102. void rgblight_decrease_sat(void);
  103. void rgblight_increase_val(void);
  104. void rgblight_decrease_val(void);
  105. void rgblight_increase_speed(void);
  106. void rgblight_decrease_speed(void);
  107. void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
  108. uint16_t rgblight_get_hue(void);
  109. uint8_t rgblight_get_sat(void);
  110. uint8_t rgblight_get_val(void);
  111. void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b);
  112. void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index);
  113. void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index);
  114. uint32_t eeconfig_read_rgblight(void);
  115. void eeconfig_update_rgblight(uint32_t val);
  116. void eeconfig_update_rgblight_default(void);
  117. void eeconfig_debug_rgblight(void);
  118. void rgb_matrix_increase(void);
  119. void rgb_matrix_decrease(void);
  120. void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1);
  121. void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1);
  122. void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
  123. void rgblight_mode_noeeprom(uint8_t mode);
  124. void rgblight_toggle_noeeprom(void);
  125. void rgblight_enable_noeeprom(void);
  126. void rgblight_disable_noeeprom(void);
  127. void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom);
  128. void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom);
  129. #define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF)
  130. void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b);
  131. void rgblight_task(void);
  132. void rgblight_timer_init(void);
  133. void rgblight_timer_enable(void);
  134. void rgblight_timer_disable(void);
  135. void rgblight_timer_toggle(void);
  136. void rgblight_effect_breathing(uint8_t interval);
  137. void rgblight_effect_rainbow_mood(uint8_t interval);
  138. void rgblight_effect_rainbow_swirl(uint8_t interval);
  139. void rgblight_effect_snake(uint8_t interval);
  140. void rgblight_effect_knight(uint8_t interval);
  141. void rgblight_effect_christmas(void);
  142. void rgblight_effect_rgbtest(void);
  143. #endif