Merge pull request #1 from jackhumbert/master

Update
This commit is contained in:
kuel 2016-08-03 11:24:29 -05:00 committed by GitHub
commit 8d8709fb79
7 changed files with 562 additions and 499 deletions

View file

@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CONFIG_H
#define CONFIG_H
#define PREVENT_STUCK_MODIFIERS
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
@ -50,9 +51,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* Keymap for Infiity prototype */
#define INFINITY_PROTOTYPE
/* Keymap for Infinity prototype */
//#define INFINITY_PROTOTYPE
/* Keymap for Infinity 1.1a (first revision with LED support) */
//#define INFINITY_LED
/*
* Feature disable options

View file

@ -29,15 +29,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
K54, K64, K74, K84, K05, K15, K25, K35, K45, K55, K65, K75, K85, \
K06, K16, K26, K36, K46, K56, K66, K76 \
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26 }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36 }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46 }, \
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56 }, \
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66 }, \
{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76 }, \
{ KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86 } \
{ K00, K01, K02, K03, K04, K05, K06 }, \
{ K10, K11, K12, K13, K14, K15, K16 }, \
{ K20, K21, K22, K23, K24, K25, K26 }, \
{ K30, K31, K32, K33, K34, K35, K36 }, \
{ K40, K41, K42, K43, K44, K45, K46 }, \
{ K50, K51, K52, K53, K54, K55, K56 }, \
{ K60, K61, K62, K63, K64, K65, K66 }, \
{ K70, K71, K72, K73, K74, K75, K76 }, \
{ K80, K81, K82, K83, K84, K85, K86 } \
}
#else
@ -50,15 +50,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
K64, K74, K84, K05, K15, K25, K35, K45, K55, K65, K75, K85, K06, \
K16, K26, K36, K46, K56, K66, K76, K86 \
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26 }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36 }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46 }, \
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56 }, \
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66 }, \
{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76 }, \
{ KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86 } \
{ K00, K01, K02, K03, K04, K05, K06 }, \
{ K10, K11, K12, K13, K14, K15, K16 }, \
{ K20, K21, K22, K23, K24, K25, K26 }, \
{ K30, K31, K32, K33, K34, K35, K36 }, \
{ K40, K41, K42, K43, K44, K45, K46 }, \
{ K50, K51, K52, K53, K54, K55, K56 }, \
{ K60, K61, K62, K63, K64, K65, K66 }, \
{ K70, K71, K72, K73, K74, K75, K76 }, \
{ K80, K81, K82, K83, K84, K85, K86 } \
}
#endif

View file

@ -14,12 +14,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | |Gui|Alt | Space |Alt |Gui| | |
* `-----------------------------------------------------------'
*/
[0] =
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS, GRV, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
NO, LGUI,LALT, SPC, RALT,RGUI,NO, NO),
[0] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSLS, KC_GRV, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSPC, \
KC_LCTL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,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,MO(1), \
KC_NO, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_NO, KC_NO),
/* Layer 1: HHKB mode (HHKB Fn)
* ,-----------------------------------------------------------.
@ -34,15 +34,15 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | |Gui|Alt | Space |Alt |Gui| | |
* `-----------------------------------------------------------'
*/
[1] =
KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC, \
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
[1] = KEYMAP(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
KC_CAPS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, \
KC_TRNS,KC_VOLD,KC_VOLU,KC_MUTE,KC_TRNS,KC_TRNS,KC_PAST,KC_PSLS,KC_HOME,KC_PGUP,KC_LEFT,KC_RGHT,KC_PENT, \
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PPLS,KC_PMNS,KC_END, KC_PGDN,KC_DOWN,KC_TRNS,KC_TRNS, \
KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS),
};
const uint16_t fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
};

View file

@ -0,0 +1,82 @@
#include "infinity_chibios.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
* ,-----------------------------------------------------------.
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
* |-----------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Bksp|
* |-----------------------------------------------------------|
* |Contro| A| S| D| F| G| H| J| K| L| ;| '|Enter |
* |-----------------------------------------------------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn2|
* |-----------------------------------------------------------'
* |Fn2 |Gui |Alt | Space |RAlt|Prv|PlPs|Next|
* `-----------------------------------------------------------'
*/
[0] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, LT(5, KC_ENT), \
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, MO(4), \
MO(4), KC_LGUI, KC_LALT, LT(3, KC_SPC), KC_RALT, KC_MPRV, KC_MPLY, KC_MNXT),
/* Layer 1: "Toggle" off SpaceFn for League of Legends
*/
[1] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, 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, MO(4), \
MO(4), KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_MPRV, KC_MPLY, KC_MNXT),
/* Layer 2: "Toggle" off SpaceFn for MapleRoyals
*/
[2] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, 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_UP, KC_LSFT, \
MO(4), KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT),
/* Layer 3: FN layer 1
*/
[3] = KEYMAP(
KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, \
KC_NO, KC_BTN1, KC_MS_U, KC_BTN2, LALT(KC_F4), KC_HOME, KC_PGUP, KC_PSCR, KC_SLCK, KC_UP, KC_NO, KC_LPRN, KC_RPRN, KC_DEL, \
MO(6), KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_END, KC_PGDN, KC_TILD, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, KC_NO, \
LGUI(KC_SPC), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_CALC, KC_MENU, KC_TRNS, TG(4), \
KC_TRNS, KC_TRNS, KC_TRNS, LT(3, KC_SPC), KC_TRNS, KC_VOLD, KC_MUTE, KC_VOLU),
/* Layer 4: FN layer 2
*/
[4] = KEYMAP(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PMNS, KC_PPLS, KC_PSLS, TG(2), \
KC_CAPS, KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, KC_NO, KC_PSCR, KC_NO, KC_P7, KC_P8, KC_P9, KC_PAST, KC_BSPC, \
KC_LCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_P4, KC_P5, KC_P6, KC_PENT, \
KC_LSFT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_P1, KC_P2, KC_P3, KC_RSFT, MO(4), \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_NO, TG(1)),
/* Layer 5: FN layer 3
*/
[5] = KEYMAP(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_TAB , KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F13, KC_F14, KC_F15, KC_F16, KC_NO, KC_TRNS, \
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F17, KC_F18, KC_F19, KC_F20, LT(5, KC_ENT), \
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F21, KC_F22, KC_F23, KC_F24, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RALT, KC_NO, KC_NO, KC_NO),
/* Layer 6: FN layer 4
*/
[6] = KEYMAP(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
LCTL(LSFT(KC_TAB)), KC_NO, LGUI(KC_UP), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
MO(6), LGUI(KC_LEFT), LGUI(KC_DOWN), LGUI(KC_RGHT), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO),
};
const uint16_t PROGMEM fn_actions[] = {
};

View file

@ -14,12 +14,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | |Gui|Alt | Space |Alt |Gui| | |
* `-----------------------------------------------------------'
*/
[0] =
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,FN6, \
FN7, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,FN1, \
NO, LGUI,LALT, FN4, FN5, RGUI,NO, NO),
[0] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSLS,KC_GRV, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSPC, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT(3, KC_SCLN), KC_QUOT,MT(KC_RCTL, KC_ENT), \
OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, LT(2, KC_SLSH), KC_RSFT,TG(1), \
KC_NO, KC_LGUI,KC_LALT, LT(4, KC_SPC), MO(4), KC_RGUI,KC_NO, KC_NO),
/* Layer 1: HHKB mode (HHKB Fn)
* ,-----------------------------------------------------------.
@ -34,12 +34,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | |Gui|Alt | Space |Alt |Gui| | |
* `-----------------------------------------------------------'
*/
[1] =
KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS,BSPC, \
LCTL,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \
LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \
TRNS,LGUI,LALT, TRNS, RALT,RGUI,TRNS,TRNS),
[1] = KEYMAP(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
KC_CAPS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS, KC_UP, KC_TRNS,KC_BSPC, \
KC_LCTL,KC_VOLD,KC_VOLU,KC_MUTE,KC_TRNS,KC_TRNS,KC_PAST,KC_PSLS,KC_HOME,KC_PGUP,KC_LEFT,KC_RGHT,KC_ENT, \
KC_LSFT,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PPLS,KC_PMNS,KC_END, KC_PGDN,KC_DOWN,KC_RSFT,KC_TRNS, \
KC_TRNS,KC_LGUI,KC_LALT, KC_TRNS, KC_RALT,KC_RGUI,KC_TRNS,KC_TRNS),
/* Layer 2: Vi mode[Slash]
* ,-----------------------------------------------------------.
@ -54,12 +54,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |Gui|Alt | Space |Alt |Gui|
* `-------------------------------------------'
*/
[2] = \
KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \
LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \
LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT,TRNS, \
TRNS,LGUI,LALT, SPC, RALT,RGUI,TRNS,TRNS),
[2] = KEYMAP(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
KC_TAB, KC_HOME,KC_PGDN,KC_UP, KC_PGUP,KC_END, KC_HOME,KC_PGDN,KC_PGUP,KC_END, KC_NO, KC_NO, KC_NO, KC_BSPC, \
KC_LCTL,KC_NO, KC_LEFT,KC_DOWN,KC_RGHT,KC_NO, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_NO, KC_NO, KC_ENT, \
KC_LSFT,KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME,KC_PGDN,KC_PGUP,KC_END, LT(2, KC_SLSH), KC_RSFT,KC_TRNS, \
KC_TRNS,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_TRNS, KC_TRNS),
/* Layer 3: Mouse mode(IJKL)[Semicolon]
* ,-----------------------------------------------------------.
@ -75,12 +75,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------------------------------'
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
*/
[3] = \
KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,FN9, FN10,FN8, \
LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,FN3, NO, ENT, \
LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT,TRNS, \
TRNS,LGUI,LALT, BTN1, TRNS,TRNS,TRNS,TRNS),
[3] = KEYMAP(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
LALT(KC_TAB), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_L,KC_WH_D,KC_MS_U, KC_WH_U, KC_WH_R, ALT_T(KC_LEFT), ALT_T(KC_RGHT),LALT(KC_TAB), \
KC_LCTL, KC_ACL0,KC_ACL1,KC_ACL2,KC_ACL2,KC_NO, KC_NO, KC_MS_L,KC_MS_D, KC_MS_R, LT(3, KC_SCLN), KC_NO, KC_ENT, \
KC_LSFT, KC_NO, KC_NO, KC_NO, KC_NO, KC_BTN3,KC_BTN2,KC_BTN1,ALT_T(KC_LEFT), ALT_T(KC_RGHT), KC_NO, KC_RSFT, KC_TRNS, \
KC_TRNS, KC_LGUI,KC_LALT, KC_BTN1, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
/* Layer 4: Mouse mode(IJKL)[Space]
* ,-----------------------------------------------------------.
@ -96,104 +96,18 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------------------------------'
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
*/
[4] = \
KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN8, \
LCTL,VOLD,VOLU,MUTE,NO, NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, \
LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT,TRNS, \
TRNS,LGUI,LALT, TRNS, TRNS,TRNS,TRNS,TRNS),
[4] = KEYMAP(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
LALT(KC_TAB), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_L,KC_WH_D,KC_MS_U, KC_WH_U, KC_WH_R,KC_BTN4,KC_BTN5,LALT(KC_TAB), \
KC_LCTL, KC_VOLD,KC_VOLU,KC_MUTE,KC_NO, KC_NO, KC_NO, KC_MS_L,KC_MS_D, KC_MS_R, KC_BTN1,KC_NO, KC_ENT, \
KC_LSFT, KC_NO, KC_NO, KC_NO, KC_NO, KC_BTN3,KC_BTN2,KC_BTN1,ALT_T(KC_LEFT),ALT_T(KC_RGHT),KC_NO, KC_RSFT,KC_TRNS, \
KC_TRNS, KC_LGUI,KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS),
};
/* id for user defined functions */
enum function_id {
LSHIFT_LPAREN,
};
enum macro_id {
HELLO,
VOLUP,
ALT_TAB,
};
/*
* Fn action definition
*/
const uint16_t fn_actions[] = {
[0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used)
[1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps)
[2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash*
[3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon*
[4] = ACTION_LAYER_TAP_KEY(4, KC_SPC), // Mousekey layer with Space
[5] = ACTION_LAYER_MOMENTARY(4), // Mousekey layer(IJKL)
[6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT), // RControl with tap Enter
[7] = ACTION_MODS_ONESHOT(MOD_LSFT), // Oneshot Shift
[8] = ACTION_MACRO(ALT_TAB), // Application switching
[9] = ACTION_MODS_KEY(MOD_LALT, KC_LEFT),
[10] = ACTION_MODS_KEY(MOD_LALT, KC_RIGHT),
};
/*
* Macro definition
*/
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch (id) {
case HELLO:
return (record->event.pressed ?
MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) :
MACRO_NONE );
case VOLUP:
return (record->event.pressed ?
MACRO( D(VOLU), U(VOLU), END ) :
MACRO_NONE );
case ALT_TAB:
return (record->event.pressed ?
MACRO( D(LALT), D(TAB), END ) :
MACRO( U(TAB), END ));
}
return MACRO_NONE;
}
/*
* user defined action function
*/
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
if (record->event.pressed) dprint("P"); else dprint("R");
dprintf("%d", record->tap.count);
if (record->tap.interrupted) dprint("i");
dprint("\n");
switch (id) {
case LSHIFT_LPAREN:
// Shift parentheses example: LShft + tap '('
// http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#shift-parentheses
// http://geekhack.org/index.php?topic=41989.msg1304899#msg1304899
if (record->event.pressed) {
if (record->tap.count > 0 && !record->tap.interrupted) {
if (record->tap.interrupted) {
dprint("tap interrupted\n");
register_mods(MOD_BIT(KC_LSHIFT));
}
} else {
register_mods(MOD_BIT(KC_LSHIFT));
}
} else {
if (record->tap.count > 0 && !(record->tap.interrupted)) {
add_weak_mods(MOD_BIT(KC_LSHIFT));
send_keyboard_report();
register_code(KC_9);
unregister_code(KC_9);
del_weak_mods(MOD_BIT(KC_LSHIFT));
send_keyboard_report();
record->tap.count = 0; // ad hoc: cancel tap
} else {
unregister_mods(MOD_BIT(KC_LSHIFT));
}
}
break;
}
}

View file

@ -12,9 +12,12 @@
* Infinity Pinusage:
* Column pins are input with internal pull-down. Row pins are output and strobe with high.
* Key is high or 1 when it turns on.
*
* INFINITY PRODUCTION (NO LED)
* col: { PTD1, PTD2, PTD3, PTD4, PTD5, PTD6, PTD7 }
* row: { PTB0, PTB1, PTB2, PTB3, PTB16, PTB17, PTC4, PTC5, PTD0 }
* INFINITY PRODUCTION (WITH LED)
* col: { PTD1, PTD2, PTD3, PTD4, PTD5, PTD6, PTD7 }
* row: { PTC0, PTC1, PTC2, PTC3, PTC4, PTC5, PTC6, PTC7, PTD0 }
*/
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
@ -34,6 +37,18 @@ void matrix_init(void)
palSetPadMode(GPIOD, 6, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOD, 7, PAL_MODE_INPUT_PULLDOWN);
#ifdef INFINITY_LED
/* Row(strobe) */
palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 2, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 5, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 7, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL);
#else
/* Row(strobe) */
palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL);
@ -44,7 +59,7 @@ void matrix_init(void)
palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 5, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL);
#endif
memset(matrix, 0, MATRIX_ROWS);
memset(matrix_debouncing, 0, MATRIX_ROWS);
}
@ -53,7 +68,20 @@ uint8_t matrix_scan(void)
{
for (int row = 0; row < MATRIX_ROWS; row++) {
matrix_row_t data = 0;
#ifdef INFINITY_LED
// strobe row
switch (row) {
case 0: palSetPad(GPIOC, 0); break;
case 1: palSetPad(GPIOC, 1); break;
case 2: palSetPad(GPIOC, 2); break;
case 3: palSetPad(GPIOC, 3); break;
case 4: palSetPad(GPIOC, 4); break;
case 5: palSetPad(GPIOC, 5); break;
case 6: palSetPad(GPIOC, 6); break;
case 7: palSetPad(GPIOC, 7); break;
case 8: palSetPad(GPIOD, 0); break;
}
#else
// strobe row
switch (row) {
case 0: palSetPad(GPIOB, 0); break;
@ -66,12 +94,26 @@ uint8_t matrix_scan(void)
case 7: palSetPad(GPIOC, 5); break;
case 8: palSetPad(GPIOD, 0); break;
}
#endif
wait_us(1); // need wait to settle pin state
// read col data
data = (palReadPort(GPIOD)>>1);
#ifdef INFINITY_LED
// un-strobe row
switch (row) {
case 0: palClearPad(GPIOC, 0); break;
case 1: palClearPad(GPIOC, 1); break;
case 2: palClearPad(GPIOC, 2); break;
case 3: palClearPad(GPIOC, 3); break;
case 4: palClearPad(GPIOC, 4); break;
case 5: palClearPad(GPIOC, 5); break;
case 6: palClearPad(GPIOC, 6); break;
case 7: palClearPad(GPIOC, 7); break;
case 8: palClearPad(GPIOD, 0); break;
}
#else
// un-strobe row
switch (row) {
case 0: palClearPad(GPIOB, 0); break;
@ -84,6 +126,7 @@ uint8_t matrix_scan(void)
case 7: palClearPad(GPIOC, 5); break;
case 8: palClearPad(GPIOD, 0); break;
}
#endif
if (matrix_debouncing[row] != data) {
matrix_debouncing[row] = data;

View file

@ -22,9 +22,26 @@ const uint8_t DIM_CURVE[] PROGMEM = {
83, 85, 86, 88, 90, 91, 93, 94, 96, 98, 99, 101, 103, 105, 107, 109,
110, 112, 114, 116, 118, 121, 123, 125, 127, 129, 132, 134, 136, 139, 141, 144,
146, 149, 151, 154, 157, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 190,
193, 196, 200, 203, 207, 211, 214, 218, 222, 226, 230, 234, 238, 242, 248, 255,
193, 196, 200, 203, 207, 211, 214, 218, 222, 226, 230, 234, 238, 242, 248, 255
};
const uint8_t RGBLED_BREATHING_TABLE[] PROGMEM = {
0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9,
10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76,
79, 82, 85, 88, 90, 93, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124,
127, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, 173,
176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, 213, 215,
218, 220, 222, 224, 226, 228, 230, 232, 234, 235, 237, 238, 240, 241, 243, 244,
245, 246, 248, 249, 250, 250, 251, 252, 253, 253, 254, 254, 254, 255, 255, 255,
255, 255, 255, 255, 254, 254, 254, 253, 253, 252, 251, 250, 250, 249, 248, 246,
245, 244, 243, 241, 240, 238, 237, 235, 234, 232, 230, 228, 226, 224, 222, 220,
218, 215, 213, 211, 208, 206, 203, 201, 198, 196, 193, 190, 188, 185, 182, 179,
176, 173, 170, 167, 165, 162, 158, 155, 152, 149, 146, 143, 140, 137, 134, 131,
128, 124, 121, 118, 115, 112, 109, 106, 103, 100, 97, 93, 90, 88, 85, 82,
79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40,
37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11,
10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0
};
const uint8_t RGBLED_BREATHING_TABLE[] PROGMEM = {0,0,0,0,1,1,1,2,2,3,4,5,5,6,7,9,10,11,12,14,15,17,18,20,21,23,25,27,29,31,33,35,37,40,42,44,47,49,52,54,57,59,62,65,67,70,73,76,79,82,85,88,90,93,97,100,103,106,109,112,115,118,121,124,127,131,134,137,140,143,146,149,152,155,158,162,165,167,170,173,176,179,182,185,188,190,193,196,198,201,203,206,208,211,213,215,218,220,222,224,226,228,230,232,234,235,237,238,240,241,243,244,245,246,248,249,250,250,251,252,253,253,254,254,254,255,255,255,255,255,255,255,254,254,254,253,253,252,251,250,250,249,248,246,245,244,243,241,240,238,237,235,234,232,230,228,226,224,222,220,218,215,213,211,208,206,203,201,198,196,193,190,188,185,182,179,176,173,170,167,165,162,158,155,152,149,146,143,140,137,134,131,128,124,121,118,115,112,109,106,103,100,97,93,90,88,85,82,79,76,73,70,67,65,62,59,57,54,52,49,47,44,42,40,37,35,33,31,29,27,25,23,21,20,18,17,15,14,12,11,10,9,7,6,5,5,4,3,2,2,1,1,1,0,0,0};
const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30};
const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
@ -38,63 +55,56 @@ uint8_t rgblight_inited = 0;
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
/* convert hue, saturation and brightness ( HSB/HSV ) to RGB
The DIM_CURVE is used only on brightness/value and on saturation (inverted).
This looks the most natural.
*/
uint8_t r = 0, g = 0, b = 0;
// Convert hue, saturation, and value (HSV/HSB) to RGB. DIM_CURVE is used only
// on value and saturation (inverted). This looks the most natural.
uint8_t r = 0, g = 0, b = 0, base, color;
val = pgm_read_byte(&DIM_CURVE[val]);
sat = 255 - pgm_read_byte(&DIM_CURVE[255 - sat]);
uint8_t base;
if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
r = val;
g = val;
b = val;
} else {
base = ((255 - sat) * val) >> 8;
color = (val - base) * (hue % 60) / 60;
switch (hue / 60) {
case 0:
r = val;
g = (((val - base)*hue) / 60) + base;
g = base + color;
b = base;
break;
case 1:
r = (((val - base)*(60 - (hue % 60))) / 60) + base;
r = val - color;
g = val;
b = base;
break;
case 2:
r = base;
g = val;
b = (((val - base)*(hue % 60)) / 60) + base;
b = base + color;
break;
case 3:
r = base;
g = (((val - base)*(60 - (hue % 60))) / 60) + base;
g = val - color;
b = val;
break;
case 4:
r = (((val - base)*(hue % 60)) / 60) + base;
r = base + color;
g = base;
b = val;
break;
case 5:
r = val;
g = base;
b = (((val - base)*(60 - (hue % 60))) / 60) + base;
b = val - color;
break;
}
}
setrgb(r,g,b, led1);
setrgb(r, g, b, led1);
}
void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1) {
@ -162,15 +172,14 @@ void rgblight_increase(void) {
}
rgblight_mode(mode);
}
void rgblight_decrease(void) {
uint8_t mode = 0;
if (rgblight_config.mode > 1) { //mode will never < 1, if mode is less than 1, eeprom need to be initialized.
mode = rgblight_config.mode-1;
// Mode will never be < 1. If it ever is, eeprom needs to be initialized.
if (rgblight_config.mode > 1) {
mode = rgblight_config.mode - 1;
}
rgblight_mode(mode);
}
void rgblight_step(void) {
uint8_t mode = 0;
mode = rgblight_config.mode + 1;
@ -184,7 +193,7 @@ void rgblight_mode(uint8_t mode) {
if (!rgblight_config.enable) {
return;
}
if (mode<1) {
if (mode < 1) {
rgblight_config.mode = 1;
} else if (mode > RGBLIGHT_MODES) {
rgblight_config.mode = RGBLIGHT_MODES;
@ -197,7 +206,7 @@ void rgblight_mode(uint8_t mode) {
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_disable();
#endif
} else if (rgblight_config.mode >=2 && rgblight_config.mode <=23) {
} else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 23) {
// MODE 2-5, breathing
// MODE 6-8, rainbow mood
// MODE 9-14, rainbow swirl
@ -218,7 +227,6 @@ void rgblight_toggle(void) {
if (rgblight_config.enable) {
rgblight_mode(rgblight_config.mode);
} else {
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_disable();
#endif
@ -228,17 +236,17 @@ void rgblight_toggle(void) {
}
void rgblight_increase_hue(void){
void rgblight_increase_hue(void) {
uint16_t hue;
hue = (rgblight_config.hue+RGBLIGHT_HUE_STEP) % 360;
rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val);
}
void rgblight_decrease_hue(void){
void rgblight_decrease_hue(void) {
uint16_t hue;
if (rgblight_config.hue-RGBLIGHT_HUE_STEP <0 ) {
hue = (rgblight_config.hue+360-RGBLIGHT_HUE_STEP) % 360;
if (rgblight_config.hue-RGBLIGHT_HUE_STEP < 0) {
hue = (rgblight_config.hue + 360 - RGBLIGHT_HUE_STEP) % 360;
} else {
hue = (rgblight_config.hue-RGBLIGHT_HUE_STEP) % 360;
hue = (rgblight_config.hue - RGBLIGHT_HUE_STEP) % 360;
}
rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val);
}
@ -247,25 +255,25 @@ void rgblight_increase_sat(void) {
if (rgblight_config.sat + RGBLIGHT_SAT_STEP > 255) {
sat = 255;
} else {
sat = rgblight_config.sat+RGBLIGHT_SAT_STEP;
sat = rgblight_config.sat + RGBLIGHT_SAT_STEP;
}
rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
}
void rgblight_decrease_sat(void){
void rgblight_decrease_sat(void) {
uint8_t sat;
if (rgblight_config.sat - RGBLIGHT_SAT_STEP < 0) {
sat = 0;
} else {
sat = rgblight_config.sat-RGBLIGHT_SAT_STEP;
sat = rgblight_config.sat - RGBLIGHT_SAT_STEP;
}
rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
}
void rgblight_increase_val(void){
void rgblight_increase_val(void) {
uint8_t val;
if (rgblight_config.val + RGBLIGHT_VAL_STEP > 255) {
val = 255;
} else {
val = rgblight_config.val+RGBLIGHT_VAL_STEP;
val = rgblight_config.val + RGBLIGHT_VAL_STEP;
}
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
}
@ -274,12 +282,12 @@ void rgblight_decrease_val(void) {
if (rgblight_config.val - RGBLIGHT_VAL_STEP < 0) {
val = 0;
} else {
val = rgblight_config.val-RGBLIGHT_VAL_STEP;
val = rgblight_config.val - RGBLIGHT_VAL_STEP;
}
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
}
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val){
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
inmem_config.raw = rgblight_config.raw;
if (rgblight_config.enable) {
struct cRGB tmp_led;
@ -291,7 +299,7 @@ void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val){
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
}
}
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val){
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
if (rgblight_config.enable) {
if (rgblight_config.mode == 1) {
// same static color
@ -314,22 +322,21 @@ void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val){
}
}
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b){
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
// dprintf("rgblight set rgb: %u,%u,%u\n", r,g,b);
for (uint8_t i=0;i<RGBLED_NUM;i++) {
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
led[i].r = r;
led[i].g = g;
led[i].b = b;
}
rgblight_set();
}
void rgblight_set(void) {
if (rgblight_config.enable) {
ws2812_setleds(led, RGBLED_NUM);
} else {
for (uint8_t i=0;i<RGBLED_NUM;i++) {
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
@ -338,7 +345,6 @@ void rgblight_set(void) {
}
}
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
// Animation timer -- AVR Timer3
@ -354,8 +360,8 @@ void rgblight_timer_init(void) {
/* Set TOP value */
uint8_t sreg = SREG;
cli();
OCR3AH = (RGBLED_TIMER_TOP>>8)&0xff;
OCR3AL = RGBLED_TIMER_TOP&0xff;
OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff;
OCR3AL = RGBLED_TIMER_TOP & 0xff;
SREG = sreg;
}
void rgblight_timer_enable(void) {
@ -372,149 +378,164 @@ void rgblight_timer_toggle(void) {
}
ISR(TIMER3_COMPA_vect) {
// Mode = 1, static light, do nothing here
if (rgblight_config.mode>=2 && rgblight_config.mode<=5) {
// mode = 1, static light, do nothing here
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
// mode = 2 to 5, breathing mode
rgblight_effect_breathing(rgblight_config.mode-2);
} else if (rgblight_config.mode>=6 && rgblight_config.mode<=8) {
rgblight_effect_rainbow_mood(rgblight_config.mode-6);
} else if (rgblight_config.mode>=9 && rgblight_config.mode<=14) {
rgblight_effect_rainbow_swirl(rgblight_config.mode-9);
} else if (rgblight_config.mode>=15 && rgblight_config.mode<=20) {
rgblight_effect_snake(rgblight_config.mode-15);
} else if (rgblight_config.mode>=21 && rgblight_config.mode<=23) {
rgblight_effect_knight(rgblight_config.mode-21);
rgblight_effect_breathing(rgblight_config.mode - 2);
} else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) {
// mode = 6 to 8, rainbow mood mod
rgblight_effect_rainbow_mood(rgblight_config.mode - 6);
} else if (rgblight_config.mode >= 9 && rgblight_config.mode <= 14) {
// mode = 9 to 14, rainbow swirl mode
rgblight_effect_rainbow_swirl(rgblight_config.mode - 9);
} else if (rgblight_config.mode >= 15 && rgblight_config.mode <= 20) {
// mode = 15 to 20, snake mode
rgblight_effect_snake(rgblight_config.mode - 15);
} else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) {
// mode = 21 to 23, knight mode
rgblight_effect_knight(rgblight_config.mode - 21);
}
}
// effects
// Effects
void rgblight_effect_breathing(uint8_t interval) {
static uint8_t pos = 0;
static uint16_t last_timer = 0;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_BREATHING_INTERVALS[interval])) return;
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_BREATHING_INTERVALS[interval])) {
return;
}
last_timer = timer_read();
rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, pgm_read_byte(&RGBLED_BREATHING_TABLE[pos]));
pos = (pos+1) % 256;
pos = (pos + 1) % 256;
}
void rgblight_effect_rainbow_mood(uint8_t interval) {
static uint16_t current_hue=0;
static uint16_t current_hue = 0;
static uint16_t last_timer = 0;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval])) return;
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval])) {
return;
}
last_timer = timer_read();
rgblight_sethsv_noeeprom(current_hue, rgblight_config.sat, rgblight_config.val);
current_hue = (current_hue+1) % 360;
current_hue = (current_hue + 1) % 360;
}
void rgblight_effect_rainbow_swirl(uint8_t interval) {
static uint16_t current_hue=0;
static uint16_t current_hue = 0;
static uint16_t last_timer = 0;
uint16_t hue;
uint8_t i;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval/2])) return;
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval / 2])) {
return;
}
last_timer = timer_read();
for (i=0; i<RGBLED_NUM; i++) {
hue = (360/RGBLED_NUM*i+current_hue)%360;
for (i = 0; i < RGBLED_NUM; i++) {
hue = (360 / RGBLED_NUM * i + current_hue) % 360;
sethsv(hue, rgblight_config.sat, rgblight_config.val, &led[i]);
}
rgblight_set();
if (interval % 2) {
current_hue = (current_hue+1) % 360;
current_hue = (current_hue + 1) % 360;
} else {
if (current_hue -1 < 0) {
if (current_hue - 1 < 0) {
current_hue = 359;
} else {
current_hue = current_hue - 1;
}
}
}
void rgblight_effect_snake(uint8_t interval) {
static uint8_t pos=0;
static uint8_t pos = 0;
static uint16_t last_timer = 0;
uint8_t i,j;
uint8_t i, j;
int8_t k;
int8_t increament = 1;
if (interval%2) increament = -1;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_SNAKE_INTERVALS[interval/2])) return;
int8_t increment = 1;
if (interval % 2) {
increment = -1;
}
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_SNAKE_INTERVALS[interval / 2])) {
return;
}
last_timer = timer_read();
for (i=0;i<RGBLED_NUM;i++) {
led[i].r=0;
led[i].g=0;
led[i].b=0;
for (j=0;j<RGBLIGHT_EFFECT_SNAKE_LENGTH;j++) {
k = pos+j*increament;
if (k<0) k = k+RGBLED_NUM;
if (i==k) {
for (i = 0; i < RGBLED_NUM; i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {
k = pos + j * increment;
if (k < 0) {
k = k + RGBLED_NUM;
}
if (i == k) {
sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), &led[i]);
}
}
}
rgblight_set();
if (increament == 1) {
if (increment == 1) {
if (pos - 1 < 0) {
pos = RGBLED_NUM-1;
pos = RGBLED_NUM - 1;
} else {
pos -= 1;
}
} else {
pos = (pos+1)%RGBLED_NUM;
pos = (pos + 1) % RGBLED_NUM;
}
}
void rgblight_effect_knight(uint8_t interval) {
static int8_t pos=0;
static int8_t pos = 0;
static uint16_t last_timer = 0;
uint8_t i,j,cur;
uint8_t i, j, cur;
int8_t k;
struct cRGB preled[RGBLED_NUM];
static int8_t increament = -1;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) return;
static int8_t increment = -1;
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) {
return;
}
last_timer = timer_read();
for (i=0;i<RGBLED_NUM;i++) {
preled[i].r=0;
preled[i].g=0;
preled[i].b=0;
for (j=0;j<RGBLIGHT_EFFECT_KNIGHT_LENGTH;j++) {
k = pos+j*increament;
if (k<0) k = 0;
if (k>=RGBLED_NUM) k=RGBLED_NUM-1;
if (i==k) {
for (i = 0; i < RGBLED_NUM; i++) {
preled[i].r = 0;
preled[i].g = 0;
preled[i].b = 0;
for (j = 0; j < RGBLIGHT_EFFECT_KNIGHT_LENGTH; j++) {
k = pos + j * increment;
if (k < 0) {
k = 0;
}
if (k >= RGBLED_NUM) {
k = RGBLED_NUM - 1;
}
if (i == k) {
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, &preled[i]);
}
}
}
if (RGBLIGHT_EFFECT_KNIGHT_OFFSET) {
for (i=0;i<RGBLED_NUM;i++) {
cur = (i+RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM;
for (i = 0; i < RGBLED_NUM; i++) {
cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM;
led[i].r = preled[cur].r;
led[i].g = preled[cur].g;
led[i].b = preled[cur].b;
}
}
rgblight_set();
if (increament == 1) {
if (increment == 1) {
if (pos - 1 < 0 - RGBLIGHT_EFFECT_KNIGHT_LENGTH) {
pos = 0- RGBLIGHT_EFFECT_KNIGHT_LENGTH;
increament = -1;
pos = 0 - RGBLIGHT_EFFECT_KNIGHT_LENGTH;
increment = -1;
} else {
pos -= 1;
}
} else {
if (pos+1>RGBLED_NUM+RGBLIGHT_EFFECT_KNIGHT_LENGTH) {
pos = RGBLED_NUM+RGBLIGHT_EFFECT_KNIGHT_LENGTH-1;
increament = 1;
if (pos + 1 > RGBLED_NUM + RGBLIGHT_EFFECT_KNIGHT_LENGTH) {
pos = RGBLED_NUM + RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1;
increment = 1;
} else {
pos += 1;
}
}
}
#endif