Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgblight.c: add remap feature #5243

Merged
merged 5 commits into from
Mar 20, 2019
Merged

Conversation

mtei
Copy link
Contributor

@mtei mtei commented Feb 25, 2019

Description

Added support for RGBLIGHT_LED_MAP macro to rgblight.c.

Example 1:

// config.h

#define RGBLED_NUM 10
#define RGBLIGHT_LED_MAP { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }

Example 2:

// config.h

#define RGBLED_NUM 30

/* RGB LED Conversion macro from physical array to electric array */
#define LED_LAYOUT( \
    L00, L01, L02, L03, L04, L05,  \
    L10, L11, L12, L13, L14, L15,  \
    L20, L21, L22, L23, L24, L25,  \
    L30, L31, L32, L33, L34, L35,  \
    L40, L41, L42, L43, L44, L45 ) \
  { \
    L05, L04, L03, L02, L01, L00,   \
    L10, L11, L12, L13, L14, L15,   \
    L25, L24, L23, L22, L21, L20,   \
    L30, L31, L32, L33, L34, L35,   \
    L46, L45, L44, L43, L42, L41    \
  }

/* RGB LED logical order map */
/* Top->Bottom, Right->Left */
#define RGBLIGHT_LED_MAP LED_LAYOUT( \
  25, 20, 15, 10,  5,  0,       \
  26, 21, 16, 11,  6,  1,       \
  27, 22, 17, 12,  7,  2,       \
  28, 23, 18, 13,  8,  3,       \
  29, 24, 19, 14,  9,  4 )

On a keyboard that uses the RGB LEDs as a backlight for each key, this macro helps to light the corresponding LED when the key is pressed.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

quantum/rgblight.c Outdated Show resolved Hide resolved
Copy link
Contributor

@mechmerlin mechmerlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mechmerlin mechmerlin merged commit f7fd7f6 into qmk:master Mar 20, 2019
chie4hao pushed a commit to chie4hao/qmk_firmware that referenced this pull request Mar 28, 2019
* rgblight.c: add RGBLIGHT_LED_MAP support

* add code to keyboards/helix/rev2/keymaps/five_rows/config.h to test rgblight.c:RGBLIGHT_LED_MAP

* Test end. Revert "add code to keyboards/helix/rev2/keymaps/five_rows/config.h to test rgblight.c:RGBLIGHT_LED_MAP"

This reverts commit e7488d6.

* update docs/feature_rgblight.md

* led_map[] move to PROGMEM
zer09 pushed a commit to zer09/qmk_firmware that referenced this pull request Mar 31, 2019
* rgblight.c: add RGBLIGHT_LED_MAP support

* add code to keyboards/helix/rev2/keymaps/five_rows/config.h to test rgblight.c:RGBLIGHT_LED_MAP

* Test end. Revert "add code to keyboards/helix/rev2/keymaps/five_rows/config.h to test rgblight.c:RGBLIGHT_LED_MAP"

This reverts commit e7488d6.

* update docs/feature_rgblight.md

* led_map[] move to PROGMEM
@mtei mtei deleted the rgblight.c-remap_feature branch April 8, 2019 20:46
danielo515 pushed a commit to danielo515/qmk_firmware that referenced this pull request May 15, 2019
* rgblight.c: add RGBLIGHT_LED_MAP support

* add code to keyboards/helix/rev2/keymaps/five_rows/config.h to test rgblight.c:RGBLIGHT_LED_MAP

* Test end. Revert "add code to keyboards/helix/rev2/keymaps/five_rows/config.h to test rgblight.c:RGBLIGHT_LED_MAP"

This reverts commit e7488d6.

* update docs/feature_rgblight.md

* led_map[] move to PROGMEM
Timbus pushed a commit to Timbus/qmk_firmware that referenced this pull request Jun 23, 2019
* rgblight.c: add RGBLIGHT_LED_MAP support

* add code to keyboards/helix/rev2/keymaps/five_rows/config.h to test rgblight.c:RGBLIGHT_LED_MAP

* Test end. Revert "add code to keyboards/helix/rev2/keymaps/five_rows/config.h to test rgblight.c:RGBLIGHT_LED_MAP"

This reverts commit e7488d6.

* update docs/feature_rgblight.md

* led_map[] move to PROGMEM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants