From 8521712bc08130821998796d73dfdd41a8a7fb0f Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Fri, 2 May 2014 15:09:22 +0900 Subject: [PATCH] Add breathing backlight support for LR92 --- keyboard/lr92/Makefile | 1 + keyboard/lr92/backlight.c | 81 ++++++++++++++++++++++++++++----------- keyboard/lr92/config.h | 4 ++ 3 files changed, 64 insertions(+), 22 deletions(-) diff --git a/keyboard/lr92/Makefile b/keyboard/lr92/Makefile index 9da7c64e..8433f390 100644 --- a/keyboard/lr92/Makefile +++ b/keyboard/lr92/Makefile @@ -136,6 +136,7 @@ NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality KEYMAP_EX_ENABLE = yes # External keymap in eeprom KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor +BREATHING_LED_ENABLE = yes # Enable breathing backlight # Optimize size but this may cause error "relocation truncated to fit" diff --git a/keyboard/lr92/backlight.c b/keyboard/lr92/backlight.c index 3859d49b..e61b5b4b 100644 --- a/keyboard/lr92/backlight.c +++ b/keyboard/lr92/backlight.c @@ -19,6 +19,7 @@ along with this program. If not, see . #include #include #include "backlight.h" +#include "breathing_led.h" static const uint8_t backlight_table[] PROGMEM = { 0, 16, 128, 255 @@ -27,32 +28,68 @@ static const uint8_t backlight_table[] PROGMEM = { /* Backlight pin configuration * PWM: PC6(OC3A) */ +void backlight_enable(void) +{ + // Turn on PWM + cli(); + DDRC |= (1< 0) { - // Turn on PWM - cli(); - DDRC |= (1<. #define DEBOUNCE 5 /* number of backlight levels */ +#ifdef BREATHING_LED_ENABLE +#define BACKLIGHT_LEVELS 6 +#else #define BACKLIGHT_LEVELS 3 +#endif /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE