Commit Graph

55 Commits

Author SHA1 Message Date
QMK Bot 1aa40dde46 format code according to conventions [skip ci] 2020-03-10 20:24:13 +00:00
Nathan Gray 2ffb08843b
Feature: RGBLight layers (#7768)
* New feature: RGBLIGHT_LAYERS

This feature allows users to define multiple independent layers of lighting
that can be toggled on and off individually, making it easy to use your
RGB lighting to indicate things like active keyboard layer & modifier state.

* Demonstrate built in functions for layer state checking

Also link the video in the docs.

* Follow existing pattern for setting rgblight_status flags

* Eliminate rgblight_is_static_mode since it's not needed

Just check to see if the timer is enabled directly.
2020-03-10 12:50:01 -07:00
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
QMK Bot e3d59a72f9 format code according to conventions [skip ci] 2020-01-20 18:48:28 +00:00
Wilba 484a9b12bc Add VIA support for QMK backlight, QMK RGBLight (#7911)
* Add VIA support for QMK backlight, QMK RGBLight

* clang-format changes
2020-01-20 10:18:25 -08:00
skullY b624f32f94 clang-format changes 2019-08-30 15:01:52 -07:00
XScorpion2 e7711b3b66 Moving rgb typedefs into a single location (#5978)
Because someone named the define poorly

Using full relative path as handwired/promethium has a color.h file
2019-06-04 11:04:30 -07:00
Takeshi ISHII 670a9b7f83 Add effect range to rgblight.c (#5856)
* add rgblight_set_effect_range()

* implement effect range

* Arrange the order of function list in rgblight.h .

* update docs/feature_rgblight.md

* fix RGBLIGHT_RAINBOW_SWIRL_RANGE default value

* add example code about Utility Functions

* add example code about direct operation functions

* When RGBLIGHT_SPLIT is defined, the following function has no meaning and is invalidated.

 * rgblight_setrgb_master(r, g, b)
 * rgblight_setrgb_slave(r, g, b)
 * rgblight_sethsv_master(h, s, v)
 * rgblight_sethsv_slave(h, s, v)

* add temporary test code for rgblight_set_effect_range

* fix rgblight_effect_knight() bug

* Test End. Revert "add temporary test code for rgblight_set_effect_range"

This reverts commit 5680cddd012d68b2db75a532862a7fef250f8973.
2019-05-15 21:11:28 -07:00
Takeshi ISHII 3da8d46a07 If RGBLIGHT_EFFECT_BREATHE_CENTER is undefined, use fixed breathe table instead of exp() and sin() (#5484)
* If RGBLIGHT_EFFECT_BREATHE_CENTER is undefined, use fixed breathe table instead of exp() and sin()

* Change rgblight breathing table size to be easily selectable.

add RGBLIGHT_BREATHE_TABLE_SIZE macro for customize breathing effect.
2019-05-02 07:59:29 -07:00
XScorpion2 22ba36a4d8 rgblight 255 hue (#5547) 2019-05-01 08:02:02 -07:00
Takeshi ISHII dfab177f88 Add function to support split-keyboard in rgblight.[ch]. (#5020)
* add temporary file that is rgblight.c call graph

* add rgblight_update_hook()

* update rgblight-call-graph.dot (temporary file)

* add more hook point

* add TODO comment

* temporary Revert "add TODO comment"

This reverts commit df6165aac9b3a31d1d3e31ce52aadc134b84eac2.

* temporary Revert "add more hook point"

This reverts commit 64592b06f3bcdaac47c59f922018a273bef76776.

* temporary Revert "add rgblight_update_hook()"

This reverts commit 432b74c912ed4333e6633e20a1bcda10c6a10eaf.

* add rgblight_update_hook()

* add more hook point

* add TODO comment

* implement rgblight_update_hook()

* remove rgblight_update_hook(), add RGBLIGHT_SPLIT_SET_CHANGE_XXXX

rgblight_update_hook() is too large.
change to simple flag setting.

* shrink rgblight_config_t

* implement rgblight_update_sync()

Note: The animation synchronization process has not been implemented yet.

* update quantum/rgblight-call-graph.dot (temporary file)

* rmove quantum/rgblight-call-graph.dot (temporary file)

* update rgblight.c

* Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c .

* fix build break rgblight_update_sync() when all animation off

* fix quantum/rgblight.c:rgblight_disable_XX() add RGBLIGHT_SPLIT_SET_CHANGE_MODE

* quantum/rgblight.c change code order: move rgblight_update_sync()

* add mode_base_table[] to quantum/rgblight.c

* quantum/rgblight.c use mode_base_table[] and rgblight_status.base_mode

* quantum/rgblkght.c animation timer integration

* quantum/rgblkght.c add animation sync for split keyboard

* fix mode_base_table[] and snake effect

* fix build break keyboards/mxss.

keyboards/mxss's local rgblight.c need old version rgblight.h

* rgblight.c: fix animation sync

* quantum/rgblight.c: fix snake effect sync

* quantum/rgblight.c: animation sync interverl 30 sec

* quantum/rgblight.c: fix rgblight_effect_rainbow_swirl() and rgblight_effect_knight()

* quantum/rgblight.c: add macro RGBLIGHT_SPLIT_ANIMATION

* cherry-pick from 'rgblight_modes.h sample implementation'

* fix RGBLIGHT_SPLIT_ANIMATION check position

* Update temporary code in Helix keyboard 'five_rows' keymap to test rgblight.c

* Reduce the firmware size by 1500 bytes when rgblight_effect_breathing() is enabled.

* Changed to rgblight_sethsv_eeprom_helper() for easier reading.

* add fail-safe code to quantum/rgblight.c:rgblight_task(),rgblight_timer_enable()

* remove temporary code in Helix keyboard 'five_rows' keymap

* quantum/rgblight.c: add split-keyboard master side sync functions

add functions:
  uint8_t rgblight_get_change_flags(void);
  void rgblight_clear_change_flags(void);
  void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo);

change function:
  void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom);

* Change rgblight_update_sync() to use write_to_eeprom.

* remove TODO comment from quantum/rgblight.h

* Revert "fix build break keyboards/mxss."

This reverts commit 90b9a1aa7d8af226751500e49e3ea0214cc4e024.
(Separated this change into the newly opened PR #5461.)

* Revert "Reduce the firmware size by 1500 bytes when rgblight_effect_breathing() is enabled."

This reverts commit b61004e63e82cf5334cee4def4ba10cffa88885f.

* update quantum/rgblight.c: Code size reduction when not using RGBLIGHT_SPLIT.

* Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c .

* add temporary pdhelix(Patched Helix) code

* Add temporary code to split_common/transport.c to test rgblight.c.

* Finish testing rgblight.c with helix keyboard.

Revert "Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c ."

This reverts commit 0bf81a4723a977adc0cb09b4272ee5c9b4f2bbbb.

* Finish testing rgblight.c with quantum/split_common code.

Revert "Add temporary code to split_common/transport.c to test rgblight.c."

This reverts commit 71db3e24eef40d4c455fb9fd1664e4487c9d927a.

* remove temporary pdhelix(Patched Helix) code

This reverts commit 5287e51a394741bcb6028c7cfc0dd0c984645f76.

* Added description of RGBLIGHT_SPLIT macro to docs/feature_rgblight.md.

* add RGBLIGHT_SPLIT_SET_CHANGE_HSVS to rgblight_init()

* Changed to restart animation only when changing mode.

When changing hue, sat and val, the animation is not restarted and continues.
2019-04-19 15:05:51 -07:00
Danny f077204fae Add support for RGB LEDs wired directly to each half's controller (#5392)
* Add support for wiring RGB LEDs for both halves directly to their respective controllers

RGB LEDs for each half don't need to be chained together across the TRRS cable with this

* Add split RGB LED support for serial

* Update config/rules for bakingpy layout

* Un-nest ifdefs for hand detection

* Read RGB config state from memory instead of EEPROM for serial updates

* Reuse existing LED pointer instead of creating new one
2019-03-23 17:20:14 -07:00
Len Trigg 9c4424ae2c rgblight split transfer non-eeprom config (#5396)
* Make rgblight_update_dword not update eeprom (we already have
eeconfig_update_rgblight for that).

Make split i2c keyboards transfer active rgblight config rather than
eeprom saved version of rgblight config, enabling runtime changes
that aren't persisted to eeprom.

* prev_level and prev_rgb only store successfully transmitted values
2019-03-15 13:46:49 -07:00
Konstantin Đorđević 4e2369693f Move RGBLIGHT_LIMIT_VAL definition from rgblight.c to rgblight.h (#5167) 2019-02-17 19:05:12 -08:00
Erovia 642f6cf14f Add support for using ranges for RGB (#4981)
* Add support for using ranges for RGB

This patch adds support for controlling continuous ranges of RGB LEDs.
Helper functions for split boards are also available.

* RGB Range: Use hardware-platform agnostic wait
2019-02-15 06:52:04 -08:00
Drashna Jaelre cc146e32dc Improve RGB Light code (#4326)
* Improve RGB Light code

* Add is_rgblight_initialized as an externed value in rgblight.h

* Use remander of hue
2019-02-15 06:37:44 -08:00
David Dai b7688590b8 Change rgblight_get_mode & rgb_matrix_get_mode's return type to uint8_t. (#4747)
* Change rgblight_get_mode's return type to uint8_t.

Since rgblight_get_mode() is just returning rgblight_config_t.mode,
it should match rgblight_config_t.mode's type: uint8_t.

* Update rgb_matrix_get_mode to return uint8_t.
2018-12-31 08:42:58 -08:00
Fredric Silberberg 9e6ee47779 Added noeeprom versions of set hue, sat, val, and step 2018-12-13 18:30:15 -08:00
mtei 4bb0fb2ffc A comment indicating the insertion location of the new mode was added. 2018-10-11 17:14:42 -07:00
mtei 661e304033 Add a temporary comment to quantum/rgblight.h to aid migration.
Add a temporary comment. The content is a contrast table of old magic number and new symbol.
2018-10-11 17:14:42 -07:00
Takeshi ISHII 6d6d91c834 rgblight.[ch] more configurable (#3582)
* add temporary test code rgblight-macro-test1.[ch]

* rgblight.h : mode auto numberring and auto generate mode name symbol

No change in build result.

* rgblight.c use RGBLIGHT_MODE_xxx symbols

No change in build result.

* quantum.c use RGBLIGHT_MODE_xxx symbols

No change in build result.

* fix build break. when RGB_MATRIX_ENABLE defined

* add temporary test code rgblight-macro-test2.[ch]

* modify rgblight_mode_eeprom_helper() and rgblight_sethsv_eeprom_helper()

* modify rgblight_task()

* configurable each effect compile on/off in config.h

* update docs/feature_rgblight.md

* fix conflict. docs/feature_rgblight.md

* remove temporary test code rgblight-macro-test*.[ch]

* fix comment typo.

* remove old mode number from comment

* update docs/feature_rgblight.md about effect mode

* Revert "update docs/feature_rgblight.md about effect mode"

This reverts commit 43890663fcc9dda1899df7a37d382fc38b1a6d6d.

* some change docs/feature_rgblight.md

* fix typo

* docs/feature_rgblight.md update: revise mode number table
2018-09-13 10:24:09 -07:00
Brad 595f3cbe5b Added alternating led underglow pattern (#3498)
* added alternating led pattern

* added alternating with rgblight_config values

* removed my comments
2018-07-29 08:42:11 -07:00
That-Canadian 0fab3bbde3 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"
2018-07-16 22:25:02 -04:00
Takeshi ISHII 5229734647 Add rgblight mode 35 (R,G,B test mode) (#3114)
* add rgblight mode 35 (RGB cyclic mode) into quantum/rgblight.c

* Update docs, add rgblight mode 35(RGB cyclic)

* rename RGBCYCLIC to RGBTEST
2018-06-04 08:10:39 -07:00
Drashna Jaelre 751719e6cb Add and fix _noeeprom functions to many of the RGB Underglow functions (#3070)
* And and fix _noeeprom functions to many of the RGB Underglow functions

* Many functions are unnecessarily calling the eeprom write code. The toggle/enable is command is especially guilty of this, as it writes to EEPROM 3 times.  But rgb mode writes twice, every time it's called. And init resets the rgb eeprom range and then writes back to it twice!
* Fixed the rgblight_sethsv_noeeprom to work as expected, by moving a lot of the code to a helper function.
* Added a noeeprom function for mode, enable, disable, and toggle functions. (didn't bother for increase/decrease stuff, and didn't add new keycodes)
* Add to predefined colors list
* Add new functions to manual/docs

* Update RGB Sleep feature to use _noeeprom

Because that's exactly what it should be doing, actually!
2018-05-29 11:05:22 -04:00
yiancar afacd42368 Add effect speed support for RGB Matrix *No EEPROM yet* (#2922)
* Added Modular keyboards L,R and NUM

Created code modules for the 3 modules of the modular keyboard.
Original idea by MechboardsUK. Uses i2c implementation similar to lets
split

* Remove modular from master

This is to fix incorrect branching

* Add effect speed support for RGB Matrix *No eeprom yet*

Keycodes RGB_SPI and RGB_SPD have been added to increase and decrease effect speed.

Speed is not saved in EEPROM yet as per Jack's request.

* Update rgb_matrix.c

* RGB Matrix speed fix rgblight.h

* More fixes for rgb speed. Speed functions declared but not used in rgblight

* More travis fixes..

* Another one for travis..
2018-05-08 23:23:21 -04:00
U-LANDSRAAD\drashna c1b46206a7 Fix commands and update my userspace (for testing) 2018-03-28 16:55:58 -04:00
kamisamamizu 12e66330c5 Add COSPAD to QMK and add functions to read HSV (#2156)
* Added functions to read HSV values

I have added three functions to rgb_light.c to be able to read the hue, saturation and value from other places.
They are rgblight_get_hue(), rgblight_get_sat(), adn rgblight_get_val().

* Create keymap.c

* Add COSPAD support to QMK

I have ported the COSPAD numpad to qmk.

* Update readme.md

* Update cospad.c
2017-12-17 11:44:13 -05:00
Colin T.A. Gray 16546ee06f Add 'rgblight_disable' and 'rgblight_setrgb_at/rgblight_sethsv_at'
Refactors rgblight_toggle to use rgblight_enable or rgblight_disable
Use 'rgblight_setrgb_at/rgblight_sethsv_at' to control an individual LED
2017-12-08 16:10:42 -05:00
skullydazed ad49db8cd2 Address #1689 by using a formula to define the breathing curve (#1692)
* Address #1689 by using a formula to define the breathing curve and exposing defines to control the shape of the curve.

* Tweak the behavior of breathing for clueboard
2017-10-17 16:47:49 -07:00
Jack Humbert dc7d0c7b74 update to driver separation 2017-09-15 21:43:58 -04:00
skullydazed 4580d3a730 RGB improvements (#1684)
* Allow the knight animation to be restricted to a portion of the LED strip

* Add keys for jumping directly to particular animation modes

* Remove orphaned break statements

* Tweak the `RGB_MODE` buttons so they cycle through the same mode.

* small indentation fix
2017-09-06 14:49:19 -07:00
David Stosik 4edfa97e03 Improve and simplify RGB Knight mode (#1677)
* Simplify RGB Knight mode code, and make it look closer to KITT

* Remove RGBLIGHT_EFFECT_DUALKNIGHT_LENGTH
2017-09-05 14:19:08 -07:00
David Stosik 94f8b758b3 Fix Kitt and its default behavior (#1674) 2017-09-03 11:02:06 -07:00
Jack Humbert 42d5a324eb Start mvoing hardware drivers to /drivers/ (#1433)
* start driver isolation

* update nyquist and orthodox boards

* update atreus62

* move drivers to avr

* update avr conditional
2017-07-10 11:18:47 -04:00
Luiz Ribeiro d4cd5dda5c Added a build flag for using a custom rgblight driver 2017-06-11 12:30:48 -04:00
skullydazed 23839b8c6d Clarify the quantum license (#1042)
* Clarify the license for files we have signoff on

* Update against the currently signed off files

* Remove unused and not clearly licensed headers

* Replace an #endif I accidentally removed while resolving merge conflicts
2017-03-28 15:20:36 -07:00
dungdung a7882b1ffc Added non-animated gradient mode 2017-02-06 14:18:20 -08:00
dungdung 5a1b68d562 Added mode reverse step function 2017-02-06 14:18:20 -08:00
dungdung 0e548f8b5d Christmas mode now works with even RGBED_NUM
Added Christmas mode steps to reduce red and green colors blending into each other
Added Christmas mode interval
Increased green hue to 120
2017-02-06 14:18:20 -08:00
Scott Wilson 748181dccd Add extern for 'led' global, set 'weak' attribute for rgblight_set() 2016-12-28 16:29:02 -05:00
Jack Humbert cae269b08b Christmas RGB light mode 2016-12-23 10:29:19 -05:00
Erez Zukerman 4094544d41 Test layout for ErgoDox EZ manufacturing robot 2016-11-29 09:23:16 -05:00
Jack Humbert 2e23689b8e converted to new format 2016-11-23 18:52:02 -05:00
Erez Zukerman 285c5a91f2 Groundwork for dedicated color keycodes 2016-11-17 20:56:36 -05:00
Jack Humbert 3774a7fcda rgb light through midi 2016-11-17 17:42:14 -05:00
Jack Humbert e9f7487518 mostly working 2016-11-13 23:02:38 -05:00
Jack Humbert 33e62c080c merging 2016-11-12 20:54:37 -05:00
Fred Sundvik 9b0e21f87f Tunable RGB light intervals 2016-10-09 19:26:16 +03:00
Jack Humbert b8679bbe04 RGBW lights 2016-10-05 20:41:38 -04:00