From 58d598d5ee2d9420850684b8e8ce414225ea658d Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Mon, 28 Apr 2014 16:39:43 +0900 Subject: [PATCH] Add breathing backlight support for smart68 --- keyboard/smart68/Makefile | 1 + keyboard/smart68/backlight.c | 75 ++++++++++++++++++++++++++++-------- keyboard/smart68/config.h | 4 ++ 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/keyboard/smart68/Makefile b/keyboard/smart68/Makefile index 55c78da8..ec8b8d73 100644 --- a/keyboard/smart68/Makefile +++ b/keyboard/smart68/Makefile @@ -131,6 +131,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/smart68/backlight.c b/keyboard/smart68/backlight.c index 84c753af..89434a48 100644 --- a/keyboard/smart68/backlight.c +++ b/keyboard/smart68/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,26 +28,68 @@ static const uint8_t backlight_table[] PROGMEM = { /* Backlight pin configuration * PWM: PB7 */ +void backlight_enable(void) +{ + // Turn on PWM + cli(); + DDRB |= (1< 0) { - // Turn on PWM - cli(); - DDRB |= (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