aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/rama/m6_a/config.h113
-rw-r--r--keyboards/rama/m6_a/rules.mk32
-rw-r--r--keyboards/rama/m6_b/config.h33
-rw-r--r--keyboards/rama/m6_b/m6_b.c216
-rw-r--r--keyboards/rama/m6_b/m6_b_api.h39
-rw-r--r--keyboards/rama/m6_b/rgb_backlight.c139
-rw-r--r--keyboards/rama/m6_b/rgb_backlight.h34
-rw-r--r--keyboards/rama/m6_b/rules.mk24
-rw-r--r--keyboards/rama/u80_a/config.h17
-rw-r--r--keyboards/rama/u80_a/keymaps/default/keymap.c15
-rw-r--r--keyboards/rama/u80_a/rules.mk12
-rw-r--r--keyboards/wilba_tech/wt60_a/config.h17
-rw-r--r--keyboards/wilba_tech/wt60_a/rules.mk11
-rw-r--r--keyboards/wilba_tech/wt65_a/config.h17
-rw-r--r--keyboards/wilba_tech/wt65_a/rules.mk11
-rw-r--r--keyboards/wilba_tech/wt80_a/config.h17
-rw-r--r--keyboards/wilba_tech/wt80_a/keymaps/default/keymap.c16
-rw-r--r--keyboards/wilba_tech/wt80_a/rules.mk11
-rw-r--r--keyboards/wilba_tech/wt80_a/wt80_a.h15
-rw-r--r--keyboards/wilba_tech/wt_main.c155
-rw-r--r--keyboards/zeal60/rgb_backlight.c122
-rw-r--r--keyboards/zeal60/zeal60.c1
-rw-r--r--keyboards/zeal65/config.h8
23 files changed, 468 insertions, 607 deletions
diff --git a/keyboards/rama/m6_a/config.h b/keyboards/rama/m6_a/config.h
index 8d77f5339..63da79274 100644
--- a/keyboards/rama/m6_a/config.h
+++ b/keyboards/rama/m6_a/config.h
@@ -1,20 +1,18 @@
1/* 1/* Copyright 2018 Jason Williams (Wilba)
2Copyright 2018 Wilba 2 *
3 3 * This program is free software: you can redistribute it and/or modify
4This 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
5it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, either version 2 of the License, or
6the Free Software Foundation, either version 2 of the License, or 6 * (at your option) any later version.
7(at your option) any later version. 7 *
8 8 * This program is distributed in the hope that it will be useful,
9This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details.
12GNU General Public License for more details. 12 *
13 13 * You should have received a copy of the GNU General Public License
14You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */
16*/
17
18#pragma once 16#pragma once
19 17
20#include "config_common.h" 18#include "config_common.h"
@@ -47,7 +45,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
47 45
48/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ 46/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
49#define DIODE_DIRECTION COL2ROW 47#define DIODE_DIRECTION COL2ROW
50 48
51// #define BACKLIGHT_PIN B7 49// #define BACKLIGHT_PIN B7
52// #define BACKLIGHT_BREATHING 50// #define BACKLIGHT_BREATHING
53// #define BACKLIGHT_LEVELS 3 51// #define BACKLIGHT_LEVELS 3
@@ -109,88 +107,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
109 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ 107 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
110) 108)
111 109
112/* control how magic key switches layers */
113//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
114//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
115//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
116
117/* override magic key keymap */
118//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
119//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
120//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
121//#define MAGIC_KEY_HELP1 H
122//#define MAGIC_KEY_HELP2 SLASH
123//#define MAGIC_KEY_DEBUG D
124//#define MAGIC_KEY_DEBUG_MATRIX X
125//#define MAGIC_KEY_DEBUG_KBD K
126//#define MAGIC_KEY_DEBUG_MOUSE M
127//#define MAGIC_KEY_VERSION V
128//#define MAGIC_KEY_STATUS S
129//#define MAGIC_KEY_CONSOLE C
130//#define MAGIC_KEY_LAYER0_ALT1 ESC
131//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
132//#define MAGIC_KEY_LAYER0 0
133//#define MAGIC_KEY_LAYER1 1
134//#define MAGIC_KEY_LAYER2 2
135//#define MAGIC_KEY_LAYER3 3
136//#define MAGIC_KEY_LAYER4 4
137//#define MAGIC_KEY_LAYER5 5
138//#define MAGIC_KEY_LAYER6 6
139//#define MAGIC_KEY_LAYER7 7
140//#define MAGIC_KEY_LAYER8 8
141//#define MAGIC_KEY_LAYER9 9
142//#define MAGIC_KEY_BOOTLOADER PAUSE
143//#define MAGIC_KEY_LOCK CAPS
144//#define MAGIC_KEY_EEPROM E
145//#define MAGIC_KEY_NKRO N
146//#define MAGIC_KEY_SLEEP_LED Z
147
148/*
149 * Feature disable options
150 * These options are also useful to firmware size reduction.
151 */
152
153/* disable debug print */
154//#define NO_DEBUG
155
156/* disable print */
157//#define NO_PRINT
158
159/* disable action features */
160//#define NO_ACTION_LAYER
161//#define NO_ACTION_TAPPING
162//#define NO_ACTION_ONESHOT
163//#define NO_ACTION_MACRO
164//#define NO_ACTION_FUNCTION
165
166/*
167 * MIDI options
168 */
169
170/* Prevent use of disabled MIDI features in the keymap */
171//#define MIDI_ENABLE_STRICT 1
172
173/* enable basic MIDI features:
174 - MIDI notes can be sent when in Music mode is on
175*/
176//#define MIDI_BASIC
177
178/* enable advanced MIDI features:
179 - MIDI notes can be added to the keymap
180 - Octave shift and transpose
181 - Virtual sustain, portamento, and modulation wheel
182 - etc.
183*/
184//#define MIDI_ADVANCED
185
186/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
187//#define MIDI_TONE_KEYCODE_OCTAVES 1
188
189#define RGB_BACKLIGHT_ENABLED 0 110#define RGB_BACKLIGHT_ENABLED 0
190 111
191#define DYNAMIC_KEYMAP_LAYER_COUNT 4 112#define DYNAMIC_KEYMAP_LAYER_COUNT 4
192 113
193
194// EEPROM usage 114// EEPROM usage
195 115
196// TODO: refactor with new user EEPROM code (coming soon) 116// TODO: refactor with new user EEPROM code (coming soon)
@@ -206,3 +126,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
206#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35 126#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35
207// Dynamic keymap starts after backlight config (35+37) 127// Dynamic keymap starts after backlight config (35+37)
208#define DYNAMIC_KEYMAP_EEPROM_ADDR 72 128#define DYNAMIC_KEYMAP_EEPROM_ADDR 72
129
diff --git a/keyboards/rama/m6_a/rules.mk b/keyboards/rama/m6_a/rules.mk
index ed85ac36d..ff1706918 100644
--- a/keyboards/rama/m6_a/rules.mk
+++ b/keyboards/rama/m6_a/rules.mk
@@ -1,5 +1,5 @@
1# project specific files 1# project specific files
2SRC = keyboards/rama/m6_b/m6_b.c 2SRC = ../zeal60/zeal60.c
3 3
4# MCU name 4# MCU name
5MCU = atmega32u4 5MCU = atmega32u4
@@ -43,24 +43,32 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
43# Boot Section 43# Boot Section
44BOOTLOADER = atmel-dfu 44BOOTLOADER = atmel-dfu
45 45
46# Do not put the microcontroller into power saving mode
47# when we get USB suspend event. We want it to keep updating
48# backlight effects.
49OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
50
51
46# Build Options 52# Build Options
47# change yes to no to disable 53# change yes to no to disable
48# 54#
49BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 55BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
50MOUSEKEY_ENABLE = no # Mouse keys(+4700) 56MOUSEKEY_ENABLE = no # Mouse keys(+4700)
51EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 57EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
52CONSOLE_ENABLE = no # Console for debug(+400) 58CONSOLE_ENABLE = no # Console for debug(+400)
53COMMAND_ENABLE = no # Commands for debug and configuration 59COMMAND_ENABLE = no # Commands for debug and configuration
54# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 60NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
55SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 61BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
56# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 62MIDI_ENABLE = no # MIDI controls
57NKRO_ENABLE = yes # USB Nkey Rollover 63AUDIO_ENABLE = no # Audio output on port C6
58BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
59MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
60UNICODE_ENABLE = no # Unicode 64UNICODE_ENABLE = no # Unicode
61BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 65BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
62AUDIO_ENABLE = no # Audio output on port C6 66RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
63FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 67
68# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
69SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
64 70
65RAW_ENABLE = yes 71RAW_ENABLE = yes
66DYNAMIC_KEYMAP_ENABLE = yes \ No newline at end of file 72DYNAMIC_KEYMAP_ENABLE = yes
73CIE1931_CURVE = no
74
diff --git a/keyboards/rama/m6_b/config.h b/keyboards/rama/m6_b/config.h
index 1adaad3f9..c016703e0 100644
--- a/keyboards/rama/m6_b/config.h
+++ b/keyboards/rama/m6_b/config.h
@@ -109,8 +109,38 @@
109 109
110#define RGB_BACKLIGHT_ENABLED 1 110#define RGB_BACKLIGHT_ENABLED 1
111 111
112#define DYNAMIC_KEYMAP_LAYER_COUNT 4 112// This conditionally compiles the backlight code for M6-B specifics
113#define RGB_BACKLIGHT_M6_B
114
115// enable/disable LEDs based on layout
116#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0
117#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0
118#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0
119#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0
120#define RGB_BACKLIGHT_USE_ISO_ENTER 0
121#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0
122
123// disable backlight when USB suspended (PC sleep/hibernate/shutdown)
124#define RGB_BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0
125
126// disable backlight after timeout in minutes, 0 = no timeout
127#define RGB_BACKLIGHT_DISABLE_AFTER_TIMEOUT 0
128
129// the default effect (RGB test)
130#define RGB_BACKLIGHT_EFFECT 255
131
132// These define which keys in the matrix are alphas/mods
133// Used for backlight effects so colors are different for
134// alphas vs. mods
135// Each value is for a row, bit 0 is column 0
136// Alpha=0 Mod=1
137#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_0 0
138#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_1 0
139#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_2 0
140#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_3 0
141#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0
113 142
143#define DYNAMIC_KEYMAP_LAYER_COUNT 4
114 144
115// EEPROM usage 145// EEPROM usage
116 146
@@ -127,3 +157,4 @@
127#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35 157#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35
128// Dynamic keymap starts after backlight config (35+37) 158// Dynamic keymap starts after backlight config (35+37)
129#define DYNAMIC_KEYMAP_EEPROM_ADDR 72 159#define DYNAMIC_KEYMAP_EEPROM_ADDR 72
160
diff --git a/keyboards/rama/m6_b/m6_b.c b/keyboards/rama/m6_b/m6_b.c
index e7cd2f628..581b31d75 100644
--- a/keyboards/rama/m6_b/m6_b.c
+++ b/keyboards/rama/m6_b/m6_b.c
@@ -13,218 +13,6 @@
13 * You should have received a copy of the GNU General Public License 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/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "m6_b.h" 16#ifndef RGB_BACKLIGHT_M6_B
17#include "m6_b_api.h" 17#error RGB_BACKLIGHT_M6_B not defined, you done goofed somehao, brah
18
19// Check that no backlight functions are called
20#if RGB_BACKLIGHT_ENABLED
21#include "rgb_backlight.h"
22#endif // RGB_BACKLIGHT_ENABLED
23
24#include "raw_hid.h"
25#include "dynamic_keymap.h"
26#include "timer.h"
27#include "tmk_core/common/eeprom.h"
28
29bool eeprom_is_valid(void)
30{
31 return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC &&
32 eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION);
33}
34
35void eeprom_set_valid(bool valid)
36{
37 eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF);
38 eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF);
39}
40
41void eeprom_reset(void)
42{
43 // Set the keyboard-specific EEPROM state as invalid.
44 eeprom_set_valid(false);
45 // Set the TMK/QMK EEPROM state as invalid.
46 eeconfig_disable();
47}
48
49#ifdef RAW_ENABLE
50
51void raw_hid_receive( uint8_t *data, uint8_t length )
52{
53 uint8_t *command_id = &(data[0]);
54 uint8_t *command_data = &(data[1]);
55 switch ( *command_id )
56 {
57 case id_get_protocol_version:
58 {
59 command_data[0] = PROTOCOL_VERSION >> 8;
60 command_data[1] = PROTOCOL_VERSION & 0xFF;
61 break;
62 }
63 case id_get_keyboard_value:
64 {
65 if ( command_data[0] == id_uptime )
66 {
67 uint32_t value = timer_read32();
68 command_data[1] = (value >> 24 ) & 0xFF;
69 command_data[2] = (value >> 16 ) & 0xFF;
70 command_data[3] = (value >> 8 ) & 0xFF;
71 command_data[4] = value & 0xFF;
72 }
73 else
74 {
75 *command_id = id_unhandled;
76 }
77 break;
78 }
79#ifdef DYNAMIC_KEYMAP_ENABLE
80 case id_dynamic_keymap_get_keycode:
81 {
82 uint16_t keycode = dynamic_keymap_get_keycode( command_data[0], command_data[1], command_data[2] );
83 command_data[3] = keycode >> 8;
84 command_data[4] = keycode & 0xFF;
85 break;
86 }
87 case id_dynamic_keymap_set_keycode:
88 {
89 dynamic_keymap_set_keycode( command_data[0], command_data[1], command_data[2], ( command_data[3] << 8 ) | command_data[4] );
90 break;
91 }
92 case id_dynamic_keymap_reset:
93 {
94 dynamic_keymap_reset();
95 break;
96 }
97#endif // DYNAMIC_KEYMAP_ENABLE
98#if RGB_BACKLIGHT_ENABLED
99 case id_backlight_config_set_value:
100 {
101 //backlight_config_set_value(command_data);
102 break;
103 }
104 case id_backlight_config_get_value:
105 {
106 //backlight_config_get_value(command_data);
107 break;
108 }
109 case id_backlight_config_save:
110 {
111 //backlight_config_save();
112 break;
113 }
114#endif // RGB_BACKLIGHT_ENABLED
115 case id_eeprom_reset:
116 {
117 eeprom_reset();
118 break;
119 }
120 case id_bootloader_jump:
121 {
122 // Need to send data back before the jump
123 // Informs host that the command is handled
124 raw_hid_send( data, length );
125 // Give host time to read it
126 wait_ms(100);
127 bootloader_jump();
128 break;
129 }
130 default:
131 {
132 // Unhandled message.
133 *command_id = id_unhandled;
134 break;
135 }
136 }
137
138 // Return same buffer with values changed
139 raw_hid_send( data, length );
140
141}
142
143#endif 18#endif
144
145void main_init(void)
146{
147 // If the EEPROM has the magic, the data is good.
148 // OK to load from EEPROM.
149 if (eeprom_is_valid()) {
150#if RGB_BACKLIGHT_ENABLED
151 //backlight_config_load();
152#endif // RGB_BACKLIGHT_ENABLED
153 } else {
154#if RGB_BACKLIGHT_ENABLED
155 // If the EEPROM has not been saved before, or is out of date,
156 // save the default values to the EEPROM. Default values
157 // come from construction of the zeal_backlight_config instance.
158 //backlight_config_save();
159#endif // RGB_BACKLIGHT_ENABLED
160#ifdef DYNAMIC_KEYMAP_ENABLE
161 // This resets the keymaps in EEPROM to what is in flash.
162 dynamic_keymap_reset();
163#endif
164 // Save the magic number last, in case saving was interrupted
165 eeprom_set_valid(true);
166 }
167#if RGB_BACKLIGHT_ENABLED
168 // Initialize LED drivers for backlight.
169 backlight_init_drivers();
170
171 backlight_timer_init();
172 backlight_timer_enable();
173#endif // RGB_BACKLIGHT_ENABLED
174}
175
176void bootmagic_lite(void)
177{
178 // The lite version of TMK's bootmagic.
179 // 100% less potential for accidentally making the
180 // keyboard do stupid things.
181
182 // We need multiple scans because debouncing can't be turned off.
183 matrix_scan();
184 wait_ms(DEBOUNCING_DELAY);
185 wait_ms(DEBOUNCING_DELAY);
186 matrix_scan();
187
188 // If the Esc (matrix 0,0) is held down on power up,
189 // reset the EEPROM valid state and jump to bootloader.
190 if ( matrix_get_row(0) & (1<<0) ) {
191 eeprom_reset();
192 bootloader_jump();
193 }
194}
195
196void matrix_init_kb(void) {
197 bootmagic_lite();
198 main_init();
199 matrix_init_user();
200}
201
202void matrix_scan_kb(void) {
203#if RGB_BACKLIGHT_ENABLED
204 // This only updates the LED driver buffers if something has changed.
205 backlight_update_pwm_buffers();
206#endif // BACKLIGHT_ENABLED
207 matrix_scan_user();
208}
209
210bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
211 return process_record_user(keycode, record);
212}
213
214void led_set_kb(uint8_t usb_led) {
215 led_set_user(usb_led);
216}
217
218void suspend_power_down_kb(void)
219{
220#if RGB_BACKLIGHT_ENABLED
221 //backlight_set_suspend_state(true);
222#endif // BACKLIGHT_ENABLED
223}
224
225void suspend_wakeup_init_kb(void)
226{
227#if RGB_BACKLIGHT_ENABLED
228 //backlight_set_suspend_state(false);
229#endif // BACKLIGHT_ENABLED
230}
diff --git a/keyboards/rama/m6_b/m6_b_api.h b/keyboards/rama/m6_b/m6_b_api.h
deleted file mode 100644
index 041fd6e6e..000000000
--- a/keyboards/rama/m6_b/m6_b_api.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/* Copyright 2017 Jason Williams (Wilba)
2 *
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.
7 *
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.
12 *
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/>.
15 */
16#pragma once
17
18#define PROTOCOL_VERSION 0x0001
19
20enum m6_b_command_id
21{
22 id_get_protocol_version = 0x01, // always 0x01
23 id_get_keyboard_value,
24 id_set_keyboard_value,
25 id_dynamic_keymap_get_keycode,
26 id_dynamic_keymap_set_keycode,
27 id_dynamic_keymap_reset,
28 id_backlight_config_set_value,
29 id_backlight_config_get_value,
30 id_backlight_config_save,
31 id_eeprom_reset,
32 id_bootloader_jump,
33 id_unhandled = 0xFF,
34};
35
36enum m6_b_keyboard_value_id
37{
38 id_uptime = 0x01
39};
diff --git a/keyboards/rama/m6_b/rgb_backlight.c b/keyboards/rama/m6_b/rgb_backlight.c
deleted file mode 100644
index 8f7ac0630..000000000
--- a/keyboards/rama/m6_b/rgb_backlight.c
+++ /dev/null
@@ -1,139 +0,0 @@
1/* Copyright 2018 Jason Williams (Wilba)
2 *
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.
7 *
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.
12 *
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/>.
15 */
16#if RGB_BACKLIGHT_ENABLED
17
18#include "rgb_backlight.h"
19//#include "rgb_backlight_api.h"
20
21#include <avr/io.h>
22#include <util/delay.h>
23#include <avr/interrupt.h>
24#include "progmem.h"
25
26#include "quantum/color.h"
27#include "drivers/avr/i2c_master.h"
28#include "drivers/issi/is31fl3218.h"
29
30bool g_suspend_state = false;
31
32// Global tick at 20 Hz
33uint32_t g_tick = 0;
34uint8_t g_config_effect_speed = 0;
35uint8_t g_config_brightness = 255;
36
37void backlight_update_pwm_buffers(void)
38{
39 IS31FL3218_update_pwm_buffers();
40}
41
42void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
43{
44 IS31FL3218_set_color( index, red, green, blue );
45}
46
47void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
48{
49 IS31FL3218_set_color_all( red, green, blue );
50}
51
52
53// This is (F_CPU/1024) / 20 Hz
54// = 15625 Hz / 20 Hz
55// = 781
56#define TIMER3_TOP 260
57
58void backlight_timer_init(void)
59{
60 static uint8_t backlight_timer_is_init = 0;
61 if ( backlight_timer_is_init )
62 {
63 return;
64 }
65 backlight_timer_is_init = 1;
66
67 // Timer 3 setup
68 TCCR3B = _BV(WGM32) | // CTC mode OCR3A as TOP
69 _BV(CS32) | _BV(CS30); // prescale by /1024
70 // Set TOP value
71 uint8_t sreg = SREG;
72 cli();
73
74 OCR3AH = (TIMER3_TOP >> 8) & 0xff;
75 OCR3AL = TIMER3_TOP & 0xff;
76 SREG = sreg;
77}
78
79void backlight_timer_enable(void)
80{
81 TIMSK3 |= _BV(OCIE3A);
82}
83
84void backlight_timer_disable(void)
85{
86 TIMSK3 &= ~_BV(OCIE3A);
87}
88
89void backlight_set_suspend_state(bool state)
90{
91 g_suspend_state = state;
92}
93
94void backlight_effect_cycle_all(void)
95{
96 uint8_t hueOffset = ( g_tick << g_config_effect_speed ) & 0xFF;
97 uint8_t satOffset = 127;
98 // Relies on hue being 8-bit and wrapping
99 for ( int i=0; i<6; i++ )
100 {
101 HSV hsv = { .h = hueOffset, .s = satOffset, .v = g_config_brightness };
102 RGB rgb = hsv_to_rgb( hsv );
103 backlight_set_color( i, rgb.r, rgb.g, rgb.b );
104 }
105}
106
107ISR(TIMER3_COMPA_vect)
108{
109 // delay 1 second before driving LEDs or doing anything else
110 static uint8_t startup_tick = 0;
111 if ( startup_tick < 20 )
112 {
113 startup_tick++;
114 return;
115 }
116
117 g_tick++;
118
119 if ( g_suspend_state )
120 {
121 backlight_set_color_all( 0, 0, 0 );
122 }
123 else
124 {
125 //HSV hsv = { .h = 240, .s = 255, .v = g_config_brightness };
126 //RGB rgb = hsv_to_rgb( hsv );
127 //backlight_set_color_all( rgb.r, rgb.g, rgb.b );
128 backlight_effect_cycle_all();
129 }
130}
131
132void backlight_init_drivers(void)
133{
134 // Initialize I2C
135 i2c_init();
136 IS31FL3218_init();
137}
138
139#endif // RGB_BACKLIGHT_ENABLED
diff --git a/keyboards/rama/m6_b/rgb_backlight.h b/keyboards/rama/m6_b/rgb_backlight.h
deleted file mode 100644
index bbf605284..000000000
--- a/keyboards/rama/m6_b/rgb_backlight.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/* Copyright 2018 Jason Williams (Wilba)
2 *
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.
7 *
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.
12 *
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/>.
15 */
16#pragma once
17
18#if RGB_BACKLIGHT_ENABLED
19#else
20#error rgb_backlight.h included when RGB_BACKLIGHT_ENABLED == 0
21#endif // RGB_BACKLIGHT_ENABLED
22
23#include <stdint.h>
24#include <stdbool.h>
25
26#include "quantum/color.h"
27
28void backlight_init_drivers(void);
29void backlight_update_pwm_buffers(void);
30void backlight_timer_init(void);
31void backlight_timer_enable(void);
32void backlight_timer_disable(void);
33void backlight_set_suspend_state(bool state);
34
diff --git a/keyboards/rama/m6_b/rules.mk b/keyboards/rama/m6_b/rules.mk
index 8226debd4..1a7466af3 100644
--- a/keyboards/rama/m6_b/rules.mk
+++ b/keyboards/rama/m6_b/rules.mk
@@ -1,5 +1,6 @@
1# project specific files 1# project specific files
2SRC = rgb_backlight.c \ 2SRC = ../zeal60/zeal60.c \
3 ../zeal60/rgb_backlight.c \
3 quantum/color.c \ 4 quantum/color.c \
4 drivers/issi/is31fl3218.c \ 5 drivers/issi/is31fl3218.c \
5 drivers/avr/i2c_master.c 6 drivers/avr/i2c_master.c
@@ -56,22 +57,23 @@ OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
56# Build Options 57# Build Options
57# change yes to no to disable 58# change yes to no to disable
58# 59#
59BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 60BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
60MOUSEKEY_ENABLE = no # Mouse keys(+4700) 61MOUSEKEY_ENABLE = no # Mouse keys(+4700)
61EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 62EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
62CONSOLE_ENABLE = no # Console for debug(+400) 63CONSOLE_ENABLE = no # Console for debug(+400)
63COMMAND_ENABLE = no # Commands for debug and configuration 64COMMAND_ENABLE = no # Commands for debug and configuration
64# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 65NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
65SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 66BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
66# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 67MIDI_ENABLE = no # MIDI controls
67NKRO_ENABLE = yes # USB Nkey Rollover 68AUDIO_ENABLE = no # Audio output on port C6
68BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
69MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
70UNICODE_ENABLE = no # Unicode 69UNICODE_ENABLE = no # Unicode
71BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 70BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
72AUDIO_ENABLE = no # Audio output on port C6 71RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
73FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 72
73# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
74SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
74 75
75RAW_ENABLE = yes 76RAW_ENABLE = yes
76DYNAMIC_KEYMAP_ENABLE = yes 77DYNAMIC_KEYMAP_ENABLE = yes
77CIE1931_CURVE = yes 78CIE1931_CURVE = yes
79
diff --git a/keyboards/rama/u80_a/config.h b/keyboards/rama/u80_a/config.h
index bfd972828..9c74735ad 100644
--- a/keyboards/rama/u80_a/config.h
+++ b/keyboards/rama/u80_a/config.h
@@ -185,3 +185,20 @@
185/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ 185/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
186//#define MIDI_TONE_KEYCODE_OCTAVES 1 186//#define MIDI_TONE_KEYCODE_OCTAVES 1
187 187
188#define DYNAMIC_KEYMAP_LAYER_COUNT 4
189
190// EEPROM usage
191
192// TODO: refactor with new user EEPROM code (coming soon)
193#define EEPROM_MAGIC 0x451F
194#define EEPROM_MAGIC_ADDR 32
195// Bump this every time we change what we store
196// This will automatically reset the EEPROM with defaults
197// and avoid loading invalid data from the EEPROM
198#define EEPROM_VERSION 0x07
199#define EEPROM_VERSION_ADDR 34
200
201// Backlight config starts after EEPROM version
202#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35
203// Dynamic keymap starts after backlight config (35+37)
204#define DYNAMIC_KEYMAP_EEPROM_ADDR 72
diff --git a/keyboards/rama/u80_a/keymaps/default/keymap.c b/keyboards/rama/u80_a/keymaps/default/keymap.c
index cf9225e3e..036a57b68 100644
--- a/keyboards/rama/u80_a/keymaps/default/keymap.c
+++ b/keyboards/rama/u80_a/keymaps/default/keymap.c
@@ -18,5 +18,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
18 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 18 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
19 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 19 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
20 20
21 [2] = LAYOUT_all(
22 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
23 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
24 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
25 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
26 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
28
29 [3] = LAYOUT_all(
30 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
32 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
33 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
34 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
35 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
21}; 36};
22 37
diff --git a/keyboards/rama/u80_a/rules.mk b/keyboards/rama/u80_a/rules.mk
index 99224c247..67b04e350 100644
--- a/keyboards/rama/u80_a/rules.mk
+++ b/keyboards/rama/u80_a/rules.mk
@@ -52,17 +52,21 @@ BOOTLOADER = atmel-dfu
52# change yes to no to disable 52# change yes to no to disable
53# 53#
54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 55MOUSEKEY_ENABLE = no # Mouse keys(+4700)
56EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 56EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
57CONSOLE_ENABLE = yes # Console for debug(+400) 57CONSOLE_ENABLE = no # Console for debug(+400)
58COMMAND_ENABLE = yes # Commands for debug and configuration 58COMMAND_ENABLE = no # Commands for debug and configuration
59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
62NKRO_ENABLE = no # USB Nkey Rollover 62NKRO_ENABLE = yes # USB Nkey Rollover
63BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default 63BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
64MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) 64MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
65UNICODE_ENABLE = no # Unicode 65UNICODE_ENABLE = no # Unicode
66BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 66BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
67AUDIO_ENABLE = no # Audio output on port C6 67AUDIO_ENABLE = no # Audio output on port C6
68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
69
70RAW_ENABLE = yes
71DYNAMIC_KEYMAP_ENABLE = yes
72CIE1931_CURVE = yes \ No newline at end of file
diff --git a/keyboards/wilba_tech/wt60_a/config.h b/keyboards/wilba_tech/wt60_a/config.h
index 95f4c786e..26f9ed2ba 100644
--- a/keyboards/wilba_tech/wt60_a/config.h
+++ b/keyboards/wilba_tech/wt60_a/config.h
@@ -185,3 +185,20 @@
185/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ 185/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
186//#define MIDI_TONE_KEYCODE_OCTAVES 1 186//#define MIDI_TONE_KEYCODE_OCTAVES 1
187 187
188#define DYNAMIC_KEYMAP_LAYER_COUNT 4
189
190// EEPROM usage
191
192// TODO: refactor with new user EEPROM code (coming soon)
193#define EEPROM_MAGIC 0x451F
194#define EEPROM_MAGIC_ADDR 32
195// Bump this every time we change what we store
196// This will automatically reset the EEPROM with defaults
197// and avoid loading invalid data from the EEPROM
198#define EEPROM_VERSION 0x07
199#define EEPROM_VERSION_ADDR 34
200
201// Backlight config starts after EEPROM version
202#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35
203// Dynamic keymap starts after backlight config (35+37)
204#define DYNAMIC_KEYMAP_EEPROM_ADDR 72
diff --git a/keyboards/wilba_tech/wt60_a/rules.mk b/keyboards/wilba_tech/wt60_a/rules.mk
index 99224c247..76a07d7a4 100644
--- a/keyboards/wilba_tech/wt60_a/rules.mk
+++ b/keyboards/wilba_tech/wt60_a/rules.mk
@@ -52,17 +52,20 @@ BOOTLOADER = atmel-dfu
52# change yes to no to disable 52# change yes to no to disable
53# 53#
54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 55MOUSEKEY_ENABLE = no # Mouse keys(+4700)
56EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 56EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
57CONSOLE_ENABLE = yes # Console for debug(+400) 57CONSOLE_ENABLE = no # Console for debug(+400)
58COMMAND_ENABLE = yes # Commands for debug and configuration 58COMMAND_ENABLE = no # Commands for debug and configuration
59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
62NKRO_ENABLE = no # USB Nkey Rollover 62NKRO_ENABLE = yes # USB Nkey Rollover
63BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default 63BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
64MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) 64MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
65UNICODE_ENABLE = no # Unicode 65UNICODE_ENABLE = no # Unicode
66BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 66BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
67AUDIO_ENABLE = no # Audio output on port C6 67AUDIO_ENABLE = no # Audio output on port C6
68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
69
70RAW_ENABLE = yes
71DYNAMIC_KEYMAP_ENABLE = yes \ No newline at end of file
diff --git a/keyboards/wilba_tech/wt65_a/config.h b/keyboards/wilba_tech/wt65_a/config.h
index fa919f186..5f535c6a7 100644
--- a/keyboards/wilba_tech/wt65_a/config.h
+++ b/keyboards/wilba_tech/wt65_a/config.h
@@ -185,3 +185,20 @@
185/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ 185/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
186//#define MIDI_TONE_KEYCODE_OCTAVES 1 186//#define MIDI_TONE_KEYCODE_OCTAVES 1
187 187
188#define DYNAMIC_KEYMAP_LAYER_COUNT 4
189
190// EEPROM usage
191
192// TODO: refactor with new user EEPROM code (coming soon)
193#define EEPROM_MAGIC 0x451F
194#define EEPROM_MAGIC_ADDR 32
195// Bump this every time we change what we store
196// This will automatically reset the EEPROM with defaults
197// and avoid loading invalid data from the EEPROM
198#define EEPROM_VERSION 0x07
199#define EEPROM_VERSION_ADDR 34
200
201// Backlight config starts after EEPROM version
202#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35
203// Dynamic keymap starts after backlight config (35+37)
204#define DYNAMIC_KEYMAP_EEPROM_ADDR 72
diff --git a/keyboards/wilba_tech/wt65_a/rules.mk b/keyboards/wilba_tech/wt65_a/rules.mk
index 99224c247..76a07d7a4 100644
--- a/keyboards/wilba_tech/wt65_a/rules.mk
+++ b/keyboards/wilba_tech/wt65_a/rules.mk
@@ -52,17 +52,20 @@ BOOTLOADER = atmel-dfu
52# change yes to no to disable 52# change yes to no to disable
53# 53#
54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 55MOUSEKEY_ENABLE = no # Mouse keys(+4700)
56EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 56EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
57CONSOLE_ENABLE = yes # Console for debug(+400) 57CONSOLE_ENABLE = no # Console for debug(+400)
58COMMAND_ENABLE = yes # Commands for debug and configuration 58COMMAND_ENABLE = no # Commands for debug and configuration
59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
62NKRO_ENABLE = no # USB Nkey Rollover 62NKRO_ENABLE = yes # USB Nkey Rollover
63BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default 63BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
64MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) 64MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
65UNICODE_ENABLE = no # Unicode 65UNICODE_ENABLE = no # Unicode
66BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 66BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
67AUDIO_ENABLE = no # Audio output on port C6 67AUDIO_ENABLE = no # Audio output on port C6
68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
69
70RAW_ENABLE = yes
71DYNAMIC_KEYMAP_ENABLE = yes \ No newline at end of file
diff --git a/keyboards/wilba_tech/wt80_a/config.h b/keyboards/wilba_tech/wt80_a/config.h
index 9687cb6d6..f78ce7fb3 100644
--- a/keyboards/wilba_tech/wt80_a/config.h
+++ b/keyboards/wilba_tech/wt80_a/config.h
@@ -185,3 +185,20 @@
185/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ 185/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
186//#define MIDI_TONE_KEYCODE_OCTAVES 1 186//#define MIDI_TONE_KEYCODE_OCTAVES 1
187 187
188#define DYNAMIC_KEYMAP_LAYER_COUNT 4
189
190// EEPROM usage
191
192// TODO: refactor with new user EEPROM code (coming soon)
193#define EEPROM_MAGIC 0x451F
194#define EEPROM_MAGIC_ADDR 32
195// Bump this every time we change what we store
196// This will automatically reset the EEPROM with defaults
197// and avoid loading invalid data from the EEPROM
198#define EEPROM_VERSION 0x07
199#define EEPROM_VERSION_ADDR 34
200
201// Backlight config starts after EEPROM version
202#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35
203// Dynamic keymap starts after backlight config (35+37)
204#define DYNAMIC_KEYMAP_EEPROM_ADDR 72
diff --git a/keyboards/wilba_tech/wt80_a/keymaps/default/keymap.c b/keyboards/wilba_tech/wt80_a/keymaps/default/keymap.c
index cf9225e3e..9cbe7ff62 100644
--- a/keyboards/wilba_tech/wt80_a/keymaps/default/keymap.c
+++ b/keyboards/wilba_tech/wt80_a/keymaps/default/keymap.c
@@ -18,5 +18,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
18 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 18 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
19 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 19 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
20 20
21 [2] = LAYOUT_all(
22 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
23 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
24 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
25 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
26 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
27 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
28
29 [3] = LAYOUT_all(
30 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
32 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
33 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
34 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
35 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
36
21}; 37};
22 38
diff --git a/keyboards/wilba_tech/wt80_a/rules.mk b/keyboards/wilba_tech/wt80_a/rules.mk
index 99224c247..76a07d7a4 100644
--- a/keyboards/wilba_tech/wt80_a/rules.mk
+++ b/keyboards/wilba_tech/wt80_a/rules.mk
@@ -52,17 +52,20 @@ BOOTLOADER = atmel-dfu
52# change yes to no to disable 52# change yes to no to disable
53# 53#
54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 55MOUSEKEY_ENABLE = no # Mouse keys(+4700)
56EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 56EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
57CONSOLE_ENABLE = yes # Console for debug(+400) 57CONSOLE_ENABLE = no # Console for debug(+400)
58COMMAND_ENABLE = yes # Commands for debug and configuration 58COMMAND_ENABLE = no # Commands for debug and configuration
59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
62NKRO_ENABLE = no # USB Nkey Rollover 62NKRO_ENABLE = yes # USB Nkey Rollover
63BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default 63BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
64MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) 64MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
65UNICODE_ENABLE = no # Unicode 65UNICODE_ENABLE = no # Unicode
66BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 66BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
67AUDIO_ENABLE = no # Audio output on port C6 67AUDIO_ENABLE = no # Audio output on port C6
68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
69
70RAW_ENABLE = yes
71DYNAMIC_KEYMAP_ENABLE = yes \ No newline at end of file
diff --git a/keyboards/wilba_tech/wt80_a/wt80_a.h b/keyboards/wilba_tech/wt80_a/wt80_a.h
index 26403ef34..a6fb1cccb 100644
--- a/keyboards/wilba_tech/wt80_a/wt80_a.h
+++ b/keyboards/wilba_tech/wt80_a/wt80_a.h
@@ -41,3 +41,18 @@
41 { K500, K501, K502, ____, ____, ____, K506, ____, ____, ____, K510, K511, K512, K513, K514, K515, K516 } \ 41 { K500, K501, K502, ____, ____, ____, K506, ____, ____, ____, K510, K511, K512, K513, K514, K515, K516 } \
42} 42}
43 43
44#define LAYOUT_no_split( \
45 K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K014, K015, K016, \
46 K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, K115, K116, \
47 K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, K215, K216, \
48 K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, \
49 K400, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K415, \
50 K500, K501, K502, K506, K510, K511, K512, K513, K514, K515, K516 \
51) { \
52 { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, ____, K014, K015, K016 }, \
53 { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, K115, K116 }, \
54 { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, K215, K216 }, \
55 { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, ____, ____, ____ }, \
56 { K400, ____, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, ____, K415, ____ }, \
57 { K500, K501, K502, ____, ____, ____, K506, ____, ____, ____, K510, K511, K512, K513, K514, K515, K516 } \
58}
diff --git a/keyboards/wilba_tech/wt_main.c b/keyboards/wilba_tech/wt_main.c
index f514dbefc..23f07d7eb 100644
--- a/keyboards/wilba_tech/wt_main.c
+++ b/keyboards/wilba_tech/wt_main.c
@@ -16,6 +16,152 @@
16 16
17#include "quantum.h" 17#include "quantum.h"
18#include "keyboards/wilba_tech/wt_mono_backlight.h" 18#include "keyboards/wilba_tech/wt_mono_backlight.h"
19#include "keyboards/zeal60/zeal60_api.h" // Temporary hack
20
21#include "raw_hid.h"
22#include "dynamic_keymap.h"
23#include "timer.h"
24#include "tmk_core/common/eeprom.h"
25
26bool eeprom_is_valid(void)
27{
28 return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC &&
29 eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION);
30}
31
32void eeprom_set_valid(bool valid)
33{
34 eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF);
35 eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF);
36}
37
38void eeprom_reset(void)
39{
40 // Set the Zeal60 specific EEPROM state as invalid.
41 eeprom_set_valid(false);
42 // Set the TMK/QMK EEPROM state as invalid.
43 eeconfig_disable();
44}
45
46#ifdef RAW_ENABLE
47
48void raw_hid_receive( uint8_t *data, uint8_t length )
49{
50 uint8_t *command_id = &(data[0]);
51 uint8_t *command_data = &(data[1]);
52 switch ( *command_id )
53 {
54 case id_get_protocol_version:
55 {
56 command_data[0] = PROTOCOL_VERSION >> 8;
57 command_data[1] = PROTOCOL_VERSION & 0xFF;
58 break;
59 }
60 case id_get_keyboard_value:
61 {
62 if ( command_data[0] == id_uptime )
63 {
64 uint32_t value = timer_read32();
65 command_data[1] = (value >> 24 ) & 0xFF;
66 command_data[2] = (value >> 16 ) & 0xFF;
67 command_data[3] = (value >> 8 ) & 0xFF;
68 command_data[4] = value & 0xFF;
69 }
70 else
71 {
72 *command_id = id_unhandled;
73 }
74 break;
75 }
76#ifdef DYNAMIC_KEYMAP_ENABLE
77 case id_dynamic_keymap_get_keycode:
78 {
79 uint16_t keycode = dynamic_keymap_get_keycode( command_data[0], command_data[1], command_data[2] );
80 command_data[3] = keycode >> 8;
81 command_data[4] = keycode & 0xFF;
82 break;
83 }
84 case id_dynamic_keymap_set_keycode:
85 {
86 dynamic_keymap_set_keycode( command_data[0], command_data[1], command_data[2], ( command_data[3] << 8 ) | command_data[4] );
87 break;
88 }
89 case id_dynamic_keymap_reset:
90 {
91 dynamic_keymap_reset();
92 break;
93 }
94#endif // DYNAMIC_KEYMAP_ENABLE
95 case id_backlight_config_set_value:
96 {
97 //backlight_config_set_value(command_data);
98 break;
99 }
100 case id_backlight_config_get_value:
101 {
102 //backlight_config_get_value(command_data);
103 break;
104 }
105 case id_backlight_config_save:
106 {
107 //backlight_config_save();
108 break;
109 }
110 case id_eeprom_reset:
111 {
112 eeprom_reset();
113 break;
114 }
115 case id_bootloader_jump:
116 {
117 // Need to send data back before the jump
118 // Informs host that the command is handled
119 raw_hid_send( data, length );
120 // Give host time to read it
121 wait_ms(100);
122 bootloader_jump();
123 break;
124 }
125 default:
126 {
127 // Unhandled message.
128 *command_id = id_unhandled;
129 break;
130 }
131 }
132
133 // Return same buffer with values changed
134 raw_hid_send( data, length );
135
136}
137
138#endif
139
140void main_init(void)
141{
142 // If the EEPROM has the magic, the data is good.
143 // OK to load from EEPROM.
144 if (eeprom_is_valid()) {
145 //backlight_config_load();
146 } else {
147 // If the EEPROM has not been saved before, or is out of date,
148 // save the default values to the EEPROM. Default values
149 // come from construction of the zeal_backlight_config instance.
150 //backlight_config_save();
151#ifdef DYNAMIC_KEYMAP_ENABLE
152 // This resets the keymaps in EEPROM to what is in flash.
153 dynamic_keymap_reset();
154#endif
155 // Save the magic number last, in case saving was interrupted
156 eeprom_set_valid(true);
157 }
158
159 // Initialize LED drivers for backlight.
160 backlight_init_drivers();
161
162 backlight_timer_init();
163 backlight_timer_enable();
164}
19 165
20void bootmagic_lite(void) 166void bootmagic_lite(void)
21{ 167{
@@ -32,9 +178,7 @@ void bootmagic_lite(void)
32 // If the Esc (matrix 0,0) is held down on power up, 178 // If the Esc (matrix 0,0) is held down on power up,
33 // reset the EEPROM valid state and jump to bootloader. 179 // reset the EEPROM valid state and jump to bootloader.
34 if ( matrix_get_row(0) & (1<<0) ) { 180 if ( matrix_get_row(0) & (1<<0) ) {
35 // Set the TMK/QMK EEPROM state as invalid. 181 eeprom_reset();
36 eeconfig_disable();
37 // Jump to bootloader.
38 bootloader_jump(); 182 bootloader_jump();
39 } 183 }
40} 184}
@@ -42,14 +186,13 @@ void bootmagic_lite(void)
42void matrix_init_kb(void) 186void matrix_init_kb(void)
43{ 187{
44 bootmagic_lite(); 188 bootmagic_lite();
45 backlight_init_drivers(); 189 main_init();
46 backlight_timer_init();
47 backlight_timer_enable();
48 matrix_init_user(); 190 matrix_init_user();
49} 191}
50 192
51void matrix_scan_kb(void) 193void matrix_scan_kb(void)
52{ 194{
195 // This only updates the LED driver buffers if something has changed.
53 backlight_update_pwm_buffers(); 196 backlight_update_pwm_buffers();
54 matrix_scan_user(); 197 matrix_scan_user();
55} 198}
diff --git a/keyboards/zeal60/rgb_backlight.c b/keyboards/zeal60/rgb_backlight.c
index ce8b1cb17..c3dade123 100644
--- a/keyboards/zeal60/rgb_backlight.c
+++ b/keyboards/zeal60/rgb_backlight.c
@@ -15,12 +15,12 @@
15 */ 15 */
16#if RGB_BACKLIGHT_ENABLED 16#if RGB_BACKLIGHT_ENABLED
17 17
18#if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_ZEAL65) || defined (RGB_BACKLIGHT_M60_A) 18#if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_ZEAL65) || defined (RGB_BACKLIGHT_M60_A) || defined(RGB_BACKLIGHT_M6_B)
19#else 19#else
20#error None of the following was defined: RGB_BACKLIGHT_ZEAL60, RGB_BACKLIGHT_ZEAL65, RGB_BACKLIGHT_M60_A 20#error None of the following was defined: RGB_BACKLIGHT_ZEAL60, RGB_BACKLIGHT_ZEAL65, RGB_BACKLIGHT_M60_A, RGB_BACKLIGHT_M6_B
21#endif 21#endif
22 22
23#include "zeal60.h" 23#include "quantum.h"
24#include "rgb_backlight.h" 24#include "rgb_backlight.h"
25#include "rgb_backlight_api.h" 25#include "rgb_backlight_api.h"
26#include "rgb_backlight_keycodes.h" 26#include "rgb_backlight_keycodes.h"
@@ -32,7 +32,14 @@
32 32
33#include "quantum/color.h" 33#include "quantum/color.h"
34#include "drivers/avr/i2c_master.h" 34#include "drivers/avr/i2c_master.h"
35
36#if defined (RGB_BACKLIGHT_M6_B)
37#include "drivers/issi/is31fl3218.h"
38#define BACKLIGHT_LED_COUNT 6
39#else
35#include "drivers/issi/is31fl3731.h" 40#include "drivers/issi/is31fl3731.h"
41#define BACKLIGHT_LED_COUNT 72
42#endif
36 43
37#define BACKLIGHT_EFFECT_MAX 10 44#define BACKLIGHT_EFFECT_MAX 10
38 45
@@ -69,11 +76,12 @@ uint8_t g_indicator_state = 0;
69uint32_t g_tick = 0; 76uint32_t g_tick = 0;
70 77
71// Ticks since this key was last hit. 78// Ticks since this key was last hit.
72uint8_t g_key_hit[72]; 79uint8_t g_key_hit[BACKLIGHT_LED_COUNT];
73 80
74// Ticks since any key was last hit. 81// Ticks since any key was last hit.
75uint32_t g_any_key_hit = 0; 82uint32_t g_any_key_hit = 0;
76 83
84#if !defined(RGB_BACKLIGHT_M6_B)
77// This is a 7-bit address, that gets left-shifted and bit 0 85// This is a 7-bit address, that gets left-shifted and bit 0
78// set to 0 for write, 1 for read (as per I2C protocol) 86// set to 0 for write, 1 for read (as per I2C protocol)
79#define ISSI_ADDR_1 0x74 87#define ISSI_ADDR_1 0x74
@@ -162,7 +170,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
162 {1, C9_16, C7_15, C6_15}, // LD16 170 {1, C9_16, C7_15, C6_15}, // LD16
163 {1, C8_16, C7_16, C6_16}, // LD17 171 {1, C8_16, C7_16, C6_16}, // LD17
164}; 172};
165 173#endif // !defined(RGB_BACKLIGHT_M6_B)
166 174
167 175
168typedef struct Point { 176typedef struct Point {
@@ -175,7 +183,7 @@ typedef struct Point {
175// point values in range x=0..224 y=0..64 183// point values in range x=0..224 y=0..64
176// origin is center of top-left key (i.e Esc) 184// origin is center of top-left key (i.e Esc)
177#if defined (RGB_BACKLIGHT_ZEAL65) 185#if defined (RGB_BACKLIGHT_ZEAL65)
178const Point g_map_led_to_point[72] PROGMEM = { 186const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
179 // LA0..LA17 187 // LA0..LA17
180 {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, 188 {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32},
181 {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, 189 {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0},
@@ -189,7 +197,7 @@ const Point g_map_led_to_point[72] PROGMEM = {
189 {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, 197 {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48},
190 {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {144,60}, {164,64}, {188,64}, {208,64} 198 {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {144,60}, {164,64}, {188,64}, {208,64}
191}; 199};
192const Point g_map_led_to_point_polar[72] PROGMEM = { 200const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
193 // LA0..LA17 201 // LA0..LA17
194 {64,128}, {75,132}, {84,145}, {91,164}, {97,187}, {102,213}, {105,242}, {109,255}, {128,247}, 202 {64,128}, {75,132}, {84,145}, {91,164}, {97,187}, {102,213}, {105,242}, {109,255}, {128,247},
195 {61,255}, {67,255}, {72,255}, {77,255}, {82,255}, {86,255}, {90,255}, {93,255}, {96,255}, 203 {61,255}, {67,255}, {72,255}, {77,255}, {82,255}, {86,255}, {90,255}, {93,255}, {96,255},
@@ -204,7 +212,7 @@ const Point g_map_led_to_point_polar[72] PROGMEM = {
204 {189,128}, {200,131}, {210,141}, {218,159}, {201,228}, {201,228}, {206,255}, {213,255}, {218,255} 212 {189,128}, {200,131}, {210,141}, {218,159}, {201,228}, {201,228}, {206,255}, {213,255}, {218,255}
205}; 213};
206#elif defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) 214#elif defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A)
207const Point g_map_led_to_point[72] PROGMEM = { 215const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
208 // LA0..LA17 216 // LA0..LA17
209 {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, 217 {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32},
210 {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, 218 {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0},
@@ -218,7 +226,7 @@ const Point g_map_led_to_point[72] PROGMEM = {
218 {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48}, 226 {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48},
219 {116,48}, {132,48}, {148,48}, {164,48}, {144,64}, {161,64}, {181,64}, {201,64}, {221,64} 227 {116,48}, {132,48}, {148,48}, {164,48}, {144,64}, {161,64}, {181,64}, {201,64}, {221,64}
220}; 228};
221const Point g_map_led_to_point_polar[72] PROGMEM = { 229const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
222 // LA0..LA17 230 // LA0..LA17
223 {58,129}, {70,129}, {80,139}, {89,157}, {96,181}, {101,208}, {105,238}, {109,255}, {128,247}, {58,255}, 231 {58,129}, {70,129}, {80,139}, {89,157}, {96,181}, {101,208}, {105,238}, {109,255}, {128,247}, {58,255},
224 {64,255}, {70,255}, {75,255}, {80,255}, {85,255}, {89,255}, {93,255}, {96,255}, 232 {64,255}, {70,255}, {75,255}, {80,255}, {85,255}, {89,255}, {93,255}, {96,255},
@@ -232,6 +240,16 @@ const Point g_map_led_to_point_polar[72] PROGMEM = {
232 {0,27}, {0,64}, {0,101}, {0,137}, {0,174}, {255,233}, {228,201}, {235,255}, {237,255}, 240 {0,27}, {0,64}, {0,101}, {0,137}, {0,174}, {255,233}, {228,201}, {235,255}, {237,255},
233 {195,128}, {206,136}, {215,152}, {222,175}, {205,234}, {209,255}, {214,255}, {219,255}, {223,255} 241 {195,128}, {206,136}, {215,152}, {222,175}, {205,234}, {209,255}, {214,255}, {219,255}, {223,255}
234}; 242};
243#elif defined (RGB_BACKLIGHT_M6_B)
244// M6-B is really simple:
245// 0 3 5
246// 1 2 4
247const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = {
248 {0,0}, {0,16}, {16,16}, {16,0}, {32,16}, {32,0}
249};
250const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = {
251 {0,0}, {0,16}, {16,16}, {16,0}, {32,16}, {32,0}
252};
235#endif 253#endif
236 254
237// This may seem counter-intuitive, but it's quite flexible. 255// This may seem counter-intuitive, but it's quite flexible.
@@ -245,16 +263,30 @@ void map_led_to_point( uint8_t index, Point *point )
245 point->x = pgm_read_byte(addr); 263 point->x = pgm_read_byte(addr);
246 point->y = pgm_read_byte(addr+1); 264 point->y = pgm_read_byte(addr+1);
247 265
266#if defined (RGB_BACKLIGHT_M6_B)
267 return;
268#endif
269
248 switch (index) 270 switch (index)
249 { 271 {
250 case 18+4: // LB4A 272 case 18+4: // LB4A
251 if ( g_config.use_split_backspace ) 273 if ( g_config.use_split_backspace )
252 point->x -= 8; 274 point->x -= 8;
253 break; 275 break;
276#if defined (RGB_BACKLIGHT_ZEAL60)
254 case 18+14: // LB14A 277 case 18+14: // LB14A
255 if ( g_config.use_iso_enter ) 278 if ( g_config.use_iso_enter )
256 point->y += 8; // extremely pedantic 279 point->y += 8; // extremely pedantic
257 break; 280 break;
281 case 54+5: // LD5A
282 if ( !g_config.use_iso_enter )
283 point->x -= 10;
284 break;
285 case 36+16: // LC16A
286 if ( !g_config.use_split_left_shift )
287 point->x += 8;
288 break;
289#endif
258#if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) 290#if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A)
259 case 36+0: // LC0A 291 case 36+0: // LC0A
260 if ( g_config.use_7u_spacebar ) 292 if ( g_config.use_7u_spacebar )
@@ -264,19 +296,11 @@ void map_led_to_point( uint8_t index, Point *point )
264 if ( g_config.use_7u_spacebar ) 296 if ( g_config.use_7u_spacebar )
265 point->x += 4; 297 point->x += 4;
266 break; 298 break;
267#endif
268 case 36+16: // LC16A
269 if ( !g_config.use_split_left_shift )
270 point->x += 8;
271 break;
272 case 54+5: // LD5A
273 if ( !g_config.use_iso_enter )
274 point->x -= 10;
275 break;
276 case 54+7: // LD7A 299 case 54+7: // LD7A
277 if ( !g_config.use_split_right_shift ) 300 if ( !g_config.use_split_right_shift )
278 point->x -= 8; 301 point->x -= 8;
279 break; 302 break;
303#endif
280 } 304 }
281} 305}
282 306
@@ -325,6 +349,13 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
325 { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8 }, 349 { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8 },
326 { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 54+13, 54+14, 54+15, 54+16, 54+17 } 350 { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 54+13, 54+14, 54+15, 54+16, 54+17 }
327}; 351};
352#elif defined (RGB_BACKLIGHT_M6_B)
353// M6-B is really simple:
354// 0 3 5
355// 1 2 4
356const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
357 { 0, 3, 5, 1, 2, 4 }
358};
328#endif 359#endif
329 360
330void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led ) 361void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led )
@@ -338,18 +369,30 @@ void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led )
338 369
339void backlight_update_pwm_buffers(void) 370void backlight_update_pwm_buffers(void)
340{ 371{
372#if defined (RGB_BACKLIGHT_M6_B)
373 IS31FL3218_update_pwm_buffers();
374#else
341 IS31FL3731_update_pwm_buffers( ISSI_ADDR_1, ISSI_ADDR_2 ); 375 IS31FL3731_update_pwm_buffers( ISSI_ADDR_1, ISSI_ADDR_2 );
342 IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); 376 IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 );
377#endif
343} 378}
344 379
345void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) 380void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
346{ 381{
382#if defined (RGB_BACKLIGHT_M6_B)
383 IS31FL3218_set_color( index, red, green, blue );
384#else
347 IS31FL3731_set_color( index, red, green, blue ); 385 IS31FL3731_set_color( index, red, green, blue );
386#endif
348} 387}
349 388
350void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) 389void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
351{ 390{
391#if defined (RGB_BACKLIGHT_M6_B)
392 IS31FL3218_set_color_all( red, green, blue );
393#else
352 IS31FL3731_set_color_all( red, green, blue ); 394 IS31FL3731_set_color_all( red, green, blue );
395#endif
353} 396}
354 397
355void backlight_set_key_hit(uint8_t row, uint8_t column) 398void backlight_set_key_hit(uint8_t row, uint8_t column)
@@ -436,6 +479,7 @@ void backlight_effect_rgb_test(void)
436 } 479 }
437} 480}
438 481
482#if defined(RGB_DEBUGGING_ONLY)
439// This tests the LEDs 483// This tests the LEDs
440// Note that it will change the LED control registers 484// Note that it will change the LED control registers
441// in the LED drivers, and leave them in an invalid 485// in the LED drivers, and leave them in an invalid
@@ -475,6 +519,7 @@ void backlight_effect_single_LED_test(void)
475 backlight_set_color_all( 255, 255, 255 ); 519 backlight_set_color_all( 255, 255, 255 );
476 backlight_test_led( led, color==0, color==1, color==2 ); 520 backlight_test_led( led, color==0, color==1, color==2 );
477} 521}
522#endif // defined(RGB_DEBUGGING_ONLY)
478 523
479// All LEDs off 524// All LEDs off
480void backlight_effect_all_off(void) 525void backlight_effect_all_off(void)
@@ -502,7 +547,7 @@ void backlight_effect_alphas_mods(void)
502 { 547 {
503 uint8_t index; 548 uint8_t index;
504 map_row_column_to_led( row, column, &index ); 549 map_row_column_to_led( row, column, &index );
505 if ( index < 72 ) 550 if ( index < BACKLIGHT_LED_COUNT )
506 { 551 {
507 if ( ( g_config.alphas_mods[row] & (1<<column) ) == 0 ) 552 if ( ( g_config.alphas_mods[row] & (1<<column) ) == 0 )
508 { 553 {
@@ -542,7 +587,7 @@ void backlight_effect_gradient_up_down(void)
542 HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; 587 HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness };
543 RGB rgb; 588 RGB rgb;
544 Point point; 589 Point point;
545 for ( int i=0; i<72; i++ ) 590 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
546 { 591 {
547 map_led_to_point( i, &point ); 592 map_led_to_point( i, &point );
548 // The y range will be 0..64, map this to 0..4 593 // The y range will be 0..64, map this to 0..4
@@ -580,9 +625,9 @@ void backlight_effect_raindrops(bool initialize)
580 RGB rgb; 625 RGB rgb;
581 626
582 // Change one LED every tick 627 // Change one LED every tick
583 uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % 72 : 255; 628 uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % BACKLIGHT_LED_COUNT : 255;
584 629
585 for ( int i=0; i<72; i++ ) 630 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
586 { 631 {
587 // If initialize, all get set to random colors 632 // If initialize, all get set to random colors
588 // If not, all but one will stay the same as before. 633 // If not, all but one will stay the same as before.
@@ -604,7 +649,7 @@ void backlight_effect_cycle_all(void)
604 uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; 649 uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF;
605 650
606 // Relies on hue being 8-bit and wrapping 651 // Relies on hue being 8-bit and wrapping
607 for ( int i=0; i<72; i++ ) 652 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
608 { 653 {
609 uint16_t offset2 = g_key_hit[i]<<2; 654 uint16_t offset2 = g_key_hit[i]<<2;
610 // stabilizer LEDs use spacebar hits 655 // stabilizer LEDs use spacebar hits
@@ -627,7 +672,7 @@ void backlight_effect_cycle_left_right(void)
627 HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; 672 HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness };
628 RGB rgb; 673 RGB rgb;
629 Point point; 674 Point point;
630 for ( int i=0; i<72; i++ ) 675 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
631 { 676 {
632 uint16_t offset2 = g_key_hit[i]<<2; 677 uint16_t offset2 = g_key_hit[i]<<2;
633 // stabilizer LEDs use spacebar hits 678 // stabilizer LEDs use spacebar hits
@@ -652,7 +697,7 @@ void backlight_effect_cycle_up_down(void)
652 HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; 697 HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness };
653 RGB rgb; 698 RGB rgb;
654 Point point; 699 Point point;
655 for ( int i=0; i<72; i++ ) 700 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
656 { 701 {
657 uint16_t offset2 = g_key_hit[i]<<2; 702 uint16_t offset2 = g_key_hit[i]<<2;
658 // stabilizer LEDs use spacebar hits 703 // stabilizer LEDs use spacebar hits
@@ -677,9 +722,9 @@ void backlight_effect_jellybean_raindrops( bool initialize )
677 RGB rgb; 722 RGB rgb;
678 723
679 // Change one LED every tick 724 // Change one LED every tick
680 uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % 72 : 255; 725 uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % BACKLIGHT_LED_COUNT : 255;
681 726
682 for ( int i=0; i<72; i++ ) 727 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
683 { 728 {
684 // If initialize, all get set to random colors 729 // If initialize, all get set to random colors
685 // If not, all but one will stay the same as before. 730 // If not, all but one will stay the same as before.
@@ -702,7 +747,7 @@ void backlight_effect_cycle_radial1(void)
702 HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; 747 HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness };
703 RGB rgb; 748 RGB rgb;
704 Point point; 749 Point point;
705 for ( int i=0; i<72; i++ ) 750 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
706 { 751 {
707 map_led_to_point_polar( i, &point ); 752 map_led_to_point_polar( i, &point );
708 // Relies on hue being 8-bit and wrapping 753 // Relies on hue being 8-bit and wrapping
@@ -720,7 +765,7 @@ void backlight_effect_cycle_radial2(void)
720 HSV hsv = { .h = 0, .s = g_config.color_1.s, .v = g_config.brightness }; 765 HSV hsv = { .h = 0, .s = g_config.color_1.s, .v = g_config.brightness };
721 RGB rgb; 766 RGB rgb;
722 Point point; 767 Point point;
723 for ( int i=0; i<72; i++ ) 768 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
724 { 769 {
725 map_led_to_point_polar( i, &point ); 770 map_led_to_point_polar( i, &point );
726 uint8_t offset2 = offset + point.x; 771 uint8_t offset2 = offset + point.x;
@@ -826,7 +871,7 @@ ISR(TIMER3_COMPA_vect)
826 g_any_key_hit++; 871 g_any_key_hit++;
827 } 872 }
828 873
829 for ( int led = 0; led < 72; led++ ) 874 for ( int led = 0; led < BACKLIGHT_LED_COUNT; led++ )
830 { 875 {
831 if ( g_key_hit[led] < 255 ) 876 if ( g_key_hit[led] < 255 )
832 { 877 {
@@ -899,7 +944,9 @@ ISR(TIMER3_COMPA_vect)
899 944
900 if ( ! suspend_backlight ) 945 if ( ! suspend_backlight )
901 { 946 {
947#if !defined(RGB_BACKLIGHT_M6_B)
902 backlight_effect_indicators(); 948 backlight_effect_indicators();
949#endif
903 } 950 }
904} 951}
905 952
@@ -1239,17 +1286,19 @@ void backlight_init_drivers(void)
1239{ 1286{
1240 // Initialize I2C 1287 // Initialize I2C
1241 i2c_init(); 1288 i2c_init();
1289
1290#if defined(RGB_BACKLIGHT_M6_B)
1291 IS31FL3218_init();
1292#else
1242 IS31FL3731_init( ISSI_ADDR_1 ); 1293 IS31FL3731_init( ISSI_ADDR_1 );
1243 IS31FL3731_init( ISSI_ADDR_2 ); 1294 IS31FL3731_init( ISSI_ADDR_2 );
1244 1295
1245 for ( int index = 0; index < 72; index++ ) 1296 for ( int index = 0; index < BACKLIGHT_LED_COUNT; index++ )
1246 { 1297 {
1247 // OR the possible "disabled" cases together, then NOT the result to get the enabled state 1298 // OR the possible "disabled" cases together, then NOT the result to get the enabled state
1248 // LC6 LD13 not present on Zeal65 1299 // LC6 LD13 not present on Zeal65
1249#if defined (RGB_BACKLIGHT_ZEAL65) 1300#if defined (RGB_BACKLIGHT_ZEAL65)
1250 bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 1301 bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5
1251 ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15
1252 ( index == 54+8 && !g_config.use_split_right_shift ) || // LD8
1253 ( index == 36+6 ) || // LC6 1302 ( index == 36+6 ) || // LC6
1254 ( index == 54+13 ) ); // LD13 1303 ( index == 54+13 ) ); // LD13
1255#elif defined (RGB_BACKLIGHT_M60_A) 1304#elif defined (RGB_BACKLIGHT_M60_A)
@@ -1286,11 +1335,12 @@ void backlight_init_drivers(void)
1286 } 1335 }
1287 // This actually updates the LED drivers 1336 // This actually updates the LED drivers
1288 IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); 1337 IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 );
1338#endif // !defined(RGB_BACKLIGHT_M6_B)
1289 1339
1290 // TODO: put the 1 second startup delay here? 1340 // TODO: put the 1 second startup delay here?
1291 1341
1292 // clear the key hits 1342 // clear the key hits
1293 for ( int led=0; led<72; led++ ) 1343 for ( int led=0; led<BACKLIGHT_LED_COUNT; led++ )
1294 { 1344 {
1295 g_key_hit[led] = 255; 1345 g_key_hit[led] = 255;
1296 } 1346 }
@@ -1510,9 +1560,10 @@ void backlight_color_2_sat_decrease(void)
1510 backlight_config_save(); 1560 backlight_config_save();
1511} 1561}
1512 1562
1563#if defined(RGB_DEBUGGING_ONLY)
1513void backlight_test_led( uint8_t index, bool red, bool green, bool blue ) 1564void backlight_test_led( uint8_t index, bool red, bool green, bool blue )
1514{ 1565{
1515 for ( int i=0; i<72; i++ ) 1566 for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
1516 { 1567 {
1517 if ( i == index ) 1568 if ( i == index )
1518 { 1569 {
@@ -1524,6 +1575,7 @@ void backlight_test_led( uint8_t index, bool red, bool green, bool blue )
1524 } 1575 }
1525 } 1576 }
1526} 1577}
1578#endif // defined(RGB_DEBUGGING_ONLY)
1527 1579
1528void backlight_debug_led( bool state ) 1580void backlight_debug_led( bool state )
1529{ 1581{
diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c
index be54f75f3..b3b5d03fd 100644
--- a/keyboards/zeal60/zeal60.c
+++ b/keyboards/zeal60/zeal60.c
@@ -164,6 +164,7 @@ void main_init(void)
164 // Save the magic number last, in case saving was interrupted 164 // Save the magic number last, in case saving was interrupted
165 eeprom_set_valid(true); 165 eeprom_set_valid(true);
166 } 166 }
167
167#if RGB_BACKLIGHT_ENABLED 168#if RGB_BACKLIGHT_ENABLED
168 // Initialize LED drivers for backlight. 169 // Initialize LED drivers for backlight.
169 backlight_init_drivers(); 170 backlight_init_drivers();
diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h
index 2dbf61237..683df2038 100644
--- a/keyboards/zeal65/config.h
+++ b/keyboards/zeal65/config.h
@@ -79,10 +79,10 @@
79 79
80// enable/disable LEDs based on layout 80// enable/disable LEDs based on layout
81#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 81#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0
82#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 82#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 // Unused
83#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 83#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 // Unused
84#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 84#define RGB_BACKLIGHT_USE_7U_SPACEBAR 1 // Used only for stab LED matching spacebar LED
85#define RGB_BACKLIGHT_USE_ISO_ENTER 0 85#define RGB_BACKLIGHT_USE_ISO_ENTER 0 // Unused
86#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 86#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0
87 87
88// disable backlight when USB suspended (PC sleep/hibernate/shutdown) 88// disable backlight when USB suspended (PC sleep/hibernate/shutdown)