1
0
Fork 0

Merge pull request #1239 from priyadi/promethium

Keymap updates
This commit is contained in:
Jack Humbert 2017-04-18 16:17:27 -04:00 committed by GitHub
commit be0afd24bf
8 changed files with 502 additions and 55 deletions

View file

@ -35,12 +35,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DESCRIPTION
/* key matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 6
#define MATRIX_ROWS 9
/* default pin-out */
#define MATRIX_COL_PINS { B6, B7, D6, C7, F6, F7 }
#define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 }
#define MATRIX_COL_PINS { F4, F1, F0, D6, D0, D1 }
#define MATRIX_ROW_PINS { F5, F6, F7 }
#define TRACKPOINT_PINS { B7, B6, D7 }
#define UNUSED_PINS
/*
@ -152,17 +153,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#define PS2_INIT_DELAY 2000
#define PS2_INIT_DELAY 3000
#define BATTERY_PIN 9
#define BATTERY_POLL 30000
#define MAX_VOLTAGE 4.2
#define MIN_VOLTAGE 3.2
#define ___ KC_NO
#define KEYMAP( \
k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \
k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, \
tp1, tp2, tp3 \
) \
{ \
{k11, k12, k13, k14, k15, k16}, \
@ -172,18 +176,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{k17, k18, k19, k1a, k1b, k1c}, \
{k27, k28, k29, k2a, k2b, k2c}, \
{k37, k38, k39, k3a, k3b, k3c}, \
{k47, k48, k49, k4a, k4b, k4c} \
{k47, k48, k49, k4a, k4b, k4c}, \
{tp1, tp2, tp3, ___, ___, ___} \
}
#ifndef __ASSEMBLER__ // assembler doesn't like enum in .h file
enum led_sequence {
LED_IND_LINUX,
LED_IND_APPLE,
LED_IND_WINDOWS,
LED_IND_QWERTY,
LED_IND_ALT,
LED_IND_AUDIO,
LED_IND_BLUETOOTH,
LED_IND_USB,
LED_IND_BATTERY,
LED_IND_BATTERY,
LED_IND_CAPSLOCK,
LED_IND_GUI,
LED_IND_FUN,
LED_IND_NUM,
LED_IND_PUNC,
LED_IND_EMOJI,
LED_IND_GREEK,
LED_BKSP,
LED_ENT,
@ -261,7 +276,7 @@ enum led_sequence {
# define PS2_CLOCK_PORT PORTD
# define PS2_CLOCK_PIN PIND
# define PS2_CLOCK_DDR DDRD
# define PS2_CLOCK_BIT 1
# define PS2_CLOCK_BIT 3
# define PS2_DATA_PORT PORTD
# define PS2_DATA_PIN PIND
# define PS2_DATA_DDR DDRD

View file

@ -19,6 +19,8 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
PS2_MOUSE_ENABLE = yes
PS2_USE_INT = yes
FAUXCLICKY_ENABLE = yes
BLUETOOTH = AdafruitBLE
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View file

@ -37,8 +37,8 @@ On Promethium, USB or Bluetooth output is detected on startup. If USB is connect
SYS-W, SYS-L, SYS-M switch Unicode input method. SYS-Q, SYS-D, SYS-C, SYS-K, SYS-N switch to QWERTY, DVORAK, Colemak, Workman and Norman, respectively.
On Planck, SYS-A (mnemonic: audio) toggles faux clicky: use buzzer to emit clicks on key presses and releases.
SYS-A (mnemonic: audio) toggles faux clicky: use buzzer to emit clicks on key presses and releases.
On Promethium there are 6 indicator LEDs, and under switch LEDs on each switches, including Trackpoint buttons. Totaling 57 LEDs. Output is limited to 0xF for each LEDs to conserve power. SYS-G (mnemonic: glow) toggles various backlighting modes.
On Promethium there are 16 indicator LEDs, and under switch LEDs on each switches, including Trackpoint buttons. Totaling 67 LEDs. Output is limited to 0xF for each LEDs to conserve power. SYS-G (mnemonic: glow) toggles various backlighting modes.
On Promethium, there's a LED to indicate battery level. Hue indicates level: green is full, red is empty.

View file

@ -38,6 +38,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
#ifdef FAUXCLICKY_ENABLE
#include "fauxclicky.h"
#ifdef RGBSPS_ENABLE
#undef FAUXCLICKY_OFF
#define FAUXCLICKY_OFF do { \
fauxclicky_enabled = false; \
rgbsps_set(LED_AUDIO, 0, 0, 0); \
fauxclicky_stop(); \
} while (0)
#undef FAUXCLICKY_ON
#define FAUXCLICKY_ON do { \
fauxclicky_enabled = true; \
rgbsps_set(LED_AUDIO, 8, 0, 8); \
} while (0)
#endif
#endif
#include "outputselect.h"
#include "led.h"
@ -128,8 +141,8 @@ enum planck_keycodes {
#ifndef FAUXCLICKY_ENABLE
FC_TOG,
#endif
#ifndef ADAFRUIT_BLE_ENABLE
OUT_BLE,
#ifndef MODULE_ADAFRUIT_BLE
OUT_BT,
#endif
KEYCODE_END
};
@ -428,12 +441,23 @@ const uint8_t PROGMEM LED_FN[] = {
};
const uint8_t PROGMEM LED_INDICATORS[] = {
LED_IND_EMOJI,
LED_IND_NUM,
LED_IND_FUN,
LED_IND_BATTERY,
LED_IND_USB,
LED_IND_LINUX,
LED_IND_APPLE,
LED_IND_WINDOWS,
LED_IND_QWERTY,
LED_IND_ALT,
LED_IND_AUDIO,
LED_IND_BLUETOOTH,
LED_IND_USB,
LED_IND_BATTERY,
LED_IND_CAPSLOCK,
LED_IND_GUI,
LED_IND_FUN,
LED_IND_NUM,
LED_IND_PUNC,
LED_IND_EMOJI,
LED_IND_GREEK,
};
const uint8_t PROGMEM LED_TRACKPOINT[] = {
@ -486,15 +510,31 @@ void led_reset(void) {
}
}
void led_set_default_layer_indicator(void) {
uint8_t default_layer = biton32(default_layer_state);
if (default_layer == _QWERTY) {
rgbsps_set(LED_IND_QWERTY, 15, 10, 0);
rgbsps_set(LED_IND_ALT, 0, 0, 0);
} else {
rgbsps_set(LED_IND_QWERTY, 0, 0, 0);
rgbsps_set(LED_IND_ALT, 15, 10, 0);
}
rgbsps_send();
return;
}
void led_set_layer_indicator(void) {
static uint8_t oldlayer = 255;
rgbsps_set(LED_IND_FUN, 0, 0, 0);
// rgbsps_set(LED_IND_NUM, 0, 0, 0);
rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
led_reset();
rgbsps_set(LED_IND_GUI, 0, 0, 0);
rgbsps_set(LED_IND_FUN, 0, 0, 0);
rgbsps_set(LED_IND_NUM, 0, 0, 0);
rgbsps_set(LED_IND_PUNC, 0, 0, 0);
rgbsps_set(LED_IND_GREEK, 0, 0, 0);
rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
uint8_t layer = biton32(layer_state);
if (oldlayer == layer) {
return;
@ -508,24 +548,57 @@ void led_set_layer_indicator(void) {
}
switch(layer) {
case _GUI:
rgbsps_set(LED_IND_GUI, 15, 0, 15);
break;
case _FUN:
rgbsps_set(LED_IND_FUN, 15, 0, 0);
break;
// case _NUM:
// rgbsps_set(LED_IND_NUM, 0, 0, 15);
// break;
case _NUM:
rgbsps_set(LED_IND_NUM, 0, 0, 15);
break;
case _PUNC:
rgbsps_set(LED_IND_PUNC, 0, 15, 0);
break;
case _GREEKL:
case _GREEKU:
rgbsps_set(LED_IND_GREEK, 0, 15, 15);
break;
case _EMOJI:
rgbsps_set(LED_IND_EMOJI, 15, 15, 0);
break;
default:
rgbsps_set(LED_IND_GUI, 3, 3, 3);
rgbsps_set(LED_IND_FUN, 3, 3, 3);
// rgbsps_set(LED_IND_NUM, 3, 3, 3);
rgbsps_set(LED_IND_NUM, 3, 3, 3);
rgbsps_set(LED_IND_PUNC, 3, 3, 3);
rgbsps_set(LED_IND_GREEK, 3, 3, 3);
rgbsps_set(LED_IND_EMOJI, 3, 3, 3);
}
rgbsps_send();
}
void led_set_unicode_input_mode(void) {
rgbsps_set(LED_IND_LINUX, 0, 0, 0);
rgbsps_set(LED_IND_APPLE, 0, 0, 0);
rgbsps_set(LED_IND_WINDOWS, 0, 0, 0);
switch (get_unicode_input_mode()) {
case UC_LNX:
rgbsps_set(LED_IND_LINUX, 15, 15, 15);
break;
case UC_OSX:
rgbsps_set(LED_IND_APPLE, 15, 15, 15);
break;
case UC_WIN:
case UC_WINC:
rgbsps_set(LED_IND_WINDOWS, 15, 15, 15);
break;
}
rgbsps_send();
}
void led_set_output_ble(void) {
rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15);
rgbsps_set(LED_IND_USB, 0, 0, 0);
@ -552,7 +625,16 @@ void led_init(void) {
rgbsps_set(LED_TRACKPOINT1, 15, 0, 0);
rgbsps_set(LED_TRACKPOINT2, 0, 0, 15);
rgbsps_set(LED_TRACKPOINT3, 15, 0, 0);
// unicode input mode
led_set_unicode_input_mode();
// layer indicator
led_set_layer_indicator();
led_set_default_layer_indicator();
}
#endif // RGBSPS_ENABLE
// keymaps
@ -574,7 +656,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT ,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, KC_LALT, KC_LGUI, EMPTY, NUM, LSPACE, RSPACE, FUN, GREEK, KC_RGUI, C_RALT, KC_RCTL
KC_LCTL, KC_LALT, KC_LGUI, EMPTY, NUM, LSPACE, RSPACE, FUN, GREEK, KC_RGUI, C_RALT, KC_RCTL,
_______, _______, _______
),
/* Dvorak
@ -593,7 +676,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, _______,
_______, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, _______,
_______, KC_SLSH, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______
),
#endif
@ -614,7 +698,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, _______,
_______, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, _______,
_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______
),
#endif
@ -635,7 +720,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, KC_Q, KC_W, KC_D, KC_F, KC_K, KC_J, KC_U, KC_R, KC_L, KC_QUOT, _______,
_______, KC_A, KC_S, KC_E, KC_T, KC_G, KC_Y, KC_N, KC_I, KC_O, KC_H, _______,
_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______
),
#endif
@ -656,7 +742,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______,
_______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______,
_______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______
),
#endif
@ -675,7 +762,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, X(LTEQ), X(GTEQ), _______,
KC_GRV, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, X(NOTEQ),KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, _______,
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, X(PLMIN),KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_COLN, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_COLN, _______,
_______, _______, _______
),
/* Num
@ -690,10 +778,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_NUM] = KEYMAP(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_7, KC_8, KC_9, S(KC_D), _______,
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_1, KC_2, KC_3, S(KC_D), _______,
KC_GRV, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______,
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), _______,
_______, _______, KC_X, _______, _______, _______, _______, FUN0 , KC_COMM, KC_DOT, KC_COLN, _______
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_7, KC_8, KC_9, S(KC_F), _______,
_______, _______, KC_X, _______, _______, _______, _______, FUN0 , KC_COMM, KC_DOT, KC_COLN, _______,
_______, _______, _______
),
/* Func
@ -711,7 +800,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_INS, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL,
KC_CAPS, KC_F5, KC_F6, KC_F7, KC_F8, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______,
_______, KC_F9, KC_F10, KC_F11, KC_F12, KC_PAUS, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______
),
/* Uppercase Greek
@ -729,7 +819,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, XXXXXXX, XXXXXXX,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC), X(UPI), _______,
_______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA), X(UXI),X(UKAPP),X(ULAMB), KC_QUOT, _______,
_______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA), X(UNU), X(UMU), KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______
),
/* Lowercase Greek
@ -747,7 +838,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, XXXXXXX,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC), X(LPI), _______,
_______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA), X(LXI),X(LKAPP),X(LLAMB), KC_QUOT, _______,
_______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA), X(LNU), X(LMU), KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______
),
/* Empty
@ -765,7 +857,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______
),
/* Emoji
@ -783,7 +876,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW),
X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS),
X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH),
X(POO), X(EYES), X(HUNRD),_______, X(SKULL),X(HORNS), X(HALO), X(FEAR),_______,X(YUMMY),X(DISAP),X(NOEVK)
X(POO), X(EYES), X(HUNRD),_______, X(SKULL),X(HORNS), X(HALO), X(FEAR),_______,X(YUMMY),X(DISAP),X(NOEVK),
_______, _______, _______
),
/* GUI
@ -801,7 +895,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
XXXXXXX, G(KC_1), G(KC_2), G(KC_3), G(KC_4), G(KC_5), G(KC_6), G(KC_7), G(KC_8), G(KC_9), G(KC_0), XXXXXXX,
KC_ESC, XXXXXXX, S(KC_TAB),KC_ESC, KC_TAB, XXXXXXX, XXXXXXX, KC_WWWB, XXXXXXX, KC_WWWF, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, KC_SPC, KC_SPC, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, _______, _______
),
/* Sys
@ -816,10 +911,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_SYS] = KEYMAP(
XXXXXXX, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
DEBUG, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, FC_TOG, XXXXXXX, DVORAK, XXXXXXX, GLOW, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BLE, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______
XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BT, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
_______, _______, _______
),
@ -828,6 +924,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
#ifdef RGBSPS_ENABLE
led_set_default_layer_indicator();
#endif
}
#ifdef DOUBLESPACE_LAYER_ENABLE
@ -1072,14 +1171,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// OS switchers
case LINUX:
set_unicode_input_mode(UC_LNX);
#ifdef RGBSPS_ENABLE
led_set_unicode_input_mode();
#endif
return false;
break;
case WIN:
set_unicode_input_mode(UC_WINC);
#ifdef RGBSPS_ENABLE
led_set_unicode_input_mode();
#endif
return false;
break;
case OSX:
set_unicode_input_mode(UC_OSX);
#ifdef RGBSPS_ENABLE
led_set_unicode_input_mode();
#endif
return false;
break;
@ -1101,6 +1209,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// faux clicky indicator
#ifdef FAUXCLICKY_ENABLE
case FC_TOG:
#ifdef RGBSPS_ENABLE
if (fauxclicky_enabled) {
rgbsps_set(LED_IND_AUDIO, 0, 0, 0);
} else {
rgbsps_set(LED_IND_AUDIO, 5, 11, 13);
}
rgbsps_send();
#endif
return true;
break;
#endif
@ -1109,12 +1225,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
void set_output_user(uint8_t output) {
#ifdef ADAFRUIT_BLE_ENABLE
#ifdef MODULE_ADAFRUIT_BLE
switch(output) {
case OUTPUT_USB:
led_set_output_usb();
break;
case OUTPUT_ADAFRUIT_BLE:
case OUTPUT_BLUETOOTH:
led_set_output_ble();
break;
default:
@ -1133,12 +1249,12 @@ void matrix_init_user() {
#endif
// auto detect output on init
#ifdef ADAFRUIT_BLE_ENABLE
#ifdef MODULE_ADAFRUIT_BLE
uint8_t output = auto_detect_output();
if (output == OUTPUT_USB) {
set_output(OUTPUT_USB);
} else {
set_output(OUTPUT_ADAFRUIT_BLE);
set_output(OUTPUT_BLUETOOTH);
}
#endif
}
@ -1164,9 +1280,9 @@ void turn_off_capslock() {
bool new_capslock = usb_led & (1<<USB_LED_CAPS_LOCK);
if (new_capslock ^ capslock) { // capslock state is different
if ((capslock = new_capslock)) {
rgbsps_set(LED_IND_NUM, 15, 0, 0);
rgbsps_set(LED_IND_CAPSLOCK, 15, 0, 0);
} else {
rgbsps_set(LED_IND_NUM, 0, 0, 0);
rgbsps_set(LED_IND_CAPSLOCK, 0, 0, 0);
}
rgbsps_send();
}

View file

@ -0,0 +1,306 @@
/*
Copyright 2012 Jun Wako
Copyright 2014 Jack Humbert
Copyright 2017 Priyadi Iman Nurcahyo
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 <stdint.h>
#include <stdbool.h>
#if defined(__AVR__)
#include <avr/io.h>
#endif
#include "wait.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "matrix.h"
#include "timer.h"
/* Set 0 if debouncing isn't needed */
#ifndef DEBOUNCING_DELAY
# define DEBOUNCING_DELAY 5
#endif
#if (DEBOUNCING_DELAY > 0)
static uint16_t debouncing_time;
static bool debouncing = false;
#endif
#if (MATRIX_COLS <= 8)
# define print_matrix_header() print("\nr/c 01234567\n")
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
# define matrix_bitpop(i) bitpop(matrix[i])
# define ROW_SHIFTER ((uint8_t)1)
#elif (MATRIX_COLS <= 16)
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
# define matrix_bitpop(i) bitpop16(matrix[i])
# define ROW_SHIFTER ((uint16_t)1)
#elif (MATRIX_COLS <= 32)
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
# define matrix_bitpop(i) bitpop32(matrix[i])
# define ROW_SHIFTER ((uint32_t)1)
#endif
#ifdef MATRIX_MASKED
extern const matrix_row_t matrix_mask[];
#endif
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
static const uint8_t tp_pins[3] = TRACKPOINT_PINS;
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
static void init_cols(void);
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
static void unselect_rows(void);
static void select_row(uint8_t row);
static void unselect_row(uint8_t row);
__attribute__ ((weak))
void matrix_init_quantum(void) {
matrix_init_kb();
}
__attribute__ ((weak))
void matrix_scan_quantum(void) {
matrix_scan_kb();
}
__attribute__ ((weak))
void matrix_init_kb(void) {
matrix_init_user();
}
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
}
__attribute__ ((weak))
void matrix_init_user(void) {
}
__attribute__ ((weak))
void matrix_scan_user(void) {
}
inline
uint8_t matrix_rows(void) {
return MATRIX_ROWS;
}
inline
uint8_t matrix_cols(void) {
return MATRIX_COLS;
}
void matrix_init(void) {
// To use PORTF disable JTAG with writing JTD bit twice within four cycles.
#if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega32U4__))
MCUCR |= _BV(JTD);
MCUCR |= _BV(JTD);
#endif
// initialize row and col
unselect_rows();
init_cols();
// initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
matrix[i] = 0;
matrix_debouncing[i] = 0;
}
matrix_init_quantum();
}
uint8_t matrix_scan(void
){
// Set row, read cols
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
# if (DEBOUNCING_DELAY > 0)
bool matrix_changed = read_cols_on_row(matrix_debouncing, current_row);
if (matrix_changed) {
debouncing = true;
debouncing_time = timer_read();
}
# else
read_cols_on_row(matrix, current_row);
# endif
}
# if (DEBOUNCING_DELAY > 0)
if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
matrix[i] = matrix_debouncing[i];
}
debouncing = false;
}
# endif
matrix_scan_quantum();
return 1;
}
bool matrix_is_modified(void)
{
#if (DEBOUNCING_DELAY > 0)
if (debouncing) return false;
#endif
return true;
}
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix[row] & ((matrix_row_t)1<col));
}
inline
matrix_row_t matrix_get_row(uint8_t row)
{
// Matrix mask lets you disable switches in the returned matrix data. For example, if you have a
// switch blocker installed and the switch is always pressed.
#ifdef MATRIX_MASKED
return matrix[row] & matrix_mask[row];
#else
return matrix[row];
#endif
}
void matrix_print(void)
{
print_matrix_header();
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
phex(row); print(": ");
print_matrix_row(row);
print("\n");
}
}
uint8_t matrix_key_count(void)
{
uint8_t count = 0;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
count += matrix_bitpop(i);
}
return count;
}
#define ROW_MASK 0b11100000
static const uint8_t row_bit[MATRIX_ROWS] = {
// 76543210
0b00000000,
0b00100000,
0b01000000,
0b01100000,
0b10000000,
0b10100000,
0b11000000,
0b11100000,
};
static void init_cols(void)
{
// columns
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
uint8_t pin = col_pins[x];
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
}
// rows
DDRF |= ROW_MASK;
PORTF &= ~ROW_MASK;
// trackpoint
for(uint8_t x = 0; x < 3; x++) {
uint8_t pin = tp_pins[x];
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
}
}
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
{
// Store last value of row prior to reading
matrix_row_t last_row_value = current_matrix[current_row];
// Clear data in matrix row
current_matrix[current_row] = 0;
// special case for trackpoint
if (current_row == 8) {
for(uint8_t tp_index = 0; tp_index < 3; tp_index++) {
// Select the TP pin to read (active low)
uint8_t pin = tp_pins[tp_index];
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
// Populate the matrix row with the state of the col pin
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << tp_index);
}
return (last_row_value != current_matrix[current_row]);
}
// Select row and wait for row selecton to stabilize
select_row(current_row);
_delay_us(5); // without this wait it won't read stable value.
// wait_us(50);
// For each col...
for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
// Select the col pin to read (active low)
uint8_t pin = col_pins[col_index];
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
// Populate the matrix row with the state of the col pin
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
}
// Unselect row
unselect_row(current_row);
return (last_row_value != current_matrix[current_row]);
}
static void select_row(uint8_t row)
{
PORTF = row_bit[row] | (PORTF & ~ROW_MASK);
}
static void unselect_row(uint8_t row)
{
}
static void unselect_rows(void)
{
}

View file

@ -2,6 +2,11 @@
#include "analog.h"
#include "timer.h"
#include "matrix.h"
#include "musical_notes.h"
float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_F3, .03125);
float fauxclicky_released_note[2] = MUSICAL_NOTE(_C3, .03125);
float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C3, .03125);
// cubic fit {3.3, 0}, {3.5, 2.9}, {3.6, 5}, {3.7, 8.6}, {3.8, 36}, {3.9, 62}, {4.0, 73}, {4.05, 83}, {4.1, 89}, {4.15, 94}, {4.2, 100}

View file

@ -65,12 +65,14 @@ BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
PS2_MOUSE_ENABLE ?= yes
PS2_USE_INT ?= yes
ADAFRUIT_BLE_ENABLE ?= yes
API_SYSEX_ENABLE ?= no
CUSTOM_MATRIX ?= yes
BLUETOOTH ?= AdafruitBLE
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
SRC += $(QUANTUM_DIR)/light_ws2812.c
SRC += rgbsps.c
SRC += $(QUANTUM_DIR)/analog.c
SRC += $(QUANTUM_DIR)/analog.c
SRC += matrix.c

View file

@ -27,7 +27,8 @@
k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \
k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, \
tp1, tp2, tp3 \
) \
{ \
{k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c}, \