redscarfII: Add support for RedScarfII+
This commit is contained in:
parent
cf3121c650
commit
6757f9138d
@ -42,7 +42,7 @@
|
|||||||
TARGET = RedScarfII_lufa
|
TARGET = RedScarfII_lufa
|
||||||
|
|
||||||
# Directory common source filess exist
|
# Directory common source filess exist
|
||||||
TOP_DIR = ../..
|
TMK_DIR = ../../tmk_core_custom
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
# Directory keyboard dependent files exist
|
||||||
TARGET_DIR = .
|
TARGET_DIR = .
|
||||||
@ -52,7 +52,10 @@ SRC = keymap_common.c \
|
|||||||
matrix.c \
|
matrix.c \
|
||||||
led.c \
|
led.c \
|
||||||
backlight.c \
|
backlight.c \
|
||||||
ledmap.c
|
ledmap.c \
|
||||||
|
yc059.c \
|
||||||
|
rgb.c \
|
||||||
|
suspend.c
|
||||||
|
|
||||||
ifdef KEYMAP
|
ifdef KEYMAP
|
||||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
SRC := keymap_$(KEYMAP).c $(SRC)
|
||||||
@ -102,7 +105,7 @@ ARCH = AVR8
|
|||||||
F_USB = $(F_CPU)
|
F_USB = $(F_CPU)
|
||||||
|
|
||||||
# Interrupt driven control endpoint task(+60)
|
# Interrupt driven control endpoint task(+60)
|
||||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT -DREDSCARFII_PLUS
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in *bytes*
|
# Boot Section Size in *bytes*
|
||||||
@ -122,7 +125,7 @@ endif
|
|||||||
# comment out to disable the options.
|
# comment out to disable the options.
|
||||||
#
|
#
|
||||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
#MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
@ -146,9 +149,8 @@ LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
|
|||||||
|
|
||||||
# Search Path
|
# Search Path
|
||||||
VPATH += $(TARGET_DIR)
|
VPATH += $(TARGET_DIR)
|
||||||
VPATH += $(TOP_DIR)
|
VPATH += $(TMK_DIR)
|
||||||
|
|
||||||
include $(TOP_DIR)/protocol/lufa.mk
|
include $(TMK_DIR)/protocol/lufa.mk
|
||||||
include $(TOP_DIR)/protocol.mk
|
include $(TMK_DIR)/common.mk
|
||||||
include $(TOP_DIR)/common.mk
|
include $(TMK_DIR)/rules.mk
|
||||||
include $(TOP_DIR)/rules.mk
|
|
||||||
|
@ -36,7 +36,7 @@ inline void backlight_set_raw(uint8_t raw);
|
|||||||
|
|
||||||
#ifdef SOFTPWM_LED_ENABLE
|
#ifdef SOFTPWM_LED_ENABLE
|
||||||
#ifdef FADING_LED_ENABLE
|
#ifdef FADING_LED_ENABLE
|
||||||
static uint8_t backlight_mode;
|
extern backlight_config_t backlight_config;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -66,10 +66,6 @@ void backlight_disable(void)
|
|||||||
|
|
||||||
void backlight_set(uint8_t level)
|
void backlight_set(uint8_t level)
|
||||||
{
|
{
|
||||||
#ifdef FADING_LED_ENABLE
|
|
||||||
backlight_mode = level;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BREATHING_LED_ENABLE
|
#ifdef BREATHING_LED_ENABLE
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -187,14 +183,20 @@ void softpwm_led_off(uint8_t index)
|
|||||||
#ifdef FADING_LED_ENABLE
|
#ifdef FADING_LED_ENABLE
|
||||||
void action_keyevent(keyevent_t event)
|
void action_keyevent(keyevent_t event)
|
||||||
{
|
{
|
||||||
if (backlight_mode == 7) {
|
if (backlight_config.enable) {
|
||||||
if (event.pressed) {
|
switch (backlight_config.level) {
|
||||||
softpwm_led_decrease_all(32);
|
case 7:
|
||||||
}
|
if (event.pressed) {
|
||||||
}
|
fading_led_set_delay_all(64);
|
||||||
if (backlight_mode == 8) {
|
softpwm_led_decrease_all(32);
|
||||||
if (event.pressed) {
|
}
|
||||||
softpwm_led_increase_all(32);
|
break;;
|
||||||
|
case 8:
|
||||||
|
if (event.pressed) {
|
||||||
|
fading_led_set_delay_all(64);
|
||||||
|
softpwm_led_increase_all(32);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
/* USB Device descriptor parameter */
|
/* USB Device descriptor parameter */
|
||||||
#define VENDOR_ID 0x5253
|
#define VENDOR_ID 0x5253
|
||||||
#define PRODUCT_ID 0x0002
|
#define PRODUCT_ID 0x0002
|
||||||
|
#ifdef REDSCARFII_PLUS
|
||||||
|
#define DEVICE_VER 0x0002
|
||||||
|
#define MANUFACTURER Young Pioneers
|
||||||
|
#define PRODUCT Red Scarf II+
|
||||||
|
#define DESCRIPTION t.m.k. keyboard firmware for Red Scarf II+
|
||||||
|
#else
|
||||||
#define DEVICE_VER 0x0001
|
#define DEVICE_VER 0x0001
|
||||||
#define MANUFACTURER Young Pioneers
|
#define MANUFACTURER Young Pioneers
|
||||||
#define PRODUCT Red Scarf II
|
#define PRODUCT Red Scarf II
|
||||||
#define DESCRIPTION t.m.k. keyboard firmware for Red Scarf II
|
#define DESCRIPTION t.m.k. keyboard firmware for Red Scarf II
|
||||||
|
#endif
|
||||||
|
|
||||||
/* key matrix size */
|
/* key matrix size */
|
||||||
#define MATRIX_ROWS 6
|
#define MATRIX_ROWS 6
|
||||||
@ -51,8 +58,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#else
|
#else
|
||||||
#define BACKLIGHT_LEVELS 3
|
#define BACKLIGHT_LEVELS 3
|
||||||
#endif
|
#endif
|
||||||
|
#define BACKLIGHT_CUSTOM
|
||||||
|
|
||||||
|
/* number of leds */
|
||||||
|
#ifdef REDSCARFII_PLUS
|
||||||
|
#define LED_COUNT 3
|
||||||
|
#else
|
||||||
#define LED_COUNT 4
|
#define LED_COUNT 4
|
||||||
|
#endif
|
||||||
|
#define EECONFIG_LEDMAP_IN_EEPROM 8
|
||||||
|
|
||||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
#define LOCKING_SUPPORT_ENABLE
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
@ -65,6 +79,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#define SUSPEND_ACTION
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Feature disable options
|
* Feature disable options
|
||||||
* These options are also useful to firmware size reduction.
|
* These options are also useful to firmware size reduction.
|
||||||
|
@ -39,18 +39,18 @@ extern const uint16_t fn_actions[];
|
|||||||
* K3B and K2M are extra keys for ISO
|
* K3B and K2M are extra keys for ISO
|
||||||
*/
|
*/
|
||||||
#define KEYMAP( \
|
#define KEYMAP( \
|
||||||
K5A, K5F, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H, K0I, K0J, K0K, K0L, K0M, K0N, K0P, K0Q, K0R, K0S, \
|
K5B, K5C, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H, K0I, K0J, K0K, K0L, K0M, K0N, K0P, K0Q, K0R, K0S, \
|
||||||
K5B, K5G, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, K1S, \
|
K5D, K5E, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, K1S, \
|
||||||
K5C, K5H, K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, K2S, \
|
K5F, K5G, K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, K2S, \
|
||||||
K5D, K5I, K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, K3S, \
|
K5H, K5I, K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, K3S, \
|
||||||
K5E, K5J, K4A, K4B, K4C, K4J, K4K, K4L, K4M, K4N, K4P, K4Q, K4R, K4S \
|
K5J, K5K, K4A, K4B, K4C, K4J, K4K, K4L, K4H, K4M, K4N, K4P, K4Q, K4R, K4S \
|
||||||
) { \
|
) { \
|
||||||
{ KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F, KC_##K0G, KC_##K0H, KC_##K0I, KC_##K0J, KC_##K0K, KC_##K0L, KC_##K0M, KC_##K0N, KC_##K0P, KC_##K0Q, KC_##K0R, KC_##K0S }, \
|
{ KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F, KC_##K0G, KC_##K0H, KC_##K0I, KC_##K0J, KC_##K0K, KC_##K0L, KC_##K0M, KC_##K0N, KC_##K0P, KC_##K0Q, KC_##K0R, KC_##K0S }, \
|
||||||
{ KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F, KC_##K1G, KC_##K1H, KC_##K1I, KC_##K1J, KC_##K1K, KC_##K1L, KC_##K1M, KC_##K1N, KC_##K1P, KC_##K1Q, KC_##K1R, KC_##K1S }, \
|
{ KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F, KC_##K1G, KC_##K1H, KC_##K1I, KC_##K1J, KC_##K1K, KC_##K1L, KC_##K1M, KC_##K1N, KC_##K1P, KC_##K1Q, KC_##K1R, KC_##K1S }, \
|
||||||
{ KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F, KC_##K2G, KC_##K2H, KC_##K2I, KC_##K2J, KC_##K2K, KC_##K2L, KC_##K2M, KC_##K2N, KC_##K2P, KC_##K2Q, KC_##K2R, KC_##K2S }, \
|
{ KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F, KC_##K2G, KC_##K2H, KC_##K2I, KC_##K2J, KC_##K2K, KC_##K2L, KC_##K2M, KC_##K2N, KC_##K2P, KC_##K2Q, KC_##K2R, KC_##K2S }, \
|
||||||
{ KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F, KC_##K3G, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K3L, KC_##K3M, KC_##K3N, KC_##K3P, KC_##K3Q, KC_##K3R, KC_##K3S }, \
|
{ KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F, KC_##K3G, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K3L, KC_##K3M, KC_##K3N, KC_##K3P, KC_##K3Q, KC_##K3R, KC_##K3S }, \
|
||||||
{ KC_##K4A, KC_##K4B, KC_##K4C, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K4J, KC_##K4K, KC_##K4L, KC_##K4M, KC_##K4N, KC_##K4P, KC_##K4Q, KC_##K4R, KC_##K4S }, \
|
{ KC_##K4A, KC_##K4B, KC_##K4C, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K4H, KC_NO, KC_##K4J, KC_##K4K, KC_##K4L, KC_##K4M, KC_##K4N, KC_##K4P, KC_##K4Q, KC_##K4R, KC_##K4S }, \
|
||||||
{ KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F, KC_##K5G, KC_##K5H, KC_##K5I, KC_##K5J, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
|
{ KC_NO, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F, KC_##K5G, KC_##K5H, KC_##K5I, KC_##K5J, KC_##K5K, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No extra F1-F10 keys */
|
/* No extra F1-F10 keys */
|
||||||
@ -59,13 +59,13 @@ extern const uint16_t fn_actions[];
|
|||||||
K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, K1S, \
|
K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, K1S, \
|
||||||
K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, K2S, \
|
K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, K2S, \
|
||||||
K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, K3S, \
|
K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, K3S, \
|
||||||
K4A, K4B, K4C, K4J, K4K, K4L, K4M, K4N, K4P, K4Q, K4R, K4S \
|
K4A, K4B, K4C, K4J, K4K, K4L, K4H, K4M, K4N, K4P, K4Q, K4R, K4S \
|
||||||
) KEYMAP( \
|
) KEYMAP( \
|
||||||
NO, NO, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H, K0I, K0J, K0K, K0L, K0M, K0N, K0P, K0Q, K0R, K0S, \
|
NO, NO, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H, K0I, K0J, K0K, K0L, K0M, K0N, K0P, K0Q, K0R, K0S, \
|
||||||
NO, NO, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, K1S, \
|
NO, NO, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, K1S, \
|
||||||
NO, NO, K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, K2S, \
|
NO, NO, K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, K2S, \
|
||||||
NO, NO, K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, K3S, \
|
NO, NO, K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, K3S, \
|
||||||
NO, NO, K4A, K4B, K4C, K4J, K4K, K4L, K4M, K4N, K4P, K4Q, K4R, K4S \
|
NO, NO, K4A, K4B, K4C, K4J, K4K, K4L, K4H, K4M, K4N, K4P, K4Q, K4R, K4S \
|
||||||
)
|
)
|
||||||
|
|
||||||
/* ANSI valiant. No extra keys for ISO */
|
/* ANSI valiant. No extra keys for ISO */
|
||||||
@ -74,13 +74,13 @@ extern const uint16_t fn_actions[];
|
|||||||
K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, \
|
K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, \
|
||||||
K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, K2P, K2Q, K2R, K2S, \
|
K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, K2P, K2Q, K2R, K2S, \
|
||||||
K3A, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
|
K3A, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
|
||||||
K4A, K4B, K4C, K4I, K4K, K4L, K4M, K4N, K4P, K4Q, K4R, K4S \
|
K4A, K4B, K4C, K4I, K4K, K4L, K4H, K4M, K4N, K4P, K4Q, K4R, K4S \
|
||||||
) KEYMAP_NORMAL( \
|
) KEYMAP_NORMAL( \
|
||||||
K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H, K0I, K0J, K0K, K0L, K0M, K0N, K0P, K0Q, K0R, K0S, \
|
K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H, K0I, K0J, K0K, K0L, K0M, K0N, K0P, K0Q, K0R, K0S, \
|
||||||
K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, NO, \
|
K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, NO, \
|
||||||
K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, NO, K2N, K2P, K2Q, K2R, K2S, \
|
K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, NO, K2N, K2P, K2Q, K2R, K2S, \
|
||||||
K3A, NO, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, NO, \
|
K3A, NO, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, NO, \
|
||||||
K4A, K4B, K4C, K4I, K4K, K4L, K4M, K4N, K4P, K4Q, K4R, K4S \
|
K4A, K4B, K4C, K4I, K4K, K4L, K4H, K4M, K4N, K4P, K4Q, K4R, K4S \
|
||||||
)
|
)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "keymap_common.h"
|
#include "keymap_common.h"
|
||||||
|
#include "rgb.h"
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
#ifdef KEYMAP_SECTION_ENABLE
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
@ -6,7 +7,7 @@ const uint8_t keymaps[KEYMAPS_COUNT][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((s
|
|||||||
#else
|
#else
|
||||||
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
||||||
#endif
|
#endif
|
||||||
/* Keymap 0: Default Layer
|
/* Keymap 0: ModelF/77 - OEM 1.25-1.25-1.25-6.25-1.25-1.25-1.25-1.25
|
||||||
* ,-----------------------------------------------------------------------------------.
|
* ,-----------------------------------------------------------------------------------.
|
||||||
* | F1| F6|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Num| /| *| -|
|
* | F1| F6|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Num| /| *| -|
|
||||||
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
||||||
@ -16,34 +17,129 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
|||||||
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
||||||
* | F4| F9|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0| 1| 2| 3| |
|
* | F4| F9|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0| 1| 2| 3| |
|
||||||
* |---+---+-----------------------------------------------------------+---+---+---|Ent|
|
* |---+---+-----------------------------------------------------------+---+---+---|Ent|
|
||||||
* | F5|F10|Ctrl|Gui |Alt | Space |Alt |Gui |Fn0 |Ctrl| 0| 0| .| |
|
* | F5|F10|Ctrl|Gui |Alt | Space |Alt |Fn0 |Gui |Ctrl| 0| 0| .| |
|
||||||
* `-----------------------------------------------------------------------------------'
|
* `-----------------------------------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
KEYMAP(
|
KEYMAP(
|
||||||
F1, F6, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,NLCK,PSLS,PAST,PMNS, \
|
F1, F2, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,NLCK,PSLS,PAST,PMNS, \
|
||||||
F2, F7, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS,P7, P8, P9, PPLS, \
|
F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS,P7, P8, P9, PPLS, \
|
||||||
F3, F8, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, P4, P5, P6, PPLS, \
|
F5, F6, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, P4, P5, P6, PPLS, \
|
||||||
F4, F9, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, P1, P2, P3, PENT, \
|
F7, F8, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, P1, P2, P3, PENT, \
|
||||||
F5, F10, LCTL,LGUI,LALT, SPC, RALT,FN0, RGUI,RCTL,P0, P0, PDOT,PENT ),
|
F9, F10, LCTL,LGUI,LALT, SPC, RALT,FN0, RGUI,RGUI,RCTL,P0, P0, PDOT,PENT ),
|
||||||
/* Keymap 1: Fn Layer
|
/* Keymap 1: ModelF/77 - Winkeyless 1.5-1-1.5-7-1.5-1-1.5
|
||||||
* ,-----------------------------------------------------------------------------------.
|
* ,-----------------------------------------------------------------------------------.
|
||||||
* | | | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | | | | |
|
* | F1| F6|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Num| /| *| -|
|
||||||
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
||||||
* | | | | |Up | | | |Cal| |Ins| |Psc|Slk|Pau| | | | | |
|
* | F2| F7|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| 7| 8| 9| |
|
||||||
* |---+---+-----------------------------------------------------------|---+---+---| |
|
* |---+---+-----------------------------------------------------------+---+---+---| +|
|
||||||
* | | | |Lef|Dow|Rig| | | | | | |Hom|PgU| | | | | |
|
* | F3| F8|Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | 4| 5| 6| |
|
||||||
* |---+---+-----------------------------------------------------------|---+---+---+---|
|
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
||||||
* | | | | |App|Fn1|Fn2|Fn3|VoD|VoU|Mut|End|PgD| | | | | | |
|
* | F4| F9|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0| 1| 2| 3| |
|
||||||
* |---+---+-----------------------------------------------------------+---+---+---| |
|
* |---+---+-----------------------------------------------------------+---+---+---|Ent|
|
||||||
* | | | | | | Fn4 | | | | | | | | |
|
* | F5|F10|Ctrl |Gui|Alt | Space |Alt |Fn0|Ctrl | 0| 0| .| |
|
||||||
* `-----------------------------------------------------------------------------------'
|
* `-----------------------------------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
KEYMAP(
|
KEYMAP(
|
||||||
TRNS,TRNS,GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, TRNS,TRNS,TRNS,TRNS, \
|
F1, F2, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,NLCK,PSLS,PAST,PMNS, \
|
||||||
TRNS,TRNS,TRNS,TRNS,UP, TRNS,TRNS,TRNS,CALC,TRNS,INS, TRNS,PSCR,SLCK,PAUS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS,P7, P8, P9, PPLS, \
|
||||||
TRNS,TRNS,TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,PGUP,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
F5, F6, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, P4, P5, P6, PPLS, \
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,APP, FN1, FN2, FN3, VOLD,VOLU,MUTE,END, PGDN,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
F7, F8, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, P1, P2, P3, PENT, \
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS, FN4, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS ),
|
F9, F10, LCTL,LGUI,LALT, SPC, RALT,RALT,RGUI,FN0, RCTL,P0, P0, PDOT,PENT ),
|
||||||
|
/* Keymap 2: ModelF/77 - OEM + Arrow Keys 1.25-1.25-1.25-6.25-1-1-1-1-1
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | F1| F6|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Num| /| *| -|
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
||||||
|
* | F2| F7|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| 7| 8| 9| |
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---| +|
|
||||||
|
* | F3| F8|Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | 4| 5| 6| |
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
||||||
|
* | F4| F9|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up| 1| 2| 3| |
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---|Ent|
|
||||||
|
* | F5|F10|Ctrl|Gui |Alt | Space |Alt|Fn0|Ctr|Lef|Dow|Rig| 0| .| |
|
||||||
|
* `-----------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP(
|
||||||
|
F1, F2, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,NLCK,PSLS,PAST,PMNS, \
|
||||||
|
F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS,P7, P8, P9, PPLS, \
|
||||||
|
F5, F6, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, P4, P5, P6, PPLS, \
|
||||||
|
F7, F8, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,UP, P1, P2, P3, PENT, \
|
||||||
|
F9, F10, LCTL,LGUI,LALT, SPC, RALT,FN0, RCTL,LEFT,DOWN,RGHT,P0, PDOT,PENT ),
|
||||||
|
/* Keymap 3: ModelF/77 - 18xx 1.5-1.5-7-1.5-1.5-1-1
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | F1| F6|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Num| /| *| -|
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
||||||
|
* | F2| F7|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| 7| 8| 9| |
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---| +|
|
||||||
|
* | F3| F8|Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | 4| 5| 6| |
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
||||||
|
* | F4| F9|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up| 1| 2| 3| |
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---|Ent|
|
||||||
|
* | F5|F10|Ctrl |Alt | Space |Alt |Ctrl |Lef|Dow|Rig| 0| .| |
|
||||||
|
* `-----------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP(
|
||||||
|
F1, F2, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,NLCK,PSLS,PAST,FN0, \
|
||||||
|
F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS,P7, P8, P9, PMNS, \
|
||||||
|
F5, F6, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, P4, P5, P6, PPLS, \
|
||||||
|
F7, F8, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,UP, P1, P2, P3, PENT, \
|
||||||
|
F9, F10, LCTL,LGUI,LALT, SPC, RALT,FN0, RCTL,LEFT,DOWN,RGHT,P0, PDOT,PENT ),
|
||||||
|
/* Keymap 4: Mini/68 - OEM 1.25-1.25-1.25-6.25-1-1-1
|
||||||
|
* ,-----------------------------------------------------------------------.
|
||||||
|
* | F1| F6|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |Hom|
|
||||||
|
* |---+---+-----------------------------------------------------------+---|
|
||||||
|
* | F2| F7|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|PgU|
|
||||||
|
* |---+---+-----------------------------------------------------------+---|
|
||||||
|
* | F3| F8|Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |PgD|
|
||||||
|
* |---+---+-----------------------------------------------------------+---|
|
||||||
|
* | F4| F9|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up|End|
|
||||||
|
* |---+---+-----------------------------------------------------------+---|
|
||||||
|
* | F5|F10|Ctrl|Gui |Alt | Space |Alt|Fn0|Ctr|Lef|Dow|Rig|
|
||||||
|
* `-----------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP(
|
||||||
|
F1, F2, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,HOME,PSLS,PAST,FN0, \
|
||||||
|
F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS,PGUP,P8, P9, PMNS, \
|
||||||
|
F5, F6, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, PGDN,P5, P6, PPLS, \
|
||||||
|
F7, F8, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,UP, END, P2, P3, PENT, \
|
||||||
|
F9, F10, LCTL,LGUI,LALT, SPC, RALT,FN0, RCTL,LEFT,DOWN,RGHT,P0, PDOT,PENT ),
|
||||||
|
/* Keymap 5: Mini/68 - 18xx 1.5-1.5-7-1.5-1.5
|
||||||
|
* ,-----------------------------------------------------------------------.
|
||||||
|
* | F1| F6|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | `|
|
||||||
|
* |---+---+-----------------------------------------------------------+---|
|
||||||
|
* | F2| F7|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|PgU|
|
||||||
|
* |---+---+-----------------------------------------------------------+---|
|
||||||
|
* | F3| F8|Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |PgD|
|
||||||
|
* |---+---+-----------------------------------------------------------+---|
|
||||||
|
* | F4| F9|Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up|Fn0|
|
||||||
|
* |---+---+-----------------------------------------------------------+---|
|
||||||
|
* | F5|F10|Ctrl |Alt | Space |Alt |Ctrl |Lef|Dow|Rig|
|
||||||
|
* `-----------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP(
|
||||||
|
F1, F2, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,GRV, PSLS,PAST,FN0, \
|
||||||
|
F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS,PGUP,P8, P9, PMNS, \
|
||||||
|
F5, F6, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, PGDN,P5, P6, PPLS, \
|
||||||
|
F7, F8, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,UP, FN0, P2, P3, PENT, \
|
||||||
|
F9, F10, LCTL,LGUI,LALT, SPC, RALT,FN0, RCTL,LEFT,DOWN,RGHT,P0, PDOT,PENT ),
|
||||||
|
/* Keymap 6: Fn Layer
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* |n17|n24| `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |n10|n11|n12|n13|
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---+---|
|
||||||
|
* |n10|n22| | |Up |Fn5|Fn6|Fn7|Cal| |Ins| |Psc|Slk|Pau| |n14|n15|n16| |
|
||||||
|
* |---+---+-----------------------------------------------------------|---+---+---|n17|
|
||||||
|
* |n14|n16| |Lef|Dow|Rig|Fn8|Fn9| | | | |Hom|PgU| |n18|n19|n20| |
|
||||||
|
* |---+---+-----------------------------------------------------------|---+---+---+---|
|
||||||
|
* |n25|n27| | |App|Fn1|Fn2|Fn3|VoD|VoU|Mut|End|PgD| | |n22|n23|n24| |
|
||||||
|
* |---+---+-----------------------------------------------------------+---+---+---|n25|
|
||||||
|
* |n15|n13| | | | | | | | |n26|n27|n28| |
|
||||||
|
* `-----------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP(
|
||||||
|
FN10,FN14,GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, FN10,FN11,FN12,FN13, \
|
||||||
|
FN26,FN15,TRNS,TRNS,UP, FN5, FN6, FN7, CALC,TRNS,INS, TRNS,PSCR,SLCK,PAUS,TRNS,FN14,FN15,FN16,FN17, \
|
||||||
|
FN23,FN16,TRNS,LEFT,DOWN,RGHT,FN8, FN9, TRNS,TRNS,TRNS,TRNS,HOME,PGUP,TRNS,TRNS,FN18,FN19,FN20,FN21, \
|
||||||
|
FN28,FN13,TRNS,TRNS,TRNS,APP, FN1, FN2, FN3, VOLD,VOLU,MUTE,END, PGDN,TRNS,TRNS,FN22,FN23,FN24,FN25, \
|
||||||
|
FN17,FN25,TRNS,TRNS,TRNS, FN4, TRNS,TRNS,TRNS,TRNS,TRNS,FN26,FN27,FN28,FN29 ),
|
||||||
/* Keymap 2: Arrow key Overlayer
|
/* Keymap 2: Arrow key Overlayer
|
||||||
* ,-----------------------------------------------------------------------------------.
|
* ,-----------------------------------------------------------------------------------.
|
||||||
* | | | | | | | | | | | | | | | | | | | | |
|
* | | | | | | | | | | | | | | | | | | | | |
|
||||||
@ -57,12 +153,28 @@ const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
|||||||
* | | | | | | | | | | |Lef|Dow|Rig| |
|
* | | | | | | | | | | |Lef|Dow|Rig| |
|
||||||
* `-----------------------------------------------------------------------------------'
|
* `-----------------------------------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
KEYMAP(
|
KEYMAP(
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,UP, TRNS,TRNS, \
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,UP, TRNS,TRNS, \
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,LEFT,DOWN,RGHT,TRNS ),
|
TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,LEFT,DOWN,RGHT,TRNS ),
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Action function definition
|
||||||
|
*/
|
||||||
|
enum function_id {
|
||||||
|
AF_RGB_ON = 0,
|
||||||
|
AF_RGB_OFF,
|
||||||
|
AF_RGB_TOGGLE,
|
||||||
|
AF_RGB_INCREASE,
|
||||||
|
AF_RGB_DECREASE,
|
||||||
|
AF_RGB_FIXED,
|
||||||
|
AF_RGB_VARIABLE,
|
||||||
|
AF_RGB_STEP
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -73,12 +185,36 @@ const uint16_t fn_actions[FN_ACTIONS_COUNT] __attribute__ ((section (".keymap.fn
|
|||||||
#else
|
#else
|
||||||
const uint16_t fn_actions[] PROGMEM = {
|
const uint16_t fn_actions[] PROGMEM = {
|
||||||
#endif
|
#endif
|
||||||
/* Poker2 Layout */
|
[0] = ACTION_LAYER_MOMENTARY(6),
|
||||||
[0] = ACTION_LAYER_MOMENTARY(1),
|
|
||||||
[1] = ACTION_BACKLIGHT_DECREASE(),
|
[1] = ACTION_BACKLIGHT_DECREASE(),
|
||||||
[2] = ACTION_BACKLIGHT_TOGGLE(),
|
[2] = ACTION_BACKLIGHT_TOGGLE(),
|
||||||
[3] = ACTION_BACKLIGHT_INCREASE(),
|
[3] = ACTION_BACKLIGHT_INCREASE(),
|
||||||
[4] = ACTION_LAYER_TOGGLE(2)
|
[5] = ACTION_FUNCTION(AF_RGB_TOGGLE),
|
||||||
|
/*[4] = ACTION_LAYER_TOGGLE(2),*/
|
||||||
|
[6] = ACTION_FUNCTION_OPT(AF_RGB_STEP, RGB_FIXED),
|
||||||
|
[7] = ACTION_FUNCTION_OPT(AF_RGB_STEP, RGB_VARIABLE),
|
||||||
|
[8] = ACTION_FUNCTION(AF_RGB_DECREASE),
|
||||||
|
[9] = ACTION_FUNCTION(AF_RGB_INCREASE),
|
||||||
|
[10] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_RED),
|
||||||
|
[11] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_GREEN),
|
||||||
|
[12] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_BLUE),
|
||||||
|
[13] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_WHITE),
|
||||||
|
[14] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_RED_1),
|
||||||
|
[15] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_GREEN_1),
|
||||||
|
[16] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_BLUE_1),
|
||||||
|
[17] = ACTION_FUNCTION_OPT(AF_RGB_VARIABLE, RGB_VARIABLE_FLASH),
|
||||||
|
[18] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_RED_2),
|
||||||
|
[19] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_GREEN_2),
|
||||||
|
[20] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_BLUE_2),
|
||||||
|
[21] = ACTION_FUNCTION_OPT(AF_RGB_VARIABLE, RGB_VARIABLE_STROBE),
|
||||||
|
[22] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_RED_3),
|
||||||
|
[23] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_GREEN_3),
|
||||||
|
[24] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_BLUE_3),
|
||||||
|
[25] = ACTION_FUNCTION_OPT(AF_RGB_VARIABLE, RGB_VARIABLE_FADE),
|
||||||
|
[26] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_RED_4),
|
||||||
|
[27] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_GREEN_4),
|
||||||
|
[28] = ACTION_FUNCTION_OPT(AF_RGB_FIXED, RGB_FIXED_BLUE_4),
|
||||||
|
[29] = ACTION_FUNCTION_OPT(AF_RGB_VARIABLE, RGB_VARIABLE_SMOOTH),
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef KEYMAP_IN_EEPROM_ENABLE
|
#ifdef KEYMAP_IN_EEPROM_ENABLE
|
||||||
@ -91,6 +227,38 @@ uint16_t fn_actions_count(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
|
{
|
||||||
|
if (record->event.pressed) {
|
||||||
|
switch (id) {
|
||||||
|
case AF_RGB_ON:
|
||||||
|
rgb_on();
|
||||||
|
break;
|
||||||
|
case AF_RGB_OFF:
|
||||||
|
rgb_off();
|
||||||
|
break;
|
||||||
|
case AF_RGB_TOGGLE:
|
||||||
|
rgb_toggle();
|
||||||
|
break;
|
||||||
|
case AF_RGB_INCREASE:
|
||||||
|
rgb_increase();
|
||||||
|
break;
|
||||||
|
case AF_RGB_DECREASE:
|
||||||
|
rgb_decrease();
|
||||||
|
break;
|
||||||
|
case AF_RGB_FIXED:
|
||||||
|
rgb_set(RGB_FIXED, opt);
|
||||||
|
break;
|
||||||
|
case AF_RGB_VARIABLE:
|
||||||
|
rgb_set(RGB_VARIABLE, opt);
|
||||||
|
break;
|
||||||
|
case AF_RGB_STEP:
|
||||||
|
rgb_step(opt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action macro definition
|
* Action macro definition
|
||||||
*/
|
*/
|
||||||
|
@ -47,6 +47,7 @@ void led_set(uint8_t usb_led)
|
|||||||
DDRE &= ~(1<<PE6);
|
DDRE &= ~(1<<PE6);
|
||||||
PORTE &= ~(1<<PE6);
|
PORTE &= ~(1<<PE6);
|
||||||
}
|
}
|
||||||
|
#ifndef REDSCARFII_PLUS
|
||||||
if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
|
if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
|
||||||
// output high
|
// output high
|
||||||
DDRC |= (1<<PC6);
|
DDRC |= (1<<PC6);
|
||||||
@ -57,6 +58,7 @@ void led_set(uint8_t usb_led)
|
|||||||
DDRC &= ~(1<<PC6);
|
DDRC &= ~(1<<PC6);
|
||||||
PORTC &= ~(1<<PC6);
|
PORTC &= ~(1<<PC6);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,10 +21,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#ifdef LEDMAP_ENABLE
|
#ifdef LEDMAP_ENABLE
|
||||||
|
|
||||||
static const uint16_t ledmaps[LED_COUNT] PROGMEM = {
|
static const uint16_t ledmaps[LED_COUNT] PROGMEM = {
|
||||||
[0] = LEDMAP_CAPS_LOCK, // CapsLock
|
[0] = LEDMAP_CAPS_LOCK | LEDMAP_BACKLIGHT, // CapsLock
|
||||||
[1] = LEDMAP_NUM_LOCK, // NumLock
|
[1] = LEDMAP_NUM_LOCK | LEDMAP_BACKLIGHT, // NumLock
|
||||||
[2] = LEDMAP_SCROLL_LOCK, // Logo
|
#ifdef REDSCARFII_PLUS
|
||||||
[3] = LEDMAP_BACKLIGHT, // Backlight
|
[2] = LEDMAP_BACKLIGHT, // Backlight
|
||||||
|
#else
|
||||||
|
[2] = LEDMAP_SCROLL_LOCK | LEDMAP_BACKLIGHT, // Logo
|
||||||
|
[3] = LEDMAP_BACKLIGHT, // Backlight
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
ledmap_t ledmap_get_code(uint8_t index)
|
ledmap_t ledmap_get_code(uint8_t index)
|
||||||
@ -44,8 +48,10 @@ void ledmap_led_init(void)
|
|||||||
PORTC |= (1<<PC7);
|
PORTC |= (1<<PC7);
|
||||||
DDRE |= (1<<PE6);
|
DDRE |= (1<<PE6);
|
||||||
PORTE |= (1<<PE6);
|
PORTE |= (1<<PE6);
|
||||||
|
#ifndef REDSCARFII_PLUS
|
||||||
DDRC |= (1<<PC6);
|
DDRC |= (1<<PC6);
|
||||||
PORTC &= ~(1<<PC6);
|
PORTC &= ~(1<<PC6);
|
||||||
|
#endif
|
||||||
DDRB |= (1<<PB7);
|
DDRB |= (1<<PB7);
|
||||||
PORTB &= ~(1<<PB7);
|
PORTB &= ~(1<<PB7);
|
||||||
}
|
}
|
||||||
@ -59,12 +65,18 @@ void ledmap_led_on(uint8_t index)
|
|||||||
case 1:
|
case 1:
|
||||||
PORTE &= ~(1<<PE6);
|
PORTE &= ~(1<<PE6);
|
||||||
break;
|
break;
|
||||||
|
#ifdef REDSCARFII_PLUS
|
||||||
|
case 2:
|
||||||
|
PORTB |= (1<<PB7);
|
||||||
|
break;
|
||||||
|
#else
|
||||||
case 2:
|
case 2:
|
||||||
PORTC |= (1<<PC6);
|
PORTC |= (1<<PC6);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PORTB |= (1<<PB7);
|
PORTB |= (1<<PB7);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,12 +89,18 @@ void ledmap_led_off(uint8_t index)
|
|||||||
case 1:
|
case 1:
|
||||||
PORTE |= (1<<PE6);
|
PORTE |= (1<<PE6);
|
||||||
break;
|
break;
|
||||||
|
#ifdef REDSCARFII_PLUS
|
||||||
case 2:
|
case 2:
|
||||||
PORTC &= ~(1<<PB6);
|
PORTB &= ~(1<<PB7);
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
case 2:
|
||||||
|
PORTC &= ~(1<<PC6);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PORTB &= ~(1<<PB7);
|
PORTB &= ~(1<<PB7);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "print.h"
|
#include "print.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#ifdef REDSCARFII_PLUS
|
||||||
|
#include "rgb.h"
|
||||||
|
#endif
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
|
||||||
#ifndef DEBOUNCE
|
#ifndef DEBOUNCE
|
||||||
@ -60,6 +63,11 @@ void matrix_init(void)
|
|||||||
MCUCR = (1<<JTD);
|
MCUCR = (1<<JTD);
|
||||||
MCUCR = (1<<JTD);
|
MCUCR = (1<<JTD);
|
||||||
|
|
||||||
|
#ifdef REDSCARFII_PLUS
|
||||||
|
// initialize rgb led
|
||||||
|
rgb_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
// initialize row and col
|
// initialize row and col
|
||||||
init_rows();
|
init_rows();
|
||||||
init_cols();
|
init_cols();
|
||||||
|
181
keyboard/RedScarfII/rgb.c
Normal file
181
keyboard/RedScarfII/rgb.c
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2014 Kai Ryu <kai1103@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <avr/eeprom.h>
|
||||||
|
#include "yc059.h"
|
||||||
|
#include "rgb.h"
|
||||||
|
|
||||||
|
static rgb_config_t rgb_config;
|
||||||
|
|
||||||
|
void rgb_init(void)
|
||||||
|
{
|
||||||
|
DDRE |= (1<<PE2);
|
||||||
|
yc059_init();
|
||||||
|
rgb_read_config();
|
||||||
|
if (rgb_config.raw == RGB_UNCONFIGURED) {
|
||||||
|
rgb_config.enable = 0;
|
||||||
|
rgb_config.mode = RGB_FIXED;
|
||||||
|
rgb_config.id = RGB_FIXED_WHITE;
|
||||||
|
rgb_write_config();
|
||||||
|
}
|
||||||
|
yc059_send(rgb_config.enable ? YC059_ON : YC059_OFF);
|
||||||
|
rgb_resume();
|
||||||
|
PORTE |= (1<<PE2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_resume(void)
|
||||||
|
{
|
||||||
|
yc059_send(rgb_to_yc059(rgb_config.mode, rgb_config.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_read_config(void)
|
||||||
|
{
|
||||||
|
rgb_config.raw = eeprom_read_byte(EECONFIG_RGB);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_write_config(void)
|
||||||
|
{
|
||||||
|
eeprom_write_byte(EECONFIG_RGB, rgb_config.raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_on(void)
|
||||||
|
{
|
||||||
|
rgb_config.enable = 1;
|
||||||
|
PORTE &= ~(1<<PE2);
|
||||||
|
yc059_send(YC059_ON);
|
||||||
|
rgb_resume();
|
||||||
|
PORTE |= (1<<PE2);
|
||||||
|
rgb_write_config();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_off(void)
|
||||||
|
{
|
||||||
|
rgb_config.enable = 0;
|
||||||
|
yc059_send(YC059_OFF);
|
||||||
|
rgb_write_config();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_toggle(void)
|
||||||
|
{
|
||||||
|
if (rgb_config.enable) {
|
||||||
|
rgb_off();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rgb_on();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_increase(void)
|
||||||
|
{
|
||||||
|
yc059_send(YC059_INCREASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_decrease(void)
|
||||||
|
{
|
||||||
|
yc059_send(YC059_DECREASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_set(uint8_t mode, uint8_t id)
|
||||||
|
{
|
||||||
|
if (rgb_config.enable) {
|
||||||
|
rgb_config.mode = mode;
|
||||||
|
rgb_config.id = id;
|
||||||
|
rgb_resume();
|
||||||
|
rgb_write_config();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_step(uint8_t mode)
|
||||||
|
{
|
||||||
|
if (rgb_config.enable) {
|
||||||
|
if (rgb_config.mode != mode) {
|
||||||
|
rgb_config.mode = mode;
|
||||||
|
rgb_config.id = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uint8_t count;
|
||||||
|
switch (mode) {
|
||||||
|
case RGB_FIXED:
|
||||||
|
count = RGB_FIXED_COUNT;
|
||||||
|
break;
|
||||||
|
case RGB_VARIABLE:
|
||||||
|
count = RGB_VARIABLE_COUNT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
count = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rgb_config.id = (rgb_config.id + 1) % count;
|
||||||
|
}
|
||||||
|
rgb_resume();
|
||||||
|
rgb_write_config();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t rgb_to_yc059(uint8_t mode, uint8_t id)
|
||||||
|
{
|
||||||
|
switch (mode) {
|
||||||
|
case RGB_FIXED:
|
||||||
|
switch (id) {
|
||||||
|
case RGB_FIXED_WHITE:
|
||||||
|
return YC059_FIXED_WHITE;
|
||||||
|
case RGB_FIXED_RED:
|
||||||
|
return YC059_FIXED_RED;
|
||||||
|
case RGB_FIXED_GREEN:
|
||||||
|
return YC059_FIXED_GREEN;
|
||||||
|
case RGB_FIXED_BLUE:
|
||||||
|
return YC059_FIXED_BLUE;
|
||||||
|
case RGB_FIXED_RED_1:
|
||||||
|
return YC059_FIXED_RED_1;
|
||||||
|
case RGB_FIXED_GREEN_1:
|
||||||
|
return YC059_FIXED_GREEN_1;
|
||||||
|
case RGB_FIXED_BLUE_1:
|
||||||
|
return YC059_FIXED_BLUE_1;
|
||||||
|
case RGB_FIXED_RED_2:
|
||||||
|
return YC059_FIXED_RED_2;
|
||||||
|
case RGB_FIXED_GREEN_2:
|
||||||
|
return YC059_FIXED_GREEN_2;
|
||||||
|
case RGB_FIXED_BLUE_2:
|
||||||
|
return YC059_FIXED_BLUE_2;
|
||||||
|
case RGB_FIXED_RED_3:
|
||||||
|
return YC059_FIXED_RED_3;
|
||||||
|
case RGB_FIXED_GREEN_3:
|
||||||
|
return YC059_FIXED_GREEN_3;
|
||||||
|
case RGB_FIXED_BLUE_3:
|
||||||
|
return YC059_FIXED_BLUE_3;
|
||||||
|
case RGB_FIXED_RED_4:
|
||||||
|
return YC059_FIXED_RED_4;
|
||||||
|
case RGB_FIXED_GREEN_4:
|
||||||
|
return YC059_FIXED_GREEN_4;
|
||||||
|
case RGB_FIXED_BLUE_4:
|
||||||
|
return YC059_FIXED_BLUE_4;
|
||||||
|
}
|
||||||
|
case RGB_VARIABLE:
|
||||||
|
switch (id) {
|
||||||
|
case RGB_VARIABLE_FLASH:
|
||||||
|
return YC059_FLASH;
|
||||||
|
case RGB_VARIABLE_STROBE:
|
||||||
|
return YC059_STROBE;
|
||||||
|
case RGB_VARIABLE_FADE:
|
||||||
|
return YC059_FADE;
|
||||||
|
case RGB_VARIABLE_SMOOTH:
|
||||||
|
return YC059_SMOOTH;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return YC059_ERROR;
|
||||||
|
}
|
||||||
|
}
|
82
keyboard/RedScarfII/rgb.h
Normal file
82
keyboard/RedScarfII/rgb.h
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2014 Kai Ryu <kai1103@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RGB_H
|
||||||
|
#define RGB_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
enum rgb_mode_id {
|
||||||
|
RGB_FIXED = 0,
|
||||||
|
RGB_VARIABLE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum rgb_fixed_id {
|
||||||
|
RGB_FIXED_WHITE = 0,
|
||||||
|
RGB_FIXED_RED,
|
||||||
|
RGB_FIXED_GREEN,
|
||||||
|
RGB_FIXED_BLUE,
|
||||||
|
RGB_FIXED_RED_1,
|
||||||
|
RGB_FIXED_GREEN_1,
|
||||||
|
RGB_FIXED_BLUE_1,
|
||||||
|
RGB_FIXED_RED_2,
|
||||||
|
RGB_FIXED_GREEN_2,
|
||||||
|
RGB_FIXED_BLUE_2,
|
||||||
|
RGB_FIXED_RED_3,
|
||||||
|
RGB_FIXED_GREEN_3,
|
||||||
|
RGB_FIXED_BLUE_3,
|
||||||
|
RGB_FIXED_RED_4,
|
||||||
|
RGB_FIXED_GREEN_4,
|
||||||
|
RGB_FIXED_BLUE_4,
|
||||||
|
RGB_FIXED_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum rgb_variable_id {
|
||||||
|
RGB_VARIABLE_FLASH = 0,
|
||||||
|
RGB_VARIABLE_STROBE,
|
||||||
|
RGB_VARIABLE_FADE,
|
||||||
|
RGB_VARIABLE_SMOOTH,
|
||||||
|
RGB_VARIABLE_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
uint8_t raw;
|
||||||
|
struct {
|
||||||
|
uint8_t id :4;
|
||||||
|
uint8_t mode :3;
|
||||||
|
bool enable :1;
|
||||||
|
};
|
||||||
|
} rgb_config_t;
|
||||||
|
|
||||||
|
#define EECONFIG_RGB (uint8_t *)7
|
||||||
|
#define RGB_UNCONFIGURED 0xFF
|
||||||
|
|
||||||
|
void rgb_init(void);
|
||||||
|
void rgb_resume(void);
|
||||||
|
void rgb_read_config(void);
|
||||||
|
void rgb_write_config(void);
|
||||||
|
void rgb_on(void);
|
||||||
|
void rgb_off(void);
|
||||||
|
void rgb_toggle(void);
|
||||||
|
void rgb_increase(void);
|
||||||
|
void rgb_decrease(void);
|
||||||
|
void rgb_set(uint8_t mode, uint8_t id);
|
||||||
|
void rgb_step(uint8_t mode);
|
||||||
|
uint8_t rgb_to_yc059(uint8_t mode, uint8_t id);
|
||||||
|
|
||||||
|
#endif
|
35
keyboard/RedScarfII/suspend.c
Normal file
35
keyboard/RedScarfII/suspend.c
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2014 Kai Ryu <kai1103@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include "suspend.h"
|
||||||
|
#include "rgb.h"
|
||||||
|
|
||||||
|
#ifdef SUSPEND_ACTION
|
||||||
|
|
||||||
|
void suspend_power_down_action(void)
|
||||||
|
{
|
||||||
|
DDRE &= ~(1<<PE2);
|
||||||
|
PORTE &= ~(1<<PE2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void suspend_wakeup_init_action(void)
|
||||||
|
{
|
||||||
|
rgb_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
110
keyboard/RedScarfII/yc059.c
Normal file
110
keyboard/RedScarfII/yc059.c
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2014 Kai Ryu <kai1103@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include "yc059.h"
|
||||||
|
|
||||||
|
inline
|
||||||
|
void yc059_ir_enable(void)
|
||||||
|
{
|
||||||
|
YC059_IR_DDR |= (1<<YC059_IR_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void yc059_ir_disable(void)
|
||||||
|
{
|
||||||
|
YC059_IR_DDR &= ~(1<<YC059_IR_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void yc059_ir_high(void)
|
||||||
|
{
|
||||||
|
YC059_IR_PORT &= ~(1<<YC059_IR_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void yc059_ir_low(void)
|
||||||
|
{
|
||||||
|
YC059_IR_PORT |= (1<<YC059_IR_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void yc059_init(void)
|
||||||
|
{
|
||||||
|
YC059_IR_DDR &= ~(1<<YC059_IR_BIT);
|
||||||
|
YC059_IR_PORT &= ~(1<<YC059_IR_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void yc059_send(uint8_t data)
|
||||||
|
{
|
||||||
|
if (data == YC059_ERROR) return;
|
||||||
|
cli();
|
||||||
|
yc059_ir_enable();
|
||||||
|
yc059_send_header();
|
||||||
|
yc059_send_address();
|
||||||
|
yc059_send_byte(data);
|
||||||
|
yc059_send_byte(~data);
|
||||||
|
yc059_send_stop();
|
||||||
|
yc059_ir_disable();
|
||||||
|
sei();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void yc059_send_header(void)
|
||||||
|
{
|
||||||
|
yc059_ir_high();
|
||||||
|
_delay_us(YC059_HDR_MARK);
|
||||||
|
yc059_ir_low();
|
||||||
|
_delay_us(YC059_HDR_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void yc059_send_stop(void)
|
||||||
|
{
|
||||||
|
yc059_ir_high();
|
||||||
|
_delay_us(YC059_BIT_MARK);
|
||||||
|
yc059_ir_low();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void yc059_send_address(void)
|
||||||
|
{
|
||||||
|
yc059_send_word(YC059_ADDRESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void yc059_send_byte(uint8_t byte)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
|
yc059_ir_high();
|
||||||
|
_delay_us(YC059_BIT_MARK);
|
||||||
|
yc059_ir_low();
|
||||||
|
if (byte & 1) {
|
||||||
|
_delay_us(YC059_ONE_SPACE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_delay_us(YC059_ZERO_SPACE);
|
||||||
|
}
|
||||||
|
byte >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void yc059_send_word(uint16_t word)
|
||||||
|
{
|
||||||
|
yc059_send_byte((word & 0xFF00) >> 8);
|
||||||
|
yc059_send_byte(word & 0xFF);
|
||||||
|
}
|
73
keyboard/RedScarfII/yc059.h
Normal file
73
keyboard/RedScarfII/yc059.h
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2014 Kai Ryu <kai1103@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef YC059_H
|
||||||
|
#define YC059_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define YC059_FREQ 38000
|
||||||
|
#define YC059_ADDRESS 0x00EF
|
||||||
|
|
||||||
|
#define YC059_HDR_MARK 9000
|
||||||
|
#define YC059_HDR_SPACE 4500
|
||||||
|
#define YC059_BIT_MARK 560
|
||||||
|
#define YC059_ONE_SPACE 1600
|
||||||
|
#define YC059_ZERO_SPACE 560
|
||||||
|
#define YC059_RPT_SPACE 2250
|
||||||
|
|
||||||
|
#define YC059_IR_DDR DDRC
|
||||||
|
#define YC059_IR_PORT PORTC
|
||||||
|
#define YC059_IR_BIT PC6
|
||||||
|
|
||||||
|
enum yc059_id {
|
||||||
|
YC059_INCREASE = 0,
|
||||||
|
YC059_DECREASE,
|
||||||
|
YC059_OFF,
|
||||||
|
YC059_ON,
|
||||||
|
YC059_FIXED_RED,
|
||||||
|
YC059_FIXED_GREEN,
|
||||||
|
YC059_FIXED_BLUE,
|
||||||
|
YC059_FIXED_WHITE,
|
||||||
|
YC059_FIXED_RED_1,
|
||||||
|
YC059_FIXED_GREEN_1,
|
||||||
|
YC059_FIXED_BLUE_1,
|
||||||
|
YC059_FLASH,
|
||||||
|
YC059_FIXED_RED_2,
|
||||||
|
YC059_FIXED_GREEN_2,
|
||||||
|
YC059_FIXED_BLUE_2,
|
||||||
|
YC059_STROBE,
|
||||||
|
YC059_FIXED_RED_3,
|
||||||
|
YC059_FIXED_GREEN_3,
|
||||||
|
YC059_FIXED_BLUE_3,
|
||||||
|
YC059_FADE,
|
||||||
|
YC059_FIXED_RED_4,
|
||||||
|
YC059_FIXED_GREEN_4,
|
||||||
|
YC059_FIXED_BLUE_4,
|
||||||
|
YC059_SMOOTH,
|
||||||
|
YC059_ERROR = 0xFF
|
||||||
|
};
|
||||||
|
|
||||||
|
void yc059_init(void);
|
||||||
|
void yc059_send(uint8_t data);
|
||||||
|
void yc059_send_header(void);
|
||||||
|
void yc059_send_address(void);
|
||||||
|
void yc059_send_byte(uint8_t byte);
|
||||||
|
void yc059_send_word(uint16_t word);
|
||||||
|
void yc059_send_stop(void);
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user