1 /* Copyright 2018 Jumail Mundekkat / MxBlue
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // EEPROM management code taken from Wilba6582
18 // https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/zeal_eeprom.h
20 #ifndef MXSS_FRONTLED_H
21 #define MXSS_FRONTLED_H
23 #include "quantum_keycodes.h"
25 // RGBLED index for front LEDs
26 #define RGBLIGHT_FLED1 14
27 #define RGBLIGHT_FLED2 15
29 // Brightness increase step for front LEDs
30 #define FLED_VAL_STEP 8
32 // QMK never uses more then 32bytes of EEPROM, so our region starts there
33 // Magic value to verify the state of the EEPROM
34 #define EEPROM_MAGIC 0xC3E7
35 #define EEPROM_MAGIC_ADDR ((void*)32)
38 #define EEPROM_FRONTLED_ADDR ((void*)34)
40 // Modes for front LEDs
42 #define FLED_INDI 0b01
44 #define FLED_UNDEF 0b11
46 // Hard-coded color for capslock indicator in FLED_INDI mode, H:0% S:100% = Red
48 #define FLED_CAPS_S 255
50 // Config storage format for EEPROM
59 // Structure to store hue and saturation values
60 typedef struct _hs_set {
65 // Custom keycodes for front LED control
67 FLED_MOD = SAFE_RANGE,
70 NEW_SAFE_RANGE // define a new safe range
73 bool eeprom_is_valid(void); // Check if EEPROM has been set up
74 void eeprom_set_valid(bool valid); // Change validity state of EEPROM
75 void eeprom_update_conf(void); // Store current front LED config to EEPROM
77 void fled_mode_cycle(void); // Cycle between the 3 modes for the front LEDs
78 void fled_val_increase(void); // Increase the brightness of the front LEDs
79 void fled_val_decrease(void); // Decrease the brightness of the front LEDs
81 #endif //MXSS_FRONTLED_H