diff --git a/keyboard/fantastic60/Makefile b/keyboard/fantastic60/Makefile index ddd6b630..0001702b 100755 --- a/keyboard/fantastic60/Makefile +++ b/keyboard/fantastic60/Makefile @@ -42,7 +42,7 @@ TARGET = fantastic60_lufa # Directory common source filess exist -TOP_DIR = ../.. +TMK_DIR = ../../tmk_core_custom # Directory keyboard dependent files exist TARGET_DIR = . @@ -52,7 +52,6 @@ SRC = keymap_common.c \ matrix.c \ led.c \ backlight.c \ - shift_register.c \ rgb.c ifdef KEYMAP @@ -123,7 +122,7 @@ endif # comment out to disable the options. # 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) CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration @@ -133,10 +132,10 @@ USB_6KRO_ENABLE = yes # USB 6key Rollover PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support PS2_USE_BUSYWAIT = yes BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -#KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom +KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom #KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight -#FADING_LED_ENABLE = yes # Enable fading 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 @@ -147,9 +146,9 @@ BREATHING_LED_ENABLE = yes # Enable breathing backlight # Search Path VPATH += $(TARGET_DIR) -VPATH += $(TOP_DIR) +VPATH += $(TMK_DIR) -include $(TOP_DIR)/protocol/lufa.mk -include $(TOP_DIR)/protocol.mk -include $(TOP_DIR)/common.mk -include $(TOP_DIR)/rules.mk +include $(TMK_DIR)/protocol/lufa.mk +include $(TMK_DIR)/protocol.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/rules.mk diff --git a/keyboard/fantastic60/Makefile.pjrc b/keyboard/fantastic60/Makefile.pjrc index ddc1b4d1..6be60b90 100644 --- a/keyboard/fantastic60/Makefile.pjrc +++ b/keyboard/fantastic60/Makefile.pjrc @@ -42,7 +42,7 @@ TARGET = fantastic60_pjrc # Directory common source filess exist -TOP_DIR = ../.. +TMK_DIR = ../../tmk_core_custom # Directory keyboard dependent files exist TARGET_DIR = . @@ -52,8 +52,7 @@ SRC = keymap_common.c \ matrix.c \ led.c \ backlight.c \ - ledmap.c \ - fantastic.c + rgb.c ifdef KEYMAP SRC := keymap_$(KEYMAP).c $(SRC) @@ -93,7 +92,7 @@ endif # comment out to disable the options. # 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) CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration @@ -108,14 +107,15 @@ 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 # Search Path VPATH += $(TARGET_DIR) -VPATH += $(TOP_DIR) +VPATH += $(TMK_DIR) -include $(TOP_DIR)/protocol/pjrc.mk -include $(TOP_DIR)/common.mk -include $(TOP_DIR)/rules.mk +include $(TMK_DIR)/protocol/pjrc.mk +include $(TMK_DIR)/protocol.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/rules.mk diff --git a/keyboard/fantastic60/backlight.c b/keyboard/fantastic60/backlight.c index b8c35679..bbc14bf1 100755 --- a/keyboard/fantastic60/backlight.c +++ b/keyboard/fantastic60/backlight.c @@ -21,12 +21,14 @@ along with this program. If not, see . #include "backlight.h" #include "softpwm_led.h" #include "action.h" +#include "rgb.h" #ifdef BACKLIGHT_ENABLE #define BACKLIGHT 0 extern backlight_config_t backlight_config; +uint8_t backlight_brightness; static const uint8_t backlight_table[] PROGMEM = { 0, 16, 128, 255 }; @@ -43,7 +45,8 @@ void backlight_set(uint8_t level) fading_led_disable(BACKLIGHT); #endif breathing_led_disable(BACKLIGHT); - softpwm_led_set(BACKLIGHT, pgm_read_byte(&backlight_table[level])); + backlight_brightness = pgm_read_byte(&backlight_table[level]); + softpwm_led_set(BACKLIGHT, backlight_brightness); break; case 4: case 5: @@ -72,7 +75,8 @@ void backlight_set(uint8_t level) fading_led_disable(BACKLIGHT); #endif breathing_led_disable(BACKLIGHT); - softpwm_led_set(BACKLIGHT, 0); + backlight_brightness = 0; + softpwm_led_set(BACKLIGHT, backlight_brightness); break; } #else @@ -89,22 +93,20 @@ void backlight_set(uint8_t level) #ifdef SOFTPWM_LED_ENABLE /* Backlight pin configuration * Backlight: PF7 - * RGB R: PE2 - * RGB G: PC6 - * RGB B: PC7 + * RGB R: PF6 + * RGB G: PF5 + * RGB B: PF4 */ void softpwm_led_init() { - DDRF |= (1<> index); + /* switch (index) { case 0: PORTF &= ~(1<> index); + /* switch (index) { case 0: PORTF |= (1<. /* USB Device descriptor parameter */ #define VENDOR_ID 0x6C4E #define PRODUCT_ID 0x6060 -#define DEVICE_VER 0x0001 +#define DEVICE_VER 0x0002 #define MANUFACTURER TEX Electronic #define PRODUCT Fantastic60 #define DESCRIPTION t.m.k. keyboard firmware for Fantastic60 @@ -101,7 +101,7 @@ along with this program. If not, see . //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -#define NO_ACTION_MACRO +//#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION #endif diff --git a/keyboard/fantastic60/ledmap.c b/keyboard/fantastic60/ledmap.c index 279316b0..9a0838cb 100644 --- a/keyboard/fantastic60/ledmap.c +++ b/keyboard/fantastic60/ledmap.c @@ -17,7 +17,6 @@ along with this program. If not, see . #include #include "ledmap.h" -#include "fantastic.h" #ifdef LEDMAP_ENABLE @@ -35,20 +34,18 @@ ledmap_t ledmap_get_code(uint8_t index) /* LED pin configration * CapsLock: PE6 * Backlight: PF7 - * RGB R: PE2 - * RGB G: PC6 - * RGB B: PC7 + * RGB R: PF6 + * RGB G: PF5 + * RGB B: PF4 */ void ledmap_led_init(void) { - DDRE |= (1<. #include #include "softpwm_led.h" #include "backlight.h" -#include "shift_register.h" #include "rgb.h" volatile static uint8_t rgb_fading_enable = 0; @@ -43,9 +42,10 @@ static void hsb_to_rgb(uint16_t hue, uint8_t saturation, uint8_t brightness, rgb void rgb_init(void) { - shift_register_init(); - shift_register_write_word(0xFFFF); + /* shift_register_init(); */ + /* shift_register_write_word(0xFFFF); */ rgb_read_config(); + rgb_read_color(); if (rgb_config.raw == RGB_UNCONFIGURED) { rgb_config.enable = 0; rgb_config.level = RGB_OFF; @@ -166,21 +166,31 @@ void rgb_color_decrease(uint8_t color) void rgb_set_level(uint8_t level) { + rgb_color_t rgb_color_off = { .raw = {0} }; switch (level) { case RGB_OFF: rgb_fading_enable = 0; rgb_brightness = 0; - shift_register_write_word(0xFFFF); + rgb_refresh(&rgb_color_off); + /* shift_register_write_word(0xFFFF); */ break; case RGB_FIXED: rgb_refresh(&rgb_color); - shift_register_write_word(0x0000); + /* shift_register_write_word(0x0000); */ break; case RGB_FADE_SLOW: case RGB_FADE_MID: case RGB_FADE_FAST: + if (backlight_config.enable) { + if (backlight_config.level >= 1 && backlight_config.level <= 3) { + rgb_brightness = backlight_brightness; + } + } + else { + rgb_brightness = 16; + } rgb_fading_enable = 3 - (level - RGB_FADE_SLOW); - shift_register_write_word(0x0000); + /* shift_register_write_word(0x0000); */ break; } }