Browse Source

staryu: Improve experience of backlight

master
Kai Ryu 7 years ago
parent
commit
f1148804a8
3 changed files with 12 additions and 5 deletions
  1. 8
    2
      keyboard/staryu/backlight.c
  2. 3
    2
      keyboard/staryu/config.h
  3. 1
    1
      tmk_core_custom

+ 8
- 2
keyboard/staryu/backlight.c View File

@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <avr/pgmspace.h>
#include "backlight.h"
#include "softpwm_led.h"
#include "action.h"
#include "hook.h"
#include "timer.h"
#include "rgb.h"

@@ -45,6 +45,7 @@ void backlight_set(uint8_t level)
backlight_brightness = pgm_read_byte(&backlight_table[level]);
softpwm_led_set_all(backlight_brightness);
rgb_set_brightness(backlight_brightness);
softpwm_led_enable_all();
break;
case 4:
case 5:
@@ -53,13 +54,16 @@ void backlight_set(uint8_t level)
breathing_led_set_duration(6 - level);
breathing_led_set_index_all(0);
breathing_led_enable_all();
softpwm_led_enable_all();
break;
case 7:
breathing_led_disable_all();
breathing_led_set_duration(1);
softpwm_led_set_all(0);
fading_led_set_direction_all(FADING_LED_FADE_OUT);
fading_led_set_duration(3);
fading_led_enable_all();
softpwm_led_enable_all();
break;
case 0:
default:
@@ -67,6 +71,7 @@ void backlight_set(uint8_t level)
breathing_led_disable_all();
backlight_brightness = 0;
softpwm_led_set_all(backlight_brightness);
softpwm_led_disable_all();
break;
}
}
@@ -126,13 +131,14 @@ void softpwm_led_off(uint8_t index)
static uint8_t idle_state = 0;
static uint16_t idle_last = 0;

void action_keyevent(keyevent_t event)
void hook_matrix_change(keyevent_t event)
{
if (backlight_config.enable) {
if (backlight_config.level == 7) {
if (event.pressed) {
if (idle_state > 1) {
breathing_led_disable_all();
softpwm_led_set_all(0);
}
idle_state = 0;
uint8_t key = event.key.col + 1;

+ 3
- 2
keyboard/staryu/config.h View File

@@ -21,8 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* USB Device descriptor parameter */
#define VENDOR_ID 0x1209
#define PRODUCT_ID 0x2333
#define DEVICE_VER 0x0104
#define PRODUCT_ID 0x2328
#define DEVICE_VER 0x0205
#define MANUFACTURER K.T.E.C.
#define PRODUCT Staryu
#define DESCRIPTION t.m.k. keyboard firmware for Staryu
@@ -45,6 +45,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define BACKLIGHT_LEVELS 7
#define CUSTOM_LED_ENABLE
#define RGB_LED_ENABLE
#define SOFTPWM_LED_FREQ 80

/* number of LEDs */
#define LED_COUNT 6

+ 1
- 1
tmk_core_custom

@@ -1 +1 @@
Subproject commit 85bb7f9de8452c1a4e718ae686f80249a490bc26
Subproject commit a9f231ea07a9e16816cd98f76f77720634eb725e