mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-26 05:06:42 +00:00
Add MxSS keyboard (#3335)
* Added basic MxSS support * Fixed split RSHFT for ISO layouts * Updated readme.md for MxSS * Added initial support for individual control of front RGB LEDs * Changed RGBLED color selection to work using hue and saturation rather than RGB Added code for LED state change on layer change * Avoid needing an entire 8 bits to store the brightness value * Added custom keycodes, along with their handlers * Added EEPROM storage for front LED config * Fixed up ability to use QMK Configurator and updated readme.md * Applied suggested changes from pull request: https://github.com/standard/standard/issues/452 Updated name in license descriptions Updated layouts to snake case Corrected mistakes in info.json Updated layer_colors to a weak attributed array in mxss.c * Defined a new safe range for custom keycodes in keymap.c
This commit is contained in:
parent
df8b564518
commit
e661f1559e
138
keyboards/mxss/config.h
Normal file
138
keyboards/mxss/config.h
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2018 Jumail Mundekkat / MxBlue
|
||||||
|
|
||||||
|
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 CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define VENDOR_ID 0xFEED
|
||||||
|
#define PRODUCT_ID 0x6060
|
||||||
|
#define DEVICE_VER 0x0001
|
||||||
|
#define MANUFACTURER MxBlue
|
||||||
|
#define PRODUCT MxSS
|
||||||
|
#define DESCRIPTION Custom Polycarb Keyboard
|
||||||
|
|
||||||
|
/* key matrix size */
|
||||||
|
#define MATRIX_ROWS 5
|
||||||
|
#define MATRIX_COLS 15
|
||||||
|
|
||||||
|
/* matrix pin configuration */
|
||||||
|
#define MATRIX_ROW_PINS { F4, F1, F7, B1, B7 }
|
||||||
|
#define MATRIX_COL_PINS { D7, D6, D4, D0, C6, B6, D1, B5, D2, B4, D3, D5, B0, B2, B3 }
|
||||||
|
#define UNUSED_PINS
|
||||||
|
|
||||||
|
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
|
||||||
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
|
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||||
|
#define DEBOUNCING_DELAY 5
|
||||||
|
|
||||||
|
/* Basic RGB configuration */
|
||||||
|
#define RGB_DI_PIN C7
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLED_NUM 20
|
||||||
|
#define RGBLIGHT_HUE_STEP 8
|
||||||
|
#define RGBLIGHT_SAT_STEP 8
|
||||||
|
#define RGBLIGHT_VAL_STEP 8
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
|
||||||
|
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
|
||||||
|
* This is userful for the Windows task manager shortcut (ctrl+shift+esc).
|
||||||
|
*/
|
||||||
|
// #define GRAVE_ESC_CTRL_OVERRIDE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Force NKRO
|
||||||
|
*
|
||||||
|
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
|
||||||
|
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
|
||||||
|
* makefile for this to work.)
|
||||||
|
*
|
||||||
|
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
|
||||||
|
* until the next keyboard reset.
|
||||||
|
*
|
||||||
|
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
|
||||||
|
* fully operational during normal computer usage.
|
||||||
|
*
|
||||||
|
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
|
||||||
|
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
|
||||||
|
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
|
||||||
|
* power-up.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//#define FORCE_NKRO
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Magic Key Options
|
||||||
|
*
|
||||||
|
* Magic keys are hotkey commands that allow control over firmware functions of
|
||||||
|
* the keyboard. They are best used in combination with the HID Listen program,
|
||||||
|
* found here: https://www.pjrc.com/teensy/hid_listen.html
|
||||||
|
*
|
||||||
|
* The options below allow the magic key functionality to be changed. This is
|
||||||
|
* useful if your keyboard/keypad is missing keys and you want magic key support.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* key combination for magic key command */
|
||||||
|
#define IS_COMMAND() ( \
|
||||||
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/* control how magic key switches layers */
|
||||||
|
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
|
||||||
|
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
|
||||||
|
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
|
||||||
|
|
||||||
|
/* override magic key keymap */
|
||||||
|
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
|
||||||
|
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
|
||||||
|
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
|
||||||
|
//#define MAGIC_KEY_HELP1 H
|
||||||
|
//#define MAGIC_KEY_HELP2 SLASH
|
||||||
|
//#define MAGIC_KEY_DEBUG D
|
||||||
|
//#define MAGIC_KEY_DEBUG_MATRIX X
|
||||||
|
//#define MAGIC_KEY_DEBUG_KBD K
|
||||||
|
//#define MAGIC_KEY_DEBUG_MOUSE M
|
||||||
|
//#define MAGIC_KEY_VERSION V
|
||||||
|
//#define MAGIC_KEY_STATUS S
|
||||||
|
//#define MAGIC_KEY_CONSOLE C
|
||||||
|
//#define MAGIC_KEY_LAYER0_ALT1 ESC
|
||||||
|
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
|
||||||
|
//#define MAGIC_KEY_LAYER0 0
|
||||||
|
//#define MAGIC_KEY_LAYER1 1
|
||||||
|
//#define MAGIC_KEY_LAYER2 2
|
||||||
|
//#define MAGIC_KEY_LAYER3 3
|
||||||
|
//#define MAGIC_KEY_LAYER4 4
|
||||||
|
//#define MAGIC_KEY_LAYER5 5
|
||||||
|
//#define MAGIC_KEY_LAYER6 6
|
||||||
|
//#define MAGIC_KEY_LAYER7 7
|
||||||
|
//#define MAGIC_KEY_LAYER8 8
|
||||||
|
//#define MAGIC_KEY_LAYER9 9
|
||||||
|
//#define MAGIC_KEY_BOOTLOADER PAUSE
|
||||||
|
//#define MAGIC_KEY_LOCK CAPS
|
||||||
|
//#define MAGIC_KEY_EEPROM E
|
||||||
|
//#define MAGIC_KEY_NKRO N
|
||||||
|
//#define MAGIC_KEY_SLEEP_LED Z
|
||||||
|
|
||||||
|
#endif
|
45
keyboards/mxss/info.json
Normal file
45
keyboards/mxss/info.json
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"keyboard_name": "MxSS",
|
||||||
|
"maintainer": "qmk",
|
||||||
|
"url": "https://geekhack.org/index.php?topic=94986.0",
|
||||||
|
"height": 5,
|
||||||
|
"width": 16,
|
||||||
|
"layouts": {
|
||||||
|
"LAYOUT": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0, "w":2}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1, "w":1.5}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2, "w":2.25}, {"x":15, "y":2}, {"x":0, "y":3, "w":2.25}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_7u": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0, "w":2}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1, "w":1.5}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2, "w":2.25}, {"x":15, "y":2}, {"x":0, "y":3, "w":2.25}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.5}, {"x":1.5, "y":4}, {"x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":7}, {"x":11, "y":4, "w":1.5}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_splitspace": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0, "w":2}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1, "w":1.5}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2, "w":2.25}, {"x":15, "y":2}, {"x":0, "y":3, "w":2.25}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":2.25}, {"x":6, "y":4, "w":1.25}, {"x":7.25, "y":4, "w":2.75}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_splitbs": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1, "w":1.5}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2, "w":2.25}, {"x":15, "y":2}, {"x":0, "y":3, "w":2.25}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_splitbs_7u": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1, "w":1.5}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2, "w":2.25}, {"x":15, "y":2}, {"x":0, "y":3, "w":2.25}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.5}, {"x":1.5, "y":4}, {"x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":7}, {"x":11, "y":4, "w":1.5}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_splitbs_splitspace": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1, "w":1.5}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2, "w":2.25}, {"x":15, "y":2}, {"x":0, "y":3, "w":2.25}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":2.25}, {"x":6, "y":4, "w":1.25}, {"x":7.25, "y":4, "w":2.75}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_iso": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0, "w":2}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.75, "y":1, "w":1.25, "h":2}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2}, {"x":15, "y":2}, {"x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_iso_7u": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0, "w":2}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.75, "y":1, "w":1.25, "h":2}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2}, {"x":15, "y":2}, {"x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.5}, {"x":1.5, "y":4}, {"x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":7}, {"x":11, "y":4, "w":1.5}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_iso_splitspace": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0, "w":2}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.75, "y":1, "w":1.25, "h":2}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2}, {"x":15, "y":2}, {"x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":2.25}, {"x":6, "y":4, "w":1.25}, {"x":7.25, "y":4, "w":2.75}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_iso_splitbs": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.75, "y":1, "w":1.25, "h":2}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2}, {"x":15, "y":2}, {"x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_iso_splitbs_7u": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.75, "y":1, "w":1.25, "h":2}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2}, {"x":15, "y":2}, {"x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.5}, {"x":1.5, "y":4}, {"x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":7}, {"x":11, "y":4, "w":1.5}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
},
|
||||||
|
"LAYOUT_ISO_splitbs_splitspace": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.75, "y":1, "w":1.25, "h":2}, {"x":15, "y":1}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2}, {"x":15, "y":2}, {"x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":15, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":2.25}, {"x":6, "y":4, "w":1.25}, {"x":7.25, "y":4, "w":2.75}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":13, "y":4}, {"x":14, "y":4}, {"x":15, "y":4}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
keyboards/mxss/keymaps/default/config.h
Normal file
24
keyboards/mxss/keymaps/default/config.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* Copyright 2018 Jumail Mundekkat / MxBlue
|
||||||
|
*
|
||||||
|
* 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 CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
// place overrides here
|
||||||
|
|
||||||
|
#endif
|
89
keyboards/mxss/keymaps/default/keymap.c
Normal file
89
keyboards/mxss/keymaps/default/keymap.c
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/* Copyright 2018 Jumail Mundekkat / MxBlue
|
||||||
|
*
|
||||||
|
* 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 QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
// Colors for layers
|
||||||
|
// Format: {hue, saturation}
|
||||||
|
// {0, 0} to turn off the LED
|
||||||
|
// Add additional rows to handle more layers
|
||||||
|
const hs_set layer_colors[] = {
|
||||||
|
[0] = {0, 0}, // Color for Layer 0
|
||||||
|
[1] = {86, 255}, // Color for Layer 1
|
||||||
|
[2] = {36, 255}, // Color for Layer 2
|
||||||
|
[3] = {185, 255}, // Color for Layer 3
|
||||||
|
};
|
||||||
|
const size_t lc_size = sizeof(layer_colors) / sizeof(uint16_t);
|
||||||
|
|
||||||
|
// Use NEW_SAFE_RANGE to define new custom keycodes in order to not overwrite the ones used for front LED control
|
||||||
|
enum custom_keycodes {
|
||||||
|
MY_KEYCODE = NEW_SAFE_RANGE,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
LAYOUT( /* Base */
|
||||||
|
KC_GESC, 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_BSPC,
|
||||||
|
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_BSLS, KC_DEL,
|
||||||
|
KC_CAPSLOCK, 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_PGUP,
|
||||||
|
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_UP, KC_PGDN,
|
||||||
|
KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
|
||||||
|
),
|
||||||
|
|
||||||
|
LAYOUT( /* L1 */
|
||||||
|
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_DEL,
|
||||||
|
KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PSCR, FLED_VAD, FLED_VAI, FLED_MOD, RGB_VAI,
|
||||||
|
RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, RGB_VAD,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, RGB_MOD, RGB_SAI, RGB_TOG,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_HUD, RGB_SAD, RGB_HUI
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t PROGMEM fn_actions[] = {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
|
{
|
||||||
|
// MACRODOWN only works in this function
|
||||||
|
switch(id) {
|
||||||
|
case 0:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_RSFT);
|
||||||
|
} else {
|
||||||
|
unregister_code(KC_RSFT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return MACRO_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_set_user(uint8_t usb_led) {
|
||||||
|
|
||||||
|
}
|
209
keyboards/mxss/mxss.c
Normal file
209
keyboards/mxss/mxss.c
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
/* Copyright 2018 Jumail Mundekkat / MxBlue
|
||||||
|
*
|
||||||
|
* 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 QMK_KEYBOARD_H
|
||||||
|
#include "tmk_core/common/eeprom.h"
|
||||||
|
#include "tmk_core/common/action_layer.h"
|
||||||
|
#include "rgblight.h"
|
||||||
|
|
||||||
|
// Variables for controlling front LED application
|
||||||
|
uint8_t fled_mode; // Mode for front LEDs
|
||||||
|
uint8_t fled_val; // Brightness for front leds (0 - 255)
|
||||||
|
LED_TYPE fleds[2]; // Front LED rgb values for indicator mode use
|
||||||
|
|
||||||
|
// Predefined colors for layers
|
||||||
|
// Format: {hue, saturation}
|
||||||
|
// {0, 0} to turn off the LED
|
||||||
|
// Add additional rows to handle more layers
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const hs_set layer_colors[] = {
|
||||||
|
[0] = {0, 0}, // Color for Layer 0
|
||||||
|
[1] = {86, 255}, // Color for Layer 1
|
||||||
|
[2] = {36, 255}, // Color for Layer 2
|
||||||
|
[3] = {185, 255}, // Color for Layer 3
|
||||||
|
};
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const size_t lc_size = sizeof(layer_colors) / sizeof(uint16_t);
|
||||||
|
|
||||||
|
void matrix_init_kb(void) {
|
||||||
|
// If EEPROM config exists, load it
|
||||||
|
if (eeprom_is_valid()) {
|
||||||
|
fled_config fled_conf;
|
||||||
|
fled_conf.raw = eeprom_read_byte(EEPROM_FRONTLED_ADDR);
|
||||||
|
fled_mode = fled_conf.mode;
|
||||||
|
fled_val = fled_conf.val * FLED_VAL_STEP;
|
||||||
|
// Else, default config
|
||||||
|
} else {
|
||||||
|
fled_mode = FLED_RGB;
|
||||||
|
fled_val = 10 * FLED_VAL_STEP;
|
||||||
|
eeprom_update_conf(); // Store default config to EEPROM
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set default values for leds
|
||||||
|
setrgb(0, 0, 0, &fleds[0]);
|
||||||
|
setrgb(0, 0, 0, &fleds[1]);
|
||||||
|
|
||||||
|
// Handle lighting for indicator mode
|
||||||
|
if (fled_mode == FLED_INDI) {
|
||||||
|
// Enable capslock led if enabled on host
|
||||||
|
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))
|
||||||
|
sethsv(FLED_CAPS_H, FLED_CAPS_S, fled_val, &fleds[0]);
|
||||||
|
|
||||||
|
// Determine and set colour of layer LED according to current layer
|
||||||
|
// if hue = sat = 0, leave LED off
|
||||||
|
uint8_t layer = biton32(layer_state);
|
||||||
|
if (layer < lc_size && !(layer_colors[layer].hue == 0 && layer_colors[layer].hue == 0))
|
||||||
|
sethsv(layer_colors[layer].hue, layer_colors[layer].sat, fled_val, &fleds[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_scan_kb(void) {
|
||||||
|
// put your looping keyboard code here
|
||||||
|
// runs every cycle (a lot)
|
||||||
|
|
||||||
|
matrix_scan_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
// Handle custom keycodes for front LED operation
|
||||||
|
switch (keycode) {
|
||||||
|
case FLED_MOD: // Change between front LED operation modes (off, indicator, RGB)
|
||||||
|
if (record->event.pressed)
|
||||||
|
fled_mode_cycle();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLED_VAI: // Increase the brightness of the front LEDs by FLED_VAL_STEP
|
||||||
|
if (record->event.pressed)
|
||||||
|
fled_val_increase();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLED_VAD: // Decrease the brightness of the front LEDs by FLED_VAL_STEP
|
||||||
|
if (record->event.pressed)
|
||||||
|
fled_val_decrease();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break; // Process all other keycodes normally
|
||||||
|
}
|
||||||
|
|
||||||
|
return process_record_user(keycode, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_set_kb(uint8_t usb_led) {
|
||||||
|
// Set indicator LED appropriately, whether it is used or not
|
||||||
|
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
|
||||||
|
sethsv(FLED_CAPS_H, FLED_CAPS_S, fled_val, &fleds[0]);
|
||||||
|
} else {
|
||||||
|
setrgb(0, 0, 0, &fleds[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
led_set_user(usb_led);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t layer_state_set_kb(uint32_t state) {
|
||||||
|
// Determine and set colour of layer LED according to current layer
|
||||||
|
// if hue = sat = 0, leave LED off
|
||||||
|
uint8_t layer = biton32(state);
|
||||||
|
|
||||||
|
if (layer < lc_size && !(layer_colors[layer].hue == 0 && layer_colors[layer].hue == 0))
|
||||||
|
sethsv(layer_colors[layer].hue, layer_colors[layer].sat, fled_val, &fleds[1]);
|
||||||
|
else
|
||||||
|
setrgb(0, 0, 0, &fleds[1]);
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
// EEPROM Management
|
||||||
|
|
||||||
|
// Test if magic value is present at expected location
|
||||||
|
bool eeprom_is_valid(void)
|
||||||
|
{
|
||||||
|
return (eeprom_read_word(EEPROM_MAGIC_ADDR) == EEPROM_MAGIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set magic value at expected location
|
||||||
|
void eeprom_set_valid(bool valid)
|
||||||
|
{
|
||||||
|
eeprom_update_word(EEPROM_MAGIC_ADDR, valid ? EEPROM_MAGIC : 0xFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store current front led config in EEPROM
|
||||||
|
void eeprom_update_conf(void)
|
||||||
|
{
|
||||||
|
// Create storage struct and set values
|
||||||
|
fled_config conf;
|
||||||
|
conf.mode = fled_mode;
|
||||||
|
|
||||||
|
// Small hack to ensure max value is stored correctly
|
||||||
|
if (fled_val == 255)
|
||||||
|
conf.val = 256 / FLED_VAL_STEP;
|
||||||
|
else
|
||||||
|
conf.val = fled_val / FLED_VAL_STEP;
|
||||||
|
|
||||||
|
// Set magic value and store config
|
||||||
|
eeprom_set_valid(true);
|
||||||
|
eeprom_update_byte(EEPROM_FRONTLED_ADDR, conf.raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom keycode functions
|
||||||
|
|
||||||
|
void fled_mode_cycle(void)
|
||||||
|
{
|
||||||
|
// FLED -> FLED_RGB -> FLED_INDI
|
||||||
|
switch (fled_mode) {
|
||||||
|
case FLED_OFF:
|
||||||
|
fled_mode = FLED_RGB;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLED_RGB:
|
||||||
|
fled_mode = FLED_INDI;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLED_INDI:
|
||||||
|
fled_mode = FLED_OFF;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update stored config
|
||||||
|
eeprom_update_conf();
|
||||||
|
}
|
||||||
|
|
||||||
|
void fled_val_increase(void)
|
||||||
|
{
|
||||||
|
// Increase val by FLED_VAL_STEP, handling the upper edge case
|
||||||
|
if (fled_val + FLED_VAL_STEP > 255)
|
||||||
|
fled_val = 255;
|
||||||
|
else
|
||||||
|
fled_val += FLED_VAL_STEP;
|
||||||
|
|
||||||
|
// Update stored config
|
||||||
|
eeprom_update_conf();
|
||||||
|
}
|
||||||
|
|
||||||
|
void fled_val_decrease(void)
|
||||||
|
{
|
||||||
|
// Decrease val by FLED_VAL_STEP, handling the lower edge case
|
||||||
|
if (fled_val - FLED_VAL_STEP > 255)
|
||||||
|
fled_val = 255;
|
||||||
|
else
|
||||||
|
fled_val -= FLED_VAL_STEP;
|
||||||
|
|
||||||
|
// Update stored config
|
||||||
|
eeprom_update_conf();
|
||||||
|
}
|
207
keyboards/mxss/mxss.h
Normal file
207
keyboards/mxss/mxss.h
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
/* Copyright 2018 Jumail Mundekkat / MxBlue
|
||||||
|
*
|
||||||
|
* 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 MXSS_H
|
||||||
|
#define MXSS_H
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
#include "mxss_frontled.h"
|
||||||
|
|
||||||
|
// This a shortcut to help you visually see your layout.
|
||||||
|
// The following is an example using the Planck MIT layout
|
||||||
|
// The first section contains all of the arguments
|
||||||
|
// The second converts the arguments into a two-dimensional array
|
||||||
|
|
||||||
|
#define LAYOUT( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k10E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, k2E, \
|
||||||
|
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k46, k4A, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, KC_NO, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k10E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KC_NO, k2D, k2E }, \
|
||||||
|
{ k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, k4A, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ANSI, normalBS, 7u
|
||||||
|
#define LAYOUT_7u( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, k2E, \
|
||||||
|
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k46, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, KC_NO, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KC_NO, k2D, k2E }, \
|
||||||
|
{ k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, KC_NO, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ANSI, normalBS, split space
|
||||||
|
#define LAYOUT_splitspace( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, k2E, \
|
||||||
|
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k43, k46, k48, k4A, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, KC_NO, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KC_NO, k2D, k2E }, \
|
||||||
|
{ k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, k43, KC_NO, KC_NO, k46, KC_NO, k48, KC_NO, k4A, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ANSI, splitBS, 6.25u
|
||||||
|
#define LAYOUT_splitbs( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, k2E, \
|
||||||
|
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k46, k4A, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KC_NO, k2D, k2E }, \
|
||||||
|
{ k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, k4A, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ANSI, splitBS, 7u
|
||||||
|
#define LAYOUT_splitbs_7u( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, k2E, \
|
||||||
|
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k46, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KC_NO, k2D, k2E }, \
|
||||||
|
{ k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, KC_NO, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ANSI, normalBS, split space
|
||||||
|
#define LAYOUT_splitbs_splitspace( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, k2E, \
|
||||||
|
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k43, k46, k48, k4A, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KC_NO, k2D, k2E }, \
|
||||||
|
{ k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, k43, KC_NO, KC_NO, k46, KC_NO, k48, KC_NO, k4A, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ISO, normalBS, 6.25u
|
||||||
|
#define LAYOUT_iso( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E, \
|
||||||
|
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k46, k4A, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, KC_NO, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E }, \
|
||||||
|
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, k4A, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ISO, normalBS, 7u
|
||||||
|
#define LAYOUT_iso_7u( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E, \
|
||||||
|
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k46, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, KC_NO, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E }, \
|
||||||
|
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, KC_NO, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ISO, normalBS, split space
|
||||||
|
#define LAYOUT_iso_splitspace( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E, \
|
||||||
|
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k43, k46, k48, k4A, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, KC_NO, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E }, \
|
||||||
|
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, k43, KC_NO, KC_NO, k46, KC_NO, k48, KC_NO, k4A, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ISO, splitBS, 6.25u
|
||||||
|
#define LAYOUT_iso_splitbs( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E, \
|
||||||
|
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k46, k4A, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E }, \
|
||||||
|
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, k4A, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ISO, splitBS, 7u
|
||||||
|
#define LAYOUT_iso_splitbs_7u( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E, \
|
||||||
|
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k46, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E }, \
|
||||||
|
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, KC_NO, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, KC_NO, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
//ISO, splitBS, split space
|
||||||
|
#define LAYOUT_iso_splitbs_splitspace( \
|
||||||
|
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, \
|
||||||
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \
|
||||||
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E, \
|
||||||
|
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \
|
||||||
|
k40, k41, k42, k43, k46, k48, k4A, k4B, k4C, k4D, k4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E }, \
|
||||||
|
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \
|
||||||
|
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E }, \
|
||||||
|
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \
|
||||||
|
{ k40, k41, k42, k43, KC_NO, KC_NO, k46, KC_NO, k48, KC_NO, k4A, k4B, k4C, k4D, k4E }, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
81
keyboards/mxss/mxss_frontled.h
Normal file
81
keyboards/mxss/mxss_frontled.h
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/* Copyright 2018 Jumail Mundekkat / MxBlue
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// EEPROM management code taken from Wilba6582
|
||||||
|
// https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/zeal_eeprom.h
|
||||||
|
|
||||||
|
#ifndef MXSS_FRONTLED_H
|
||||||
|
#define MXSS_FRONTLED_H
|
||||||
|
|
||||||
|
#include "quantum_keycodes.h"
|
||||||
|
|
||||||
|
// RGBLED index for front LEDs
|
||||||
|
#define RGBLIGHT_FLED1 14
|
||||||
|
#define RGBLIGHT_FLED2 15
|
||||||
|
|
||||||
|
// Brightness increase step for front LEDs
|
||||||
|
#define FLED_VAL_STEP 8
|
||||||
|
|
||||||
|
// QMK never uses more then 32bytes of EEPROM, so our region starts there
|
||||||
|
// Magic value to verify the state of the EEPROM
|
||||||
|
#define EEPROM_MAGIC 0xC3E7
|
||||||
|
#define EEPROM_MAGIC_ADDR ((void*)32)
|
||||||
|
|
||||||
|
// Front LED settings
|
||||||
|
#define EEPROM_FRONTLED_ADDR ((void*)34)
|
||||||
|
|
||||||
|
// Modes for front LEDs
|
||||||
|
#define FLED_OFF 0b00
|
||||||
|
#define FLED_INDI 0b01
|
||||||
|
#define FLED_RGB 0b10
|
||||||
|
#define FLED_UNDEF 0b11
|
||||||
|
|
||||||
|
// Hard-coded color for capslock indicator in FLED_INDI mode, H:0% S:100% = Red
|
||||||
|
#define FLED_CAPS_H 0
|
||||||
|
#define FLED_CAPS_S 255
|
||||||
|
|
||||||
|
// Config storage format for EEPROM
|
||||||
|
typedef union {
|
||||||
|
uint8_t raw;
|
||||||
|
struct {
|
||||||
|
uint8_t mode :2;
|
||||||
|
uint8_t val :6;
|
||||||
|
};
|
||||||
|
} fled_config;
|
||||||
|
|
||||||
|
// Structure to store hue and saturation values
|
||||||
|
typedef struct _hs_set {
|
||||||
|
uint16_t hue;
|
||||||
|
uint8_t sat;
|
||||||
|
} hs_set;
|
||||||
|
|
||||||
|
// Custom keycodes for front LED control
|
||||||
|
enum fled_keycodes {
|
||||||
|
FLED_MOD = SAFE_RANGE,
|
||||||
|
FLED_VAI,
|
||||||
|
FLED_VAD,
|
||||||
|
NEW_SAFE_RANGE // define a new safe range
|
||||||
|
};
|
||||||
|
|
||||||
|
bool eeprom_is_valid(void); // Check if EEPROM has been set up
|
||||||
|
void eeprom_set_valid(bool valid); // Change validity state of EEPROM
|
||||||
|
void eeprom_update_conf(void); // Store current front LED config to EEPROM
|
||||||
|
|
||||||
|
void fled_mode_cycle(void); // Cycle between the 3 modes for the front LEDs
|
||||||
|
void fled_val_increase(void); // Increase the brightness of the front LEDs
|
||||||
|
void fled_val_decrease(void); // Decrease the brightness of the front LEDs
|
||||||
|
|
||||||
|
#endif //MXSS_FRONTLED_H
|
54
keyboards/mxss/readme.md
Normal file
54
keyboards/mxss/readme.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# MxSS - Polycarb 65% Kit for MX/SMK
|
||||||
|
|
||||||
|
![MxSS - Polycarb 65% Kit for MX/SMK](https://i.imgur.com/WDTWcmU.jpg)
|
||||||
|
|
||||||
|
### Information:
|
||||||
|
|
||||||
|
- Case: Frosted Polycarbonate, CNC milled
|
||||||
|
- Plate: Brass, mirror-finished and electroplated
|
||||||
|
- Weight: Same as plate
|
||||||
|
- PCB: Custom designed for the MxSS by kawasaki161, White solder mask and ENIG finish
|
||||||
|
|
||||||
|
### Details:
|
||||||
|
|
||||||
|
- 2.9 degrees angle on the case
|
||||||
|
- Top mount plate
|
||||||
|
- Center USB, Type-B Mini
|
||||||
|
- MX and SMK (White and Orange) switch support
|
||||||
|
- Holtite support
|
||||||
|
- RGB underglow
|
||||||
|
- 1.5kg with plate and weight
|
||||||
|
|
||||||
|
Keyboard Maintainer: [MxBlue](https://github.com/mxblu)
|
||||||
|
|
||||||
|
Hardware Supported: Custom PCB, ATMega32u4
|
||||||
|
|
||||||
|
Hardware Availability: https://geekhack.org/index.php?topic=94986.0
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
make mxss:default
|
||||||
|
|
||||||
|
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||||
|
|
||||||
|
# Front LED Operation
|
||||||
|
|
||||||
|
The MxSS PCB has 2 front RGB LEDs which has a separate brightness and mode of operation to the rest of the RGB LEDs. These are controlled through the supplied custom keycodes.
|
||||||
|
|
||||||
|
There are 3 modes of operation:
|
||||||
|
|
||||||
|
- FLED_OFF - Front LEDs stay off
|
||||||
|
- FLED_RGB - Front LEDs are part of the standard RGB LED modes, only works correctly with rainbow modes (will fix on request)
|
||||||
|
- FLED_INDI - Top front LED represents Caps Lock status, bottom LED represents current layer
|
||||||
|
|
||||||
|
Colors for FLED_INDI mode are hardcoded as hue/saturation values, the caps lock color can be found in mxss_frontled.h, the layer colors are defined in keymap.c (see default/keymap.c for example).
|
||||||
|
|
||||||
|
## Custom Keycodes
|
||||||
|
|
||||||
|
- FLED_MOD - Cycle between the 3 modes (FLED_OFF -> FLED_RGB -> FLED_INDI)
|
||||||
|
- FLED_VAI - Increase front LED brightness
|
||||||
|
- FLED_VAD - Decrease front LED brightness
|
||||||
|
|
||||||
|
# Further Notes
|
||||||
|
|
||||||
|
As SAFE_RANGE is used for defining the custom keycodes seen above, please use NEW_SAFE_RANGE as the starting value for any custom keycodes in keymap.c, as per the example.
|
804
keyboards/mxss/rgblight.c
Normal file
804
keyboards/mxss/rgblight.c
Normal file
@ -0,0 +1,804 @@
|
|||||||
|
/* Copyright 2016-2017 Yang Liu
|
||||||
|
*
|
||||||
|
* 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 <math.h>
|
||||||
|
#include <avr/eeprom.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include "progmem.h"
|
||||||
|
#include "timer.h"
|
||||||
|
#include "rgblight.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "led_tables.h"
|
||||||
|
#include "mxss_frontled.h"
|
||||||
|
|
||||||
|
#ifndef RGBLIGHT_LIMIT_VAL
|
||||||
|
#define RGBLIGHT_LIMIT_VAL 255
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||||
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||||
|
|
||||||
|
#define LED_PTRTOIND(ptr) ((uint32_t) (ptr - led)/sizeof(LED_TYPE))
|
||||||
|
|
||||||
|
void copyrgb(LED_TYPE *src, LED_TYPE *dst);
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30};
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20};
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31};
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024};
|
||||||
|
|
||||||
|
rgblight_config_t rgblight_config;
|
||||||
|
|
||||||
|
LED_TYPE led[RGBLED_NUM];
|
||||||
|
|
||||||
|
bool rgblight_timer_enabled = false;
|
||||||
|
|
||||||
|
extern uint8_t fled_mode;
|
||||||
|
extern uint8_t fled_val;
|
||||||
|
extern LED_TYPE fleds[2];
|
||||||
|
hs_set fled_hs[2];
|
||||||
|
|
||||||
|
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
|
||||||
|
uint8_t r = 0, g = 0, b = 0, base, color;
|
||||||
|
|
||||||
|
// if led is front leds, cache the hue and sat values
|
||||||
|
if (led1 == &led[RGBLIGHT_FLED1]) {
|
||||||
|
fled_hs[0].hue = hue;
|
||||||
|
fled_hs[0].sat = sat;
|
||||||
|
} else if (led1 == &led[RGBLIGHT_FLED2]) {
|
||||||
|
fled_hs[1].hue = hue;
|
||||||
|
fled_hs[1].sat = sat;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val > RGBLIGHT_LIMIT_VAL) {
|
||||||
|
val=RGBLIGHT_LIMIT_VAL; // limit the val
|
||||||
|
}
|
||||||
|
|
||||||
|
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 = base + color;
|
||||||
|
b = base;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
r = val - color;
|
||||||
|
g = val;
|
||||||
|
b = base;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
r = base;
|
||||||
|
g = val;
|
||||||
|
b = base + color;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
r = base;
|
||||||
|
g = val - color;
|
||||||
|
b = val;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
r = base + color;
|
||||||
|
g = base;
|
||||||
|
b = val;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
r = val;
|
||||||
|
g = base;
|
||||||
|
b = val - color;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r = pgm_read_byte(&CIE1931_CURVE[r]);
|
||||||
|
g = pgm_read_byte(&CIE1931_CURVE[g]);
|
||||||
|
b = pgm_read_byte(&CIE1931_CURVE[b]);
|
||||||
|
|
||||||
|
setrgb(r, g, b, led1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1) {
|
||||||
|
(*led1).r = r;
|
||||||
|
(*led1).g = g;
|
||||||
|
(*led1).b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void copyrgb(LED_TYPE *src, LED_TYPE *dst) {
|
||||||
|
(*dst).r = (*src).r;
|
||||||
|
(*dst).g = (*src).g;
|
||||||
|
(*dst).b = (*src).b;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t eeconfig_read_rgblight(void) {
|
||||||
|
return eeprom_read_dword(EECONFIG_RGBLIGHT);
|
||||||
|
}
|
||||||
|
void eeconfig_update_rgblight(uint32_t val) {
|
||||||
|
eeprom_update_dword(EECONFIG_RGBLIGHT, val);
|
||||||
|
}
|
||||||
|
void eeconfig_update_rgblight_default(void) {
|
||||||
|
dprintf("eeconfig_update_rgblight_default\n");
|
||||||
|
rgblight_config.enable = 1;
|
||||||
|
rgblight_config.mode = 1;
|
||||||
|
rgblight_config.hue = 0;
|
||||||
|
rgblight_config.sat = 255;
|
||||||
|
rgblight_config.val = RGBLIGHT_LIMIT_VAL;
|
||||||
|
rgblight_config.speed = 0;
|
||||||
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
|
}
|
||||||
|
void eeconfig_debug_rgblight(void) {
|
||||||
|
dprintf("rgblight_config eprom\n");
|
||||||
|
dprintf("rgblight_config.enable = %d\n", rgblight_config.enable);
|
||||||
|
dprintf("rghlight_config.mode = %d\n", rgblight_config.mode);
|
||||||
|
dprintf("rgblight_config.hue = %d\n", rgblight_config.hue);
|
||||||
|
dprintf("rgblight_config.sat = %d\n", rgblight_config.sat);
|
||||||
|
dprintf("rgblight_config.val = %d\n", rgblight_config.val);
|
||||||
|
dprintf("rgblight_config.speed = %d\n", rgblight_config.speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_init(void) {
|
||||||
|
debug_enable = 1; // Debug ON!
|
||||||
|
dprintf("rgblight_init called.\n");
|
||||||
|
dprintf("rgblight_init start!\n");
|
||||||
|
if (!eeconfig_is_enabled()) {
|
||||||
|
dprintf("rgblight_init eeconfig is not enabled.\n");
|
||||||
|
eeconfig_init();
|
||||||
|
eeconfig_update_rgblight_default();
|
||||||
|
}
|
||||||
|
rgblight_config.raw = eeconfig_read_rgblight();
|
||||||
|
if (!rgblight_config.mode) {
|
||||||
|
dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n");
|
||||||
|
eeconfig_update_rgblight_default();
|
||||||
|
rgblight_config.raw = eeconfig_read_rgblight();
|
||||||
|
}
|
||||||
|
eeconfig_debug_rgblight(); // display current eeprom values
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
|
rgblight_timer_init(); // setup the timer
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (rgblight_config.enable) {
|
||||||
|
rgblight_mode_noeeprom(rgblight_config.mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_update_dword(uint32_t dword) {
|
||||||
|
rgblight_config.raw = dword;
|
||||||
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
|
if (rgblight_config.enable)
|
||||||
|
rgblight_mode(rgblight_config.mode);
|
||||||
|
else {
|
||||||
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
|
rgblight_timer_disable();
|
||||||
|
#endif
|
||||||
|
rgblight_set();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_increase(void) {
|
||||||
|
uint8_t mode = 0;
|
||||||
|
if (rgblight_config.mode < RGBLIGHT_MODES) {
|
||||||
|
mode = rgblight_config.mode + 1;
|
||||||
|
}
|
||||||
|
rgblight_mode(mode);
|
||||||
|
}
|
||||||
|
void rgblight_decrease(void) {
|
||||||
|
uint8_t mode = 0;
|
||||||
|
// 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;
|
||||||
|
if (mode > RGBLIGHT_MODES) {
|
||||||
|
mode = 1;
|
||||||
|
}
|
||||||
|
rgblight_mode(mode);
|
||||||
|
}
|
||||||
|
void rgblight_step_reverse(void) {
|
||||||
|
uint8_t mode = 0;
|
||||||
|
mode = rgblight_config.mode - 1;
|
||||||
|
if (mode < 1) {
|
||||||
|
mode = RGBLIGHT_MODES;
|
||||||
|
}
|
||||||
|
rgblight_mode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t rgblight_get_mode(void) {
|
||||||
|
if (!rgblight_config.enable) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rgblight_config.mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
|
||||||
|
if (!rgblight_config.enable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mode < 1) {
|
||||||
|
rgblight_config.mode = 1;
|
||||||
|
} else if (mode > RGBLIGHT_MODES) {
|
||||||
|
rgblight_config.mode = RGBLIGHT_MODES;
|
||||||
|
} else {
|
||||||
|
rgblight_config.mode = mode;
|
||||||
|
}
|
||||||
|
if (write_to_eeprom) {
|
||||||
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
|
xprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode);
|
||||||
|
} else {
|
||||||
|
xprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode);
|
||||||
|
}
|
||||||
|
if (rgblight_config.mode == 1) {
|
||||||
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
|
rgblight_timer_disable();
|
||||||
|
#endif
|
||||||
|
} else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) ||
|
||||||
|
rgblight_config.mode == 35 ) {
|
||||||
|
// MODE 2-5, breathing
|
||||||
|
// MODE 6-8, rainbow mood
|
||||||
|
// MODE 9-14, rainbow swirl
|
||||||
|
// MODE 15-20, snake
|
||||||
|
// MODE 21-23, knight
|
||||||
|
// MODE 24, xmas
|
||||||
|
// MODE 35 RGB test
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
|
rgblight_timer_enable();
|
||||||
|
#endif
|
||||||
|
} else if (rgblight_config.mode >= 25 && rgblight_config.mode <= 34) {
|
||||||
|
// MODE 25-34, static gradient
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
|
rgblight_timer_disable();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_mode(uint8_t mode) {
|
||||||
|
rgblight_mode_eeprom_helper(mode, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_mode_noeeprom(uint8_t mode) {
|
||||||
|
rgblight_mode_eeprom_helper(mode, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rgblight_toggle(void) {
|
||||||
|
xprintf("rgblight toggle [EEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable);
|
||||||
|
if (rgblight_config.enable) {
|
||||||
|
rgblight_disable();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rgblight_enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_toggle_noeeprom(void) {
|
||||||
|
xprintf("rgblight toggle [NOEEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable);
|
||||||
|
if (rgblight_config.enable) {
|
||||||
|
rgblight_disable_noeeprom();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rgblight_enable_noeeprom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_enable(void) {
|
||||||
|
rgblight_config.enable = 1;
|
||||||
|
// No need to update EEPROM here. rgblight_mode() will do that, actually
|
||||||
|
//eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
|
xprintf("rgblight enable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
|
||||||
|
rgblight_mode(rgblight_config.mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_enable_noeeprom(void) {
|
||||||
|
rgblight_config.enable = 1;
|
||||||
|
xprintf("rgblight enable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
|
||||||
|
rgblight_mode_noeeprom(rgblight_config.mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_disable(void) {
|
||||||
|
rgblight_config.enable = 0;
|
||||||
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
|
xprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
|
||||||
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
|
//rgblight_timer_disable();
|
||||||
|
#endif
|
||||||
|
_delay_ms(50);
|
||||||
|
rgblight_set();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_disable_noeeprom(void) {
|
||||||
|
rgblight_config.enable = 0;
|
||||||
|
xprintf("rgblight disable [noEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
|
||||||
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
|
rgblight_timer_disable();
|
||||||
|
#endif
|
||||||
|
_delay_ms(50);
|
||||||
|
rgblight_set();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Deals with the messy details of incrementing an integer
|
||||||
|
uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
|
||||||
|
int16_t new_value = value;
|
||||||
|
new_value += step;
|
||||||
|
return MIN( MAX( new_value, min ), max );
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
|
||||||
|
int16_t new_value = value;
|
||||||
|
new_value -= step;
|
||||||
|
return MIN( MAX( new_value, min ), max );
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
uint16_t hue;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val);
|
||||||
|
}
|
||||||
|
void rgblight_increase_sat(void) {
|
||||||
|
uint8_t sat;
|
||||||
|
if (rgblight_config.sat + RGBLIGHT_SAT_STEP > 255) {
|
||||||
|
sat = 255;
|
||||||
|
} else {
|
||||||
|
sat = rgblight_config.sat + RGBLIGHT_SAT_STEP;
|
||||||
|
}
|
||||||
|
rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
|
||||||
|
}
|
||||||
|
void rgblight_increase_val(void) {
|
||||||
|
uint8_t val;
|
||||||
|
if (rgblight_config.val + RGBLIGHT_VAL_STEP > RGBLIGHT_LIMIT_VAL) {
|
||||||
|
val = RGBLIGHT_LIMIT_VAL;
|
||||||
|
} else {
|
||||||
|
val = rgblight_config.val + RGBLIGHT_VAL_STEP;
|
||||||
|
}
|
||||||
|
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
|
||||||
|
}
|
||||||
|
void rgblight_decrease_val(void) {
|
||||||
|
uint8_t val;
|
||||||
|
if (rgblight_config.val - RGBLIGHT_VAL_STEP < 0) {
|
||||||
|
val = 0;
|
||||||
|
} else {
|
||||||
|
val = rgblight_config.val - RGBLIGHT_VAL_STEP;
|
||||||
|
}
|
||||||
|
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
|
||||||
|
}
|
||||||
|
void rgblight_increase_speed(void) {
|
||||||
|
rgblight_config.speed = increment( rgblight_config.speed, 1, 0, 3 );
|
||||||
|
eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_decrease_speed(void) {
|
||||||
|
rgblight_config.speed = decrement( rgblight_config.speed, 1, 0, 3 );
|
||||||
|
eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_noeeprom_old(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
|
if (rgblight_config.enable) {
|
||||||
|
LED_TYPE tmp_led;
|
||||||
|
sethsv(hue, sat, val, &tmp_led);
|
||||||
|
// dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val);
|
||||||
|
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) {
|
||||||
|
if (rgblight_config.enable) {
|
||||||
|
if (rgblight_config.mode == 1) {
|
||||||
|
// same static color
|
||||||
|
LED_TYPE tmp_led;
|
||||||
|
sethsv(hue, sat, val, &tmp_led);
|
||||||
|
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
|
||||||
|
} else {
|
||||||
|
// all LEDs in same color
|
||||||
|
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
|
||||||
|
// breathing mode, ignore the change of val, use in memory value instead
|
||||||
|
val = rgblight_config.val;
|
||||||
|
} else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 14) {
|
||||||
|
// rainbow mood and rainbow swirl, ignore the change of hue
|
||||||
|
hue = rgblight_config.hue;
|
||||||
|
} else if (rgblight_config.mode >= 25 && rgblight_config.mode <= 34) {
|
||||||
|
// static gradient
|
||||||
|
uint16_t _hue;
|
||||||
|
int8_t direction = ((rgblight_config.mode - 25) % 2) ? -1 : 1;
|
||||||
|
uint16_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[(rgblight_config.mode - 25) / 2]);
|
||||||
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
||||||
|
_hue = (range / RGBLED_NUM * i * direction + hue + 360) % 360;
|
||||||
|
dprintf("rgblight rainbow set hsv: %u,%u,%d,%u\n", i, _hue, direction, range);
|
||||||
|
sethsv(_hue, sat, val, (LED_TYPE *)&led[i]);
|
||||||
|
}
|
||||||
|
rgblight_set();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rgblight_config.hue = hue;
|
||||||
|
rgblight_config.sat = sat;
|
||||||
|
rgblight_config.val = val;
|
||||||
|
if (write_to_eeprom) {
|
||||||
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
|
xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
||||||
|
} else {
|
||||||
|
xprintf("rgblight set hsv [NOEEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
|
rgblight_sethsv_eeprom_helper(hue, sat, val, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
|
rgblight_sethsv_eeprom_helper(hue, sat, val, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t rgblight_get_hue(void) {
|
||||||
|
return rgblight_config.hue;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t rgblight_get_sat(void) {
|
||||||
|
return rgblight_config.sat;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t rgblight_get_val(void) {
|
||||||
|
return rgblight_config.val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
|
if (!rgblight_config.enable) { return; }
|
||||||
|
|
||||||
|
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_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) {
|
||||||
|
if (!rgblight_config.enable || index >= RGBLED_NUM) { return; }
|
||||||
|
|
||||||
|
led[index].r = r;
|
||||||
|
led[index].g = g;
|
||||||
|
led[index].b = b;
|
||||||
|
rgblight_set();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index) {
|
||||||
|
if (!rgblight_config.enable) { return; }
|
||||||
|
|
||||||
|
LED_TYPE tmp_led;
|
||||||
|
sethsv(hue, sat, val, &tmp_led);
|
||||||
|
rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_set(void) {
|
||||||
|
if (!rgblight_config.enable) {
|
||||||
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
||||||
|
if (i == RGBLIGHT_FLED1 && i == RGBLIGHT_FLED2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
led[i].r = 0;
|
||||||
|
led[i].g = 0;
|
||||||
|
led[i].b = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (fled_mode) {
|
||||||
|
case FLED_OFF:
|
||||||
|
setrgb(0, 0, 0, &led[RGBLIGHT_FLED1]);
|
||||||
|
setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLED_INDI:
|
||||||
|
copyrgb(&fleds[0], &led[RGBLIGHT_FLED1]);
|
||||||
|
copyrgb(&fleds[1], &led[RGBLIGHT_FLED2]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLED_RGB:
|
||||||
|
sethsv(fled_hs[0].hue, fled_hs[0].sat, fled_val, &led[RGBLIGHT_FLED1]);
|
||||||
|
sethsv(fled_hs[1].hue, fled_hs[1].sat, fled_val, &led[RGBLIGHT_FLED2]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ws2812_setleds(led, RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
|
|
||||||
|
// Animation timer -- AVR Timer3
|
||||||
|
void rgblight_timer_init(void) {
|
||||||
|
// static uint8_t rgblight_timer_is_init = 0;
|
||||||
|
// if (rgblight_timer_is_init) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// rgblight_timer_is_init = 1;
|
||||||
|
// /* Timer 3 setup */
|
||||||
|
// TCCR3B = _BV(WGM32) // CTC mode OCR3A as TOP
|
||||||
|
// | _BV(CS30); // Clock selelct: clk/1
|
||||||
|
// /* Set TOP value */
|
||||||
|
// uint8_t sreg = SREG;
|
||||||
|
// cli();
|
||||||
|
// OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff;
|
||||||
|
// OCR3AL = RGBLED_TIMER_TOP & 0xff;
|
||||||
|
// SREG = sreg;
|
||||||
|
|
||||||
|
rgblight_timer_enabled = true;
|
||||||
|
}
|
||||||
|
void rgblight_timer_enable(void) {
|
||||||
|
rgblight_timer_enabled = true;
|
||||||
|
dprintf("TIMER3 enabled.\n");
|
||||||
|
}
|
||||||
|
void rgblight_timer_disable(void) {
|
||||||
|
rgblight_timer_enabled = false;
|
||||||
|
dprintf("TIMER3 disabled.\n");
|
||||||
|
}
|
||||||
|
void rgblight_timer_toggle(void) {
|
||||||
|
rgblight_timer_enabled ^= rgblight_timer_enabled;
|
||||||
|
dprintf("TIMER3 toggled.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
|
rgblight_enable();
|
||||||
|
rgblight_mode(1);
|
||||||
|
rgblight_setrgb(r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_task(void) {
|
||||||
|
if (rgblight_timer_enabled) {
|
||||||
|
// 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) {
|
||||||
|
// 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);
|
||||||
|
} else if (rgblight_config.mode == 24) {
|
||||||
|
// mode = 24, christmas mode
|
||||||
|
rgblight_effect_christmas();
|
||||||
|
} else if (rgblight_config.mode == 35) {
|
||||||
|
// mode = 35, RGB test
|
||||||
|
rgblight_effect_rgbtest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Effects
|
||||||
|
void rgblight_effect_breathing(uint8_t interval) {
|
||||||
|
static uint8_t pos = 0;
|
||||||
|
static uint16_t last_timer = 0;
|
||||||
|
float val;
|
||||||
|
|
||||||
|
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_BREATHING_INTERVALS[interval])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
last_timer = timer_read();
|
||||||
|
|
||||||
|
|
||||||
|
// http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/
|
||||||
|
val = (exp(sin((pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E));
|
||||||
|
rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val);
|
||||||
|
pos = (pos + 1) % 256;
|
||||||
|
}
|
||||||
|
void rgblight_effect_rainbow_mood(uint8_t interval) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
last_timer = timer_read();
|
||||||
|
rgblight_sethsv_noeeprom_old(current_hue, rgblight_config.sat, rgblight_config.val);
|
||||||
|
current_hue = (current_hue + 1) % 360;
|
||||||
|
}
|
||||||
|
void rgblight_effect_rainbow_swirl(uint8_t interval) {
|
||||||
|
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_SWIRL_INTERVALS[interval / 2])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
last_timer = timer_read();
|
||||||
|
for (i = 0; i < RGBLED_NUM; i++) {
|
||||||
|
hue = (360 / RGBLED_NUM * i + current_hue) % 360;
|
||||||
|
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
|
||||||
|
}
|
||||||
|
rgblight_set();
|
||||||
|
|
||||||
|
if (interval % 2) {
|
||||||
|
current_hue = (current_hue + 1) % 360;
|
||||||
|
} else {
|
||||||
|
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 uint16_t last_timer = 0;
|
||||||
|
uint8_t i, j;
|
||||||
|
int8_t k;
|
||||||
|
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 * 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_TYPE *)&led[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rgblight_set();
|
||||||
|
if (increment == 1) {
|
||||||
|
if (pos - 1 < 0) {
|
||||||
|
pos = RGBLED_NUM - 1;
|
||||||
|
} else {
|
||||||
|
pos -= 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pos = (pos + 1) % RGBLED_NUM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void rgblight_effect_knight(uint8_t interval) {
|
||||||
|
static uint16_t last_timer = 0;
|
||||||
|
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
last_timer = timer_read();
|
||||||
|
|
||||||
|
static int8_t low_bound = 0;
|
||||||
|
static int8_t high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1;
|
||||||
|
static int8_t increment = 1;
|
||||||
|
uint8_t i, cur;
|
||||||
|
|
||||||
|
// Set all the LEDs to 0
|
||||||
|
for (i = 0; i < RGBLED_NUM; i++) {
|
||||||
|
led[i].r = 0;
|
||||||
|
led[i].g = 0;
|
||||||
|
led[i].b = 0;
|
||||||
|
}
|
||||||
|
// Determine which LEDs should be lit up
|
||||||
|
for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {
|
||||||
|
cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM;
|
||||||
|
|
||||||
|
if (i >= low_bound && i <= high_bound) {
|
||||||
|
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[cur]);
|
||||||
|
} else {
|
||||||
|
led[cur].r = 0;
|
||||||
|
led[cur].g = 0;
|
||||||
|
led[cur].b = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rgblight_set();
|
||||||
|
|
||||||
|
// Move from low_bound to high_bound changing the direction we increment each
|
||||||
|
// time a boundary is hit.
|
||||||
|
low_bound += increment;
|
||||||
|
high_bound += increment;
|
||||||
|
|
||||||
|
if (high_bound <= 0 || low_bound >= RGBLIGHT_EFFECT_KNIGHT_LED_NUM - 1) {
|
||||||
|
increment = -increment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rgblight_effect_christmas(void) {
|
||||||
|
static uint16_t current_offset = 0;
|
||||||
|
static uint16_t last_timer = 0;
|
||||||
|
uint16_t hue;
|
||||||
|
uint8_t i;
|
||||||
|
if (timer_elapsed(last_timer) < RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
last_timer = timer_read();
|
||||||
|
current_offset = (current_offset + 1) % 2;
|
||||||
|
for (i = 0; i < RGBLED_NUM; i++) {
|
||||||
|
hue = 0 + ((i/RGBLIGHT_EFFECT_CHRISTMAS_STEP + current_offset) % 2) * 120;
|
||||||
|
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
|
||||||
|
}
|
||||||
|
rgblight_set();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_effect_rgbtest(void) {
|
||||||
|
static uint8_t pos = 0;
|
||||||
|
static uint16_t last_timer = 0;
|
||||||
|
static uint8_t maxval = 0;
|
||||||
|
uint8_t g; uint8_t r; uint8_t b;
|
||||||
|
|
||||||
|
if (timer_elapsed(last_timer) < pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( maxval == 0 ) {
|
||||||
|
LED_TYPE tmp_led;
|
||||||
|
sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led);
|
||||||
|
maxval = tmp_led.r;
|
||||||
|
}
|
||||||
|
last_timer = timer_read();
|
||||||
|
g = r = b = 0;
|
||||||
|
switch( pos ) {
|
||||||
|
case 0: r = maxval; break;
|
||||||
|
case 1: g = maxval; break;
|
||||||
|
case 2: b = maxval; break;
|
||||||
|
}
|
||||||
|
rgblight_setrgb(r, g, b);
|
||||||
|
pos = (pos + 1) % 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* RGBLIGHT_ANIMATIONS */
|
75
keyboards/mxss/rules.mk
Normal file
75
keyboards/mxss/rules.mk
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
# MCU name
|
||||||
|
#MCU = at90usb1286
|
||||||
|
MCU = atmega32u4
|
||||||
|
|
||||||
|
# Processor frequency.
|
||||||
|
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||||
|
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||||
|
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||||
|
# automatically to create a 32-bit value in your source code.
|
||||||
|
#
|
||||||
|
# This will be an integer division of F_USB below, as it is sourced by
|
||||||
|
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||||
|
# does not *change* the processor frequency - it should merely be updated to
|
||||||
|
# reflect the processor speed set externally so that the code can use accurate
|
||||||
|
# software delays.
|
||||||
|
F_CPU = 16000000
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# LUFA specific
|
||||||
|
#
|
||||||
|
# Target architecture (see library "Board Types" documentation).
|
||||||
|
ARCH = AVR8
|
||||||
|
|
||||||
|
# Input clock frequency.
|
||||||
|
# This will define a symbol, F_USB, in all source code files equal to the
|
||||||
|
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||||
|
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||||
|
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||||
|
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||||
|
# at the end, this will be done automatically to create a 32-bit value in your
|
||||||
|
# source code.
|
||||||
|
#
|
||||||
|
# If no clock division is performed on the input clock inside the AVR (via the
|
||||||
|
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||||
|
F_USB = $(F_CPU)
|
||||||
|
|
||||||
|
# Interrupt driven control endpoint task(+60)
|
||||||
|
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||||
|
|
||||||
|
|
||||||
|
# Boot Section Size in *bytes*
|
||||||
|
# Teensy halfKay 512
|
||||||
|
# Teensy++ halfKay 1024
|
||||||
|
# Atmel DFU loader 4096
|
||||||
|
# LUFA bootloader 4096
|
||||||
|
# USBaspLoader 2048
|
||||||
|
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||||
|
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change yes to no to disable
|
||||||
|
#
|
||||||
|
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
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
NKRO_ENABLE = no # USB Nkey Rollover
|
||||||
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
||||||
|
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
||||||
|
UNICODE_ENABLE = no # Unicode
|
||||||
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
|
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||||
|
|
||||||
|
# Remove the common RGB light code and use my iteration instead
|
||||||
|
OPT_DEFS += -DRGBLIGHT_ENABLE
|
||||||
|
SRC += rgblight.c
|
||||||
|
SRC += ws2812.c
|
||||||
|
CIE1931_CURVE = yes
|
||||||
|
LED_BREATHING_TABLE = yes
|
42
keyboards/mxss/templates/keymap.c
Normal file
42
keyboards/mxss/templates/keymap.c
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/* Copyright 2018 REPLACE_WITH_YOUR_NAME
|
||||||
|
*
|
||||||
|
* 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 QMK_KEYBOARD_H
|
||||||
|
#include "mxss_frontled.h"
|
||||||
|
|
||||||
|
// Helpful defines
|
||||||
|
#define _______ KC_TRNS
|
||||||
|
|
||||||
|
// Predefined colors for layers
|
||||||
|
// Format: {hue, saturation}
|
||||||
|
// {0, 0} to turn off the LED
|
||||||
|
// Add additional rows to handle more layers
|
||||||
|
hs_set layer_colors[] = {
|
||||||
|
[0] = {0, 0}, // Color for Layer 0
|
||||||
|
[1] = {86, 255}, // Color for Layer 1
|
||||||
|
[2] = {36, 255}, // Color for Layer 2
|
||||||
|
[3] = {185, 255}, // Color for Layer 3
|
||||||
|
};
|
||||||
|
const size_t lc_size = sizeof(layer_colors) / sizeof(uint16_t);
|
||||||
|
|
||||||
|
// Use NEW_SAFE_RANGE to define new custom keycodes in order to not overwrite the ones used for front LED control
|
||||||
|
enum custom_keycodes {
|
||||||
|
MY_KEYCODE = NEW_SAFE_RANGE,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
__KEYMAP_GOES_HERE__
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user