Browse Source

Modify files for Staryu normal version

old_master
Kai Ryu 9 years ago
parent
commit
3ab4b014eb
3 changed files with 42 additions and 12 deletions
  1. 5
    3
      keyboard/staryu/Makefile
  2. 2
    2
      keyboard/staryu/config.h
  3. 35
    7
      keyboard/staryu/keymap_default.c

+ 5
- 3
keyboard/staryu/Makefile View File

@@ -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"

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

@@ -42,10 +42,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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

+ 35
- 7
keyboard/staryu/keymap_default.c View File

@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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;
}
}
}