keychron_qmk_firmware/tmk_core/protocol
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
..
arm_atsam Improvements to extrakey HID descriptors (#8156) 2020-02-25 12:18:11 +11:00
bluefruit Remove PJRC USB stack 2020-02-08 11:07:43 -08:00
chibios Refactor rgblight_reconfig.h (#7773) 2020-03-10 01:46:03 -07:00
iwrap Set proper ASCII character for KC_NUHS in iWRAP code (#7434) 2019-12-08 12:59:47 +11:00
lufa Refactor rgblight_reconfig.h (#7773) 2020-03-10 01:46:03 -07:00
midi clang-format changes 2019-08-30 15:01:52 -07:00
usb_hid Added OLED Display autoscroll during periods of OLED data inactivity (#6546) 2019-08-25 12:37:55 -07:00
vusb Refactor rgblight_reconfig.h (#7773) 2020-03-10 01:46:03 -07:00
adb.c clang-format changes 2019-08-30 15:01:52 -07:00
adb.h clang-format changes 2019-08-30 15:01:52 -07:00
arm_atsam.mk RGB Matrix support for Massdrop CTRL/ALT (#5328) 2019-04-03 18:30:47 -07:00
bluefruit.mk Remove PJRC USB stack 2020-02-08 11:07:43 -08:00
chibios.mk 2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
ibm4704.c clang-format changes 2019-08-30 15:01:52 -07:00
ibm4704.h clang-format changes 2019-08-30 15:01:52 -07:00
iwrap.mk
lufa.mk Fix battery level code in adafruit_ble.cpp (#6648) 2019-09-04 04:29:23 +10:00
m0110.c clang-format changes 2019-08-30 15:01:52 -07:00
m0110.h clang-format changes 2019-08-30 15:01:52 -07:00
midi.mk
news.c clang-format changes 2019-08-30 15:01:52 -07:00
news.h clang-format changes 2019-08-30 15:01:52 -07:00
next_kbd.c clang-format changes 2019-08-30 15:01:52 -07:00
next_kbd.h clang-format changes 2019-08-30 15:01:52 -07:00
ps2_busywait.c clang-format changes 2019-08-30 15:01:52 -07:00
ps2_interrupt.c clang-format changes 2019-08-30 15:01:52 -07:00
ps2_io_avr.c clang-format changes 2019-08-30 15:01:52 -07:00
ps2_io.h clang-format changes 2019-08-30 15:01:52 -07:00
ps2_mouse.c clang-format changes 2019-08-30 15:01:52 -07:00
ps2_mouse.h clang-format changes 2019-08-30 15:01:52 -07:00
ps2_usart.c clang-format changes 2019-08-30 15:01:52 -07:00
ps2.h clang-format changes 2019-08-30 15:01:52 -07:00
serial_mouse_microsoft.c clang-format changes 2019-08-30 15:01:52 -07:00
serial_mouse_mousesystems.c clang-format changes 2019-08-30 15:01:52 -07:00
serial_mouse.h clang-format changes 2019-08-30 15:01:52 -07:00
serial_soft.c remove SERIAL_SOFT_DEBUG macro (#7625) 2019-12-13 18:06:18 -08:00
serial_uart.c clang-format changes 2019-08-30 15:01:52 -07:00
serial.h clang-format changes 2019-08-30 15:01:52 -07:00
usb_descriptor.c Improvements to extrakey HID descriptors (#8156) 2020-02-25 12:18:11 +11:00
usb_descriptor.h Reorder Raw HID interface to match what the USB spec expects (#6801) 2019-10-08 11:47:37 -07:00
usb_hid.mk
vusb.mk
xt_interrupt.c clang-format changes 2019-08-30 15:01:52 -07:00
xt.h clang-format changes 2019-08-30 15:01:52 -07:00