From 28aeef231b95f15ad0ddbc368781e986f559aaa8 Mon Sep 17 00:00:00 2001 From: Mathias Andersson Date: Mon, 20 May 2013 21:08:21 +0200 Subject: [PATCH] Fix Phantom sleep LED. --- keyboard/phantom/config.h | 4 ++++ keyboard/phantom/led.c | 27 +++++++++++++++++++++------ keyboard/phantom/matrix.c | 12 ++++++++---- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/keyboard/phantom/config.h b/keyboard/phantom/config.h index 09f758cd..6f538933 100644 --- a/keyboard/phantom/config.h +++ b/keyboard/phantom/config.h @@ -39,6 +39,10 @@ along with this program. If not, see . /* Set 0 if need no debouncing */ #define DEBOUNCE 7 +/* Set LED brightness 0-255. + * This have no effect if sleep LED is enabled. */ +#define LED_BRIGHTNESS 250 + /* key combination for command */ #define IS_COMMAND() ( \ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ diff --git a/keyboard/phantom/led.c b/keyboard/phantom/led.c index 109004ba..f4e9108f 100644 --- a/keyboard/phantom/led.c +++ b/keyboard/phantom/led.c @@ -16,19 +16,34 @@ along with this program. If not, see . */ #include -#include "stdint.h" #include "led.h" void led_set(uint8_t usb_led) { - if (!(usb_led & (1< PORTB6, LED_B -> PORTB7 - DDRB &= 0x3F; - PORTB &= 0x3F; + DDRB |= (1<<6) | (1<<7); + PORTB &= ~((1<<6) | (1<<7)); } +#endif inline uint8_t matrix_rows(void) @@ -79,7 +81,9 @@ void matrix_init(void) // initialize row and col unselect_cols(); init_rows(); +#ifndef SLEEP_LED_ENABLE setup_leds(); +#endif // initialize matrix state: all keys off for (uint8_t i = 0; i < MATRIX_ROWS; i++) {