aboutsummaryrefslogtreecommitdiff
path: root/keyboards/wilba_tech
diff options
context:
space:
mode:
authorWilba <Jason.S.Williams@gmail.com>2018-11-14 03:31:25 +1100
committerDrashna Jaelre <drashna@live.com>2018-11-13 08:31:25 -0800
commit2dea540afbfcffaea82f70b6642c39aedb9e3b5b (patch)
treec61a59306a52a4d12d6b62eec5370721e0777bf4 /keyboards/wilba_tech
parentcaa293a8f77447891b02d5f8c91b209f9a082cc9 (diff)
downloadqmk_firmware-2dea540afbfcffaea82f70b6642c39aedb9e3b5b.tar.gz
qmk_firmware-2dea540afbfcffaea82f70b6642c39aedb9e3b5b.zip
Refactoring M6-A, M6-B, Zeal60, Zeal65, WT60-A, WT65-A, WT80-A (#4417)
* Refactored M6-B to use Zeal60 RGB backlight code * Fixed M6-B LED co-ordinates * Minor changes to RGB config for Zeal65 * Added dynamic keymaps to WT80-A, WT60-A, WT-80A, U80-A
Diffstat (limited to 'keyboards/wilba_tech')
-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
9 files changed, 252 insertions, 18 deletions
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}