1
0
Fork 0
forked from forks/qmk_firmware
qmk_firmware/quantum
Takeshi ISHII dbbab40981
Refactor rgblight_reconfig.h (#7773)
* Moved contents of rgblight_reconfig.h to rgblight_post_config.h.

In #3582, rgblight_reconfig.h had to be newly created. Now, the build system of qmk_firmware has a post_cofig feature, so that what was done in rgblight_reconfig.h can now be realized in rgblight_post_config.h.

**This commit does not change the build result.**

Testing script
```shell
  # build on master
  git checkout master
  echo master > /tmp/master_md5.txt

  # RGBLIGHT_ENABLE = no
  make HELIX=verbose helix/rev2:default:clean
  make HELIX=verbose helix/rev2:default
  md5 helix_rev2_default.hex >> /tmp/master_md5.txt

  # RGBLIGHT_ENABLE = yes, with animations
  make HELIX=verbose helix/rev2/back:default:clean
  make HELIX=verbose helix/rev2/back:default
  md5 helix_rev2_back_default.hex >> /tmp/master_md5.txt

  # RGBLIGHT_ENABLE = yes, without animations
  make HELIX=verbose,no_ani helix/rev2/back:default:clean
  make HELIX=verbose,no_ani helix/rev2/back:default
  md5 helix_rev2_back_default.hex >> /tmp/master_md5.txt

  # build on refactor_rgblight_reconfig.h
  git checkout refactor_rgblight_reconfig.h
  echo refactor_rgblight_reconfig.h > /tmp/branch_md5.txt

  # RGBLIGHT_ENABLE = no
  make HELIX=verbose helix/rev2:default:clean
  make HELIX=verbose helix/rev2:default
  md5 helix_rev2_default.hex >> /tmp/branch_md5.txt

  # RGBLIGHT_ENABLE = yes, with animations
  make HELIX=verbose helix/rev2/back:default:clean
  make HELIX=verbose helix/rev2/back:default
  md5 helix_rev2_back_default.hex >> /tmp/branch_md5.txt

  # RGBLIGHT_ENABLE = yes, without animations
  make HELIX=verbose,no_ani helix/rev2/back:default:clean
  make HELIX=verbose,no_ani helix/rev2/back:default
  md5 helix_rev2_back_default.hex >> /tmp/branch_md5.txt

  diff -u /tmp/master_md5.txt /tmp/branch_md5.txt
```

Test result:
```
--- /tmp/master_md5.txt 2020-01-03 15:42:22.000000000 +0900
+++ /tmp/branch_md5.txt 2020-01-03 15:42:42.000000000 +0900
@@ -1,4 +1,4 @@
-master
+refactor_rgblight_reconfig.h
 MD5 (helix_rev2_default.hex) = f360032edd522448366d471d8f4f8181
 MD5 (helix_rev2_back_default.hex) = 0c663acc6cccc44476b3b969ad22a48f
 MD5 (helix_rev2_back_default.hex) = e66b1195ff6d38e6e22c975b8ae42fd3
```

* Expressions that are too long are difficult to read, so wrap them.

* Edit the expression again

* remove `defined(RGBLIGHT_ANIMATIONS)` in `tmk_core/common/*/suspend.c`, `tmk_core/protocol/*/main.c`

move contents of rgblight_reconfig.h to rgblight.h.

The following changes were made to rgblight.h.

```diff
+#ifdef RGBLIGHT_USE_TIMER
 void rgblight_task(void);

 void rgblight_timer_init(void);
 void rgblight_timer_enable(void);
 void rgblight_timer_disable(void);
 void rgblight_timer_toggle(void);
+#else
+#define rgblight_task()
+#define rgblight_timer_init()
+#define rgblight_timer_enable()
+#define rgblight_timer_disable()
+#define rgblight_timer_toggle()
+#endif
```

The following changes were made to tmk_core/common/avr/suspend.c, tmk_core/common/chibios/suspend.c, tmk_core/protocol/chibios/main.c, tmk_core/protocol/lufa/lufa.c, tmk_core/protocol/vusb/main.c.

```diff
-#    ifdef RGBLIGHT_ANIMATIONS
     rgblight_timer_enable();
-#    endif
```
```diff
-#if defined(RGBLIGHT_ANIMATIONS) && defined(RGBLIGHT_ENABLE)
+#if defined(RGBLIGHT_ENABLE)
         rgblight_task();
 #endif
```

* remove 'defined(RGBLIGHT_ANIMATIONS)' in tmk_core/common/keyboard.c

Co-authored-by: Joel Challis <git@zvecr.com>
2020-03-10 01:46:03 -07:00
..
api clang-format changes 2019-08-30 15:01:52 -07:00
audio 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
backlight Backlight - Carve out a better location for private driver functionality (#8329) 2020-03-07 12:09:49 +00:00
debounce clang-format changes 2019-08-30 15:01:52 -07:00
keymap_extras Update Dvorak, Colemak and Workman keycode aliases (#8217) 2020-03-09 15:37:10 +11:00
process_keycode 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
rgb_matrix_animations RGB matrix effect - left-right gradient (#7742) 2020-01-07 21:25:17 +00:00
rgb_matrix_runners clang-format changes 2019-08-30 15:01:52 -07:00
serial_link 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
split_common Split - Avoid race condition during matrix_init_quantum (#8235) 2020-02-25 14:10:04 +00:00
stm32 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
template Remove NO_UART defines from config.h for V-USB boards (#8351) 2020-03-09 19:58:25 +00:00
tools Backlight abstraction and other changes (#439) 2016-06-23 22:18:20 -04:00
visualizer 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
api.c clang-format changes 2019-08-30 15:01:52 -07:00
api.h clang-format changes 2019-08-30 15:01:52 -07:00
color.c Run clang-format manually to fix recently changed files (#7934) 2020-01-19 16:30:34 +00:00
color.h Use White channel on RGBW LEDs (#7678) 2019-12-31 16:33:49 +00:00
config_common.h Ensure setPinInput actually sets input high-Z (#6237) 2020-01-26 23:04:38 -05:00
debounce.h Removed #include "matrix.h" from debounce.h 2019-01-26 22:44:33 +11:00
dip_switch.c Run clang-format manually to fix recently changed files 2019-11-17 08:25:58 -08:00
dip_switch.h Add Dip Switch as a core feature (#6140) 2019-09-03 08:34:31 -07:00
dynamic_keymap.c dynamic keymap sanity check (#8181) 2020-02-17 17:54:13 -08:00
dynamic_keymap.h clang-format changes 2019-08-30 15:01:52 -07:00
dynamic_macro.h [Core] Convert Dynamic Macro to a Core Feature (#5948) 2019-11-04 22:59:13 -08:00
encoder.c 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
encoder.h Added encoder support to split common code (#5477) 2019-04-03 16:01:17 -07:00
fauxclicky.c clang-format changes 2019-08-30 15:01:52 -07:00
fauxclicky.h clang-format changes 2019-08-30 15:01:52 -07:00
keycode_config.c clang-format changes 2019-08-30 15:01:52 -07:00
keycode_config.h clang-format changes 2019-08-30 15:01:52 -07:00
keymap.h clang-format changes 2019-08-30 15:01:52 -07:00
keymap_common.c 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
led_matrix.c clang-format changes 2019-08-30 15:01:52 -07:00
led_matrix_drivers.c clang-format changes 2019-08-30 15:01:52 -07:00
led_tables.c Remove unused LED_BREATHING_TABLE 2020-03-06 22:29:01 -08:00
led_tables.h Remove unused LED_BREATHING_TABLE 2020-03-06 22:29:01 -08:00
ledmatrix.h clang-format changes 2019-08-30 15:01:52 -07:00
matrix.c Allow 30us matrix delay to be keyboard/user overridable (#8216) 2020-02-21 14:49:33 +11:00
matrix_common.c Allow 30us matrix delay to be keyboard/user overridable (#8216) 2020-02-21 14:49:33 +11:00
mcu_selection.mk Add Arm Teensys to mcu_selection.mk (#8026) 2020-02-21 17:12:15 +11:00
pincontrol.h clang-format changes 2019-08-30 15:01:52 -07:00
pointing_device.c clang-format changes 2019-08-30 15:01:52 -07:00
pointing_device.h clang-format changes 2019-08-30 15:01:52 -07:00
quantum.c Reduce PROGMEM usage for sendstring LUT (#8109) 2020-03-03 10:43:18 +11:00
quantum.h Reduce PROGMEM usage for sendstring LUT (#8109) 2020-03-03 10:43:18 +11:00
quantum_keycodes.h Run clang-format manually to fix recently changed files (#7934) 2020-01-19 16:30:34 +00:00
rgb.h clang-format changes 2019-08-30 15:01:52 -07:00
rgb_matrix.c Run clang-format manually to fix recently changed files (#7934) 2020-01-19 16:30:34 +00:00
rgb_matrix.h Relocate RGB keycode processing (#7508) 2019-12-16 12:27:53 -08:00
rgb_matrix_drivers.c Use White channel on RGBW LEDs (#7678) 2019-12-31 16:33:49 +00:00
rgb_matrix_types.h clang-format changes 2019-08-30 15:01:52 -07:00
rgblight.c Refactor rgblight_reconfig.h (#7773) 2020-03-10 01:46:03 -07:00
rgblight.h Refactor rgblight_reconfig.h (#7773) 2020-03-10 01:46:03 -07:00
rgblight_breathe_table.h clang-format changes 2019-08-30 15:01:52 -07:00
rgblight_list.h clang-format changes 2019-08-30 15:01:52 -07:00
rgblight_modes.h clang-format changes 2019-08-30 15:01:52 -07:00
rgblight_post_config.h clang-format changes 2019-08-30 15:01:52 -07:00
send_string_keycodes.h Add support for delays in send_string. (#8244) 2020-02-27 20:38:19 +11:00
variable_trace.c clang-format changes 2019-08-30 15:01:52 -07:00
variable_trace.h clang-format changes 2019-08-30 15:01:52 -07:00
velocikey.c clang-format changes 2019-08-30 15:01:52 -07:00
velocikey.h clang-format changes 2019-08-30 15:01:52 -07:00
via.c Add VIA support for QMK backlight, QMK RGBLight (#7911) 2020-01-20 10:18:25 -08:00
via.h Add VIA support for QMK backlight, QMK RGBLight (#7911) 2020-01-20 10:18:25 -08:00