Skip to content

Commit

Permalink
Extend maximum number of backlight levels to 31 (qmk#6351)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and drashna committed Jul 17, 2019
1 parent a8647f0 commit 3895b4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/feature_backlight.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To change the behaviour of the backlighting, `#define` these in your `config.h`:
|---------------------|-------------|-------------------------------------------------------------------------------------------------------------|
|`BACKLIGHT_PIN` |`B7` |The pin that controls the LEDs. Unless you are designing your own keyboard, you shouldn't need to change this|
|`BACKLIGHT_PINS` |*Not defined*|experimental: see below for more information |
|`BACKLIGHT_LEVELS` |`3` |The number of brightness levels (maximum 15 excluding off) |
|`BACKLIGHT_LEVELS` |`3` |The number of brightness levels (maximum 31 excluding off) |
|`BACKLIGHT_CAPS_LOCK`|*Not defined*|Enable Caps Lock indicator using backlight (for keyboards without dedicated LED) |
|`BACKLIGHT_BREATHING`|*Not defined*|Enable backlight breathing, if supported |
|`BREATHING_PERIOD` |`6` |The length of one backlight "breath" in seconds |
Expand Down
7 changes: 4 additions & 3 deletions tmk_core/common/backlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#ifndef BACKLIGHT_LEVELS
#define BACKLIGHT_LEVELS 3
#elif BACKLIGHT_LEVELS > 15
#error "Maximum value of BACKLIGHT_LEVELS is 15"
#elif BACKLIGHT_LEVELS > 31
#error "Maximum value of BACKLIGHT_LEVELS is 31"
#endif

typedef union {
uint8_t raw;
struct {
bool enable :1;
bool breathing :1;
uint8_t level :4;
uint8_t reserved :1; // Reserved for possible future backlight modes
uint8_t level :5;
};
} backlight_config_t;

Expand Down

0 comments on commit 3895b4b

Please sign in to comment.