From 3ab4b014eb36d5acc7cea45e4be00d6cd3d90111 Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Mon, 18 May 2015 18:43:58 +0900 Subject: [PATCH] Modify files for Staryu normal version --- keyboard/staryu/Makefile | 8 +++--- keyboard/staryu/config.h | 4 +-- keyboard/staryu/keymap_default.c | 42 ++++++++++++++++++++++++++------ 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/keyboard/staryu/Makefile b/keyboard/staryu/Makefile index cf90f7b9..eafd04dc 100644 --- a/keyboard/staryu/Makefile +++ b/keyboard/staryu/Makefile @@ -52,7 +52,9 @@ SRC = keymap_common.c \ matrix.c \ led.c \ backlight.c \ - ledmap.c + ledmap.c \ + light_ws2812.c \ + rgb.c ifdef KEYMAP SRC := keymap_$(KEYMAP).c $(SRC) @@ -138,8 +140,8 @@ KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight FADING_LED_ENABLE = yes # Enable fading backlight BREATHING_LED_ENABLE = yes # Enable breathing backlight -LEDMAP_ENABLE = yes # Enable LED mapping -LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom +#LEDMAP_ENABLE = yes # Enable LED mapping +#LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom # Optimize size but this may cause error "relocation truncated to fit" diff --git a/keyboard/staryu/config.h b/keyboard/staryu/config.h index 31b3aed7..c5420f5a 100644 --- a/keyboard/staryu/config.h +++ b/keyboard/staryu/config.h @@ -42,10 +42,10 @@ along with this program. If not, see . #define DEBOUNCE 5 /* number of backlight levels */ -#define BACKLIGHT_LEVELS 8 +#define BACKLIGHT_LEVELS 7 /* number of LEDs */ -#define LED_COUNT 5 +#define LED_COUNT 6 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/staryu/keymap_default.c b/keyboard/staryu/keymap_default.c index 7b113b23..795a07ba 100644 --- a/keyboard/staryu/keymap_default.c +++ b/keyboard/staryu/keymap_default.c @@ -19,6 +19,7 @@ along with this program. If not, see . #include "keycode.h" #include "action.h" #include "keymap_common.h" +#include "rgb.h" // Default #ifdef KEYMAP_SECTION_ENABLE @@ -60,12 +61,19 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { KEYMAP( MS_U,FN3, MS_L,MS_D,MS_R ), /* Keymap 4 * ,-----------. - * | |Fn8|Fn4| + * | |Fn6|Fn4| * |---+---+---| - * |Fn6|Fn5|Fn7| + * |Fn7|Fn5|Fn8| * `-----------' */ - KEYMAP( FN7, FN3, FN5, FN4, FN6 ), + KEYMAP( FN6, FN4, FN7, FN5, FN8 ), +}; + +enum function_id { + AF_RGB_TOGGLE = 0, + AF_RGB_DECREASE, + AF_RGB_INCREASE, + AF_RGB_STEP }; /* @@ -80,10 +88,10 @@ const uint16_t fn_actions[] PROGMEM = { [2] = ACTION_DEFAULT_LAYER_SET(3), [3] = ACTION_DEFAULT_LAYER_SET(4), [4] = ACTION_DEFAULT_LAYER_SET(0), - [5] = ACTION_BACKLIGHT_TOGGLE(), - [6] = ACTION_BACKLIGHT_DECREASE(), - [7] = ACTION_BACKLIGHT_INCREASE(), - [8] = ACTION_BACKLIGHT_STEP() + [5] = ACTION_BACKLIGHT_DECREASE(), + [6] = ACTION_BACKLIGHT_INCREASE(), + [7] = ACTION_FUNCTION(AF_RGB_DECREASE), + [8] = ACTION_FUNCTION(AF_RGB_INCREASE) #endif }; @@ -96,3 +104,23 @@ uint16_t fn_actions_count(void) { return sizeof(fn_actions) / sizeof(fn_actions[0]); } #endif + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + if (record->event.pressed) { + switch (id) { + case AF_RGB_TOGGLE: + rgb_toggle(); + break; + case AF_RGB_DECREASE: + rgb_decrease(); + break; + case AF_RGB_INCREASE: + rgb_increase(); + break; + case AF_RGB_STEP: + rgb_step(); + break; + } + } +}