1
0

fantastic60: Support for Fantastic60 V2

This commit is contained in:
Kai Ryu 2015-12-14 12:26:28 +09:00
parent 49b426a378
commit 25f391d613
6 changed files with 67 additions and 57 deletions

View File

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

View File

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

View File

@ -21,12 +21,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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<<PF7);
PORTF |= (1<<PF7);
DDRE |= (1<<PE2);
PORTE |= (1<<PE2);
DDRC |= (1<<PC7 | 1<<PC6);
PORTC |= (1<<PC7 | 1<<PC6);
DDRF |= (1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
PORTF |= (1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
}
void softpwm_led_on(uint8_t index)
{
PORTF &= ~((1<<PF7) >> index);
/*
switch (index) {
case 0:
PORTF &= ~(1<<PF7);
@ -119,10 +121,13 @@ void softpwm_led_on(uint8_t index)
PORTC &= ~(1<<PC7);
break;
}
*/
}
void softpwm_led_off(uint8_t index)
{
PORTF |= ((1<<PF7) >> index);
/*
switch (index) {
case 0:
PORTF |= (1<<PF7);
@ -137,6 +142,7 @@ void softpwm_led_off(uint8_t index)
PORTC |= (1<<PC7);
break;
}
*/
}
#endif
#endif
@ -168,13 +174,13 @@ void softpwm_led_custom(void)
#ifdef FADING_LED_ENABLE
void fading_led_custom(uint8_t *value)
{
rgb_set_brightness(value[0]);
rgb_set_brightness(value[BACKLIGHT]);
}
#endif
void breathing_led_custom(uint8_t *value)
{
rgb_set_brightness(value[0]);
rgb_set_brightness(value[BACKLIGHT]);
}
#endif

View File

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

View File

@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <avr/pgmspace.h>
#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<<PE6 | 1<<PE2);
PORTE |= (1<<PE6 | 1<<PE2);
DDRF |= (1<<PF7);
PORTF |= (1<<PF7);
DDRC |= (1<<PC7 | 1<<PC6);
PORTF |= (1<<PC7 | 1<<PC6);
shift_register_init();
shift_register_write_word(0x0000);
DDRE |= (1<<PE6);
PORTE |= (1<<PE6);
DDRF |= (1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
PORTF |= (1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
/* shift_register_init(); */
/* shift_register_write_word(0x0000); */
}
void ledmap_led_on(uint8_t index)
@ -61,8 +58,7 @@ void ledmap_led_on(uint8_t index)
PORTF &= ~(1<<PF7);
break;
case 2:
PORTE &= ~(1<<PE2);
PORTC &= ~(1<<PC7 | 1<<PC6);
PORTF &= ~(1<<PF6 | 1<<PF5 | 1<<PF4);
break;
}
}
@ -77,8 +73,7 @@ void ledmap_led_off(uint8_t index)
PORTF |= (1<<PF7);
break;
case 2:
PORTE |= (1<<PE2);
PORTC |= (1<<PC7 | 1<<PC6);
PORTF |= (1<<PF6 | 1<<PF5 | 1<<PF4);
break;
}
}

View File

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