parent
20b5dd80bd
commit
b89e318d35
@ -0,0 +1,105 @@
|
||||
/*
|
||||
Copyright 2015 Jun Wako <wakojun@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 INFINITY_ERGODOX_CONFIG_H
|
||||
#define INFINITY_ERGODOX_CONFIG_H
|
||||
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x6464
|
||||
#define DEVICE_VER 0x0001
|
||||
/* in python2: list(u"whatever".encode('utf-16-le')) */
|
||||
/* at most 32 characters or the ugly hack in usb_main.c borks */
|
||||
#define MANUFACTURER "TMK"
|
||||
#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00'
|
||||
#define PRODUCT "Infinity keyboard/TMK"
|
||||
#define USBSTR_PRODUCT 'I', '\x00', 'n', '\x00', 'f', '\x00', 'i', '\x00', 'n', '\x00', 'i', '\x00', 't', '\x00', 'y', '\x00', ' ', '\x00', 'k', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '/', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00'
|
||||
|
||||
#define MOUSEKEY_INTERVAL 20
|
||||
#define MOUSEKEY_DELAY 0
|
||||
#define MOUSEKEY_TIME_TO_MAX 60
|
||||
#define MOUSEKEY_MAX_SPEED 7
|
||||
#define MOUSEKEY_WHEEL_DELAY 0
|
||||
|
||||
#define TAPPING_TOGGLE 1
|
||||
|
||||
/* define if matrix has ghost */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
#define TAPPING_TERM 200
|
||||
#define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.)
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || \
|
||||
keyboard_report->mods == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \
|
||||
)
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 18
|
||||
#define MATRIX_COLS 5
|
||||
#define LOCAL_MATRIX_ROWS 9
|
||||
|
||||
/* number of backlight levels */
|
||||
#define BACKLIGHT_LEVELS 3
|
||||
|
||||
#define LED_BRIGHTNESS_LO 100
|
||||
#define LED_BRIGHTNESS_HI 255
|
||||
|
||||
/* define if matrix has ghost */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
#define SERIAL_LINK_BAUD 562500
|
||||
#define SERIAL_LINK_THREAD_PRIORITY (NORMALPRIO - 1)
|
||||
|
||||
#define VISUALIZER_USER_DATA_SIZE 16
|
||||
/*
|
||||
* music mode options
|
||||
* midi enabled
|
||||
* keymask disabled
|
||||
* so typing normally will result in music
|
||||
*
|
||||
*/
|
||||
#define MUSIC_MASK keycode != KC_NO
|
||||
/*
|
||||
* Feature disable options
|
||||
* These options are also useful to firmware size reduction.
|
||||
*/
|
||||
|
||||
/* disable debug print */
|
||||
//#define NO_DEBUG
|
||||
|
||||
/* disable print */
|
||||
//#define NO_PRINT
|
||||
|
||||
/* disable action features */
|
||||
//#define NO_ACTION_LAYER
|
||||
//#define NO_ACTION_TAPPING
|
||||
//#define NO_ACTION_ONESHOT
|
||||
//#define NO_ACTION_MACRO
|
||||
//#define NO_ACTION_FUNCTION
|
||||
|
||||
#endif
|
@ -0,0 +1,91 @@
|
||||
# project specific files
|
||||
SRC = matrix.c \
|
||||
led.c
|
||||
|
||||
## chip/board settings
|
||||
# - the next two should match the directories in
|
||||
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
|
||||
# - For Teensies, FAMILY = KINETIS and SERIES is either
|
||||
# KL2x (LC) or K20x (3.0,3.1,3.2).
|
||||
# - For Infinity KB, SERIES = K20x
|
||||
MCU_FAMILY = KINETIS
|
||||
MCU_SERIES = K20x
|
||||
|
||||
# Linker script to use
|
||||
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
|
||||
# or <this_dir>/ld/
|
||||
# - NOTE: a custom ld script is needed for EEPROM on Teensy LC
|
||||
# - LDSCRIPT =
|
||||
# - MKL26Z64 for Teensy LC
|
||||
# - MK20DX128 for Teensy 3.0
|
||||
# - MK20DX256 for Teensy 3.1 and 3.2
|
||||
# - MK20DX128BLDR4 for Infinity 60% with Kiibohd bootloader
|
||||
# - MK20DX256BLDR8 for Infinity ErgoDox with Kiibohd bootloader
|
||||
MCU_LDSCRIPT = MK20DX256BLDR8
|
||||
|
||||
# Startup code to use
|
||||
# - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
|
||||
# - STARTUP =
|
||||
# - kl2x for Teensy LC
|
||||
# - k20x5 for Teensy 3.0 and Infinity 60%
|
||||
# - k20x7 for Teensy 3.1, 3.2 and Infinity ErgoDox
|
||||
MCU_STARTUP = k20x7
|
||||
|
||||
# Board: it should exist either in <chibios>/os/hal/boards/
|
||||
# or <this_dir>/boards
|
||||
# - BOARD =
|
||||
# - PJRC_TEENSY_LC for Teensy LC
|
||||
# - PJRC_TEENSY_3 for Teensy 3.0
|
||||
# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2
|
||||
# - MCHCK_K20 for Infinity KB
|
||||
#BOARD = MCHCK_K20
|
||||
BOARD = PJRC_TEENSY_3_1
|
||||
|
||||
# Cortex version
|
||||
# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4
|
||||
MCU = cortex-m4
|
||||
|
||||
# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
|
||||
# I.e. 6 for Teensy LC; 7 for Teensy 3.x
|
||||
ARMV = 7
|
||||
|
||||
# Vector table for application
|
||||
# 0x00000000-0x00001000 area is occupied by bootlaoder.*/
|
||||
# The CORTEX_VTOR... is needed only for MCHCK/Infinity KB
|
||||
OPT_DEFS += -DCORTEX_VTOR_INIT=0x00002000
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
CUSTOM_MATRIX = yes # Custom matrix file for the ErgoDox EZ
|
||||
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
UNICODE_ENABLE = yes # Unicode
|
||||
ONEHAND_ENABLE = yes # Allow swapping hands of keyboard
|
||||
STENO_ENABLE = yes #enable plover steno mode
|
||||
CUSTOM_MATRIX = yes # Custom matrix file
|
||||
SERIAL_LINK_ENABLE = yes
|
||||
VISUALIZER_ENABLE = yes
|
||||
LCD_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = yes
|
||||
LCD_BACKLIGHT_ENABLE = yes
|
||||
MIDI_ENABLE = yes
|
||||
MIDI_ADVANCED = yes
|
||||
MUSIC_MODE = yes
|
||||
RGBLIGHT_ENABLE = no
|
||||
|
||||
LCD_DRIVER = st7565
|
||||
LCD_WIDTH = 128
|
||||
LCD_HEIGHT = 32
|
||||
|
||||
LED_DRIVER = is31fl3731c
|
||||
LED_WIDTH = 7
|
||||
LED_HEIGHT = 7
|
||||
|
||||
LAYOUTS = ergodox
|
@ -0,0 +1,125 @@
|
||||
/* Copyright 2017 Fred Sundvik
|
||||
*
|
||||
* 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 VISUALIZER_H_
|
||||
#define VISUALIZER_H_
|
||||
|
||||
// Currently we are assuming that both the backlight and LCD are enabled
|
||||
// But it's entirely possible to write a custom visualizer that use only
|
||||
// one of them
|
||||
#ifndef LCD_BACKLIGHT_ENABLE
|
||||
#error This visualizer needs that LCD backlight is enabled
|
||||
#endif
|
||||
|
||||
#ifndef LCD_ENABLE
|
||||
#error This visualizer needs that LCD is enabled
|
||||
#endif
|
||||
|
||||
#include "visualizer.h"
|
||||
#include "visualizer_keyframes.h"
|
||||
#include "lcd_keyframes.h"
|
||||
#include "lcd_backlight_keyframes.h"
|
||||
#include "system/serial_link.h"
|
||||
#include "led.h"
|
||||
#include "default_animations.h"
|
||||
|
||||
static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
|
||||
static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
|
||||
|
||||
static bool initial_update = true;
|
||||
|
||||
// Feel free to modify the animations below, or even add new ones if needed
|
||||
extern keyframe_animation_t KITT_Scanner_animation;
|
||||
|
||||
static keyframe_animation_t lcd_layer_display = {
|
||||
.num_frames = 1,
|
||||
.loop = false,
|
||||
.frame_lengths = {gfxMillisecondsToTicks(0)},
|
||||
.frame_functions = {lcd_keyframe_display_layer_and_led_states}
|
||||
};
|
||||
|
||||
// The color animation animates the LCD color when you change layers
|
||||
static keyframe_animation_t color_animation = {
|
||||
.num_frames = 2,
|
||||
.loop = false,
|
||||
// Note that there's a 200 ms no-operation frame,
|
||||
// this prevents the color from changing when activating the layer
|
||||
// momentarily
|
||||
.frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)},
|
||||
.frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color},
|
||||
};
|
||||
|
||||
void initialize_user_visualizer(visualizer_state_t* state) {
|
||||
// The brightness will be dynamically adjustable in the future
|
||||
// But for now, change it here.
|
||||
lcd_backlight_brightness(130);
|
||||
state->current_lcd_color = initial_color;
|
||||
state->target_lcd_color = logo_background_color;
|
||||
initial_update = true;
|
||||
start_keyframe_animation(&default_startup_animation);
|
||||
}
|
||||
|
||||
|
||||
// This function should be implemented by the keymap visualizer
|
||||
// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
|
||||
// that the simple_visualizer assumes that you are updating
|
||||
// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
|
||||
// stopped. This can be done by either double buffering it or by using constant strings
|
||||
static void get_visualizer_layer_and_color(visualizer_state_t* state);
|
||||
|
||||
void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
|
||||
// Add more tests, change the colors and layer texts here
|
||||
// Usually you want to check the high bits (higher layers first)
|
||||
// because that's the order layers are processed for keypresses
|
||||
// You can for check for example:
|
||||
// state->status.layer
|
||||
// state->status.default_layer
|
||||
// state->status.leds (see led.h for available statuses)
|
||||
|
||||
uint32_t prev_color = state->target_lcd_color;
|
||||
const char* prev_layer_text = state->layer_text;
|
||||
|
||||
get_visualizer_layer_and_color(state);
|
||||
|
||||
if (initial_update || prev_color != state->target_lcd_color) {
|
||||
start_keyframe_animation(&color_animation);
|
||||
}
|
||||
|
||||
if (initial_update || prev_layer_text != state->layer_text) {
|
||||
start_keyframe_animation(&lcd_layer_display);
|
||||
}
|
||||
// You can also stop existing animations, and start your custom ones here
|
||||
// remember that you should normally have only one animation for the LCD
|
||||
// and one for the background. But you can also combine them if you want.
|
||||
|
||||
}
|
||||
|
||||
void user_visualizer_suspend(visualizer_state_t* state) {
|
||||
state->layer_text = "Suspending...";
|
||||
uint8_t hue = LCD_HUE(state->current_lcd_color);
|
||||
uint8_t sat = LCD_SAT(state->current_lcd_color);
|
||||
state->target_lcd_color = LCD_COLOR(hue, sat, 0);
|
||||
start_keyframe_animation(&default_suspend_animation);
|
||||
}
|
||||
|
||||
void user_visualizer_resume(visualizer_state_t* state) {
|
||||
state->current_lcd_color = initial_color;
|
||||
state->target_lcd_color = logo_background_color;
|
||||
initial_update = true;
|
||||
start_keyframe_animation(&default_startup_animation);
|
||||
}
|
||||
|
||||
#endif /* VISUALIZER_H_ */
|
Loading…
Reference in new issue