aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
-rw-r--r--Makefile15
-rw-r--r--keyboards/chibios_test/keymaps/default/keymap.c2
-rw-r--r--keyboards/clueboard/clueboard.c16
-rw-r--r--keyboards/clueboard/keymaps/default/keymap.c72
-rw-r--r--keyboards/clueboard/keymaps/max/keymap.c70
-rw-r--r--keyboards/clueboard/rev1/config.h5
-rw-r--r--keyboards/clueboard/rev1/rev1.c16
-rw-r--r--keyboards/clueboard/rev2/config.h5
-rw-r--r--keyboards/clueboard/rev2/rev2.c16
-rw-r--r--keyboards/clueboard/rev2/rev2.h2
-rw-r--r--keyboards/cluepad/config.h13
-rw-r--r--keyboards/cluepad/keymaps/default/keymap.c71
-rw-r--r--keyboards/gh60/keymaps/robotmaxtron/Makefile112
-rw-r--r--keyboards/gh60/keymaps/robotmaxtron/WS2812-wiring.jpgbin0 -> 1038926 bytes
-rw-r--r--keyboards/gh60/keymaps/robotmaxtron/config.h190
-rw-r--r--keyboards/gh60/keymaps/robotmaxtron/keymap.c226
-rw-r--r--keyboards/gh60/keymaps/robotmaxtron/readme.md16
-rw-r--r--keyboards/hhkb/Makefile4
-rw-r--r--keyboards/hhkb/config.h6
-rw-r--r--keyboards/hhkb/hhkb.h27
-rw-r--r--keyboards/hhkb/keymaps/jp/Makefile1
-rw-r--r--keyboards/hhkb/keymaps/jp/keymap.c58
-rw-r--r--keyboards/hhkb/keymaps/rdg_jp/Makefile1
-rw-r--r--keyboards/hhkb/keymaps/rdg_jp/keymap.c65
-rw-r--r--keyboards/infinity_ergodox/Makefile12
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h113
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/driver.mk2
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c333
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h36
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/emulator_lcd/driver.mk2
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/emulator_lcd/emulator_lcd.c10
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/emulator_led/driver.mk2
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/emulator_led/emulator_led.c10
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/board_ST7565.h127
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/driver.mk2
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c292
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/gdisp_lld_config.h26
-rw-r--r--keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/st7565.h37
-rw-r--r--keyboards/infinity_ergodox/gfxconf.h331
-rw-r--r--keyboards/infinity_ergodox/infinity_ergodox.c65
-rw-r--r--keyboards/infinity_ergodox/keymaps/default/keymap.c5
-rw-r--r--keyboards/infinity_ergodox/keymaps/default/visualizer.c168
-rw-r--r--keyboards/kc60/Makefile2
-rw-r--r--keyboards/kc60/keymaps/stanleylai/keymap.c67
-rw-r--r--keyboards/kc60/keymaps/ws2812/config.h5
-rw-r--r--keyboards/kc60/keymaps/ws2812/keymap.c65
-rw-r--r--keyboards/lets_split/config.h5
-rw-r--r--keyboards/phantom/config.h13
-rw-r--r--keyboards/phantom/keymaps/default/keymap.c69
-rw-r--r--keyboards/phantom/led.c2
-rw-r--r--keyboards/planck/keymaps/experimental/Makefile6
-rw-r--r--keyboards/planck/keymaps/experimental/config.h8
-rw-r--r--keyboards/planck/keymaps/experimental/keymap.c73
-rw-r--r--keyboards/planck/keymaps/pvc/config.h5
-rw-r--r--keyboards/planck/keymaps/yang/config.h5
-rw-r--r--keyboards/planck/keymaps/yang/keymap.c66
-rw-r--r--keyboards/preonic/config.h5
-rw-r--r--keyboards/satan/config.h14
-rw-r--r--keyboards/satan/keymaps/default/keymap.c68
-rw-r--r--keyboards/satan/keymaps/poker/keymap.c116
-rw-r--r--keyboards/satan/keymaps/sethbc/keymap.c73
-rw-r--r--keyboards/satan/keymaps/stanleylai/config.h20
-rw-r--r--keyboards/satan/keymaps/stanleylai/keymap.c84
m---------lib/ugfx0
-rw-r--r--quantum/keymap.h10
-rw-r--r--quantum/keymap_common.c2
-rwxr-xr-xquantum/light_ws2812.c25
-rw-r--r--quantum/quantum.c66
-rw-r--r--quantum/rgblight.c23
-rw-r--r--quantum/rgblight.h7
-rw-r--r--quantum/template/template.c2
-rw-r--r--quantum/visualizer/led_test.c4
-rw-r--r--quantum/visualizer/visualizer.c14
-rw-r--r--quantum/visualizer/visualizer.h2
-rw-r--r--quantum/visualizer/visualizer.mk36
-rw-r--r--readme.md101
-rw-r--r--tmk_core/common.mk2
-rw-r--r--tmk_core/common/keyboard.c8
-rw-r--r--tmk_core/common/keycode.h7
-rw-r--r--tmk_core/protocol/chibios/main.c15
-rw-r--r--tmk_core/rules.mk75
82 files changed, 2969 insertions, 786 deletions
diff --git a/.gitmodules b/.gitmodules
index 1576b8dc0..7e3c92d03 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
4[submodule "lib/chibios-contrib"] 4[submodule "lib/chibios-contrib"]
5 path = lib/chibios-contrib 5 path = lib/chibios-contrib
6 url = https://github.com/ChibiOS/ChibiOS-Contrib.git 6 url = https://github.com/ChibiOS/ChibiOS-Contrib.git
7[submodule "lib/ugfx"]
8 path = lib/ugfx
9 url = https://bitbucket.org/Tectu/ugfx
diff --git a/Makefile b/Makefile
index 7c00ce2cc..a7a10bf32 100644
--- a/Makefile
+++ b/Makefile
@@ -218,14 +218,6 @@ ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
218 VAPTH += $(SERIAL_PATH) 218 VAPTH += $(SERIAL_PATH)
219endif 219endif
220 220
221ifeq ($(MASTER),right)
222 OPT_DEFS += -DMASTER_IS_ON_RIGHT
223else
224 ifneq ($(MASTER),left)
225$(error MASTER does not have a valid value(left/right))
226 endif
227endif
228
229# Optimize size but this may cause error "relocation truncated to fit" 221# Optimize size but this may cause error "relocation truncated to fit"
230#EXTRALDFLAGS = -Wl,--relax 222#EXTRALDFLAGS = -Wl,--relax
231 223
@@ -257,10 +249,17 @@ ifeq ($(PLATFORM),AVR)
257else ifeq ($(PLATFORM),CHIBIOS) 249else ifeq ($(PLATFORM),CHIBIOS)
258 include $(TMK_PATH)/protocol/chibios.mk 250 include $(TMK_PATH)/protocol/chibios.mk
259 include $(TMK_PATH)/chibios.mk 251 include $(TMK_PATH)/chibios.mk
252 OPT_OS = chibios
260else 253else
261 $(error Unknown platform) 254 $(error Unknown platform)
262endif 255endif
263 256
257ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
258 VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer
259 VISUALIZER_PATH = $(QUANTUM_PATH)/visualizer
260 include $(VISUALIZER_PATH)/visualizer.mk
261endif
262
264include $(TMK_PATH)/rules.mk 263include $(TMK_PATH)/rules.mk
265 264
266GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S") 265GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
diff --git a/keyboards/chibios_test/keymaps/default/keymap.c b/keyboards/chibios_test/keymaps/default/keymap.c
index 239d70007..a362e2ccf 100644
--- a/keyboards/chibios_test/keymaps/default/keymap.c
+++ b/keyboards/chibios_test/keymaps/default/keymap.c
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18#include "chibios_test.h" 18#include "chibios_test.h"
19 19
20const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 20const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
21 {{KC_CAPS}}, // test with KC_CAPS, KC_A, KC_BTLD 21 {{KC_CAPS}}, // test with KC_CAPS, KC_A, RESET
22}; 22};
23 23
24const uint16_t fn_actions[] = { 24const uint16_t fn_actions[] = {
diff --git a/keyboards/clueboard/clueboard.c b/keyboards/clueboard/clueboard.c
index 13195bda6..3435202ba 100644
--- a/keyboards/clueboard/clueboard.c
+++ b/keyboards/clueboard/clueboard.c
@@ -1,17 +1 @@
1#include "clueboard.h" #include "clueboard.h"
2
3void led_init_ports() {
4 // * Set our LED pins as output
5 DDRB |= (1<<4);
6}
7
8void led_set_kb(uint8_t usb_led) {
9 DDRF |= (1<<0);
10 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
11 // Turn capslock on
12 PORTF |= (1<<0);
13 } else {
14 // Turn capslock off
15 PORTF &= ~(1<<0);
16 }
17}
diff --git a/keyboards/clueboard/keymaps/default/keymap.c b/keyboards/clueboard/keymaps/default/keymap.c
index 89f71e83a..896bc7ebc 100644
--- a/keyboards/clueboard/keymaps/default/keymap.c
+++ b/keyboards/clueboard/keymaps/default/keymap.c
@@ -67,11 +67,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
67 */ 67 */
68[_RS] = KEYMAP( 68[_RS] = KEYMAP(
69 #ifdef RGBLIGHT_ENABLE 69 #ifdef RGBLIGHT_ENABLE
70 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, F(1), F(7), \ 70 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, RGB_TOG, RGB_VAI, \
71 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,RESET, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(8), \ 71 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,RESET, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_VAD, \
72 KC_TRNS, KC_TRNS, MO(_RS),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ 72 KC_TRNS, KC_TRNS, MO(_RS),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
73 MO(_FL), KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), F(5), \ 73 MO(_FL), KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), RGB_SAI, \
74 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, F(2), F(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(4), F(6), F(3)), 74 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, RGB_MOD, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_HUD, RGB_SAD, RGB_HUI),
75 #else 75 #else
76 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, \ 76 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, \
77 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,RESET, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ 77 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,RESET, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
@@ -83,30 +83,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
83 83
84enum function_id { 84enum function_id {
85 SHIFT_ESC, 85 SHIFT_ESC,
86 #ifdef RGBLIGHT_ENABLE
87 RGBLED_TOGGLE,
88 RGBLED_STEP_MODE,
89 RGBLED_INCREASE_HUE,
90 RGBLED_DECREASE_HUE,
91 RGBLED_INCREASE_SAT,
92 RGBLED_DECREASE_SAT,
93 RGBLED_INCREASE_VAL,
94 RGBLED_DECREASE_VAL
95 #endif
96}; 86};
97 87
98const uint16_t PROGMEM fn_actions[] = { 88const uint16_t PROGMEM fn_actions[] = {
99 [0] = ACTION_FUNCTION(SHIFT_ESC), 89 [0] = ACTION_FUNCTION(SHIFT_ESC),
100 #ifdef RGBLIGHT_ENABLE
101 [1] = ACTION_FUNCTION(RGBLED_TOGGLE),
102 [2] = ACTION_FUNCTION(RGBLED_STEP_MODE),
103 [3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
104 [4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
105 [5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
106 [6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
107 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
108 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
109 #endif
110}; 90};
111 91
112void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 92void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
@@ -132,49 +112,5 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
132 } 112 }
133 } 113 }
134 break; 114 break;
135 //led operations
136 #ifdef RGBLIGHT_ENABLE
137 case RGBLED_TOGGLE:
138 if (record->event.pressed) {
139 rgblight_toggle();
140 }
141
142 break;
143 case RGBLED_INCREASE_HUE:
144 if (record->event.pressed) {
145 rgblight_increase_hue();
146 }
147 break;
148 case RGBLED_DECREASE_HUE:
149 if (record->event.pressed) {
150 rgblight_decrease_hue();
151 }
152 break;
153 case RGBLED_INCREASE_SAT:
154 if (record->event.pressed) {
155 rgblight_increase_sat();
156 }
157 break;
158 case RGBLED_DECREASE_SAT:
159 if (record->event.pressed) {
160 rgblight_decrease_sat();
161 }
162 break;
163 case RGBLED_INCREASE_VAL:
164 if (record->event.pressed) {
165 rgblight_increase_val();
166 }
167 break;
168 case RGBLED_DECREASE_VAL:
169 if (record->event.pressed) {
170 rgblight_decrease_val();
171 }
172 break;
173 case RGBLED_STEP_MODE:
174 if (record->event.pressed) {
175 rgblight_step();
176 }
177 break;
178 #endif
179 } 115 }
180} 116}
diff --git a/keyboards/clueboard/keymaps/max/keymap.c b/keyboards/clueboard/keymaps/max/keymap.c
index 82c93401d..193809840 100644
--- a/keyboards/clueboard/keymaps/max/keymap.c
+++ b/keyboards/clueboard/keymaps/max/keymap.c
@@ -66,78 +66,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
66 * `----------------------------------------------------------------------------------' 66 * `----------------------------------------------------------------------------------'
67 */ 67 */
68[_RS] = KEYMAP( 68[_RS] = KEYMAP(
69 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, F(0), F(6), \ 69 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, RGB_TOG, RGB_VAI, \
70 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,RESET, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(7), \ 70 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,RESET, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_VAD, \
71 KC_TRNS, KC_TRNS, MO(_RS),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ 71 KC_TRNS, KC_TRNS, MO(_RS),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
72 MO(_FL), KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), F(4), \ 72 MO(_FL), KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FL), RGB_SAI, \
73 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, F(1), F(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(3), F(5), F(2)), 73 KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, RGB_MOD, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_HUD, RGB_SAD, RGB_HUI),
74}; 74};
75 75
76enum function_id { 76/*enum function_id {
77 RGBLED_TOGGLE, 77};*/
78 RGBLED_STEP_MODE,
79 RGBLED_INCREASE_HUE,
80 RGBLED_DECREASE_HUE,
81 RGBLED_INCREASE_SAT,
82 RGBLED_DECREASE_SAT,
83 RGBLED_INCREASE_VAL,
84 RGBLED_DECREASE_VAL,
85};
86 78
87const uint16_t PROGMEM fn_actions[] = { 79const uint16_t PROGMEM fn_actions[] = {
88 [0] = ACTION_FUNCTION(RGBLED_TOGGLE),
89 [1] = ACTION_FUNCTION(RGBLED_STEP_MODE),
90 [2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
91 [3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
92 [4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
93 [5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
94 [6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
95 [7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
96}; 80};
97 81
98void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 82void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
99 switch (id) { 83 switch (id) {
100 case RGBLED_TOGGLE:
101 //led operations
102 if (record->event.pressed) {
103 rgblight_toggle();
104 }
105
106 break;
107 case RGBLED_INCREASE_HUE:
108 if (record->event.pressed) {
109 rgblight_increase_hue();
110 }
111 break;
112 case RGBLED_DECREASE_HUE:
113 if (record->event.pressed) {
114 rgblight_decrease_hue();
115 }
116 break;
117 case RGBLED_INCREASE_SAT:
118 if (record->event.pressed) {
119 rgblight_increase_sat();
120 }
121 break;
122 case RGBLED_DECREASE_SAT:
123 if (record->event.pressed) {
124 rgblight_decrease_sat();
125 }
126 break;
127 case RGBLED_INCREASE_VAL:
128 if (record->event.pressed) {
129 rgblight_increase_val();
130 }
131 break;
132 case RGBLED_DECREASE_VAL:
133 if (record->event.pressed) {
134 rgblight_decrease_val();
135 }
136 break;
137 case RGBLED_STEP_MODE:
138 if (record->event.pressed) {
139 rgblight_step();
140 }
141 break;
142 } 84 }
143} 85}
diff --git a/keyboards/clueboard/rev1/config.h b/keyboards/clueboard/rev1/config.h
index 9bb58f56e..8c9497232 100644
--- a/keyboards/clueboard/rev1/config.h
+++ b/keyboards/clueboard/rev1/config.h
@@ -25,9 +25,8 @@
25 25
26/* Underlight configuration 26/* Underlight configuration
27 */ 27 */
28#define ws2812_PORTREG PORTB 28#define RGB_DI_PIN B2
29#define ws2812_DDRREG DDRB 29#define RGBLIGHT_TIMER
30#define ws2812_pin 2
31#define RGBLED_NUM 14 // Number of LEDs 30#define RGBLED_NUM 14 // Number of LEDs
32#define RGBLIGHT_HUE_STEP 10 31#define RGBLIGHT_HUE_STEP 10
33#define RGBLIGHT_SAT_STEP 17 32#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/clueboard/rev1/rev1.c b/keyboards/clueboard/rev1/rev1.c
index 520a869e5..90fc6956c 100644
--- a/keyboards/clueboard/rev1/rev1.c
+++ b/keyboards/clueboard/rev1/rev1.c
@@ -1 +1,17 @@
1#include "rev1.h" 1#include "rev1.h"
2
3void led_init_ports() {
4 // * Set our LED pins as output
5 DDRF |= (1<<0);
6}
7
8void led_set_kb(uint8_t usb_led) {
9 DDRF |= (1<<0);
10 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
11 // Turn capslock on
12 PORTF |= (1<<0);
13 } else {
14 // Turn capslock off
15 PORTF &= ~(1<<0);
16 }
17}
diff --git a/keyboards/clueboard/rev2/config.h b/keyboards/clueboard/rev2/config.h
index e2f8336be..02982ff29 100644
--- a/keyboards/clueboard/rev2/config.h
+++ b/keyboards/clueboard/rev2/config.h
@@ -29,9 +29,8 @@
29 29
30/* Underlight configuration 30/* Underlight configuration
31 */ 31 */
32#define ws2812_PORTREG PORTD 32#define RGB_DI_PIN D7
33#define ws2812_DDRREG DDRD 33#define RGBLIGHT_TIMER
34#define ws2812_pin 7
35#define RGBLED_NUM 14 // Number of LEDs 34#define RGBLED_NUM 14 // Number of LEDs
36#define RGBLIGHT_HUE_STEP 10 35#define RGBLIGHT_HUE_STEP 10
37#define RGBLIGHT_SAT_STEP 17 36#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/clueboard/rev2/rev2.c b/keyboards/clueboard/rev2/rev2.c
index 7a8ec368e..1a35b87b8 100644
--- a/keyboards/clueboard/rev2/rev2.c
+++ b/keyboards/clueboard/rev2/rev2.c
@@ -45,3 +45,19 @@ void backlight_set(uint8_t level) {
45 PORTD &= ~(1<<4); // Arrows 45 PORTD &= ~(1<<4); // Arrows
46 } 46 }
47} 47}
48
49void led_init_ports() {
50 // * Set our LED pins as output
51 DDRB |= (1<<4);
52}
53
54void led_set_kb(uint8_t usb_led) {
55 DDRB |= (1<<4);
56 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
57 // Turn capslock on
58 PORTB |= (1<<4);
59 } else {
60 // Turn capslock off
61 PORTB &= ~(1<<4);
62 }
63}
diff --git a/keyboards/clueboard/rev2/rev2.h b/keyboards/clueboard/rev2/rev2.h
index 912de405d..2e9cb9dc2 100644
--- a/keyboards/clueboard/rev2/rev2.h
+++ b/keyboards/clueboard/rev2/rev2.h
@@ -13,7 +13,7 @@
13 * |------------------------------------------------------------. 13 * |------------------------------------------------------------.
14 * | 30| 31| 32| 33| 34| 35| 36| 37| 80| 81| 82| 83| 84| 85|86| 14 * | 30| 31| 32| 33| 34| 35| 36| 37| 80| 81| 82| 83| 84| 85|86|
15 * |------------------------------------------------------------------. 15 * |------------------------------------------------------------------.
16 * | 40| 41| 42| 43| 45| 46| 90| 91| 92| 93| 94| 95| 96| 16 * | 40| 41| 42| 43| 45| 46| 90| 92| 93| 94| 95| 96| 97|
17 * `------------------------------------------------------------------' 17 * `------------------------------------------------------------------'
18 * ,-----------------------------------------------------------. ,---. 18 * ,-----------------------------------------------------------. ,---.
19 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Yen| BS| |Ins| 19 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Yen| BS| |Ins|
diff --git a/keyboards/cluepad/config.h b/keyboards/cluepad/config.h
index 0955e0f70..bae05fade 100644
--- a/keyboards/cluepad/config.h
+++ b/keyboards/cluepad/config.h
@@ -69,13 +69,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
69 69
70/* Underlight configuration 70/* Underlight configuration
71 */ 71 */
72 #define ws2812_PORTREG PORTF 72#define RGB_DI_PIN F6
73 #define ws2812_DDRREG DDRF 73#define RGBLIGHT_TIMER
74 #define ws2812_pin 6 74#define RGBLED_NUM 4 // Number of LEDs
75 #define RGBLED_NUM 4 // Number of LEDs 75#define RGBLIGHT_HUE_STEP 10
76 #define RGBLIGHT_HUE_STEP 10 76#define RGBLIGHT_SAT_STEP 17
77 #define RGBLIGHT_SAT_STEP 17 77#define RGBLIGHT_VAL_STEP 17
78 #define RGBLIGHT_VAL_STEP 17
79 78
80/* 79/*
81 * Feature disable options 80 * Feature disable options
diff --git a/keyboards/cluepad/keymaps/default/keymap.c b/keyboards/cluepad/keymaps/default/keymap.c
index 8ba49952f..66827fe48 100644
--- a/keyboards/cluepad/keymaps/default/keymap.c
+++ b/keyboards/cluepad/keymaps/default/keymap.c
@@ -1,7 +1,6 @@
1#include "cluepad.h" 1#include "cluepad.h"
2 2
3#include "backlight.h" 3#include "backlight.h"
4#include "rgblight.h"
5 4
6// Each layer gets a name for readability, which is then used in the keymap matrix below. 5// Each layer gets a name for readability, which is then used in the keymap matrix below.
7// The underscores don't mean anything - you can have a layer called STUFF or any other name. 6// The underscores don't mean anything - you can have a layer called STUFF or any other name.
@@ -46,77 +45,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
46 * '-------------------' 45 * '-------------------'
47 */ 46 */
48[_FL] = KEYMAP( 47[_FL] = KEYMAP(
49 LT(_FL, KC_NLCK), KC_TRNS, KC_TRNS, F(0), \ 48 LT(_FL, KC_NLCK), KC_TRNS, KC_TRNS, RGB_TOG, \
50 KC_TRNS, F(4), KC_TRNS, F(6), \ 49 KC_TRNS, RGB_SAI, KC_TRNS, RGB_VAI, \
51 F(3), BL_STEP, F(2), \ 50 RGB_HUD, BL_STEP, RGB_HUI, \
52 KC_TRNS, F(5), KC_TRNS, F(7), \ 51 KC_TRNS, RGB_SAD, KC_TRNS, RGB_VAD, \
53 F(1), KC_TRNS) 52 RGB_MOD, KC_TRNS)
54}; 53};
55 54
56enum function_id { 55/*enum function_id {
57 RGBLED_TOGGLE, 56};*/
58 RGBLED_STEP_MODE,
59 RGBLED_INCREASE_HUE,
60 RGBLED_DECREASE_HUE,
61 RGBLED_INCREASE_SAT,
62 RGBLED_DECREASE_SAT,
63 RGBLED_INCREASE_VAL,
64 RGBLED_DECREASE_VAL,
65};
66 57
67const uint16_t PROGMEM fn_actions[] = { 58const uint16_t PROGMEM fn_actions[] = {
68 [0] = ACTION_FUNCTION(RGBLED_TOGGLE),
69 [1] = ACTION_FUNCTION(RGBLED_STEP_MODE),
70 [2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
71 [3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
72 [4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
73 [5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
74 [6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
75 [7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
76}; 59};
77 60
78void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 61void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
79 switch (id) { 62 switch (id) {
80 case RGBLED_TOGGLE:
81 if (record->event.pressed) {
82 rgblight_toggle();
83 }
84 break;
85 case RGBLED_INCREASE_HUE:
86 if (record->event.pressed) {
87 rgblight_increase_hue();
88 }
89 break;
90 case RGBLED_DECREASE_HUE:
91 if (record->event.pressed) {
92 rgblight_decrease_hue();
93 }
94 break;
95 case RGBLED_INCREASE_SAT:
96 if (record->event.pressed) {
97 rgblight_increase_sat();
98 }
99 break;
100 case RGBLED_DECREASE_SAT:
101 if (record->event.pressed) {
102 rgblight_decrease_sat();
103 }
104 break;
105 case RGBLED_INCREASE_VAL:
106 if (record->event.pressed) {
107 rgblight_increase_val();
108 }
109 break;
110 case RGBLED_DECREASE_VAL:
111 if (record->event.pressed) {
112 rgblight_decrease_val();
113 }
114 break;
115 case RGBLED_STEP_MODE:
116 if (record->event.pressed) {
117 rgblight_step();
118 }
119 break;
120 } 63 }
121} 64}
122 65
diff --git a/keyboards/gh60/keymaps/robotmaxtron/Makefile b/keyboards/gh60/keymaps/robotmaxtron/Makefile
new file mode 100644
index 000000000..2e69aee29
--- /dev/null
+++ b/keyboards/gh60/keymaps/robotmaxtron/Makefile
@@ -0,0 +1,112 @@
1#----------------------------------------------------------------------------
2# On command line:
3#
4# make all = Make software.
5#
6# make clean = Clean out built project files.
7#
8# make coff = Convert ELF to AVR COFF.
9#
10# make extcoff = Convert ELF to AVR Extended COFF.
11#
12# make program = Download the hex file to the device.
13# Please customize your programmer settings(PROGRAM_CMD)
14#
15# make teensy = Download the hex file to the device, using teensy_loader_cli.
16# (must have teensy_loader_cli installed).
17#
18# make dfu = Download the hex file to the device, using dfu-programmer (must
19# have dfu-programmer installed).
20#
21# make flip = Download the hex file to the device, using Atmel FLIP (must
22# have Atmel FLIP installed).
23#
24# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
25# (must have dfu-programmer installed).
26#
27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
28# (must have Atmel FLIP installed).
29#
30# make debug = Start either simulavr or avarice as specified for debugging,
31# with avr-gdb or avr-insight as the front end for debugging.
32#
33# make filename.s = Just compile filename.c into the assembler code only.
34#
35# make filename.i = Create a preprocessed source file for use in submitting
36# bug reports to the GCC project.
37#
38# To rebuild project do "make clean" then "make all".
39#----------------------------------------------------------------------------
40
41# MCU name
42#MCU = at90usb1287
43MCU = atmega32u4
44
45# Processor frequency.
46# This will define a symbol, F_CPU, in all source code files equal to the
47# processor frequency in Hz. You can then use this symbol in your source code to
48# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
49# automatically to create a 32-bit value in your source code.
50#
51# This will be an integer division of F_USB below, as it is sourced by
52# F_USB after it has run through any CPU prescalers. Note that this value
53# does not *change* the processor frequency - it should merely be updated to
54# reflect the processor speed set externally so that the code can use accurate
55# software delays.
56F_CPU = 16000000
57
58
59#
60# LUFA specific
61#
62# Target architecture (see library "Board Types" documentation).
63ARCH = AVR8
64
65# Input clock frequency.
66# This will define a symbol, F_USB, in all source code files equal to the
67# input clock frequency (before any prescaling is performed) in Hz. This value may
68# differ from F_CPU if prescaling is used on the latter, and is required as the
69# raw input clock is fed directly to the PLL sections of the AVR for high speed
70# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
71# at the end, this will be done automatically to create a 32-bit value in your
72# source code.
73#
74# If no clock division is performed on the input clock inside the AVR (via the
75# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
76F_USB = $(F_CPU)
77
78# Interrupt driven control endpoint task(+60)
79OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
80
81
82# Boot Section Size in *bytes*
83# Teensy halfKay 512
84# Teensy++ halfKay 1024
85# Atmel DFU loader 4096
86# LUFA bootloader 4096
87# USBaspLoader 2048
88OPT_DEFS += -DBOOTLOADER_SIZE=4096
89
90
91# Build Options
92# comment out to disable the options.
93#
94BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
95MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
96EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
97# CONSOLE_ENABLE ?= yes # Console for debug(+400)
98# COMMAND_ENABLE ?= yes # Commands for debug and configuration
99KEYBOARD_LOCK_ENABLE ?= yes # Allow locking of keyboard via magic key
100# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
101# SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend
102NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
103# BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality
104# MIDI_ENABLE ?= YES # MIDI controls
105# UNICODE_ENABLE ?= YES # Unicode
106# BLUETOOTH_ENABLE ?= yes # Enable Bluetooth with the Adafruit EZ-Key HID
107RGBLIGHT_ENABLE ?= yes # Enable RGB Underglow
108
109ifndef QUANTUM_DIR
110 include ../../../../Makefile
111endif
112
diff --git a/keyboards/gh60/keymaps/robotmaxtron/WS2812-wiring.jpg b/keyboards/gh60/keymaps/robotmaxtron/WS2812-wiring.jpg
new file mode 100644
index 000000000..4ab8cc31a
--- /dev/null
+++ b/keyboards/gh60/keymaps/robotmaxtron/WS2812-wiring.jpg
Binary files differ
diff --git a/keyboards/gh60/keymaps/robotmaxtron/config.h b/keyboards/gh60/keymaps/robotmaxtron/config.h
new file mode 100644
index 000000000..8272875ed
--- /dev/null
+++ b/keyboards/gh60/keymaps/robotmaxtron/config.h
@@ -0,0 +1,190 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x6060
26#define DEVICE_VER 0x0001
27#define MANUFACTURER geekhack
28#define PRODUCT GH60
29#define DESCRIPTION t.m.k. keyboard firmware for GH60
30
31/* key matrix size */
32#define MATRIX_ROWS 5
33#define MATRIX_COLS 14
34
35/*
36 * Keyboard Matrix Assignments
37 *
38 * Change this to how you wired your keyboard
39 * COLS: AVR pins used for columns, left to right
40 * ROWS: AVR pins used for rows, top to bottom
41 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
42 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
43 *
44*/
45 #define MATRIX_ROW_PINS { D0, D1, D2, D3, D5 }
46// Rev A
47// #define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B6, D4, B1, B0, B5, B4, D7, D6, B3 }
48// Rev B/C
49 #define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B6, D4, B1, B7, B5, B4, D7, D6, B3 }
50#define UNUSED_PINS
51
52/* COL2ROW or ROW2COL */
53#define DIODE_DIRECTION COL2ROW
54
55/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
56#define DEBOUNCING_DELAY 5
57
58/* define if matrix has ghost (lacks anti-ghosting diodes) */
59//#define MATRIX_HAS_GHOST
60
61/* number of backlight levels */
62#define BACKLIGHT_LEVELS 3
63
64/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
65#define LOCKING_SUPPORT_ENABLE
66/* Locking resynchronize hack */
67#define LOCKING_RESYNC_ENABLE
68
69/*
70 * Force NKRO
71 *
72 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
73 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
74 * makefile for this to work.)
75 *
76 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
77 * until the next keyboard reset.
78 *
79 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
80 * fully operational during normal computer usage.
81 *
82 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
83 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
84 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
85 * power-up.
86 *
87 */
88//#define FORCE_NKRO
89
90/*
91 * Magic Key Options
92 *
93 * Magic keys are hotkey commands that allow control over firmware functions of
94 * the keyboard. They are best used in combination with the HID Listen program,
95 * found here: https://www.pjrc.com/teensy/hid_listen.html
96 *
97 * The options below allow the magic key functionality to be changed. This is
98 * useful if your keyboard/keypad is missing keys and you want magic key support.
99 *
100 */
101
102/* key combination for magic key command */
103#define IS_COMMAND() ( \
104 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
105)
106
107/* control how magic key switches layers */
108//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
109//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
110//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
111
112/* override magic key keymap */
113//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
114//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
115//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
116//#define MAGIC_KEY_HELP1 H
117//#define MAGIC_KEY_HELP2 SLASH
118//#define MAGIC_KEY_DEBUG D
119//#define MAGIC_KEY_DEBUG_MATRIX X
120//#define MAGIC_KEY_DEBUG_KBD K
121//#define MAGIC_KEY_DEBUG_MOUSE M
122//#define MAGIC_KEY_VERSION V
123//#define MAGIC_KEY_STATUS S
124//#define MAGIC_KEY_CONSOLE C
125//#define MAGIC_KEY_LAYER0_ALT1 ESC
126//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
127//#define MAGIC_KEY_LAYER0 0
128//#define MAGIC_KEY_LAYER1 1
129//#define MAGIC_KEY_LAYER2 2
130//#define MAGIC_KEY_LAYER3 3
131//#define MAGIC_KEY_LAYER4 4
132//#define MAGIC_KEY_LAYER5 5
133//#define MAGIC_KEY_LAYER6 6
134//#define MAGIC_KEY_LAYER7 7
135//#define MAGIC_KEY_LAYER8 8
136//#define MAGIC_KEY_LAYER9 9
137//#define MAGIC_KEY_BOOTLOADER PAUSE
138//#define MAGIC_KEY_LOCK CAPS
139//#define MAGIC_KEY_EEPROM E
140//#define MAGIC_KEY_NKRO N
141//#define MAGIC_KEY_SLEEP_LED Z
142
143/*
144 * Feature disable options
145 * These options are also useful to firmware size reduction.
146 */
147
148/* disable debug print */
149//#define NO_DEBUG
150
151/* disable print */
152//#define NO_PRINT
153
154/* disable action features */
155//#define NO_ACTION_LAYER
156//#define NO_ACTION_TAPPING
157//#define NO_ACTION_ONESHOT
158//#define NO_ACTION_MACRO
159//#define NO_ACTION_FUNCTION
160
161/*
162 * RGB Underglow
163 * These settings are for the F4 by default:
164 *
165 *
166 * #define ws2812_PORTREG PORTF
167 * #define ws2812_DDRREG DDRF
168 * #define ws2812_pin PF4
169 * #define RGBLED_NUM 14 // Number of LEDs
170 * #define RGBLIGHT_HUE_STEP 10
171 * #define RGBLIGHT_SAT_STEP 17
172 * #define RGBLIGHT_VAL_STEP 17
173 *
174 * The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects.
175 * To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations.
176 * For details, please check this keymap. keyboard/planck/keymaps/yang/keymap.c
177*/
178
179/* Deprecated code below
180#define ws2812_PORTREG PORTF
181#define ws2812_DDRREG DDRF
182#define ws2812_pin PF4
183*/
184#define RGB_DI_PIN F4
185#define RGBLIGHT_TIMER
186#define RGBLED_NUM 8 // Number of LEDs
187#define RGBLIGHT_HUE_STEP 8
188#define RGBLIGHT_SAT_STEP 8
189#define RGBLIGHT_VAL_STEP 8
190#endif
diff --git a/keyboards/gh60/keymaps/robotmaxtron/keymap.c b/keyboards/gh60/keymaps/robotmaxtron/keymap.c
new file mode 100644
index 000000000..263eec4e5
--- /dev/null
+++ b/keyboards/gh60/keymaps/robotmaxtron/keymap.c
@@ -0,0 +1,226 @@
1#include "gh60.h"
2#include "action_layer.h"
3
4#define _BL 0
5#define _AL 1
6#define _FL 2
7#define _UL 3
8
9const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
10 /*
11 * Base layer, pretty standard ANSI layout.
12 * ,-----------------------------------------------------------.
13 * |FN12| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
14 * |-----------------------------------------------------------|
15 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
16 * |-----------------------------------------------------------|
17 * |Caps/Fn| A| S| D| F| G| H| J| K| L| ;| '|Return |
18 * |-----------------------------------------------------------|
19 * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
20 * |-----------------------------------------------------------|
21 * |Ctrl|Gui |Alt | Space |Alt |Fn |Menu|Ctrl|
22 * `-----------------------------------------------------------'
23 */
24 [_BL] = KEYMAP(
25 FN12,1,2,3,4,5,6,7,8,9,0,MINS,EQL,BSPC, \
26 TAB,Q,W,E,R,T,Y,U,I,O,P,LBRC,RBRC,BSLS, \
27 FN2,A,S,D,F,G,H,J,K,L,SCLN,QUOT,NO,ENT, \
28 LSFT,NO,Z,X,C,V,B,N,M,COMM,DOT,SLSH,NO,RSFT, \
29 LCTL,LGUI,LALT, SPC, NO,RALT,FN0,APP, RCTL),
30
31 /*
32 * Locking arrow keys to WASD for when you need dedicated arrow keys
33 * ,-----------------------------------------------------------.
34 * | | | | | | | | | | | | | | |
35 * |-----------------------------------------------------------|
36 * | | |Up | | | | | | | | | | | |
37 * |-----------------------------------------------------------|
38 * | |Left|Down|Rght| | | | | | | | | |
39 * |-----------------------------------------------------------|
40 * | | | | | | | | | | | | |
41 * |-----------------------------------------------------------|
42 * | | | | | | | | |
43 * `-----------------------------------------------------------'
44 */
45 [_AL] = KEYMAP(
46 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
47 TRNS,TRNS,UP,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
48 TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
49 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
50 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS),
51
52
53 /*
54 * Primary function layer, mostly the same as the traditional Pok3r layout.
55 * ,-------------------------------------------------------------.
56 * |`~ | F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12|DEL |
57 * |-------------------------------------------------------------|
58 * | |_AL| | | | |Calc|PgUp|Up|PgDn|Ptscn|Srlck|Pause| |
59 * |-------------------------------------------------------------|
60 * | | | | | | |Home|Left|Down|Rght|Ins| | |
61 * |-------------------------------------------------------------|
62 * | |_UL| | | | | | | | | | |
63 * |-------------------------------------------------------------|
64 * | | | | | | | | |
65 * `-------------------------------------------------------------'
66 */
67 [_FL] = KEYMAP(
68 GRAVE,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12, DELETE, \
69 TRNS,FN1,TRNS,TRNS,TRNS,TRNS,CALC,PGUP,UP,PGDN,PSCR,SLCK,PAUS,TRNS, \
70 TRNS,MUTE,_VOLDOWN,_VOLUP,TRNS,TRNS,HOME,LEFT,DOWN,RGHT,INS,TRNS,TRNS,TRNS, \
71 TRNS,TRNS,FN3,TRNS,TRNS,TRNS,TRNS,END,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
72 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS),
73
74 /*
75 * Locking layer for controlling the underglow.
76 *
77 * ,-----------------------------------------------------------.
78 * | | | | | | | | | | | | | | |
79 * |-----------------------------------------------------------|
80 * | | | | | | | | | | | | | | |
81 * |-----------------------------------------------------------|
82 * | |On|Mode| | | | | | | | | | |
83 * |-----------------------------------------------------------|
84 * | | |Hue+|Hue-|Sat+|Sat-|Val+|Val-| | | | |
85 * |-----------------------------------------------------------|
86 * | | | | | | | | |
87 * `-----------------------------------------------------------'
88 */
89 [_UL] = KEYMAP(
90 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
91 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
92 TRNS,FN4,FN5,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
93 TRNS,TRNS,TRNS,FN6,FN7,FN8,FN9,FN10,FN11,TRNS,TRNS,TRNS,TRNS,TRNS, \
94 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS),
95};
96
97enum function_id {
98 RGBLED_TOGGLE,
99 RGBLED_STEP_MODE,
100 RGBLED_INCREASE_HUE,
101 RGBLED_DECREASE_HUE,
102 RGBLED_INCREASE_SAT,
103 RGBLED_DECREASE_SAT,
104 RGBLED_INCREASE_VAL,
105 RGBLED_DECREASE_VAL,
106 SHIFT_ESC,
107};
108
109const uint16_t PROGMEM fn_actions[] = {
110 [0] = ACTION_LAYER_MOMENTARY(2), // Momentary Fn overlay
111 [1] = ACTION_LAYER_TOGGLE(1), // Toggle Arrow Layer overlay
112 [2] = ACTION_LAYER_TAP_KEY(2, KC_CAPS), // Tap to toggle caps lock and hold to activate function layer
113 [3] = ACTION_LAYER_TOGGLE(3), // Toggle Underglow Layer overlay
114 [4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow
115 [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode
116 [6] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
117 [7] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
118 [8] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
119 [9] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
120 [10] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
121 [11] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
122 [12] = ACTION_FUNCTION(SHIFT_ESC),
123};
124
125const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
126{
127 // MACRODOWN only works in this function
128 switch(id) {
129 case 0:
130 if (record->event.pressed) {
131 register_code(KC_RSFT);
132 } else {
133 unregister_code(KC_RSFT);
134 }
135 break;
136 }
137 return MACRO_NONE;
138};
139
140void matrix_scan_user(void) {
141
142// Layer LED indicators
143// ESC led on when in function layer, WASD cluster leds enabled when on arrow cluster
144 uint32_t layer = layer_state;
145 if (layer & (1<<1)) {
146 gh60_wasd_leds_on();
147 } else {
148 gh60_wasd_leds_off();
149 }
150
151 if (layer & (1<<2)) {
152 gh60_esc_led_on();
153 } else {
154 gh60_esc_led_off();
155 }
156};
157
158#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
159
160void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
161 switch (id) {
162 case RGBLED_TOGGLE:
163 //led operations
164 if (record->event.pressed) {
165 rgblight_toggle();
166 }
167 break;
168 case RGBLED_INCREASE_HUE:
169 if (record->event.pressed) {
170 rgblight_increase_hue();
171 }
172 break;
173 case RGBLED_DECREASE_HUE:
174 if (record->event.pressed) {
175 rgblight_decrease_hue();
176 }
177 break;
178 case RGBLED_INCREASE_SAT:
179 if (record->event.pressed) {
180 rgblight_increase_sat();
181 }
182 break;
183 case RGBLED_DECREASE_SAT:
184 if (record->event.pressed) {
185 rgblight_decrease_sat();
186 }
187 break;
188 case RGBLED_INCREASE_VAL:
189 if (record->event.pressed) {
190 rgblight_increase_val();
191 }
192 break;
193 case RGBLED_DECREASE_VAL:
194 if (record->event.pressed) {
195 rgblight_decrease_val();
196 }
197 break;
198 case RGBLED_STEP_MODE:
199 if (record->event.pressed) {
200 rgblight_step();
201 }
202 break;
203 static uint8_t shift_esc_shift_mask;
204 // Shift + ESC = ~
205 case SHIFT_ESC:
206 shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
207 if (record->event.pressed) {
208 if (shift_esc_shift_mask) {
209 add_key(KC_GRV);
210 send_keyboard_report();
211 } else {
212 add_key(KC_ESC);
213 send_keyboard_report();
214 }
215 } else {
216 if (shift_esc_shift_mask) {
217 del_key(KC_GRV);
218 send_keyboard_report();
219 } else {
220 del_key(KC_ESC);
221 send_keyboard_report();
222 }
223 }
224 break;
225 }
226};
diff --git a/keyboards/gh60/keymaps/robotmaxtron/readme.md b/keyboards/gh60/keymaps/robotmaxtron/readme.md
new file mode 100644
index 000000000..3e2292500
--- /dev/null
+++ b/keyboards/gh60/keymaps/robotmaxtron/readme.md
@@ -0,0 +1,16 @@
1robotmaxtron's GH60 Layout
2=====================
3
4##Quantum MK Firmware
5For the full Quantum feature list, see the parent readme.md.
6
7* Standard ANSI layout with Pok3r styled function layers
8* ESC key led enables when on function layer
9* Lockable layer with arrow keys on WASD with backlighting to indicate locked on arrow layer
10* Neopixel/WS2812 RGB Underglow Support
11
12## Reference Images
13![Wiring Refererence] (WS2812-wiring.jpg)
14
15### Additional Credits
16Keymap has been based on various keymaps available from the QMK Repo for the GH60-SATAN and KC60 keyboards.
diff --git a/keyboards/hhkb/Makefile b/keyboards/hhkb/Makefile
index 53eece396..6fe973e1e 100644
--- a/keyboards/hhkb/Makefile
+++ b/keyboards/hhkb/Makefile
@@ -78,6 +78,10 @@ ifndef QUANTUM_DIR
78 include ../../Makefile 78 include ../../Makefile
79endif 79endif
80 80
81ifneq (, $(findstring yes, $(HHKB_JP)))
82 OPT_DEFS += -DHHKB_JP
83endif
84
81debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION 85debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION
82debug-on: all 86debug-on: all
83 87
diff --git a/keyboards/hhkb/config.h b/keyboards/hhkb/config.h
index ee66e4457..3f0528b4b 100644
--- a/keyboards/hhkb/config.h
+++ b/keyboards/hhkb/config.h
@@ -29,7 +29,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
29#define DESCRIPTION q.m.k keyboard firmware for HHKB 29#define DESCRIPTION q.m.k keyboard firmware for HHKB
30 30
31/* key matrix size */ 31/* key matrix size */
32#define MATRIX_ROWS 8 32#ifdef HHKB_JP
33# define MATRIX_ROWS 16
34#else
35# define MATRIX_ROWS 8
36#endif
33#define MATRIX_COLS 8 37#define MATRIX_COLS 8
34 38
35#define TAPPING_TERM 200 39#define TAPPING_TERM 200
diff --git a/keyboards/hhkb/hhkb.h b/keyboards/hhkb/hhkb.h
index cc756c456..e95125efc 100644
--- a/keyboards/hhkb/hhkb.h
+++ b/keyboards/hhkb/hhkb.h
@@ -21,4 +21,31 @@
21 { K70, K71, K72, K73, K74, K75, K76, KC_NO } \ 21 { K70, K71, K72, K73, K74, K75, K76, KC_NO } \
22} 22}
23 23
24
25#define KEYMAP_JP( \
26 K02, K32, K62, K22, K12, K52, K72, KA2, K92, K82, KB2, KE2, KF2, KD2, KC2, \
27 K03, K63, K23, K13, K53, K73, KA3, K93, K83, KB3, KE3, KF3, KD3, \
28 K06, K66, K26, K16, K56, K76, KA6, K96, K86, KB6, KE6, KF6, KD6, KC6, \
29 K05, K65, K25, K15, K55, K75, KA5, K95, K85, KB5, KE5, KF5, KD5, KC5, \
30 K04, K34, K64, K24, K14, K74, K94, K84, KB4, KE4, KF4, KD4, KC4) \
31{ \
32 { KC_NO, KC_NO, K02, K03, K04, K05, K06, KC_NO }, \
33 { KC_NO, KC_NO, K12, K13, K14, K15, K16, KC_NO }, \
34 { KC_NO, KC_NO, K22, K23, K24, K25, K26, KC_NO }, \
35 { KC_NO, KC_NO, K32, KC_NO, K34, KC_NO, KC_NO, KC_NO }, \
36 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
37 { KC_NO, KC_NO, K52, K53, KC_NO, K55, K56, KC_NO }, \
38 { KC_NO, KC_NO, K62, K63, K64, K65, K66, KC_NO }, \
39 { KC_NO, KC_NO, K72, K73, K74, K75, K76, KC_NO }, \
40 { KC_NO, KC_NO, K82, K83, K84, K85, K86, KC_NO }, \
41 { KC_NO, KC_NO, K92, K93, K94, K95, K96, KC_NO }, \
42 { KC_NO, KC_NO, KA2, KA3, KC_NO, KA5, KA6, KC_NO }, \
43 { KC_NO, KC_NO, KB2, KB3, KB4, KB5, KB6, KC_NO }, \
44 { KC_NO, KC_NO, KC2, KC_NO, KC4, KC5, KC6, KC_NO }, \
45 { KC_NO, KC_NO, KD2, KD3, KD4, KD5, KD6, KC_NO }, \
46 { KC_NO, KC_NO, KE2, KE3, KE4, KE5, KE6, KC_NO }, \
47 { KC_NO, KC_NO, KF2, KF3, KF4, KF5, KF6, KC_NO } \
48}
49
50
24#endif 51#endif
diff --git a/keyboards/hhkb/keymaps/jp/Makefile b/keyboards/hhkb/keymaps/jp/Makefile
new file mode 100644
index 000000000..92986292a
--- /dev/null
+++ b/keyboards/hhkb/keymaps/jp/Makefile
@@ -0,0 +1 @@
HHKB_JP=yes
diff --git a/keyboards/hhkb/keymaps/jp/keymap.c b/keyboards/hhkb/keymaps/jp/keymap.c
new file mode 100644
index 000000000..8525adce5
--- /dev/null
+++ b/keyboards/hhkb/keymaps/jp/keymap.c
@@ -0,0 +1,58 @@
1#include "hhkb.h"
2
3#define _______ KC_TRNS
4
5
6/* Layer 0: HHKB JP
7 * ,-----------------------------------------------------------.
8 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
9 * |-----------------------------------------------------------|
10 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
11 * |------------------------------------------------------` Ent|
12 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
13 * |-----------------------------------------------------------|
14 * |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
15 * |-----------------------------------------------------------|
16 * | ||Ctl|Alt|Cmd| | Spc |Bsp| | | ||Lft|Dwn|Rgh|
17 * `-----------------------------------------------------------'
18 */
19
20/* Layer 1: HHKB mode (HHKB Fn)
21 * ,-----------------------------------------------------------.
22 * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
23 * |-----------------------------------------------------------|
24 * |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
25 * |------------------------------------------------------` |
26 * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
27 * |-----------------------------------------------------------|
28 * | | | | | | | +| -|End|PgD|Dow| | | |
29 * |-----------------------------------------------------------|
30 * | || | | | | | | | | || | | |
31 * `-----------------------------------------------------------'
32 */
33
34const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
35 [0] = KEYMAP_JP(
36 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC,
37 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
38 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT,
39 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_UP, KC_RSFT,
40 MO(1), KC_ZKHK, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC, KC_HENK, KC_KANA, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
41 ),
42
43 [1] = KEYMAP_JP(
44 KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
45 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
46 _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
47 _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
48 _______, _______, _______, _______, _______, _______ , _______, _______, _______, _______, _______, _______, _______
49 )
50};
51
52const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt) {
53 return MACRO_NONE;
54}
55
56const uint16_t PROGMEM fn_actions[] = {
57
58};
diff --git a/keyboards/hhkb/keymaps/rdg_jp/Makefile b/keyboards/hhkb/keymaps/rdg_jp/Makefile
new file mode 100644
index 000000000..92986292a
--- /dev/null
+++ b/keyboards/hhkb/keymaps/rdg_jp/Makefile
@@ -0,0 +1 @@
HHKB_JP=yes
diff --git a/keyboards/hhkb/keymaps/rdg_jp/keymap.c b/keyboards/hhkb/keymaps/rdg_jp/keymap.c
new file mode 100644
index 000000000..700ba3a0b
--- /dev/null
+++ b/keyboards/hhkb/keymaps/rdg_jp/keymap.c
@@ -0,0 +1,65 @@
1#include "hhkb.h"
2
3#define _______ KC_TRNS
4
5enum {
6 ZER,
7 HDN,
8 OSY
9};
10
11
12#define CTL_ESC CTL_T(KC_ESC)
13#define SFT_BSP SFT_T(KC_BSPC)
14
15#define SCRNS3 LGUI(LCTL(LSFT(KC_3)))
16#define SCRNS4 LGUI(LCTL(LSFT(KC_4)))
17
18
19/* hhkb jp ~ layout
20 * ,-----------------------------------------------------------.
21 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
22 * |-----------------------------------------------------------|
23 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
24 * |------------------------------------------------------` Ent|
25 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
26 * |-----------------------------------------------------------|
27 * |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
28 * |-----------------------------------------------------------|
29 * | ||Ctl|Alt|Cmd| | Spc |Bsp| | | ||Lft|Dwn|Rgh|
30 * `-----------------------------------------------------------'
31 */
32
33const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
34 [ZER] = KEYMAP_JP(
35 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INS, KC_BSPC,
36 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
37 CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_GRV, KC_ENT,
38 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_BSLS, KC_UP, KC_RSFT,
39 MO(HDN), KC_LCTL, KC_LALT, KC_LGUI, MO(HDN), KC_SPC, SFT_BSP, MO(HDN), MO(OSY), KC_NO, KC_LEFT, KC_DOWN, KC_RGHT
40 ),
41
42 [HDN] = KEYMAP_JP(
43 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_DEL,
44 _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______,
45 _______, KC_TILD, KC_GRV, KC_BSLS, KC_PIPE, KC_MINS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TILD, KC_GRV, _______, _______,
46 _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, _______, KC_ENT, _______, _______, _______, _______, KC_PGUP, _______,
47 _______, _______, _______, _______, _______, KC_UNDS , KC_DEL, _______, _______, _______, KC_HOME, KC_PGDN, KC_END
48 ),
49
50 [OSY] = KEYMAP_JP(
51 _______, _______, _______, SCRNS3, SCRNS4, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
52 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
53 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
54 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
55 _______, _______, _______, _______, _______, _______ , _______, _______, _______, _______, _______, _______, _______
56 )
57};
58
59const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt) {
60 return MACRO_NONE;
61}
62
63const uint16_t PROGMEM fn_actions[] = {
64
65};
diff --git a/keyboards/infinity_ergodox/Makefile b/keyboards/infinity_ergodox/Makefile
index efa32e037..7edc03d8c 100644
--- a/keyboards/infinity_ergodox/Makefile
+++ b/keyboards/infinity_ergodox/Makefile
@@ -67,6 +67,18 @@ SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend
67NKRO_ENABLE ?= yes # USB Nkey Rollover 67NKRO_ENABLE ?= yes # USB Nkey Rollover
68CUSTOM_MATRIX ?= yes # Custom matrix file 68CUSTOM_MATRIX ?= yes # Custom matrix file
69SERIAL_LINK_ENABLE = yes 69SERIAL_LINK_ENABLE = yes
70VISUALIZER_ENABLE ?= yes
71LCD_ENABLE ?= yes
72LED_ENABLE ?= yes
73LCD_BACKLIGHT_ENABLE ?= yes
74
75ifdef LCD_ENABLE
76include drivers/gdisp/st7565ergodox/driver.mk
77endif
78
79ifdef LED_ENABLE
80include drivers/gdisp/IS31FL3731C/driver.mk
81endif
70 82
71ifndef QUANTUM_DIR 83ifndef QUANTUM_DIR
72 include ../../Makefile 84 include ../../Makefile
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h b/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h
new file mode 100644
index 000000000..2ea73f1fb
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h
@@ -0,0 +1,113 @@
1/*
2Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef _GDISP_LLD_BOARD_H
19#define _GDISP_LLD_BOARD_H
20
21static const I2CConfig i2ccfg = {
22 400000 // clock speed (Hz); 400kHz max for IS31
23};
24
25#define GDISP_SCREEN_WIDTH 7
26#define GDISP_SCREEN_HEIGHT 7
27
28static const uint8_t led_mask[] = {
29 0xFF, 0x00, /* C1-1 -> C1-16 */
30 0xFF, 0x00, /* C2-1 -> C2-16 */
31 0xFF, 0x00, /* C3-1 -> C3-16 */
32 0xFF, 0x00, /* C4-1 -> C4-16 */
33 0x3F, 0x00, /* C5-1 -> C5-16 */
34 0x00, 0x00, /* C6-1 -> C6-16 */
35 0x00, 0x00, /* C7-1 -> C7-16 */
36 0x00, 0x00, /* C8-1 -> C8-16 */
37 0x00, 0x00, /* C9-1 -> C9-16 */
38};
39
40// The address of the LED
41#define LA(c, r) (c + r * 16 )
42// Need to be an address that is not mapped, but inside the range of the controller matrix
43#define NA LA(8, 8)
44
45// The numbers in the comments are the led numbers DXX on the PCB
46// The mapping is taken from the schematic of left hand side
47static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = {
48// 45 44 43 42 41 40 39
49 { LA(1, 1), LA(1, 0), LA(0, 4), LA(0, 3), LA(0, 2), LA(0, 1), LA(0, 0)},
50// 52 51 50 49 48 47 46
51 { LA(2, 3), LA(2, 2), LA(2, 1), LA(2, 0), LA(1, 4), LA(1, 3), LA(1, 2) },
52// 58 57 56 55 54 53 N/A
53 { LA(3, 4), LA(3, 3), LA(3, 2), LA(3, 1), LA(3, 0), LA(2, 4), NA },
54// 67 66 65 64 63 62 61
55 { LA(5, 3), LA(5, 2), LA(5, 1), LA(5, 0), LA(4, 4), LA(4, 3), LA(4, 2) },
56// 76 75 74 73 72 60 59
57 { LA(7, 3), LA(7, 2), LA(7, 1), LA(7, 0), LA(6, 3), LA(4, 1), LA(4, 0) },
58// N/A N/A N/A N/A N/A N/A 68
59 { NA, NA, NA, NA, NA, NA, LA(5, 4) },
60// N/A N/A N/A N/A 71 70 69
61 { NA, NA, NA, NA, LA(6, 2), LA(6, 1), LA(6, 0) },
62};
63
64
65#define IS31_ADDR_DEFAULT 0x74 // AD connected to GND
66#define IS31_TIMEOUT 5000
67
68static GFXINLINE void init_board(GDisplay *g) {
69 (void) g;
70 /* I2C pins */
71 palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL
72 palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA
73 palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL);
74 palClearPad(GPIOB, 16);
75 /* start I2C */
76 i2cStart(&I2CD1, &i2ccfg);
77 // try high drive (from kiibohd)
78 I2CD1.i2c->C2 |= I2Cx_C2_HDRS;
79 // try glitch fixing (from kiibohd)
80 I2CD1.i2c->FLT = 4;
81}
82
83static GFXINLINE void post_init_board(GDisplay *g) {
84 (void) g;
85}
86
87static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) {
88 (void) g;
89 return led_mask;
90}
91
92static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y)
93{
94 (void) g;
95 return led_mapping[y][x];
96}
97
98static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) {
99 (void) g;
100 if(!shutdown) {
101 palSetPad(GPIOB, 16);
102 }
103 else {
104 palClearPad(GPIOB, 16);
105 }
106}
107
108static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
109 (void) g;
110 i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT));
111}
112
113#endif /* _GDISP_LLD_BOARD_H */
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/driver.mk b/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/driver.mk
new file mode 100644
index 000000000..f32d0d868
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/driver.mk
@@ -0,0 +1,2 @@
1GFXINC += drivers/gdisp/IS31FL3731C
2GFXSRC += drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
new file mode 100644
index 000000000..1d21f0c49
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
@@ -0,0 +1,333 @@
1/*
2Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "gfx.h"
19
20#if GFX_USE_GDISP
21
22#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_ERGODOX
23#include "drivers/gdisp/IS31FL3731C/gdisp_lld_config.h"
24#include "src/gdisp/gdisp_driver.h"
25
26#include "board_IS31FL3731C.h"
27
28/*===========================================================================*/
29/* Driver local definitions. */
30/*===========================================================================*/
31
32#ifndef GDISP_SCREEN_HEIGHT
33 #define GDISP_SCREEN_HEIGHT 9
34#endif
35#ifndef GDISP_SCREEN_WIDTH
36 #define GDISP_SCREEN_WIDTH 16
37#endif
38#ifndef GDISP_INITIAL_CONTRAST
39 #define GDISP_INITIAL_CONTRAST 0
40#endif
41#ifndef GDISP_INITIAL_BACKLIGHT
42 #define GDISP_INITIAL_BACKLIGHT 100
43#endif
44
45#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
46
47#define IS31_ADDR_DEFAULT 0x74
48
49#define IS31_REG_CONFIG 0x00
50// bits in reg
51#define IS31_REG_CONFIG_PICTUREMODE 0x00
52#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
53#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
54// D2:D0 bits are starting frame for autoplay mode
55
56#define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode
57
58#define IS31_REG_AUTOPLAYCTRL1 0x02
59// D6:D4 number of loops (000=infty)
60// D2:D0 number of frames to be used
61
62#define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms)
63
64#define IS31_REG_DISPLAYOPT 0x05
65#define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames
66#define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8
67// D2:D0 bits blink period time (*0.27s)
68
69#define IS31_REG_AUDIOSYNC 0x06
70#define IS31_REG_AUDIOSYNC_ENABLE 0x1
71
72#define IS31_REG_FRAMESTATE 0x07
73
74#define IS31_REG_BREATHCTRL1 0x08
75// D6:D4 fade out time (26ms*2^i)
76// D2:D0 fade in time (26ms*2^i)
77
78#define IS31_REG_BREATHCTRL2 0x09
79#define IS31_REG_BREATHCTRL2_ENABLE 0x10
80// D2:D0 extinguish time (3.5ms*2^i)
81
82#define IS31_REG_SHUTDOWN 0x0A
83#define IS31_REG_SHUTDOWN_OFF 0x0
84#define IS31_REG_SHUTDOWN_ON 0x1
85
86#define IS31_REG_AGCCTRL 0x0B
87#define IS31_REG_ADCRATE 0x0C
88
89#define IS31_COMMANDREGISTER 0xFD
90#define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine'
91#define IS31_FUNCTIONREG_SIZE 0xD
92
93#define IS31_FRAME_SIZE 0xB4
94
95#define IS31_PWM_REG 0x24
96#define IS31_PWM_SIZE 0x90
97
98#define IS31_LED_MASK_SIZE 0x12
99#define IS31_SCREEN_WIDTH 16
100
101#define IS31
102
103//Generated by http://jared.geek.nz/2013/feb/linear-led-pwm
104const unsigned char cie[256] = {
105 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
106 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
108 3, 4, 4, 4, 4, 4, 4, 5, 5, 5,
109 5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
110 7, 8, 8, 8, 8, 9, 9, 9, 10, 10,
111 10, 10, 11, 11, 11, 12, 12, 12, 13, 13,
112 13, 14, 14, 15, 15, 15, 16, 16, 17, 17,
113 17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
114 22, 23, 23, 24, 24, 25, 25, 26, 26, 27,
115 28, 28, 29, 29, 30, 31, 31, 32, 32, 33,
116 34, 34, 35, 36, 37, 37, 38, 39, 39, 40,
117 41, 42, 43, 43, 44, 45, 46, 47, 47, 48,
118 49, 50, 51, 52, 53, 54, 54, 55, 56, 57,
119 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
120 68, 70, 71, 72, 73, 74, 75, 76, 77, 79,
121 80, 81, 82, 83, 85, 86, 87, 88, 90, 91,
122 92, 94, 95, 96, 98, 99, 100, 102, 103, 105,
123 106, 108, 109, 110, 112, 113, 115, 116, 118, 120,
124 121, 123, 124, 126, 128, 129, 131, 132, 134, 136,
125 138, 139, 141, 143, 145, 146, 148, 150, 152, 154,
126 155, 157, 159, 161, 163, 165, 167, 169, 171, 173,
127 175, 177, 179, 181, 183, 185, 187, 189, 191, 193,
128 196, 198, 200, 202, 204, 207, 209, 211, 214, 216,
129 218, 220, 223, 225, 228, 230, 232, 235, 237, 240,
130 242, 245, 247, 250, 252, 255,
131};
132
133
134/*===========================================================================*/
135/* Driver local functions. */
136/*===========================================================================*/
137
138typedef struct{
139 uint8_t write_buffer_offset;
140 uint8_t write_buffer[IS31_FRAME_SIZE];
141 uint8_t frame_buffer[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH];
142 uint8_t page;
143}__attribute__((__packed__)) PrivData;
144
145// Some common routines and macros
146#define PRIV(g) ((PrivData*)g->priv)
147
148/*===========================================================================*/
149/* Driver exported functions. */
150/*===========================================================================*/
151
152static GFXINLINE void write_page(GDisplay* g, uint8_t page) {
153 uint8_t tx[2] __attribute__((aligned(2)));
154 tx[0] = IS31_COMMANDREGISTER;
155 tx[1] = page;
156 write_data(g, tx, 2);
157}
158
159static GFXINLINE void write_register(GDisplay* g, uint8_t page, uint8_t reg, uint8_t data) {
160 uint8_t tx[2] __attribute__((aligned(2)));
161 tx[0] = reg;
162 tx[1] = data;
163 write_page(g, page);
164 write_data(g, tx, 2);
165}
166
167static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint16_t length) {
168 PRIV(g)->write_buffer_offset = offset;
169 write_page(g, page);
170 write_data(g, (uint8_t*)PRIV(g), length + 1);
171}
172
173LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
174 // The private area is the display surface.
175 g->priv = gfxAlloc(sizeof(PrivData));
176 __builtin_memset(PRIV(g), 0, sizeof(PrivData));
177 PRIV(g)->page = 0;
178
179 // Initialise the board interface
180 init_board(g);
181 gfxSleepMilliseconds(10);
182
183 // zero function page, all registers (assuming full_page is all zeroes)
184 write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
185 set_hardware_shutdown(g, false);
186 gfxSleepMilliseconds(10);
187 // software shutdown
188 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
189 gfxSleepMilliseconds(10);
190 // zero function page, all registers
191 write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
192 gfxSleepMilliseconds(10);
193
194
195 // zero all LED registers on all 8 pages, and enable the mask
196 __builtin_memcpy(PRIV(g)->write_buffer, get_led_mask(g), IS31_LED_MASK_SIZE);
197 for(uint8_t i=0; i<8; i++) {
198 write_ram(g, i, 0, IS31_FRAME_SIZE);
199 gfxSleepMilliseconds(1);
200 }
201
202 // software shutdown disable (i.e. turn stuff on)
203 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
204 gfxSleepMilliseconds(10);
205
206 // Finish Init
207 post_init_board(g);
208
209 /* Initialise the GDISP structure */
210 g->g.Width = GDISP_SCREEN_WIDTH;
211 g->g.Height = GDISP_SCREEN_HEIGHT;
212 g->g.Orientation = GDISP_ROTATE_0;
213 g->g.Powermode = powerOn;
214 g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
215 g->g.Contrast = GDISP_INITIAL_CONTRAST;
216 return TRUE;
217}
218
219#if GDISP_HARDWARE_FLUSH
220 LLDSPEC void gdisp_lld_flush(GDisplay *g) {
221 // Don't flush if we don't need it.
222 if (!(g->flags & GDISP_FLG_NEEDFLUSH))
223 return;
224
225 PRIV(g)->page++;
226 PRIV(g)->page %= 2;
227 // TODO: some smarter algorithm for this
228 // We should run only one physical page at a time
229 // This way we don't need to send so much data, and
230 // we could use slightly less memory
231 uint8_t* src = PRIV(g)->frame_buffer;
232 for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
233 for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
234 PRIV(g)->write_buffer[get_led_address(g, x, y)]=cie[*src];
235 ++src;
236 }
237 }
238 write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
239 gfxSleepMilliseconds(1);
240 write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
241
242 g->flags &= ~GDISP_FLG_NEEDFLUSH;
243 }
244#endif
245
246#if GDISP_HARDWARE_DRAWPIXEL
247 LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
248 coord_t x, y;
249
250 switch(g->g.Orientation) {
251 default:
252 case GDISP_ROTATE_0:
253 x = g->p.x;
254 y = g->p.y;
255 break;
256 case GDISP_ROTATE_180:
257 x = GDISP_SCREEN_WIDTH-1 - g->p.x;
258 y = g->p.y;
259 break;
260 }
261 PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
262 g->flags |= GDISP_FLG_NEEDFLUSH;
263 }
264#endif
265
266#if GDISP_HARDWARE_PIXELREAD
267 LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
268 coord_t x, y;
269
270 switch(g->g.Orientation) {
271 default:
272 case GDISP_ROTATE_0:
273 x = g->p.x;
274 y = g->p.y;
275 break;
276 case GDISP_ROTATE_180:
277 x = GDISP_SCREEN_WIDTH-1 - g->p.x;
278 y = g->p.y;
279 break;
280 }
281 return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
282 }
283#endif
284
285#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
286 LLDSPEC void gdisp_lld_control(GDisplay *g) {
287 switch(g->p.x) {
288 case GDISP_CONTROL_POWER:
289 if (g->g.Powermode == (powermode_t)g->p.ptr)
290 return;
291 switch((powermode_t)g->p.ptr) {
292 case powerOff:
293 case powerSleep:
294 case powerDeepSleep:
295 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
296 break;
297 case powerOn:
298 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
299 break;
300 default:
301 return;
302 }
303 g->g.Powermode = (powermode_t)g->p.ptr;
304 return;
305
306 case GDISP_CONTROL_ORIENTATION:
307 if (g->g.Orientation == (orientation_t)g->p.ptr)
308 return;
309 switch((orientation_t)g->p.ptr) {
310 /* Rotation is handled by the drawing routines */
311 case GDISP_ROTATE_0:
312 case GDISP_ROTATE_180:
313 g->g.Height = GDISP_SCREEN_HEIGHT;
314 g->g.Width = GDISP_SCREEN_WIDTH;
315 break;
316 case GDISP_ROTATE_90:
317 case GDISP_ROTATE_270:
318 g->g.Height = GDISP_SCREEN_WIDTH;
319 g->g.Width = GDISP_SCREEN_HEIGHT;
320 break;
321 default:
322 return;
323 }
324 g->g.Orientation = (orientation_t)g->p.ptr;
325 return;
326
327 case GDISP_CONTROL_CONTRAST:
328 return;
329 }
330 }
331#endif // GDISP_NEED_CONTROL
332
333#endif // GFX_USE_GDISP
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h b/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
new file mode 100644
index 000000000..bb28ad775
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
@@ -0,0 +1,36 @@
1/*
2Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef _GDISP_LLD_CONFIG_H
19#define _GDISP_LLD_CONFIG_H
20
21#if GFX_USE_GDISP
22
23/*===========================================================================*/
24/* Driver hardware support. */
25/*===========================================================================*/
26
27#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
28#define GDISP_HARDWARE_DRAWPIXEL TRUE
29#define GDISP_HARDWARE_PIXELREAD TRUE
30#define GDISP_HARDWARE_CONTROL TRUE
31
32#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
33
34#endif /* GFX_USE_GDISP */
35
36#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/emulator_lcd/driver.mk b/keyboards/infinity_ergodox/drivers/gdisp/emulator_lcd/driver.mk
new file mode 100644
index 000000000..16c3f80f5
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/emulator_lcd/driver.mk
@@ -0,0 +1,2 @@
1GFXINC += drivers/gdisp/emulator_lcd
2GFXSRC += drivers/gdisp/emulator_lcd/emulator_lcd.c
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/emulator_lcd/emulator_lcd.c b/keyboards/infinity_ergodox/drivers/gdisp/emulator_lcd/emulator_lcd.c
new file mode 100644
index 000000000..babfe2b36
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/emulator_lcd/emulator_lcd.c
@@ -0,0 +1,10 @@
1#define GDISP_DRIVER_VMT GDISPVMT_EMULATOR_LCD_ERGODOX
2#define GDISP_HARDWARE_DRAWPIXEL TRUE
3#define GDISP_HARDWARE_PIXELREAD TRUE
4#define GDISP_HARDWARE_CONTROL TRUE
5#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
6#define GDISP_SCREEN_WIDTH 128
7#define GDISP_SCREEN_HEIGHT 32
8#define ROTATE_180_IS_FLIP
9
10#include "emulator/emulator_driver_impl.h"
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/emulator_led/driver.mk b/keyboards/infinity_ergodox/drivers/gdisp/emulator_led/driver.mk
new file mode 100644
index 000000000..255434432
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/emulator_led/driver.mk
@@ -0,0 +1,2 @@
1GFXINC += drivers/gdisp/emulator_led
2GFXSRC += drivers/gdisp/emulator_led/emulator_led.c
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/emulator_led/emulator_led.c b/keyboards/infinity_ergodox/drivers/gdisp/emulator_led/emulator_led.c
new file mode 100644
index 000000000..b0ebcdc47
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/emulator_led/emulator_led.c
@@ -0,0 +1,10 @@
1#define GDISP_DRIVER_VMT GDISPVMT_EMULATOR_LED_ERGODOX
2#define GDISP_HARDWARE_DRAWPIXEL TRUE
3#define GDISP_HARDWARE_PIXELREAD TRUE
4#define GDISP_HARDWARE_CONTROL TRUE
5#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
6#define GDISP_SCREEN_WIDTH 7
7#define GDISP_SCREEN_HEIGHT 7
8#define ROTATE_180_IS_FLIP
9
10#include "emulator/emulator_driver_impl.h"
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/board_ST7565.h b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/board_ST7565.h
new file mode 100644
index 000000000..290571ce5
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/board_ST7565.h
@@ -0,0 +1,127 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#ifndef _GDISP_LLD_BOARD_H
9#define _GDISP_LLD_BOARD_H
10
11#include "print.h"
12
13#define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6
14#define ST7565_ADC ST7565_ADC_NORMAL
15#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
16#define ST7565_PAGE_ORDER 0,1,2,3
17/*
18 * Custom page order for several LCD boards, e.g. HEM12864-99
19 * #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
20 */
21
22#define ST7565_GPIOPORT GPIOC
23#define ST7565_PORT PORTC
24#define ST7565_A0_PIN 7
25#define ST7565_RST_PIN 8
26#define ST7565_MOSI_PIN 6
27#define ST7565_SLCK_PIN 5
28#define ST7565_SS_PIN 4
29
30#define palSetPadModeRaw(portname, bits) \
31 ST7565_PORT->PCR[ST7565_##portname##_PIN] = bits
32
33#define palSetPadModeNamed(portname, portmode) \
34 palSetPadMode(ST7565_GPIOPORT, ST7565_##portname##_PIN, portmode)
35
36#define ST7565_SPI_MODE PORTx_PCRn_DSE | PORTx_PCRn_MUX(2)
37// DSPI Clock and Transfer Attributes
38// Frame Size: 8 bits
39// MSB First
40// CLK Low by default
41static const SPIConfig spi1config = {
42 NULL,
43 /* HW dependent part.*/
44 ST7565_GPIOPORT,
45 ST7565_SS_PIN,
46 SPIx_CTARn_FMSZ(7)
47 | SPIx_CTARn_ASC(7)
48 | SPIx_CTARn_DT(7)
49 | SPIx_CTARn_CSSCK(7)
50 | SPIx_CTARn_PBR(0)
51 | SPIx_CTARn_BR(7)
52 //SPI_CR1_BR_0
53};
54
55static bool_t st7565_is_data_mode = 1;
56
57static GFXINLINE void init_board(GDisplay *g) {
58 (void) g;
59 palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL);
60 palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
61 st7565_is_data_mode = 1;
62 palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL);
63 palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
64 palSetPadModeRaw(MOSI, ST7565_SPI_MODE);
65 palSetPadModeRaw(SLCK, ST7565_SPI_MODE);
66 palSetPadModeRaw(SS, ST7565_SPI_MODE);
67
68 spiInit();
69 spiStart(&SPID1, &spi1config);
70 spiSelect(&SPID1);
71}
72
73static GFXINLINE void post_init_board(GDisplay *g) {
74 (void) g;
75}
76
77static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
78 (void) g;
79 if (state) {
80 palClearPad(ST7565_GPIOPORT, ST7565_RST_PIN);
81 }
82 else {
83 palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
84 }
85}
86
87static GFXINLINE void acquire_bus(GDisplay *g) {
88 (void) g;
89 // Only the LCD is using the SPI bus, so no need to acquire
90 // spiAcquireBus(&SPID1);
91}
92
93static GFXINLINE void release_bus(GDisplay *g) {
94 (void) g;
95 // Only the LCD is using the SPI bus, so no need to release
96 //spiReleaseBus(&SPID1);
97}
98
99static GFXINLINE void write_cmd(GDisplay *g, uint8_t cmd) {
100 (void) g;
101 if (st7565_is_data_mode) {
102 // The sleeps need to be at lest 10 vs 25 ns respectively
103 // So let's sleep two ticks, one tick might not be enough
104 // if we are at the end of the tick
105 chThdSleep(2);
106 palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN);
107 chThdSleep(2);
108 st7565_is_data_mode = 0;
109 }
110 spiSend(&SPID1, 1, &cmd);
111}
112
113static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
114 (void) g;
115 if (!st7565_is_data_mode) {
116 // The sleeps need to be at lest 10 vs 25 ns respectively
117 // So let's sleep two ticks, one tick might not be enough
118 // if we are at the end of the tick
119 chThdSleep(2);
120 palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
121 chThdSleep(2);
122 st7565_is_data_mode = 1;
123 }
124 spiSend(&SPID1, length, data);
125}
126
127#endif /* _GDISP_LLD_BOARD_H */
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/driver.mk b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/driver.mk
new file mode 100644
index 000000000..889a1a031
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/driver.mk
@@ -0,0 +1,2 @@
1GFXINC += drivers/gdisp/st7565ergodox
2GFXSRC += drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
new file mode 100644
index 000000000..c33aea81a
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
@@ -0,0 +1,292 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#include "gfx.h"
9
10#if GFX_USE_GDISP
11
12#define GDISP_DRIVER_VMT GDISPVMT_ST7565_ERGODOX
13#include "drivers/gdisp/st7565ergodox/gdisp_lld_config.h"
14#include "src/gdisp/gdisp_driver.h"
15
16#include "board_ST7565.h"
17
18/*===========================================================================*/
19/* Driver local definitions. */
20/*===========================================================================*/
21
22#ifndef GDISP_SCREEN_HEIGHT
23 #define GDISP_SCREEN_HEIGHT 32
24#endif
25#ifndef GDISP_SCREEN_WIDTH
26 #define GDISP_SCREEN_WIDTH 128
27#endif
28#ifndef GDISP_INITIAL_CONTRAST
29 #define GDISP_INITIAL_CONTRAST 0
30#endif
31#ifndef GDISP_INITIAL_BACKLIGHT
32 #define GDISP_INITIAL_BACKLIGHT 100
33#endif
34
35#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
36
37#include "drivers/gdisp/st7565ergodox/st7565.h"
38
39/*===========================================================================*/
40/* Driver config defaults for backward compatibility. */
41/*===========================================================================*/
42#ifndef ST7565_LCD_BIAS
43 #define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
44#endif
45#ifndef ST7565_ADC
46 #define ST7565_ADC ST7565_ADC_NORMAL
47#endif
48#ifndef ST7565_COM_SCAN
49 #define ST7565_COM_SCAN ST7565_COM_SCAN_INC
50#endif
51#ifndef ST7565_PAGE_ORDER
52 #define ST7565_PAGE_ORDER 0,1,2,3
53#endif
54
55/*===========================================================================*/
56/* Driver local functions. */
57/*===========================================================================*/
58
59typedef struct{
60 bool_t buffer2;
61 uint8_t ram[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8];
62}PrivData;
63
64// Some common routines and macros
65#define PRIV(g) ((PrivData*)g->priv)
66#define RAM(g) (PRIV(g)->ram)
67#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
68#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
69
70// Some common routines and macros
71#define delay(us) gfxSleepMicroseconds(us)
72#define delay_ms(ms) gfxSleepMilliseconds(ms)
73
74#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH)
75#define xybit(y) (1<<((y)&7))
76
77/*===========================================================================*/
78/* Driver exported functions. */
79/*===========================================================================*/
80
81/*
82 * As this controller can't update on a pixel boundary we need to maintain the
83 * the entire display surface in memory so that we can do the necessary bit
84 * operations. Fortunately it is a small display in monochrome.
85 * 64 * 128 / 8 = 1024 bytes.
86 */
87
88LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
89 // The private area is the display surface.
90 g->priv = gfxAlloc(sizeof(PrivData));
91 PRIV(g)->buffer2 = false;
92
93 // Initialise the board interface
94 init_board(g);
95
96 // Hardware reset
97 setpin_reset(g, TRUE);
98 gfxSleepMilliseconds(20);
99 setpin_reset(g, FALSE);
100 gfxSleepMilliseconds(20);
101
102 acquire_bus(g);
103 write_cmd(g, ST7565_DISPLAY_OFF);
104 write_cmd(g, ST7565_LCD_BIAS);
105 write_cmd(g, ST7565_ADC);
106 write_cmd(g, ST7565_COM_SCAN);
107
108 write_cmd(g, ST7565_START_LINE | 0);
109
110 write_cmd(g, ST7565_RESISTOR_RATIO | 0x6);
111
112 // turn on voltage converter (VC=1, VR=0, VF=0)
113 write_cmd(g, ST7565_POWER_CONTROL | 0x04);
114 delay_ms(50);
115
116 // turn on voltage regulator (VC=1, VR=1, VF=0)
117 write_cmd(g, ST7565_POWER_CONTROL | 0x06);
118 delay_ms(50);
119
120 // turn on voltage follower (VC=1, VR=1, VF=1)
121 write_cmd(g, ST7565_POWER_CONTROL | 0x07);
122 delay_ms(50);
123
124 write_cmd(g, 0xE2);
125 write_cmd(g, ST7565_COM_SCAN);
126 write_cmd2(g, ST7565_CONTRAST, GDISP_INITIAL_CONTRAST*64/101);
127 //write_cmd2(g, ST7565_CONTRAST, 0);
128 write_cmd(g, ST7565_DISPLAY_ON);
129 write_cmd(g, ST7565_ALLON_NORMAL);
130 write_cmd(g, ST7565_INVERT_DISPLAY);
131
132 write_cmd(g, ST7565_RMW);
133
134 // Finish Init
135 post_init_board(g);
136
137 // Release the bus
138 release_bus(g);
139
140 /* Initialise the GDISP structure */
141 g->g.Width = GDISP_SCREEN_WIDTH;
142 g->g.Height = GDISP_SCREEN_HEIGHT;
143 g->g.Orientation = GDISP_ROTATE_0;
144 g->g.Powermode = powerOn;
145 g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
146 g->g.Contrast = GDISP_INITIAL_CONTRAST;
147 return TRUE;
148}
149
150#if GDISP_HARDWARE_FLUSH
151 LLDSPEC void gdisp_lld_flush(GDisplay *g) {
152 unsigned p;
153
154 // Don't flush if we don't need it.
155 if (!(g->flags & GDISP_FLG_NEEDFLUSH))
156 return;
157
158 acquire_bus(g);
159 unsigned dstOffset = (PRIV(g)->buffer2 ? 4 : 0);
160 for (p = 0; p < 4; p++) {
161 write_cmd(g, ST7565_PAGE | (p + dstOffset));
162 write_cmd(g, ST7565_COLUMN_MSB | 0);
163 write_cmd(g, ST7565_COLUMN_LSB | 0);
164 write_cmd(g, ST7565_RMW);
165 write_data(g, RAM(g) + (p*GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH);
166 }
167 unsigned line = (PRIV(g)->buffer2 ? 32 : 0);
168 write_cmd(g, ST7565_START_LINE | line);
169 PRIV(g)->buffer2 = !PRIV(g)->buffer2;
170 release_bus(g);
171
172 g->flags &= ~GDISP_FLG_NEEDFLUSH;
173 }
174#endif
175
176#if GDISP_HARDWARE_DRAWPIXEL
177 LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
178 coord_t x, y;
179
180 switch(g->g.Orientation) {
181 default:
182 case GDISP_ROTATE_0:
183 x = g->p.x;
184 y = g->p.y;
185 break;
186 case GDISP_ROTATE_90:
187 x = g->p.y;
188 y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
189 break;
190 case GDISP_ROTATE_180:
191 x = GDISP_SCREEN_WIDTH-1 - g->p.x;
192 y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
193 break;
194 case GDISP_ROTATE_270:
195 x = GDISP_SCREEN_HEIGHT-1 - g->p.y;
196 y = g->p.x;
197 break;
198 }
199 if (gdispColor2Native(g->p.color) != Black)
200 RAM(g)[xyaddr(x, y)] |= xybit(y);
201 else
202 RAM(g)[xyaddr(x, y)] &= ~xybit(y);
203 g->flags |= GDISP_FLG_NEEDFLUSH;
204 }
205#endif
206
207#if GDISP_HARDWARE_PIXELREAD
208 LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
209 coord_t x, y;
210
211 switch(g->g.Orientation) {
212 default:
213 case GDISP_ROTATE_0:
214 x = g->p.x;
215 y = g->p.y;
216 break;
217 case GDISP_ROTATE_90:
218 x = g->p.y;
219 y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
220 break;
221 case GDISP_ROTATE_180:
222 x = GDISP_SCREEN_WIDTH-1 - g->p.x;
223 y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
224 break;
225 case GDISP_ROTATE_270:
226 x = GDISP_SCREEN_HEIGHT-1 - g->p.y;
227 y = g->p.x;
228 break;
229 }
230 return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black;
231 }
232#endif
233
234#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
235 LLDSPEC void gdisp_lld_control(GDisplay *g) {
236 switch(g->p.x) {
237 case GDISP_CONTROL_POWER:
238 if (g->g.Powermode == (powermode_t)g->p.ptr)
239 return;
240 switch((powermode_t)g->p.ptr) {
241 case powerOff:
242 case powerSleep:
243 case powerDeepSleep:
244 acquire_bus(g);
245 write_cmd(g, ST7565_DISPLAY_OFF);
246 release_bus(g);
247 break;
248 case powerOn:
249 acquire_bus(g);
250 write_cmd(g, ST7565_DISPLAY_ON);
251 release_bus(g);
252 break;
253 default:
254 return;
255 }
256 g->g.Powermode = (powermode_t)g->p.ptr;
257 return;
258
259 case GDISP_CONTROL_ORIENTATION:
260 if (g->g.Orientation == (orientation_t)g->p.ptr)
261 return;
262 switch((orientation_t)g->p.ptr) {
263 /* Rotation is handled by the drawing routines */
264 case GDISP_ROTATE_0:
265 case GDISP_ROTATE_180:
266 g->g.Height = GDISP_SCREEN_HEIGHT;
267 g->g.Width = GDISP_SCREEN_WIDTH;
268 break;
269 case GDISP_ROTATE_90:
270 case GDISP_ROTATE_270:
271 g->g.Height = GDISP_SCREEN_WIDTH;
272 g->g.Width = GDISP_SCREEN_HEIGHT;
273 break;
274 default:
275 return;
276 }
277 g->g.Orientation = (orientation_t)g->p.ptr;
278 return;
279
280 case GDISP_CONTROL_CONTRAST:
281 if ((unsigned)g->p.ptr > 100)
282 g->p.ptr = (void *)100;
283 acquire_bus(g);
284 write_cmd2(g, ST7565_CONTRAST, ((((unsigned)g->p.ptr)<<6)/101) & 0x3F);
285 release_bus(g);
286 g->g.Contrast = (unsigned)g->p.ptr;
287 return;
288 }
289 }
290#endif // GDISP_NEED_CONTROL
291
292#endif // GFX_USE_GDISP
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/gdisp_lld_config.h b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/gdisp_lld_config.h
new file mode 100644
index 000000000..48587b9e1
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/gdisp_lld_config.h
@@ -0,0 +1,26 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#ifndef _GDISP_LLD_CONFIG_H
9#define _GDISP_LLD_CONFIG_H
10
11#if GFX_USE_GDISP
12
13/*===========================================================================*/
14/* Driver hardware support. */
15/*===========================================================================*/
16
17#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
18#define GDISP_HARDWARE_DRAWPIXEL TRUE
19#define GDISP_HARDWARE_PIXELREAD TRUE
20#define GDISP_HARDWARE_CONTROL TRUE
21
22#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
23
24#endif /* GFX_USE_GDISP */
25
26#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/st7565.h b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/st7565.h
new file mode 100644
index 000000000..48636b33d
--- /dev/null
+++ b/keyboards/infinity_ergodox/drivers/gdisp/st7565ergodox/st7565.h
@@ -0,0 +1,37 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#ifndef _ST7565_H
9#define _ST7565_H
10
11#define ST7565_CONTRAST 0x81
12#define ST7565_ALLON_NORMAL 0xA4
13#define ST7565_ALLON 0xA5
14#define ST7565_POSITIVE_DISPLAY 0xA6
15#define ST7565_INVERT_DISPLAY 0xA7
16#define ST7565_DISPLAY_OFF 0xAE
17#define ST7565_DISPLAY_ON 0xAF
18
19#define ST7565_LCD_BIAS_7 0xA3
20#define ST7565_LCD_BIAS_9 0xA2
21
22#define ST7565_ADC_NORMAL 0xA0
23#define ST7565_ADC_REVERSE 0xA1
24
25#define ST7565_COM_SCAN_INC 0xC0
26#define ST7565_COM_SCAN_DEC 0xC8
27
28#define ST7565_START_LINE 0x40
29#define ST7565_PAGE 0xB0
30#define ST7565_COLUMN_MSB 0x10
31#define ST7565_COLUMN_LSB 0x00
32#define ST7565_RMW 0xE0
33
34#define ST7565_RESISTOR_RATIO 0x20
35#define ST7565_POWER_CONTROL 0x28
36
37#endif /* _ST7565_H */
diff --git a/keyboards/infinity_ergodox/gfxconf.h b/keyboards/infinity_ergodox/gfxconf.h
new file mode 100644
index 000000000..8caa577b7
--- /dev/null
+++ b/keyboards/infinity_ergodox/gfxconf.h
@@ -0,0 +1,331 @@
1/**
2 * This file has a different license to the rest of the uGFX system.
3 * You can copy, modify and distribute this file as you see fit.
4 * You do not need to publish your source modifications to this file.
5 * The only thing you are not permitted to do is to relicense it
6 * under a different license.
7 */
8
9/**
10 * Copy this file into your project directory and rename it as gfxconf.h
11 * Edit your copy to turn on the uGFX features you want to use.
12 * The values below are the defaults.
13 *
14 * Only remove the comments from lines where you want to change the
15 * default value. This allows definitions to be included from
16 * driver makefiles when required and provides the best future
17 * compatibility for your project.
18 *
19 * Please use spaces instead of tabs in this file.
20 */
21
22#ifndef _GFXCONF_H
23#define _GFXCONF_H
24
25
26///////////////////////////////////////////////////////////////////////////
27// GOS - One of these must be defined, preferably in your Makefile //
28///////////////////////////////////////////////////////////////////////////
29//#define GFX_USE_OS_CHIBIOS TRUE
30//#define GFX_USE_OS_FREERTOS FALSE
31// #define GFX_FREERTOS_USE_TRACE FALSE
32//#define GFX_USE_OS_WIN32 FALSE
33//#define GFX_USE_OS_LINUX FALSE
34//#define GFX_USE_OS_OSX FALSE
35//#define GFX_USE_OS_ECOS FALSE
36//#define GFX_USE_OS_RAWRTOS FALSE
37//#define GFX_USE_OS_ARDUINO FALSE
38//#define GFX_USE_OS_KEIL FALSE
39//#define GFX_USE_OS_CMSIS FALSE
40//#define GFX_USE_OS_RAW32 FALSE
41// #define INTERRUPTS_OFF() optional_code
42// #define INTERRUPTS_ON() optional_code
43// These are not defined by default for some reason
44#define GOS_NEED_X_THREADS FALSE
45#define GOS_NEED_X_HEAP FALSE
46
47// Options that (should where relevant) apply to all operating systems
48 #define GFX_NO_INLINE FALSE
49// #define GFX_COMPILER GFX_COMPILER_UNKNOWN
50// #define GFX_CPU GFX_CPU_UNKNOWN
51// #define GFX_OS_HEAP_SIZE 0
52// #define GFX_OS_NO_INIT FALSE
53// #define GFX_OS_INIT_NO_WARNING FALSE
54// #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine
55// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
56// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
57
58
59///////////////////////////////////////////////////////////////////////////
60// GDISP //
61///////////////////////////////////////////////////////////////////////////
62#define GFX_USE_GDISP TRUE
63
64//#define GDISP_NEED_AUTOFLUSH FALSE
65//#define GDISP_NEED_TIMERFLUSH FALSE
66//#define GDISP_NEED_VALIDATION TRUE
67//#define GDISP_NEED_CLIP TRUE
68#define GDISP_NEED_CIRCLE TRUE
69#define GDISP_NEED_ELLIPSE TRUE
70#define GDISP_NEED_ARC TRUE
71#define GDISP_NEED_ARCSECTORS TRUE
72#define GDISP_NEED_CONVEX_POLYGON TRUE
73//#define GDISP_NEED_SCROLL FALSE
74#define GDISP_NEED_PIXELREAD TRUE
75#define GDISP_NEED_CONTROL TRUE
76//#define GDISP_NEED_QUERY FALSE
77//#define GDISP_NEED_MULTITHREAD FALSE
78//#define GDISP_NEED_STREAMING FALSE
79#define GDISP_NEED_TEXT TRUE
80// #define GDISP_NEED_TEXT_WORDWRAP FALSE
81// #define GDISP_NEED_ANTIALIAS FALSE
82// #define GDISP_NEED_UTF8 FALSE
83 #define GDISP_NEED_TEXT_KERNING TRUE
84// #define GDISP_INCLUDE_FONT_UI1 FALSE
85// #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font.
86// #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
87// #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
88// #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
89// #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
90// #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE
91// #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
92// #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
93 #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE
94// #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE
95// #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE
96 #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE
97// #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
98// #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
99// #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE
100// #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
101// #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
102// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
103// #define GDISP_INCLUDE_USER_FONTS FALSE
104
105//#define GDISP_NEED_IMAGE FALSE
106// #define GDISP_NEED_IMAGE_NATIVE FALSE
107// #define GDISP_NEED_IMAGE_GIF FALSE
108// #define GDISP_NEED_IMAGE_BMP FALSE
109// #define GDISP_NEED_IMAGE_BMP_1 FALSE
110// #define GDISP_NEED_IMAGE_BMP_4 FALSE
111// #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE
112// #define GDISP_NEED_IMAGE_BMP_8 FALSE
113// #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE
114// #define GDISP_NEED_IMAGE_BMP_16 FALSE
115// #define GDISP_NEED_IMAGE_BMP_24 FALSE
116// #define GDISP_NEED_IMAGE_BMP_32 FALSE
117// #define GDISP_NEED_IMAGE_JPG FALSE
118// #define GDISP_NEED_IMAGE_PNG FALSE
119// #define GDISP_NEED_IMAGE_ACCOUNTING FALSE
120#ifdef EMULATOR
121#define GDISP_NEED_PIXMAP TRUE
122#endif
123// #define GDISP_NEED_PIXMAP_IMAGE FALSE
124
125//#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used.
126//#define GDISP_LINEBUF_SIZE 128
127//#define GDISP_STARTUP_COLOR Black
128#define GDISP_NEED_STARTUP_LOGO FALSE
129
130//#define GDISP_TOTAL_DISPLAYS 2
131
132#ifndef EMULATOR
133#define GDISP_DRIVER_LIST GDISPVMT_ST7565_ERGODOX, GDISPVMT_IS31FL3731C_ERGODOX
134#else
135#define GDISP_DRIVER_LIST GDISPVMT_EMULATOR_LCD_ERGODOX, GDISPVMT_EMULATOR_LED_ERGODOX
136#endif
137
138 #ifdef GDISP_DRIVER_LIST
139 // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
140 #define GDISP_HARDWARE_STREAM_WRITE FALSE
141 #define GDISP_HARDWARE_STREAM_READ FALSE
142 #define GDISP_HARDWARE_STREAM_POS FALSE
143 #define GDISP_HARDWARE_DRAWPIXEL TRUE
144 #define GDISP_HARDWARE_CLEARS FALSE
145 #define GDISP_HARDWARE_FILLS FALSE
146 #define GDISP_HARDWARE_BITFILLS FALSE
147 #define GDISP_HARDWARE_SCROLL FALSE
148 #define GDISP_HARDWARE_PIXELREAD TRUE
149 #define GDISP_HARDWARE_CONTROL TRUE
150 #define GDISP_HARDWARE_QUERY FALSE
151 #define GDISP_HARDWARE_CLIP FALSE
152
153 #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
154 #endif
155
156// The custom format is not defined for some reason, so define it as error
157// so we don't get compiler warnings
158#define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR
159
160#define GDISP_USE_GFXNET FALSE
161// #define GDISP_GFXNET_PORT 13001
162// #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE
163// #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE
164// #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE
165
166
167///////////////////////////////////////////////////////////////////////////
168// GWIN //
169///////////////////////////////////////////////////////////////////////////
170#define GFX_USE_GWIN FALSE
171
172//#define GWIN_NEED_WINDOWMANAGER FALSE
173// #define GWIN_REDRAW_IMMEDIATE FALSE
174// #define GWIN_REDRAW_SINGLEOP FALSE
175// #define GWIN_NEED_FLASHING FALSE
176// #define GWIN_FLASHING_PERIOD 250
177
178//#define GWIN_NEED_CONSOLE FALSE
179// #define GWIN_CONSOLE_USE_HISTORY FALSE
180// #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE
181// #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE
182// #define GWIN_CONSOLE_ESCSEQ FALSE
183// #define GWIN_CONSOLE_USE_BASESTREAM FALSE
184// #define GWIN_CONSOLE_USE_FLOAT FALSE
185//#define GWIN_NEED_GRAPH FALSE
186//#define GWIN_NEED_GL3D FALSE
187
188//#define GWIN_NEED_WIDGET FALSE
189//#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1
190// #define GWIN_NEED_LABEL FALSE
191// #define GWIN_LABEL_ATTRIBUTE FALSE
192// #define GWIN_NEED_BUTTON FALSE
193// #define GWIN_BUTTON_LAZY_RELEASE FALSE
194// #define GWIN_NEED_SLIDER FALSE
195// #define GWIN_SLIDER_NOSNAP FALSE
196// #define GWIN_SLIDER_DEAD_BAND 5
197// #define GWIN_SLIDER_TOGGLE_INC 20
198// #define GWIN_NEED_CHECKBOX FALSE
199// #define GWIN_NEED_IMAGE FALSE
200// #define GWIN_NEED_IMAGE_ANIMATION FALSE
201// #define GWIN_NEED_RADIO FALSE
202// #define GWIN_NEED_LIST FALSE
203// #define GWIN_NEED_LIST_IMAGES FALSE
204// #define GWIN_NEED_PROGRESSBAR FALSE
205// #define GWIN_PROGRESSBAR_AUTO FALSE
206// #define GWIN_NEED_KEYBOARD FALSE
207// #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1
208// #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE
209// #define GWIN_NEED_TEXTEDIT FALSE
210// #define GWIN_FLAT_STYLING FALSE
211// #define GWIN_WIDGET_TAGS FALSE
212
213//#define GWIN_NEED_CONTAINERS FALSE
214// #define GWIN_NEED_CONTAINER FALSE
215// #define GWIN_NEED_FRAME FALSE
216// #define GWIN_NEED_TABSET FALSE
217// #define GWIN_TABSET_TABHEIGHT 18
218
219
220///////////////////////////////////////////////////////////////////////////
221// GEVENT //
222///////////////////////////////////////////////////////////////////////////
223#define GFX_USE_GEVENT TRUE
224
225//#define GEVENT_ASSERT_NO_RESOURCE FALSE
226//#define GEVENT_MAXIMUM_SIZE 32
227//#define GEVENT_MAX_SOURCE_LISTENERS 32
228
229
230///////////////////////////////////////////////////////////////////////////
231// GTIMER //
232///////////////////////////////////////////////////////////////////////////
233#define GFX_USE_GTIMER FALSE
234
235//#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
236//#define GTIMER_THREAD_WORKAREA_SIZE 2048
237
238
239///////////////////////////////////////////////////////////////////////////
240// GQUEUE //
241///////////////////////////////////////////////////////////////////////////
242#define GFX_USE_GQUEUE FALSE
243
244//#define GQUEUE_NEED_ASYNC FALSE
245//#define GQUEUE_NEED_GSYNC FALSE
246//#define GQUEUE_NEED_FSYNC FALSE
247//#define GQUEUE_NEED_BUFFERS FALSE
248
249///////////////////////////////////////////////////////////////////////////
250// GINPUT //
251///////////////////////////////////////////////////////////////////////////
252#define GFX_USE_GINPUT FALSE
253
254//#define GINPUT_NEED_MOUSE FALSE
255// #define GINPUT_TOUCH_STARTRAW FALSE
256// #define GINPUT_TOUCH_NOTOUCH FALSE
257// #define GINPUT_TOUCH_NOCALIBRATE FALSE
258// #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
259// #define GINPUT_MOUSE_POLL_PERIOD 25
260// #define GINPUT_MOUSE_CLICK_TIME 300
261// #define GINPUT_TOUCH_CXTCLICK_TIME 700
262// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
263// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
264// #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32
265//#define GINPUT_NEED_KEYBOARD FALSE
266// #define GINPUT_KEYBOARD_POLL_PERIOD 200
267// #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
268// #define GKEYBOARD_LAYOUT_OFF FALSE
269// #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE
270//#define GINPUT_NEED_TOGGLE FALSE
271//#define GINPUT_NEED_DIAL FALSE
272
273
274///////////////////////////////////////////////////////////////////////////
275// GFILE //
276///////////////////////////////////////////////////////////////////////////
277#define GFX_USE_GFILE FALSE
278
279//#define GFILE_NEED_PRINTG FALSE
280//#define GFILE_NEED_SCANG FALSE
281//#define GFILE_NEED_STRINGS FALSE
282//#define GFILE_NEED_FILELISTS FALSE
283//#define GFILE_NEED_STDIO FALSE
284//#define GFILE_NEED_NOAUTOMOUNT FALSE
285//#define GFILE_NEED_NOAUTOSYNC FALSE
286
287//#define GFILE_NEED_MEMFS FALSE
288//#define GFILE_NEED_ROMFS FALSE
289//#define GFILE_NEED_RAMFS FALSE
290//#define GFILE_NEED_FATFS FALSE
291//#define GFILE_NEED_NATIVEFS FALSE
292//#define GFILE_NEED_CHBIOSFS FALSE
293
294//#define GFILE_ALLOW_FLOATS FALSE
295//#define GFILE_ALLOW_DEVICESPECIFIC FALSE
296//#define GFILE_MAX_GFILES 3
297
298///////////////////////////////////////////////////////////////////////////
299// GADC //
300///////////////////////////////////////////////////////////////////////////
301#define GFX_USE_GADC FALSE
302
303//#define GADC_MAX_LOWSPEED_DEVICES 4
304
305
306///////////////////////////////////////////////////////////////////////////
307// GAUDIO //
308///////////////////////////////////////////////////////////////////////////
309#define GFX_USE_GAUDIO FALSE
310// There seems to be a bug in the ugfx code, the wrong define is used
311// So define it in order to avoid warnings
312#define GFX_USE_GAUDIN GFX_USE_GAUDIO
313// #define GAUDIO_NEED_PLAY FALSE
314// #define GAUDIO_NEED_RECORD FALSE
315
316
317///////////////////////////////////////////////////////////////////////////
318// GMISC //
319///////////////////////////////////////////////////////////////////////////
320#define GFX_USE_GMISC TRUE
321
322//#define GMISC_NEED_ARRAYOPS FALSE
323//#define GMISC_NEED_FASTTRIG FALSE
324//#define GMISC_NEED_FIXEDTRIG FALSE
325//#define GMISC_NEED_INVSQRT FALSE
326// #define GMISC_INVSQRT_MIXED_ENDIAN FALSE
327// #define GMISC_INVSQRT_REAL_SLOW FALSE
328#define GMISC_NEED_MATRIXFLOAT2D TRUE
329#define GMISC_NEED_MATRIXFIXED2D FALSE
330
331#endif /* _GFXCONF_H */
diff --git a/keyboards/infinity_ergodox/infinity_ergodox.c b/keyboards/infinity_ergodox/infinity_ergodox.c
index 85054775e..87ed40fab 100644
--- a/keyboards/infinity_ergodox/infinity_ergodox.c
+++ b/keyboards/infinity_ergodox/infinity_ergodox.c
@@ -2,6 +2,7 @@
2#include "ch.h" 2#include "ch.h"
3#include "hal.h" 3#include "hal.h"
4#include "serial_link/system/serial_link.h" 4#include "serial_link/system/serial_link.h"
5#include "lcd_backlight.h"
5 6
6void init_serial_link_hal(void) { 7void init_serial_link_hal(void) {
7 PORTA->PCR[1] = PORTx_PCRn_PE | PORTx_PCRn_PS | PORTx_PCRn_PFE | PORTx_PCRn_MUX(2); 8 PORTA->PCR[1] = PORTx_PCRn_PE | PORTx_PCRn_PS | PORTx_PCRn_PFE | PORTx_PCRn_MUX(2);
@@ -9,3 +10,67 @@ void init_serial_link_hal(void) {
9 PORTE->PCR[0] = PORTx_PCRn_PE | PORTx_PCRn_PS | PORTx_PCRn_PFE | PORTx_PCRn_MUX(3); 10 PORTE->PCR[0] = PORTx_PCRn_PE | PORTx_PCRn_PS | PORTx_PCRn_PFE | PORTx_PCRn_MUX(3);
10 PORTE->PCR[1] = PORTx_PCRn_DSE | PORTx_PCRn_SRE | PORTx_PCRn_MUX(3); 11 PORTE->PCR[1] = PORTx_PCRn_DSE | PORTx_PCRn_SRE | PORTx_PCRn_MUX(3);
11} 12}
13
14#define RED_PIN 1
15#define GREEN_PIN 2
16#define BLUE_PIN 3
17#define CHANNEL_RED FTM0->CHANNEL[0]
18#define CHANNEL_GREEN FTM0->CHANNEL[1]
19#define CHANNEL_BLUE FTM0->CHANNEL[2]
20
21#define RGB_PORT PORTC
22#define RGB_PORT_GPIO GPIOC
23
24// Base FTM clock selection (72 MHz system clock)
25// @ 0xFFFF period, 72 MHz / (0xFFFF * 2) = Actual period
26// Higher pre-scalar will use the most power (also look the best)
27// Pre-scalar calculations
28// 0 - 72 MHz -> 549 Hz
29// 1 - 36 MHz -> 275 Hz
30// 2 - 18 MHz -> 137 Hz
31// 3 - 9 MHz -> 69 Hz (Slightly visible flicker)
32// 4 - 4 500 kHz -> 34 Hz (Visible flickering)
33// 5 - 2 250 kHz -> 17 Hz
34// 6 - 1 125 kHz -> 9 Hz
35// 7 - 562 500 Hz -> 4 Hz
36// Using a higher pre-scalar without flicker is possible but FTM0_MOD will need to be reduced
37// Which will reduce the brightness range
38#define PRESCALAR_DEFINE 0
39
40void lcd_backlight_hal_init(void) {
41 // Setup Backlight
42 SIM->SCGC6 |= SIM_SCGC6_FTM0;
43 FTM0->CNT = 0; // Reset counter
44
45 // PWM Period
46 // 16-bit maximum
47 FTM0->MOD = 0xFFFF;
48
49 // Set FTM to PWM output - Edge Aligned, Low-true pulses
50#define CNSC_MODE FTM_SC_CPWMS | FTM_SC_PS(4) | FTM_SC_CLKS(0)
51 CHANNEL_RED.CnSC = CNSC_MODE;
52 CHANNEL_GREEN.CnSC = CNSC_MODE;
53 CHANNEL_BLUE.CnSC = CNSC_MODE;
54
55 // System clock, /w prescalar setting
56 FTM0->SC = FTM_SC_CLKS(1) | FTM_SC_PS(PRESCALAR_DEFINE);
57
58 CHANNEL_RED.CnV = 0;
59 CHANNEL_GREEN.CnV = 0;
60 CHANNEL_BLUE.CnV = 0;
61
62 RGB_PORT_GPIO->PDDR |= (1 << RED_PIN);
63 RGB_PORT_GPIO->PDDR |= (1 << GREEN_PIN);
64 RGB_PORT_GPIO->PDDR |= (1 << BLUE_PIN);
65
66#define RGB_MODE PORTx_PCRn_SRE | PORTx_PCRn_DSE | PORTx_PCRn_MUX(4)
67 RGB_PORT->PCR[RED_PIN] = RGB_MODE;
68 RGB_PORT->PCR[GREEN_PIN] = RGB_MODE;
69 RGB_PORT->PCR[BLUE_PIN] = RGB_MODE;
70}
71
72void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b) {
73 CHANNEL_RED.CnV = r;
74 CHANNEL_GREEN.CnV = g;
75 CHANNEL_BLUE.CnV = b;
76}
diff --git a/keyboards/infinity_ergodox/keymaps/default/keymap.c b/keyboards/infinity_ergodox/keymaps/default/keymap.c
index c33fb7b92..f1e6b1c8a 100644
--- a/keyboards/infinity_ergodox/keymaps/default/keymap.c
+++ b/keyboards/infinity_ergodox/keymaps/default/keymap.c
@@ -18,6 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18 18
19#include "infinity_ergodox.h" 19#include "infinity_ergodox.h"
20 20
21// Workaround for old keymap format
22#define KC_RESET RESET
23
21const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 24const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
22 KEYMAP( // layer 0 : default 25 KEYMAP( // layer 0 : default
23 // left hand 26 // left hand
@@ -63,7 +66,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
63 66
64 KEYMAP( // layer 2 : keyboard functions 67 KEYMAP( // layer 2 : keyboard functions
65 // left hand 68 // left hand
66 BTLD,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, 69 RESET,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
67 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, FN3, 70 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, FN3,
68 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, 71 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
69 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, 72 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
diff --git a/keyboards/infinity_ergodox/keymaps/default/visualizer.c b/keyboards/infinity_ergodox/keymaps/default/visualizer.c
new file mode 100644
index 000000000..c0d335ce6
--- /dev/null
+++ b/keyboards/infinity_ergodox/keymaps/default/visualizer.c
@@ -0,0 +1,168 @@
1/*
2Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18// Currently we are assuming that both the backlight and LCD are enabled
19// But it's entirely possible to write a custom visualizer that use only
20// one of them
21#ifndef LCD_BACKLIGHT_ENABLE
22#error This visualizer needs that LCD backlight is enabled
23#endif
24
25#ifndef LCD_ENABLE
26#error This visualizer needs that LCD is enabled
27#endif
28
29#include "visualizer.h"
30#include "led_test.h"
31
32static const char* welcome_text[] = {"TMK", "Infinity Ergodox"};
33
34// Just an example how to write custom keyframe functions, we could have moved
35// all this into the init function
36bool display_welcome(keyframe_animation_t* animation, visualizer_state_t* state) {
37 (void)animation;
38 // Read the uGFX documentation for information how to use the displays
39 // http://wiki.ugfx.org/index.php/Main_Page
40 gdispClear(White);
41 // You can use static variables for things that can't be found in the animation
42 // or state structs
43 gdispDrawString(0, 3, welcome_text[0], state->font_dejavusansbold12, Black);
44 gdispDrawString(0, 15, welcome_text[1], state->font_dejavusansbold12, Black);
45 // Always remember to flush the display
46 gdispFlush();
47 // you could set the backlight color as well, but we won't do it here, since
48 // it's part of the following animation
49 // lcd_backlight_color(hue, saturation, intensity);
50 // We don't need constant updates, just drawing the screen once is enough
51 return false;
52}
53
54// Feel free to modify the animations below, or even add new ones if needed
55
56// Don't worry, if the startup animation is long, you can use the keyboard like normal
57// during that time
58static keyframe_animation_t startup_animation = {
59 .num_frames = 4,
60 .loop = false,
61 .frame_lengths = {0, gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(5000), 0},
62 .frame_functions = {
63 display_welcome,
64 keyframe_animate_backlight_color,
65 keyframe_no_operation,
66 enable_visualization
67 },
68};
69
70// The color animation animates the LCD color when you change layers
71static keyframe_animation_t color_animation = {
72 .num_frames = 2,
73 .loop = false,
74 // Note that there's a 200 ms no-operation frame,
75 // this prevents the color from changing when activating the layer
76 // momentarily
77 .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)},
78 .frame_functions = {keyframe_no_operation, keyframe_animate_backlight_color},
79};
80
81// The LCD animation alternates between the layer name display and a
82// bitmap that displays all active layers
83static keyframe_animation_t lcd_animation = {
84 .num_frames = 2,
85 .loop = true,
86 .frame_lengths = {gfxMillisecondsToTicks(2000), gfxMillisecondsToTicks(2000)},
87 .frame_functions = {keyframe_display_layer_text, keyframe_display_layer_bitmap},
88};
89
90static keyframe_animation_t suspend_animation = {
91 .num_frames = 3,
92 .loop = false,
93 .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0},
94 .frame_functions = {
95 keyframe_display_layer_text,
96 keyframe_animate_backlight_color,
97 keyframe_disable_lcd_and_backlight,
98 },
99};
100
101static keyframe_animation_t resume_animation = {
102 .num_frames = 5,
103 .loop = false,
104 .frame_lengths = {0, 0, gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(5000), 0},
105 .frame_functions = {
106 keyframe_enable_lcd_and_backlight,
107 display_welcome,
108 keyframe_animate_backlight_color,
109 keyframe_no_operation,
110 enable_visualization,
111 },
112};
113
114void initialize_user_visualizer(visualizer_state_t* state) {
115 // The brightness will be dynamically adjustable in the future
116 // But for now, change it here.
117 lcd_backlight_brightness(0x50);
118 state->current_lcd_color = LCD_COLOR(0x00, 0x00, 0xFF);
119 state->target_lcd_color = LCD_COLOR(0x10, 0xFF, 0xFF);
120 start_keyframe_animation(&startup_animation);
121 start_keyframe_animation(&led_test_animation);
122}
123
124void update_user_visualizer_state(visualizer_state_t* state) {
125 // Add more tests, change the colors and layer texts here
126 // Usually you want to check the high bits (higher layers first)
127 // because that's the order layers are processed for keypresses
128 // You can for check for example:
129 // state->status.layer
130 // state->status.default_layer
131 // state->status.leds (see led.h for available statuses)
132 if (state->status.layer & 0x8) {
133 state->target_lcd_color = LCD_COLOR(0xC0, 0xB0, 0xFF);
134 state->layer_text = "Numpad";
135 }
136 else if (state->status.layer & 0x4) {
137 state->target_lcd_color = LCD_COLOR(0, 0xB0, 0xFF);
138 state->layer_text = "KBD functions";
139 }
140 else if (state->status.layer & 0x2) {
141 state->target_lcd_color = LCD_COLOR(0x80, 0xB0, 0xFF);
142 state->layer_text = "Function keys";
143 }
144 else {
145 state->target_lcd_color = LCD_COLOR(0x40, 0xB0, 0xFF);
146 state->layer_text = "Default";
147 }
148 // You can also stop existing animations, and start your custom ones here
149 // remember that you should normally have only one animation for the LCD
150 // and one for the background. But you can also combine them if you want.
151 start_keyframe_animation(&lcd_animation);
152 start_keyframe_animation(&color_animation);
153}
154
155void user_visualizer_suspend(visualizer_state_t* state) {
156 state->layer_text = "Suspending...";
157 uint8_t hue = LCD_HUE(state->current_lcd_color);
158 uint8_t sat = LCD_SAT(state->current_lcd_color);
159 state->target_lcd_color = LCD_COLOR(hue, sat, 0);
160 start_keyframe_animation(&suspend_animation);
161}
162
163void user_visualizer_resume(visualizer_state_t* state) {
164 state->current_lcd_color = LCD_COLOR(0x00, 0x00, 0x00);
165 state->target_lcd_color = LCD_COLOR(0x10, 0xFF, 0xFF);
166 start_keyframe_animation(&resume_animation);
167 start_keyframe_animation(&led_test_animation);
168}
diff --git a/keyboards/kc60/Makefile b/keyboards/kc60/Makefile
index 9717b519c..b00a488b9 100644
--- a/keyboards/kc60/Makefile
+++ b/keyboards/kc60/Makefile
@@ -53,7 +53,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
53# Build Options 53# Build Options
54# change yes to no to disable 54# change yes to no to disable
55# 55#
56BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) 56BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
57MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) 57MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
58EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) 58EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
59CONSOLE_ENABLE ?= yes # Console for debug(+400) 59CONSOLE_ENABLE ?= yes # Console for debug(+400)
diff --git a/keyboards/kc60/keymaps/stanleylai/keymap.c b/keyboards/kc60/keymaps/stanleylai/keymap.c
index a7ea6040d..057c73bf4 100644
--- a/keyboards/kc60/keymaps/stanleylai/keymap.c
+++ b/keyboards/kc60/keymaps/stanleylai/keymap.c
@@ -38,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ 38 RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
39 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ 39 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
40 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ 40 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
41 KC_TRNS,KC_NO, F(1), F(2), F(3), F(4), F(5), F(6), F(7), F(8), BL_STEP,BL_TOGG, KC_TRNS, KC_TRNS,\ 41 KC_TRNS,KC_NO, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD,BL_STEP,BL_TOGG, KC_TRNS, KC_TRNS,\
42 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS), 42 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS),
43 #else 43 #else
44 RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ 44 RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
@@ -52,30 +52,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
52 52
53enum function_id { 53enum function_id {
54 SHIFT_ESC, 54 SHIFT_ESC,
55 #ifdef RGBLIGHT_ENABLE
56 RGBLED_TOGGLE,
57 RGBLED_STEP_MODE,
58 RGBLED_INCREASE_HUE,
59 RGBLED_DECREASE_HUE,
60 RGBLED_INCREASE_SAT,
61 RGBLED_DECREASE_SAT,
62 RGBLED_INCREASE_VAL,
63 RGBLED_DECREASE_VAL,
64 #endif
65}; 55};
66 56
67const uint16_t PROGMEM fn_actions[] = { 57const uint16_t PROGMEM fn_actions[] = {
68 [0] = ACTION_FUNCTION(SHIFT_ESC), 58 [0] = ACTION_FUNCTION(SHIFT_ESC),
69 #ifdef RGBLIGHT_ENABLE
70 [1] = ACTION_FUNCTION(RGBLED_TOGGLE),
71 [2] = ACTION_FUNCTION(RGBLED_STEP_MODE),
72 [3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
73 [4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
74 [5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
75 [6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
76 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
77 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
78 #endif
79}; 59};
80 60
81#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) 61#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
@@ -102,50 +82,5 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
102 } 82 }
103 } 83 }
104 break; 84 break;
105
106 #ifdef RGBLIGHT_ENABLE
107
108 case RGBLED_TOGGLE:
109 //led operations
110 if (record->event.pressed) {
111 rgblight_toggle();
112 }
113 break;
114 case RGBLED_INCREASE_HUE:
115 if (record->event.pressed) {
116 rgblight_increase_hue();
117 }
118 break;
119 case RGBLED_DECREASE_HUE:
120 if (record->event.pressed) {
121 rgblight_decrease_hue();
122 }
123 break;
124 case RGBLED_INCREASE_SAT:
125 if (record->event.pressed) {
126 rgblight_increase_sat();
127 }
128 break;
129 case RGBLED_DECREASE_SAT:
130 if (record->event.pressed) {
131 rgblight_decrease_sat();
132 }
133 break;
134 case RGBLED_INCREASE_VAL:
135 if (record->event.pressed) {
136 rgblight_increase_val();
137 }
138 break;
139 case RGBLED_DECREASE_VAL:
140 if (record->event.pressed) {
141 rgblight_decrease_val();
142 }
143 break;
144 case RGBLED_STEP_MODE:
145 if (record->event.pressed) {
146 rgblight_step();
147 }
148 break;
149 #endif
150 } 85 }
151} 86}
diff --git a/keyboards/kc60/keymaps/ws2812/config.h b/keyboards/kc60/keymaps/ws2812/config.h
index 933bb0d2d..2f39ea8e5 100644
--- a/keyboards/kc60/keymaps/ws2812/config.h
+++ b/keyboards/kc60/keymaps/ws2812/config.h
@@ -1,9 +1,8 @@
1#include "../../config.h" 1#include "../../config.h"
2 2
3/* WS2812B RGB Underglow LED */ 3/* WS2812B RGB Underglow LED */
4#define ws2812_PORTREG PORTF 4#define RGB_DI_PIN F5 // Based on wiring depicted in ws2812_wiring.jpg
5#define ws2812_DDRREG DDRF 5#define RGBLIGHT_TIMER
6#define ws2812_pin PF5 // Based on wiring depicted in ws2812_wiring.jpg
7#define RGBLED_NUM 16 // Number of LEDs. Change this to match your use case. 6#define RGBLED_NUM 16 // Number of LEDs. Change this to match your use case.
8#define RGBLIGHT_HUE_STEP 8 7#define RGBLIGHT_HUE_STEP 8
9#define RGBLIGHT_SAT_STEP 8 8#define RGBLIGHT_SAT_STEP 8
diff --git a/keyboards/kc60/keymaps/ws2812/keymap.c b/keyboards/kc60/keymaps/ws2812/keymap.c
index bd5bef787..1c0574df0 100644
--- a/keyboards/kc60/keymaps/ws2812/keymap.c
+++ b/keyboards/kc60/keymaps/ws2812/keymap.c
@@ -52,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
52 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, \ 52 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, \
53 KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_INC, BL_TOGG, \ 53 KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_INC, BL_TOGG, \
54 KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ 54 KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
55 KC_TRNS, KC_TRNS, F(1), F(2), F(3), F(4), F(5), F(6), F(7), F(8), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ 55 KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
56 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET), 56 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET),
57 #else 57 #else
58 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, \ 58 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, \
@@ -65,30 +65,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
65 65
66enum function_id { 66enum function_id {
67 SHIFT_ESC, 67 SHIFT_ESC,
68 #ifdef RGBLIGHT_ENABLE
69 RGBLED_TOGGLE,
70 RGBLED_STEP_MODE,
71 RGBLED_INCREASE_HUE,
72 RGBLED_DECREASE_HUE,
73 RGBLED_INCREASE_SAT,
74 RGBLED_DECREASE_SAT,
75 RGBLED_INCREASE_VAL,
76 RGBLED_DECREASE_VAL
77 #endif
78}; 68};
79 69
80const uint16_t PROGMEM fn_actions[] = { 70const uint16_t PROGMEM fn_actions[] = {
81 [0] = ACTION_FUNCTION(SHIFT_ESC), 71 [0] = ACTION_FUNCTION(SHIFT_ESC),
82 #ifdef RGBLIGHT_ENABLE
83 [1] = ACTION_FUNCTION(RGBLED_TOGGLE),
84 [2] = ACTION_FUNCTION(RGBLED_STEP_MODE),
85 [3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
86 [4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
87 [5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
88 [6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
89 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
90 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
91 #endif
92}; 72};
93 73
94void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 74void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
@@ -114,48 +94,5 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
114 } 94 }
115 } 95 }
116 break; 96 break;
117 //led operations
118 #ifdef RGBLIGHT_ENABLE
119 case RGBLED_TOGGLE:
120 if (record->event.pressed) {
121 rgblight_toggle();
122 }
123 break;
124 case RGBLED_INCREASE_HUE:
125 if (record->event.pressed) {
126 rgblight_increase_hue();
127 }
128 break;
129 case RGBLED_DECREASE_HUE:
130 if (record->event.pressed) {
131 rgblight_decrease_hue();
132 }
133 break;
134 case RGBLED_INCREASE_SAT:
135 if (record->event.pressed) {
136 rgblight_increase_sat();
137 }
138 break;
139 case RGBLED_DECREASE_SAT:
140 if (record->event.pressed) {
141 rgblight_decrease_sat();
142 }
143 break;
144 case RGBLED_INCREASE_VAL:
145 if (record->event.pressed) {
146 rgblight_increase_val();
147 }
148 break;
149 case RGBLED_DECREASE_VAL:
150 if (record->event.pressed) {
151 rgblight_decrease_val();
152 }
153 break;
154 case RGBLED_STEP_MODE:
155 if (record->event.pressed) {
156 rgblight_step();
157 }
158 break;
159 #endif
160 } 97 }
161} 98}
diff --git a/keyboards/lets_split/config.h b/keyboards/lets_split/config.h
index 6f90997ab..833818ce6 100644
--- a/keyboards/lets_split/config.h
+++ b/keyboards/lets_split/config.h
@@ -69,9 +69,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
69) 69)
70 70
71/* ws2812 RGB LED */ 71/* ws2812 RGB LED */
72#define ws2812_PORTREG PORTD 72#define RGB_DI_PIN D2
73#define ws2812_DDRREG DDRD 73#define RGBLIGHT_TIMER
74#define ws2812_pin PD1
75#define RGBLED_NUM 28 // Number of LEDs 74#define RGBLED_NUM 28 // Number of LEDs
76#define RGBLIGHT_HUE_STEP 10 75#define RGBLIGHT_HUE_STEP 10
77#define RGBLIGHT_SAT_STEP 17 76#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/phantom/config.h b/keyboards/phantom/config.h
index d5878766f..983a1d73f 100644
--- a/keyboards/phantom/config.h
+++ b/keyboards/phantom/config.h
@@ -62,13 +62,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
62 62
63/* Underlight configuration 63/* Underlight configuration
64 */ 64 */
65 #define ws2812_PORTREG PORTE 65#define RGB_DI_PIN E2
66 #define ws2812_DDRREG DDRE 66#define RGBLIGHT_TIMER
67 #define ws2812_pin 2 67#define RGBLED_NUM 20 // Number of LEDs
68 #define RGBLED_NUM 20 // Number of LEDs 68#define RGBLIGHT_HUE_STEP 10
69 #define RGBLIGHT_HUE_STEP 10 69#define RGBLIGHT_SAT_STEP 17
70 #define RGBLIGHT_SAT_STEP 17 70#define RGBLIGHT_VAL_STEP 17
71 #define RGBLIGHT_VAL_STEP 17
72 71
73/* 72/*
74 * Feature disable options 73 * Feature disable options
diff --git a/keyboards/phantom/keymaps/default/keymap.c b/keyboards/phantom/keymaps/default/keymap.c
index 1368226aa..a4fc319ac 100644
--- a/keyboards/phantom/keymaps/default/keymap.c
+++ b/keyboards/phantom/keymaps/default/keymap.c
@@ -1,9 +1,5 @@
1#include "phantom.h" 1#include "phantom.h"
2 2
3#ifdef RGBLIGHT_ENABLE
4#include "rgblight.h"
5#endif
6
7// Used for SHIFT_ESC 3// Used for SHIFT_ESC
8#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) 4#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
9 5
@@ -59,7 +55,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
59 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, RESET, KC_TRNS, KC_TRNS, KC_TRNS, \ 55 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, RESET, KC_TRNS, KC_TRNS, KC_TRNS, \
60 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, \ 56 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, \
61 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, \ 57 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, \
62 KC_TRNS, F(1), F(2), F(3), F(4), F(5), F(6), F(7), F(8), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ 58 KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
63 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 59 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
64 #else 60 #else
65 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, \ 61 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, \
@@ -73,30 +69,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
73 69
74enum function_id { 70enum function_id {
75 SHIFT_ESC, 71 SHIFT_ESC,
76 #ifdef RGBLIGHT_ENABLE
77 RGBLED_TOGGLE,
78 RGBLED_STEP_MODE,
79 RGBLED_INCREASE_HUE,
80 RGBLED_DECREASE_HUE,
81 RGBLED_INCREASE_SAT,
82 RGBLED_DECREASE_SAT,
83 RGBLED_INCREASE_VAL,
84 RGBLED_DECREASE_VAL
85 #endif
86}; 72};
87 73
88const uint16_t PROGMEM fn_actions[] = { 74const uint16_t PROGMEM fn_actions[] = {
89 [0] = ACTION_FUNCTION(SHIFT_ESC), 75 [0] = ACTION_FUNCTION(SHIFT_ESC),
90 #ifdef RGBLIGHT_ENABLE
91 [1] = ACTION_FUNCTION(RGBLED_TOGGLE),
92 [2] = ACTION_FUNCTION(RGBLED_STEP_MODE),
93 [3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
94 [4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
95 [5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
96 [6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
97 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
98 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
99 #endif
100}; 76};
101 77
102void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 78void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
@@ -122,48 +98,5 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
122 } 98 }
123 } 99 }
124 break; 100 break;
125 //led operations
126 #ifdef RGBLIGHT_ENABLE
127 case RGBLED_TOGGLE:
128 if (record->event.pressed) {
129 rgblight_toggle();
130 }
131 break;
132 case RGBLED_INCREASE_HUE:
133 if (record->event.pressed) {
134 rgblight_increase_hue();
135 }
136 break;
137 case RGBLED_DECREASE_HUE:
138 if (record->event.pressed) {
139 rgblight_decrease_hue();
140 }
141 break;
142 case RGBLED_INCREASE_SAT:
143 if (record->event.pressed) {
144 rgblight_increase_sat();
145 }
146 break;
147 case RGBLED_DECREASE_SAT:
148 if (record->event.pressed) {
149 rgblight_decrease_sat();
150 }
151 break;
152 case RGBLED_INCREASE_VAL:
153 if (record->event.pressed) {
154 rgblight_increase_val();
155 }
156 break;
157 case RGBLED_DECREASE_VAL:
158 if (record->event.pressed) {
159 rgblight_decrease_val();
160 }
161 break;
162 case RGBLED_STEP_MODE:
163 if (record->event.pressed) {
164 rgblight_step();
165 }
166 break;
167 #endif
168 } 101 }
169} 102}
diff --git a/keyboards/phantom/led.c b/keyboards/phantom/led.c
index b2459c774..69dba7d40 100644
--- a/keyboards/phantom/led.c
+++ b/keyboards/phantom/led.c
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19#include "stdint.h" 19#include "stdint.h"
20#include "led.h" 20#include "led.h"
21 21
22void led_init(void) { 22void led_init_ports(void) {
23 // * Set our LED pins as output 23 // * Set our LED pins as output
24 DDRB |= (1<<6); 24 DDRB |= (1<<6);
25 DDRB |= (1<<7); 25 DDRB |= (1<<7);
diff --git a/keyboards/planck/keymaps/experimental/Makefile b/keyboards/planck/keymaps/experimental/Makefile
index 581e08cd0..877c4aed0 100644
--- a/keyboards/planck/keymaps/experimental/Makefile
+++ b/keyboards/planck/keymaps/experimental/Makefile
@@ -10,12 +10,12 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
10CONSOLE_ENABLE = no # Console for debug(+400) 10CONSOLE_ENABLE = no # Console for debug(+400)
11COMMAND_ENABLE = yes # Commands for debug and configuration 11COMMAND_ENABLE = yes # Commands for debug and configuration
12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 12NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
13BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 13BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
14MIDI_ENABLE = no # MIDI controls 14MIDI_ENABLE = no # MIDI controls
15AUDIO_ENABLE = yes # Audio output on port C6 15AUDIO_ENABLE = no # Audio output on port C6
16UNICODE_ENABLE = no # Unicode 16UNICODE_ENABLE = no # Unicode
17BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 17BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
18RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. 18RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
19 19
20# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 20# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
21SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 21SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
diff --git a/keyboards/planck/keymaps/experimental/config.h b/keyboards/planck/keymaps/experimental/config.h
index 985e250ab..52acd1905 100644
--- a/keyboards/planck/keymaps/experimental/config.h
+++ b/keyboards/planck/keymaps/experimental/config.h
@@ -6,4 +6,12 @@
6#define LEADER_TIMEOUT 300 6#define LEADER_TIMEOUT 300
7#define BACKLIGHT_BREATHING 7#define BACKLIGHT_BREATHING
8 8
9
10/* ws2812 RGB LED */
11#define RGB_DI_PIN B1
12#define RGBLIGHT_TIMER
13#define RGBLED_NUM 8 // Number of LEDs
14#define RGBLIGHT_HUE_STEP 10
15#define RGBLIGHT_SAT_STEP 17
16
9#endif 17#endif
diff --git a/keyboards/planck/keymaps/experimental/keymap.c b/keyboards/planck/keymaps/experimental/keymap.c
index 8ec335d7d..d9303fcae 100644
--- a/keyboards/planck/keymaps/experimental/keymap.c
+++ b/keyboards/planck/keymaps/experimental/keymap.c
@@ -15,7 +15,7 @@ extern keymap_config_t keymap_config;
15// The underscores don't mean anything - you can have a layer called STUFF or any other name. 15// The underscores don't mean anything - you can have a layer called STUFF or any other name.
16// Layer names don't all need to be of the same length, obviously, and you can also skip them 16// Layer names don't all need to be of the same length, obviously, and you can also skip them
17// entirely and just use numbers. 17// entirely and just use numbers.
18#define _QWERTY 0 18#define _QWERTY 10
19#define _COLEMAK 1 19#define _COLEMAK 1
20#define _DVORAK 2 20#define _DVORAK 2
21#define _LOWER 3 21#define _LOWER 3
@@ -31,7 +31,15 @@ enum planck_keycodes {
31 LOWER, 31 LOWER,
32 RAISE, 32 RAISE,
33 BACKLIT, 33 BACKLIT,
34 EXT_PLV 34 EXT_PLV,
35 RGBLED_TOGGLE,
36 RGBLED_STEP_MODE,
37 RGBLED_INCREASE_HUE,
38 RGBLED_DECREASE_HUE,
39 RGBLED_INCREASE_SAT,
40 RGBLED_DECREASE_SAT,
41 RGBLED_INCREASE_VAL,
42 RGBLED_DECREASE_VAL,
35}; 43};
36 44
37// Fillers to make layering more clear 45// Fillers to make layering more clear
@@ -39,14 +47,20 @@ enum planck_keycodes {
39#define XXXXXXX KC_NO 47#define XXXXXXX KC_NO
40 48
41const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 49const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
50[0] = {
51 {KC_NO, KC_NO, KC_NO, KC_NO, RGBLED_TOGGLE, RGBLED_STEP_MODE, RGBLED_INCREASE_HUE, RGBLED_DECREASE_HUE, RGBLED_INCREASE_SAT, RGBLED_DECREASE_SAT, RGBLED_INCREASE_VAL, RGBLED_DECREASE_VAL},
52 {KC_NO, KC_NO, KC_NO, KC_NO, RGBLED_TOGGLE, RGBLED_STEP_MODE, RGBLED_INCREASE_HUE, RGBLED_DECREASE_HUE, RGBLED_INCREASE_SAT, RGBLED_DECREASE_SAT, RGBLED_INCREASE_VAL, RGBLED_DECREASE_VAL},
53 {KC_NO, KC_NO, KC_NO, KC_NO, RGBLED_TOGGLE, RGBLED_STEP_MODE, RGBLED_INCREASE_HUE, RGBLED_DECREASE_HUE, RGBLED_INCREASE_SAT, RGBLED_DECREASE_SAT, RGBLED_INCREASE_VAL, RGBLED_DECREASE_VAL},
54 {KC_NO, KC_NO, KC_NO, KC_NO, RGBLED_TOGGLE, RGBLED_STEP_MODE, RGBLED_INCREASE_HUE, RGBLED_DECREASE_HUE, RGBLED_INCREASE_SAT, RGBLED_DECREASE_SAT, RGBLED_INCREASE_VAL, RGBLED_DECREASE_VAL}
55},
42 56
43/* Qwerty 57/* Qwerty
44 * ,-----------------------------------------------------------------------------------. 58 ,-----------------------------------------------------------------------------------.
45 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | 59 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
46 * |------+------+------+------+------+-------------+------+------+------+------+------| 60 * |------+------+------+------+------+-------------+------+------+------+------+------|
47 * | Esc | A | S | D | F | G | H | J | K | L | ; | " | 61 * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
48 * |------+------+------+------+------+------|------+------+------+------+------+------| 62 * |------+------+------+------+------+------|------+------+------+------+------+------|
49 * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | 63 * | Shift| Z | X | C | V | B | N | M |, | . | / |Enter |
50 * |------+------+------+------+------+------+------+------+------+------+------+------| 64 * |------+------+------+------+------+------+------+------+------+------+------+------|
51 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | 65 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
52 * `-----------------------------------------------------------------------------------' 66 * `-----------------------------------------------------------------------------------'
@@ -292,6 +306,57 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
292 break; 306 break;
293 return false; 307 return false;
294 308
309 case RGBLED_TOGGLE:
310 //led operations
311 if (record->event.pressed) {
312 rgblight_toggle();
313 }
314 return false;
315 break;
316 case RGBLED_INCREASE_HUE:
317 if (record->event.pressed) {
318 rgblight_increase_hue();
319 }
320 return false;
321 break;
322 case RGBLED_DECREASE_HUE:
323 if (record->event.pressed) {
324 rgblight_decrease_hue();
325 }
326 return false;
327 break;
328 case RGBLED_INCREASE_SAT:
329 if (record->event.pressed) {
330 rgblight_increase_sat();
331 }
332 return false;
333 break;
334 case RGBLED_DECREASE_SAT:
335 if (record->event.pressed) {
336 rgblight_decrease_sat();
337 }
338 return false;
339 break;
340 case RGBLED_INCREASE_VAL:
341 if (record->event.pressed) {
342 rgblight_increase_val();
343 }
344 return false;
345 break;
346 case RGBLED_DECREASE_VAL:
347 if (record->event.pressed) {
348 rgblight_decrease_val();
349 }
350 return false;
351 break;
352 case RGBLED_STEP_MODE:
353 if (record->event.pressed) {
354 rgblight_step();
355 }
356 return false;
357 break;
358
359
295 } 360 }
296 return true; 361 return true;
297}; 362};
diff --git a/keyboards/planck/keymaps/pvc/config.h b/keyboards/planck/keymaps/pvc/config.h
index b64893108..c857a3e89 100644
--- a/keyboards/planck/keymaps/pvc/config.h
+++ b/keyboards/planck/keymaps/pvc/config.h
@@ -60,9 +60,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
60) 60)
61 61
62/* ws2812 RGB LED */ 62/* ws2812 RGB LED */
63#define ws2812_PORTREG PORTD 63#define RGB_DI_PIN D1
64#define ws2812_DDRREG DDRD 64#define RGBLIGHT_TIMER
65#define ws2812_pin PD1
66#define RGBLED_NUM 28 // Number of LEDs 65#define RGBLED_NUM 28 // Number of LEDs
67#define RGBLIGHT_HUE_STEP 10 66#define RGBLIGHT_HUE_STEP 10
68#define RGBLIGHT_SAT_STEP 17 67#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/planck/keymaps/yang/config.h b/keyboards/planck/keymaps/yang/config.h
index 5921e9377..feb5a1190 100644
--- a/keyboards/planck/keymaps/yang/config.h
+++ b/keyboards/planck/keymaps/yang/config.h
@@ -4,9 +4,8 @@
4#include "../../config.h" 4#include "../../config.h"
5 5
6/* ws2812 RGB LED */ 6/* ws2812 RGB LED */
7#define ws2812_PORTREG PORTD 7#define RGB_DI_PIN D1
8#define ws2812_DDRREG DDRD 8#define RGBLIGHT_TIMER
9#define ws2812_pin PD1
10#define RGBLED_NUM 28 // Number of LEDs 9#define RGBLED_NUM 28 // Number of LEDs
11#define RGBLIGHT_HUE_STEP 10 10#define RGBLIGHT_HUE_STEP 10
12#define RGBLIGHT_SAT_STEP 17 11#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/planck/keymaps/yang/keymap.c b/keyboards/planck/keymaps/yang/keymap.c
index 541b1a57e..0ce849050 100644
--- a/keyboards/planck/keymaps/yang/keymap.c
+++ b/keyboards/planck/keymaps/yang/keymap.c
@@ -51,33 +51,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
51[_RGB] = { /* RGBLIGHT */ 51[_RGB] = { /* RGBLIGHT */
52 {KC_TRNS, KC_PGUP, KC_UP, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL}, 52 {KC_TRNS, KC_PGUP, KC_UP, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL},
53 {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_HOME, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_END, KC_TRNS}, 53 {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_HOME, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_END, KC_TRNS},
54 {KC_TRNS, F(1), F(2), F(3), F(4), F(5), F(6), F(7), F(8), KC_TRNS, KC_TRNS, KC_TRNS}, 54 {KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS},
55 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} 55 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
56 56
57} 57}
58}; 58};
59 59
60enum function_id { 60/*enum function_id {
61 RGBLED_TOGGLE, 61
62 RGBLED_STEP_MODE, 62};*/
63 RGBLED_INCREASE_HUE,
64 RGBLED_DECREASE_HUE,
65 RGBLED_INCREASE_SAT,
66 RGBLED_DECREASE_SAT,
67 RGBLED_INCREASE_VAL,
68 RGBLED_DECREASE_VAL,
69};
70 63
71const uint16_t PROGMEM fn_actions[] = { 64const uint16_t PROGMEM fn_actions[] = {
72 [0] = ACTION_LAYER_TAP_KEY(_RGB, KC_SPC), 65 [0] = ACTION_LAYER_TAP_KEY(_RGB, KC_SPC),
73 [1] = ACTION_FUNCTION(RGBLED_TOGGLE),
74 [2] = ACTION_FUNCTION(RGBLED_STEP_MODE),
75 [3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
76 [4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
77 [5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
78 [6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
79 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
80 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
81}; 66};
82 67
83const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 68const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
@@ -100,47 +85,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
100 85
101void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 86void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
102 switch (id) { 87 switch (id) {
103 case RGBLED_TOGGLE: 88
104 //led operations
105 if (record->event.pressed) {
106 rgblight_toggle();
107 }
108
109 break;
110 case RGBLED_INCREASE_HUE:
111 if (record->event.pressed) {
112 rgblight_increase_hue();
113 }
114 break;
115 case RGBLED_DECREASE_HUE:
116 if (record->event.pressed) {
117 rgblight_decrease_hue();
118 }
119 break;
120 case RGBLED_INCREASE_SAT:
121 if (record->event.pressed) {
122 rgblight_increase_sat();
123 }
124 break;
125 case RGBLED_DECREASE_SAT:
126 if (record->event.pressed) {
127 rgblight_decrease_sat();
128 }
129 break;
130 case RGBLED_INCREASE_VAL:
131 if (record->event.pressed) {
132 rgblight_increase_val();
133 }
134 break;
135 case RGBLED_DECREASE_VAL:
136 if (record->event.pressed) {
137 rgblight_decrease_val();
138 }
139 break;
140 case RGBLED_STEP_MODE:
141 if (record->event.pressed) {
142 rgblight_step();
143 }
144 break;
145 } 89 }
146} 90}
diff --git a/keyboards/preonic/config.h b/keyboards/preonic/config.h
index 04946f7fb..3fb978c2f 100644
--- a/keyboards/preonic/config.h
+++ b/keyboards/preonic/config.h
@@ -62,9 +62,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
62) 62)
63 63
64/* ws2812 RGB LED */ 64/* ws2812 RGB LED */
65#define ws2812_PORTREG PORTD 65#define RGB_DI_PIN D1
66#define ws2812_DDRREG DDRD 66#define RGBLIGHT_TIMER
67#define ws2812_pin PD1
68#define RGBLED_NUM 28 // Number of LEDs 67#define RGBLED_NUM 28 // Number of LEDs
69#define RGBLIGHT_HUE_STEP 10 68#define RGBLIGHT_HUE_STEP 10
70#define RGBLIGHT_SAT_STEP 17 69#define RGBLIGHT_SAT_STEP 17
diff --git a/keyboards/satan/config.h b/keyboards/satan/config.h
index a7ea8f904..7e9f91cc8 100644
--- a/keyboards/satan/config.h
+++ b/keyboards/satan/config.h
@@ -65,13 +65,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
65 65
66/* Underlight configuration 66/* Underlight configuration
67 */ 67 */
68 #define ws2812_PORTREG PORTE 68
69 #define ws2812_DDRREG DDRE 69#define RGB_DI_PIN E2
70 #define ws2812_pin 2 70#define RGBLIGHT_TIMER
71 #define RGBLED_NUM 8 // Number of LEDs 71#define RGBLED_NUM 8 // Number of LEDs
72 #define RGBLIGHT_HUE_STEP 10 72#define RGBLIGHT_HUE_STEP 10
73 #define RGBLIGHT_SAT_STEP 17 73#define RGBLIGHT_SAT_STEP 17
74 #define RGBLIGHT_VAL_STEP 17 74#define RGBLIGHT_VAL_STEP 17
75 75
76/* 76/*
77 * Feature disable options 77 * Feature disable options
diff --git a/keyboards/satan/keymaps/default/keymap.c b/keyboards/satan/keymaps/default/keymap.c
index b19404afc..35dbbb77b 100644
--- a/keyboards/satan/keymaps/default/keymap.c
+++ b/keyboards/satan/keymaps/default/keymap.c
@@ -1,8 +1,5 @@
1#include "satan.h" 1#include "satan.h"
2 2
3#ifdef RGBLIGHT_ENABLE
4#include "rgblight.h"
5#endif
6 3
7// Used for SHIFT_ESC 4// Used for SHIFT_ESC
8#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) 5#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
@@ -53,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
53 KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, \ 50 KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, \
54 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_INC, BL_TOGG, \ 51 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_INC, BL_TOGG, \
55 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, \ 52 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, \
56 KC_TRNS, F(1), F(2), F(3), F(4), F(5), F(6), F(7), F(8), KC_TRNS, KC_TRNS, KC_TRNS, \ 53 KC_TRNS,RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, \
57 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 54 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
58 #else 55 #else
59 KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, \ 56 KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, \
@@ -66,30 +63,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
66 63
67enum function_id { 64enum function_id {
68 SHIFT_ESC, 65 SHIFT_ESC,
69 #ifdef RGBLIGHT_ENABLE
70 RGBLED_TOGGLE,
71 RGBLED_STEP_MODE,
72 RGBLED_INCREASE_HUE,
73 RGBLED_DECREASE_HUE,
74 RGBLED_INCREASE_SAT,
75 RGBLED_DECREASE_SAT,
76 RGBLED_INCREASE_VAL,
77 RGBLED_DECREASE_VAL
78 #endif
79}; 66};
80 67
81const uint16_t PROGMEM fn_actions[] = { 68const uint16_t PROGMEM fn_actions[] = {
82 [0] = ACTION_FUNCTION(SHIFT_ESC), 69 [0] = ACTION_FUNCTION(SHIFT_ESC),
83 #ifdef RGBLIGHT_ENABLE
84 [1] = ACTION_FUNCTION(RGBLED_TOGGLE),
85 [2] = ACTION_FUNCTION(RGBLED_STEP_MODE),
86 [3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
87 [4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
88 [5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
89 [6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
90 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
91 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
92 #endif
93}; 70};
94 71
95void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 72void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
@@ -115,48 +92,5 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
115 } 92 }
116 } 93 }
117 break; 94 break;
118 //led operations
119 #ifdef RGBLIGHT_ENABLE
120 case RGBLED_TOGGLE:
121 if (record->event.pressed) {
122 rgblight_toggle();
123 }
124 break;
125 case RGBLED_INCREASE_HUE:
126 if (record->event.pressed) {
127 rgblight_increase_hue();
128 }
129 break;
130 case RGBLED_DECREASE_HUE:
131 if (record->event.pressed) {
132 rgblight_decrease_hue();
133 }
134 break;
135 case RGBLED_INCREASE_SAT:
136 if (record->event.pressed) {
137 rgblight_increase_sat();
138 }
139 break;
140 case RGBLED_DECREASE_SAT:
141 if (record->event.pressed) {
142 rgblight_decrease_sat();
143 }
144 break;
145 case RGBLED_INCREASE_VAL:
146 if (record->event.pressed) {
147 rgblight_increase_val();
148 }
149 break;
150 case RGBLED_DECREASE_VAL:
151 if (record->event.pressed) {
152 rgblight_decrease_val();
153 }
154 break;
155 case RGBLED_STEP_MODE:
156 if (record->event.pressed) {
157 rgblight_step();
158 }
159 break;
160 #endif
161 } 95 }
162} 96}
diff --git a/keyboards/satan/keymaps/poker/keymap.c b/keyboards/satan/keymaps/poker/keymap.c
new file mode 100644
index 000000000..8181955cf
--- /dev/null
+++ b/keyboards/satan/keymaps/poker/keymap.c
@@ -0,0 +1,116 @@
1#include "satan.h"
2
3// Used for SHIFT_ESC
4#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
5
6// Each layer gets a name for readability, which is then used in the keymap matrix below.
7// The underscores don't mean anything - you can have a layer called STUFF or any other name.
8// Layer names don't all need to be of the same length, obviously, and you can also skip them
9// entirely and just use numbers.
10#define _BL 0
11#define _FL 1
12#define _RL 2
13
14const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15 /* Keymap _BL: (Base Layer) Default Layer
16 * ,-----------------------------------------------------------.
17 * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
18 * |-----------------------------------------------------------|
19 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |
20 * |-----------------------------------------------------------|
21 * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |
22 * |-----------------------------------------------------------|
23 * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
24 * |-----------------------------------------------------------|
25 * |Ctrl|Gui |Alt | Space |Alt |Gui |FN |Ctrl |
26 * `-----------------------------------------------------------'
27 */
28[_BL] = KEYMAP(
29 F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
30 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
31 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT, \
32 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \
33 KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT, MO(_RL), MO(_FL), KC_RCTL),
34
35/* Keymap _FL: Function Layer
36 * ,-----------------------------------------------------------.
37 * | ~ | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| DEL |
38 * |-----------------------------------------------------------|
39 * | | Up| | | | |Cal| |Ins| |PrSc|Sclk|Paus| |
40 * |-----------------------------------------------------------|
41 * | |Left|Down|Rig| | | | | | |Home|PgUp| |
42 * |-----------------------------------------------------------|
43 * | | |App| | | |Vdn|Vup|Mute|End|PgDn| |
44 * |-----------------------------------------------------------|
45 * | | | | | | | | |
46 * `-----------------------------------------------------------'
47 */
48[_FL] = KEYMAP(
49 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, \
50 KC_TRNS,KC_TRNS, KC_UP, KC_TRNS,KC_TRNS,KC_TRNS, KC_CALC,KC_TRNS,KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, \
51 KC_TRNS,KC_LEFT,KC_DOWN,KC_RGHT,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, \
52 KC_TRNS, KC_TRNS, KC_APP, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, \
53 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
54
55 /* Keymap _RL: Function Layer
56 * ,-----------------------------------------------------------.
57 * | | | | | | | | | | | | | | RESET|
58 * |-----------------------------------------------------------|
59 * | | | | | | | | | | | |BL-|BL+|BL |
60 * |-----------------------------------------------------------|
61 * | | | | | | | | | | | | |
62 * |-----------------------------------------------------------|
63 * | | F1|F2 | F3|F4 | F5| F6| F7| F8| | | |
64 * |-----------------------------------------------------------|
65 * | | | | | | | | |
66 * `-----------------------------------------------------------'
67 */
68[_RL] = KEYMAP(
69 #ifdef RGBLIGHT_ENABLE
70 KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, \
71 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_INC, BL_TOGG, \
72 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, \
73 KC_TRNS, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, \
74 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
75 #else
76 KC_GRV, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, \
77 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_INC, BL_TOGG, \
78 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, \
79 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
80 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
81 #endif
82};
83
84enum function_id {
85 SHIFT_ESC,
86};
87
88const uint16_t PROGMEM fn_actions[] = {
89 [0] = ACTION_FUNCTION(SHIFT_ESC),
90};
91
92void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
93 static uint8_t shift_esc_shift_mask;
94 switch (id) {
95 case SHIFT_ESC:
96 shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
97 if (record->event.pressed) {
98 if (shift_esc_shift_mask) {
99 add_key(KC_GRV);
100 send_keyboard_report();
101 } else {
102 add_key(KC_ESC);
103 send_keyboard_report();
104 }
105 } else {
106 if (shift_esc_shift_mask) {
107 del_key(KC_GRV);
108 send_keyboard_report();
109 } else {
110 del_key(KC_ESC);
111 send_keyboard_report();
112 }
113 }
114 break;
115 }
116}
diff --git a/keyboards/satan/keymaps/sethbc/keymap.c b/keyboards/satan/keymaps/sethbc/keymap.c
index 0ea4a7ae4..f8991f9fd 100644
--- a/keyboards/satan/keymaps/sethbc/keymap.c
+++ b/keyboards/satan/keymaps/sethbc/keymap.c
@@ -1,9 +1,5 @@
1#include "satan.h" 1#include "satan.h"
2 2
3#ifdef RGBLIGHT_ENABLE
4#include "rgblight.h"
5#endif
6
7// Used for SHIFT_ESC 3// Used for SHIFT_ESC
8#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) 4#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
9 5
@@ -44,39 +40,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
44 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 40 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
45 #else 41 #else
46 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, RESET, \ 42 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, RESET, \
47 KC_CAPS, KC_TRNS, F(1), F(2), F(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, \ 43 KC_CAPS, KC_TRNS, RGB_TOG,RGB_MOD,RGB_HUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, \
48 KC_TRNS, KC_VOLD, F(4), F(5), F(6), KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT, \ 44 KC_TRNS, KC_VOLD, RGB_HUD,RGB_SAI,RGB_SAD, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT, \
49 KC_TRNS, F(7), F(8), KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, \ 45 KC_TRNS, RGB_VAI,RGB_VAD,KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, \
50 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 46 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
51 #endif 47 #endif
52}; 48};
53 49
54enum function_id { 50enum function_id {
55 SHIFT_ESC, 51 SHIFT_ESC,
56 #ifdef RGBLIGHT_ENABLE
57 RGBLED_TOGGLE,
58 RGBLED_STEP_MODE,
59 RGBLED_INCREASE_HUE,
60 RGBLED_DECREASE_HUE,
61 RGBLED_INCREASE_SAT,
62 RGBLED_DECREASE_SAT,
63 RGBLED_INCREASE_VAL,
64 RGBLED_DECREASE_VAL
65 #endif
66}; 52};
67 53
68const uint16_t PROGMEM fn_actions[] = { 54const uint16_t PROGMEM fn_actions[] = {
69 [0] = ACTION_FUNCTION(SHIFT_ESC), 55 [0] = ACTION_FUNCTION(SHIFT_ESC),
70 #ifdef RGBLIGHT_ENABLE
71 [1] = ACTION_FUNCTION(RGBLED_TOGGLE),
72 [2] = ACTION_FUNCTION(RGBLED_STEP_MODE),
73 [3] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
74 [4] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
75 [5] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
76 [6] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
77 [7] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
78 [8] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
79 #endif
80}; 56};
81 57
82void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 58void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
@@ -102,48 +78,5 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
102 } 78 }
103 } 79 }
104 break; 80 break;
105 //led operations
106 #ifdef RGBLIGHT_ENABLE
107 case RGBLED_TOGGLE:
108 if (record->event.pressed) {
109 rgblight_toggle();
110 }
111 break;
112 case RGBLED_INCREASE_HUE:
113 if (record->event.pressed) {
114 rgblight_increase_hue();
115 }
116 break;
117 case RGBLED_DECREASE_HUE:
118 if (record->event.pressed) {
119 rgblight_decrease_hue();
120 }
121 break;
122 case RGBLED_INCREASE_SAT:
123 if (record->event.pressed) {
124 rgblight_increase_sat();
125 }
126 break;
127 case RGBLED_DECREASE_SAT:
128 if (record->event.pressed) {
129 rgblight_decrease_sat();
130 }
131 break;
132 case RGBLED_INCREASE_VAL:
133 if (record->event.pressed) {
134 rgblight_increase_val();
135 }
136 break;
137 case RGBLED_DECREASE_VAL:
138 if (record->event.pressed) {
139 rgblight_decrease_val();
140 }
141 break;
142 case RGBLED_STEP_MODE:
143 if (record->event.pressed) {
144 rgblight_step();
145 }
146 break;
147 #endif
148 } 81 }
149} 82}
diff --git a/keyboards/satan/keymaps/stanleylai/config.h b/keyboards/satan/keymaps/stanleylai/config.h
new file mode 100644
index 000000000..ae2bd36db
--- /dev/null
+++ b/keyboards/satan/keymaps/stanleylai/config.h
@@ -0,0 +1,20 @@
1#include "../../config.h"
2
3// USB Device descriptor parameter
4#define VENDOR_ID 0xFEED
5#define PRODUCT_ID 0x6060
6#define DEVICE_VER 0x0003
7#define MANUFACTURER Custom
8#define PRODUCT GH60 rev.CHN
9#define DESCRIPTION QMK keyboard firmware for GH60 with WS2812 support
10
11// Backlight configuration
12#define BACKLIGHT_LEVELS 3
13
14// Underlight configuration
15#define RGB_DI_PIN E2
16#define RGBLIGHT_TIMER
17#define RGBLED_NUM 6 // Number of LEDs
18#define RGBLIGHT_HUE_STEP 8
19#define RGBLIGHT_SAT_STEP 8
20#define RGBLIGHT_VAL_STEP 8
diff --git a/keyboards/satan/keymaps/stanleylai/keymap.c b/keyboards/satan/keymaps/stanleylai/keymap.c
new file mode 100644
index 000000000..623427e97
--- /dev/null
+++ b/keyboards/satan/keymaps/stanleylai/keymap.c
@@ -0,0 +1,84 @@
1#include "satan.h"
2
3// Used for SHIFT_ESC
4#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
5
6// Each layer gets a name for readability, which is then used in the keymap matrix below.
7// The underscores don't mean anything - you can have a layer called STUFF or any other name.
8// Layer names don't all need to be of the same length, obviously, and you can also skip them
9// entirely and just use numbers.
10#define _BL 0
11#define _FL 1
12#define _RGBL 2
13
14const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15
16// See base_layer.png and rgb_layer.png for layout reference
17
18// Base Default Layer
19// Mac Modifier Layout. Use BootMagic to toggle GUI and ALT positions.
20[_BL] = KEYMAP_HHKB(
21 F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NO, \
22 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
23 LT(_FL, KC_CAPS), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
24 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, MO(_FL), \
25 KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_LEFT, KC_DOWN, KC_RGHT),
26
27// Function layer
28[_FL] = KEYMAP_HHKB(
29 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_NO, \
30 KC_NO, KC_MPRV, KC_UP, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, \
31 KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
32 KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LT(_RGBL, KC_PGUP), KC_TRNS, \
33 KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_TRNS, KC_HOME, KC_PGDN, KC_END),
34
35// RGB Layer
36[_RGBL] = KEYMAP_HHKB(
37 #ifdef RGBLIGHT_ENABLE
38 RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
39 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
40 KC_NO, BL_TOGG, BL_STEP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
41 KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_NO, KC_NO, KC_TRNS, KC_TRNS,\
42 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
43 #else
44 RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
45 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
46 KC_NO, BL_TOGG, BL_STEP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
47 KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS,\
48 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
49 #endif
50};
51
52enum function_id {
53 SHIFT_ESC,
54};
55
56const uint16_t PROGMEM fn_actions[] = {
57 [0] = ACTION_FUNCTION(SHIFT_ESC),
58};
59
60void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
61 static uint8_t shift_esc_shift_mask;
62 switch (id) {
63 case SHIFT_ESC:
64 shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
65 if (record->event.pressed) {
66 if (shift_esc_shift_mask) {
67 add_key(KC_GRV);
68 send_keyboard_report();
69 } else {
70 add_key(KC_ESC);
71 send_keyboard_report();
72 }
73 } else {
74 if (shift_esc_shift_mask) {
75 del_key(KC_GRV);
76 send_keyboard_report();
77 } else {
78 del_key(KC_ESC);
79 send_keyboard_report();
80 }
81 }
82 break;
83 }
84}
diff --git a/lib/ugfx b/lib/ugfx
new file mode 160000
Subproject 13e084ae6231857cd0d472c529f34be07d93c08
diff --git a/quantum/keymap.h b/quantum/keymap.h
index 73f99f821..a15865183 100644
--- a/quantum/keymap.h
+++ b/quantum/keymap.h
@@ -156,6 +156,16 @@ enum quantum_keycodes {
156 BL_INC, 156 BL_INC,
157 BL_TOGG, 157 BL_TOGG,
158 BL_STEP, 158 BL_STEP,
159
160 // RGB functionality
161 RGB_TOG,
162 RGB_MOD,
163 RGB_HUI,
164 RGB_HUD,
165 RGB_SAI,
166 RGB_SAD,
167 RGB_VAI,
168 RGB_VAD,
159 169
160 // Left shift, open paren 170 // Left shift, open paren
161 KC_LSPO, 171 KC_LSPO,
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index 76872ac59..d0a8312c1 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -62,7 +62,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
62 case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE: 62 case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
63 action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode)); 63 action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
64 break; 64 break;
65 case KC_AUDIO_MUTE ... KC_WWW_FAVORITES: 65 case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
66 action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode)); 66 action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
67 break; 67 break;
68 case KC_MS_UP ... KC_MS_ACCEL2: 68 case KC_MS_UP ... KC_MS_ACCEL2:
diff --git a/quantum/light_ws2812.c b/quantum/light_ws2812.c
index f20043067..401845e85 100755
--- a/quantum/light_ws2812.c
+++ b/quantum/light_ws2812.c
@@ -19,12 +19,16 @@
19// Setleds for standard RGB 19// Setleds for standard RGB
20void inline ws2812_setleds(struct cRGB *ledarray, uint16_t leds) 20void inline ws2812_setleds(struct cRGB *ledarray, uint16_t leds)
21{ 21{
22 ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin)); 22 // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin));
23 ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF));
23} 24}
24 25
25void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pinmask) 26void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pinmask)
26{ 27{
27 ws2812_DDRREG |= pinmask; // Enable DDR 28 // ws2812_DDRREG |= pinmask; // Enable DDR
29 // new universal format (DDR)
30 _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask;
31
28 ws2812_sendarray_mask((uint8_t*)ledarray,leds+leds+leds,pinmask); 32 ws2812_sendarray_mask((uint8_t*)ledarray,leds+leds+leds,pinmask);
29 _delay_us(50); 33 _delay_us(50);
30} 34}
@@ -32,14 +36,17 @@ void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pin
32// Setleds for SK6812RGBW 36// Setleds for SK6812RGBW
33void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds) 37void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds)
34{ 38{
35 ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR 39 // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR
36 ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(ws2812_pin)); 40 // new universal format (DDR)
41 _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF);
42
43 ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF));
37 _delay_us(80); 44 _delay_us(80);
38} 45}
39 46
40void ws2812_sendarray(uint8_t *data,uint16_t datlen) 47void ws2812_sendarray(uint8_t *data,uint16_t datlen)
41{ 48{
42 ws2812_sendarray_mask(data,datlen,_BV(ws2812_pin)); 49 ws2812_sendarray_mask(data,datlen,_BV(RGB_DI_PIN & 0xF));
43} 50}
44 51
45/* 52/*
@@ -108,8 +115,10 @@ void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi)
108 uint8_t curbyte,ctr,masklo; 115 uint8_t curbyte,ctr,masklo;
109 uint8_t sreg_prev; 116 uint8_t sreg_prev;
110 117
111 masklo =~maskhi&ws2812_PORTREG; 118 // masklo =~maskhi&ws2812_PORTREG;
112 maskhi |= ws2812_PORTREG; 119 // maskhi |= ws2812_PORTREG;
120 masklo =~maskhi&_SFR_IO8((RGB_DI_PIN >> 4) + 2);
121 maskhi |= _SFR_IO8((RGB_DI_PIN >> 4) + 2);
113 sreg_prev=SREG; 122 sreg_prev=SREG;
114 cli(); 123 cli();
115 124
@@ -173,7 +182,7 @@ w_nop16
173 " dec %0 \n\t" // '1' [+2] '0' [+2] 182 " dec %0 \n\t" // '1' [+2] '0' [+2]
174 " brne loop%=\n\t" // '1' [+3] '0' [+4] 183 " brne loop%=\n\t" // '1' [+3] '0' [+4]
175 : "=&d" (ctr) 184 : "=&d" (ctr)
176 : "r" (curbyte), "I" (_SFR_IO_ADDR(ws2812_PORTREG)), "r" (maskhi), "r" (masklo) 185 : "r" (curbyte), "I" (_SFR_IO_ADDR(_SFR_IO8((RGB_DI_PIN >> 4) + 2))), "r" (maskhi), "r" (masklo)
177 ); 186 );
178 } 187 }
179 188
diff --git a/quantum/quantum.c b/quantum/quantum.c
index d8e43a465..d5b9753b7 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -93,16 +93,66 @@ bool process_record_quantum(keyrecord_t *record) {
93 *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific 93 *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
94 #endif 94 #endif
95 bootloader_jump(); 95 bootloader_jump();
96 return false;
97 } 96 }
97 return false;
98 break; 98 break;
99 case DEBUG: 99 case DEBUG:
100 if (record->event.pressed) { 100 if (record->event.pressed) {
101 print("\nDEBUG: enabled.\n"); 101 print("\nDEBUG: enabled.\n");
102 debug_enable = true; 102 debug_enable = true;
103 return false;
104 } 103 }
104 return false;
105 break;
106 #ifdef RGBLIGHT_ENABLE
107 case RGB_TOG:
108 if (record->event.pressed) {
109 rgblight_toggle();
110 }
111 return false;
112 break;
113 case RGB_MOD:
114 if (record->event.pressed) {
115 rgblight_step();
116 }
117 return false;
105 break; 118 break;
119 case RGB_HUI:
120 if (record->event.pressed) {
121 rgblight_increase_hue();
122 }
123 return false;
124 break;
125 case RGB_HUD:
126 if (record->event.pressed) {
127 rgblight_decrease_hue();
128 }
129 return false;
130 break;
131 case RGB_SAI:
132 if (record->event.pressed) {
133 rgblight_increase_sat();
134 }
135 return false;
136 break;
137 case RGB_SAD:
138 if (record->event.pressed) {
139 rgblight_decrease_sat();
140 }
141 return false;
142 break;
143 case RGB_VAI:
144 if (record->event.pressed) {
145 rgblight_increase_val();
146 }
147 return false;
148 break;
149 case RGB_VAD:
150 if (record->event.pressed) {
151 rgblight_decrease_val();
152 }
153 return false;
154 break;
155 #endif
106 case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_UNSWAP_ALT_GUI: 156 case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_UNSWAP_ALT_GUI:
107 if (record->event.pressed) { 157 if (record->event.pressed) {
108 // MAGIC actions (BOOTMAGIC without the boot) 158 // MAGIC actions (BOOTMAGIC without the boot)
@@ -162,6 +212,12 @@ bool process_record_quantum(keyrecord_t *record) {
162 register_mods(MOD_BIT(KC_LSFT)); 212 register_mods(MOD_BIT(KC_LSFT));
163 } 213 }
164 else { 214 else {
215 #ifdef DISABLE_SPACE_CADET_ROLLOVER
216 if (get_mods() & MOD_BIT(KC_RSFT)) {
217 shift_interrupted[0] = true;
218 shift_interrupted[1] = true;
219 }
220 #endif
165 if (!shift_interrupted[0]) { 221 if (!shift_interrupted[0]) {
166 register_code(LSPO_KEY); 222 register_code(LSPO_KEY);
167 unregister_code(LSPO_KEY); 223 unregister_code(LSPO_KEY);
@@ -178,6 +234,12 @@ bool process_record_quantum(keyrecord_t *record) {
178 register_mods(MOD_BIT(KC_RSFT)); 234 register_mods(MOD_BIT(KC_RSFT));
179 } 235 }
180 else { 236 else {
237 #ifdef DISABLE_SPACE_CADET_ROLLOVER
238 if (get_mods() & MOD_BIT(KC_LSFT)) {
239 shift_interrupted[0] = true;
240 shift_interrupted[1] = true;
241 }
242 #endif
181 if (!shift_interrupted[1]) { 243 if (!shift_interrupted[1]) {
182 register_code(RSPC_KEY); 244 register_code(RSPC_KEY);
183 unregister_code(RSPC_KEY); 245 unregister_code(RSPC_KEY);
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index c29ffedc3..b1b0f035d 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -146,7 +146,9 @@ void rgblight_init(void) {
146 } 146 }
147 eeconfig_debug_rgblight(); // display current eeprom values 147 eeconfig_debug_rgblight(); // display current eeprom values
148 148
149 rgblight_timer_init(); // setup the timer 149 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
150 rgblight_timer_init(); // setup the timer
151 #endif
150 152
151 if (rgblight_config.enable) { 153 if (rgblight_config.enable) {
152 rgblight_mode(rgblight_config.mode); 154 rgblight_mode(rgblight_config.mode);
@@ -192,14 +194,19 @@ void rgblight_mode(uint8_t mode) {
192 eeconfig_update_rgblight(rgblight_config.raw); 194 eeconfig_update_rgblight(rgblight_config.raw);
193 xprintf("rgblight mode: %u\n", rgblight_config.mode); 195 xprintf("rgblight mode: %u\n", rgblight_config.mode);
194 if (rgblight_config.mode == 1) { 196 if (rgblight_config.mode == 1) {
195 rgblight_timer_disable(); 197 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
198 rgblight_timer_disable();
199 #endif
196 } else if (rgblight_config.mode >=2 && rgblight_config.mode <=23) { 200 } else if (rgblight_config.mode >=2 && rgblight_config.mode <=23) {
197 // MODE 2-5, breathing 201 // MODE 2-5, breathing
198 // MODE 6-8, rainbow mood 202 // MODE 6-8, rainbow mood
199 // MODE 9-14, rainbow swirl 203 // MODE 9-14, rainbow swirl
200 // MODE 15-20, snake 204 // MODE 15-20, snake
201 // MODE 21-23, knight 205 // MODE 21-23, knight
202 rgblight_timer_enable(); 206
207 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
208 rgblight_timer_enable();
209 #endif
203 } 210 }
204 rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); 211 rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
205} 212}
@@ -211,7 +218,10 @@ void rgblight_toggle(void) {
211 if (rgblight_config.enable) { 218 if (rgblight_config.enable) {
212 rgblight_mode(rgblight_config.mode); 219 rgblight_mode(rgblight_config.mode);
213 } else { 220 } else {
214 rgblight_timer_disable(); 221
222 #if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
223 rgblight_timer_disable();
224 #endif
215 _delay_ms(50); 225 _delay_ms(50);
216 rgblight_set(); 226 rgblight_set();
217 } 227 }
@@ -328,6 +338,9 @@ void rgblight_set(void) {
328 } 338 }
329} 339}
330 340
341
342#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
343
331// Animation timer -- AVR Timer3 344// Animation timer -- AVR Timer3
332void rgblight_timer_init(void) { 345void rgblight_timer_init(void) {
333 static uint8_t rgblight_timer_is_init = 0; 346 static uint8_t rgblight_timer_is_init = 0;
@@ -503,3 +516,5 @@ void rgblight_effect_knight(uint8_t interval) {
503 } 516 }
504 517
505} 518}
519
520#endif \ No newline at end of file
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 64f92523e..def26c428 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -1,8 +1,11 @@
1#ifndef RGBLIGHT_H 1#ifndef RGBLIGHT_H
2#define RGBLIGHT_H 2#define RGBLIGHT_H
3 3
4#ifndef RGBLIGHT_MODES 4
5#define RGBLIGHT_MODES 23 5#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
6 #define RGBLIGHT_MODES 23
7#else
8 #define RGBLIGHT_MODES 1
6#endif 9#endif
7 10
8#ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH 11#ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH
diff --git a/quantum/template/template.c b/quantum/template/template.c
index dcc4b0a22..5ef349583 100644
--- a/quantum/template/template.c
+++ b/quantum/template/template.c
@@ -18,7 +18,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
18 // put your per-action keyboard code here 18 // put your per-action keyboard code here
19 // runs for every action, just before processing by the firmware 19 // runs for every action, just before processing by the firmware
20 20
21 return process_action_user(record); 21 return process_record_user(keycode, record);
22} 22}
23 23
24void led_set_kb(uint8_t usb_led) { 24void led_set_kb(uint8_t usb_led) {
diff --git a/quantum/visualizer/led_test.c b/quantum/visualizer/led_test.c
index c2ea30b55..a9abace8d 100644
--- a/quantum/visualizer/led_test.c
+++ b/quantum/visualizer/led_test.c
@@ -89,8 +89,8 @@ static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS];
89static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS]; 89static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS];
90 90
91static uint8_t compute_gradient_color(float t, float index, float num) { 91static uint8_t compute_gradient_color(float t, float index, float num) {
92 const float two_pi = 2.0f * PI; 92 const float two_pi = M_2_PI;
93 float normalized_index = (1.0f - index / (num - 1)) * two_pi; 93 float normalized_index = (1.0f - index / (num - 1.0f)) * two_pi;
94 float x = t * two_pi + normalized_index; 94 float x = t * two_pi + normalized_index;
95 float v = 0.5 * (cosf(x) + 1.0f); 95 float v = 0.5 * (cosf(x) + 1.0f);
96 return (uint8_t)(255.0f * v); 96 return (uint8_t)(255.0f * v);
diff --git a/quantum/visualizer/visualizer.c b/quantum/visualizer/visualizer.c
index c24073405..54f6faaa4 100644
--- a/quantum/visualizer/visualizer.c
+++ b/quantum/visualizer/visualizer.c
@@ -29,9 +29,7 @@ SOFTWARE.
29#include "ch.h" 29#include "ch.h"
30#endif 30#endif
31 31
32#ifdef LCD_ENABLE
33#include "gfx.h" 32#include "gfx.h"
34#endif
35 33
36#ifdef LCD_BACKLIGHT_ENABLE 34#ifdef LCD_BACKLIGHT_ENABLE
37#include "lcd_backlight.h" 35#include "lcd_backlight.h"
@@ -45,7 +43,7 @@ SOFTWARE.
45#include "nodebug.h" 43#include "nodebug.h"
46#endif 44#endif
47 45
48#ifdef USE_SERIAL_LINK 46#ifdef SERIAL_LINK_ENABLE
49#include "serial_link/protocol/transport.h" 47#include "serial_link/protocol/transport.h"
50#include "serial_link/system/serial_link.h" 48#include "serial_link/system/serial_link.h"
51#endif 49#endif
@@ -75,7 +73,7 @@ static bool visualizer_enabled = false;
75#define MAX_SIMULTANEOUS_ANIMATIONS 4 73#define MAX_SIMULTANEOUS_ANIMATIONS 4
76static keyframe_animation_t* animations[MAX_SIMULTANEOUS_ANIMATIONS] = {}; 74static keyframe_animation_t* animations[MAX_SIMULTANEOUS_ANIMATIONS] = {};
77 75
78#ifdef USE_SERIAL_LINK 76#ifdef SERIAL_LINK_ENABLE
79MASTER_TO_ALL_SLAVES_OBJECT(current_status, visualizer_keyboard_status_t); 77MASTER_TO_ALL_SLAVES_OBJECT(current_status, visualizer_keyboard_status_t);
80 78
81static remote_object_t* remote_objects[] = { 79static remote_object_t* remote_objects[] = {
@@ -458,15 +456,13 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
458} 456}
459 457
460void visualizer_init(void) { 458void visualizer_init(void) {
461#ifdef LCD_ENABLE
462 gfxInit(); 459 gfxInit();
463#endif
464 460
465#ifdef LCD_BACKLIGHT_ENABLE 461#ifdef LCD_BACKLIGHT_ENABLE
466 lcd_backlight_init(); 462 lcd_backlight_init();
467#endif 463#endif
468 464
469#ifdef USE_SERIAL_LINK 465#ifdef SERIAL_LINK_ENABLE
470 add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) ); 466 add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) );
471#endif 467#endif
472 468
@@ -490,7 +486,7 @@ void update_status(bool changed) {
490 geventSendEvent(listener); 486 geventSendEvent(listener);
491 } 487 }
492 } 488 }
493#ifdef USE_SERIAL_LINK 489#ifdef SERIAL_LINK_ENABLE
494 static systime_t last_update = 0; 490 static systime_t last_update = 0;
495 systime_t current_update = chVTGetSystemTimeX(); 491 systime_t current_update = chVTGetSystemTimeX();
496 systime_t delta = current_update - last_update; 492 systime_t delta = current_update - last_update;
@@ -510,7 +506,7 @@ void visualizer_update(uint32_t default_state, uint32_t state, uint32_t leds) {
510 // Alternatively a mutex could be used instead of the volatile variables 506 // Alternatively a mutex could be used instead of the volatile variables
511 507
512 bool changed = false; 508 bool changed = false;
513#ifdef USE_SERIAL_LINK 509#ifdef SERIAL_LINK_ENABLE
514 if (is_serial_link_connected ()) { 510 if (is_serial_link_connected ()) {
515 visualizer_keyboard_status_t* new_status = read_current_status(); 511 visualizer_keyboard_status_t* new_status = read_current_status();
516 if (new_status) { 512 if (new_status) {
diff --git a/quantum/visualizer/visualizer.h b/quantum/visualizer/visualizer.h
index 45cfa9aa9..53e250725 100644
--- a/quantum/visualizer/visualizer.h
+++ b/quantum/visualizer/visualizer.h
@@ -28,9 +28,7 @@ SOFTWARE.
28#include <stdint.h> 28#include <stdint.h>
29#include <stdbool.h> 29#include <stdbool.h>
30 30
31#ifdef LCD_ENABLE
32#include "gfx.h" 31#include "gfx.h"
33#endif
34 32
35#ifdef LCD_BACKLIGHT_ENABLE 33#ifdef LCD_BACKLIGHT_ENABLE
36#include "lcd_backlight.h" 34#include "lcd_backlight.h"
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk
index 56525ffd9..2f4a41d66 100644
--- a/quantum/visualizer/visualizer.mk
+++ b/quantum/visualizer/visualizer.mk
@@ -20,41 +20,41 @@
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21# SOFTWARE. 21# SOFTWARE.
22 22
23GFXLIB = $(VISUALIZER_DIR)/ugfx
24SRC += $(VISUALIZER_DIR)/visualizer.c 23SRC += $(VISUALIZER_DIR)/visualizer.c
25UINCDIR += $(GFXINC) $(VISUALIZER_DIR) 24EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR)
25GFXLIB = $(LIB_PATH)/ugfx
26VPATH += $(VISUALIZER_PATH)
27
28OPT_DEFS += -DVISUALIZER_ENABLE
26 29
27ifdef LCD_ENABLE 30ifdef LCD_ENABLE
28UDEFS += -DLCD_ENABLE 31OPT_DEFS += -DLCD_ENABLE
29ULIBS += -lm 32ULIBS += -lm
30USE_UGFX = yes
31endif 33endif
32 34
33ifdef LCD_BACKLIGHT_ENABLE 35ifdef LCD_BACKLIGHT_ENABLE
34SRC += $(VISUALIZER_DIR)/lcd_backlight.c 36SRC += $(VISUALIZER_DIR)/lcd_backlight.c
35ifndef EMULATOR 37OPT_DEFS += -DLCD_BACKLIGHT_ENABLE
36SRC += lcd_backlight_hal.c
37endif
38UDEFS += -DLCD_BACKLIGHT_ENABLE
39endif 38endif
40 39
41ifdef LED_ENABLE 40ifdef LED_ENABLE
42SRC += $(VISUALIZER_DIR)/led_test.c 41SRC += $(VISUALIZER_DIR)/led_test.c
43UDEFS += -DLED_ENABLE 42OPT_DEFS += -DLED_ENABLE
44USE_UGFX = yes
45endif 43endif
46 44
47ifdef USE_UGFX
48include $(GFXLIB)/gfx.mk 45include $(GFXLIB)/gfx.mk
49SRC += $(GFXSRC) 46SRC += $(patsubst $(TOP_DIR)/%,%,$(GFXSRC))
50UDEFS += $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) 47OPT_DEFS += $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS)))
51ULIBS += $(patsubst %,-l%,$(patsubst -l%,%,$(GFXLIBS)))
52endif
53 48
54ifndef VISUALIZER_USER 49ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","")
55VISUALIZER_USER = visualizer_user.c 50 SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c
51else
52 ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","")
53$(error "$(KEYMAP_PATH)/visualizer.c" does not exist)
54 else
55 SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c
56 endif
56endif 57endif
57SRC += $(VISUALIZER_USER)
58 58
59ifdef EMULATOR 59ifdef EMULATOR
60UINCDIR += $(TMK_DIR)/common 60UINCDIR += $(TMK_DIR)/common
diff --git a/readme.md b/readme.md
index c24d951d8..e0dcd5608 100644
--- a/readme.md
+++ b/readme.md
@@ -24,9 +24,6 @@ The project also includes community support for [lots of other keyboards](/keybo
24QMK is developed and maintained by Jack Humbert of OLKB with contributions from the community, and of course, [Hasu](https://github.com/tmk). This repo used to be a fork of [TMK](https://github.com/tmk/tmk_keyboard), and we are incredibly grateful for his founding contributions to the firmware. We've had to break the fork due to purely technical reasons - it simply became too different over time, and we've had to start refactoring some of the basic bits and pieces. We are huge fans of TMK and Hasu :) 24QMK is developed and maintained by Jack Humbert of OLKB with contributions from the community, and of course, [Hasu](https://github.com/tmk). This repo used to be a fork of [TMK](https://github.com/tmk/tmk_keyboard), and we are incredibly grateful for his founding contributions to the firmware. We've had to break the fork due to purely technical reasons - it simply became too different over time, and we've had to start refactoring some of the basic bits and pieces. We are huge fans of TMK and Hasu :)
25 25
26This documentation is edited and maintained by Erez Zukerman of ErgoDox EZ. If you spot any typos or inaccuracies, please [open an issue](https://github.com/jackhumbert/qmk_firmware/issues/new). 26This documentation is edited and maintained by Erez Zukerman of ErgoDox EZ. If you spot any typos or inaccuracies, please [open an issue](https://github.com/jackhumbert/qmk_firmware/issues/new).
27#### 2016/02/10
28core: flabbergast's Chibios protocol was merged from <https://github.com/flabbergast/tmk_keyboard/tree/chibios> (@72b1668). See [tmk_core/protocol/chibios/README.md](tmk_core/protocol/chibios/README.md). Chibios protocol supports Cortex-M such as STM32 and Kinetis.
29
30 27
31The OLKB product firmwares are maintained by [Jack Humbert](https://github.com/jackhumbert), the Ergodox EZ by [Erez Zukerman](https://github.com/ezuk), and the Clueboard by [Zach White](https://github.com/skullydazed). 28The OLKB product firmwares are maintained by [Jack Humbert](https://github.com/jackhumbert), the Ergodox EZ by [Erez Zukerman](https://github.com/ezuk), and the Clueboard by [Zach White](https://github.com/skullydazed).
32 29
@@ -309,6 +306,12 @@ It's defaulted to work on US keyboards, but if your layout uses different keys f
309 #define LSPO_KEY KC_9 306 #define LSPO_KEY KC_9
310 #define RSPC_KEY KC_0 307 #define RSPC_KEY KC_0
311 308
309You can also choose between different rollover behaviors of the shift keys by defining:
310
311 #define DISABLE_SPACE_CADET_ROLLOVER
312
313in your `config.h`. Disabling rollover allows you to use the opposite shift key to cancel the space cadet state in the event of an erroneous press instead of emitting a pair of parentheses when the keys are released.
314
312The only other thing you're going to want to do is create a `Makefile` in your keymap directory and set the following: 315The only other thing you're going to want to do is create a `Makefile` in your keymap directory and set the following:
313 316
314``` 317```
@@ -353,6 +356,81 @@ void matrix_scan_user(void) {
353 356
354As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_KEYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously. 357As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_KEYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.
355 358
359### Tap Dance: A single key can do 3, 5, or 100 different things
360
361Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. It's one of the nicest community-contributed features in the firmware, conceived and created by [algernon](https://github.com/algernon) in [#451](https://github.com/jackhumbert/qmk_firmware/pull/451). Here's how Algernon describes the feature:
362
363With this feature one can specify keys that behave differently, based on the amount of times they have been tapped, and when interrupted, they get handled before the interrupter.
364
365To make it clear how this is different from `ACTION_FUNCTION_TAP`, lets explore a certain setup! We want one key to send `Space` on single tap, but `Enter` on double-tap.
366
367With `ACTION_FUNCTION_TAP`, it is quite a rain-dance to set this up, and has the problem that when the sequence is interrupted, the interrupting key will be send first. Thus, `SPC a` will result in `a SPC` being sent, if they are typed within `TAPPING_TERM`. With the tap dance feature, that'll come out as `SPC a`, correctly.
368
369The implementation hooks into two parts of the system, to achieve this: into `process_record_quantum()`, and the matrix scan. We need the latter to be able to time out a tap sequence even when a key is not being pressed, so `SPC` alone will time out and register after `TAPPING_TERM` time.
370
371But lets start with how to use it, first!
372
373First, you will need `TAP_DANCE_ENABLE=yes` in your `Makefile`, because the feature is disabled by default. This adds a little less than 1k to the firmware size. Next, you will want to define some tap-dance keys, which is easiest to do with the `TD()` macro, that - similar to `F()`, takes a number, which will later be used as an index into the `tap_dance_actions` array.
374
375This array specifies what actions shall be taken when a tap-dance key is in action. Currently, there are two possible options:
376
377* `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise.
378* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the current state of the tap-dance action.
379
380The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise.
381
382And that's the bulk of it!
383
384Do note, however, that this implementation does have some consequences: keys do not register until either they reach the tapping ceiling, or they time out. This means that if you hold the key, nothing happens, no repeat, no nothing. It is possible to detect held state, and register an action then too, but that's not implemented yet. Keys also unregister immediately after being registered, so you can't even hold the second tap. This is intentional, to be consistent.
385
386And now, on to the explanation of how it works!
387
388The main entry point is `process_tap_dance()`, called from `process_record_quantum()`, which is run for every keypress, and our handler gets to run early. This function checks whether the key pressed is a tap-dance key. If it is not, and a tap-dance was in action, we handle that first, and enqueue the newly pressed key. If it is a tap-dance key, then we check if it is the same as the already active one (if there's one active, that is). If it is not, we fire off the old one first, then register the new one. If it was the same, we increment the counter and the timer.
389
390This means that you have `TAPPING_TERM` time to tap the key again, you do not have to input all the taps within that timeframe. This allows for longer tap counts, with minimal impact on responsiveness.
391
392Our next stop is `matrix_scan_tap_dance()`. This handles the timeout of tap-dance keys.
393
394For the sake of flexibility, tap-dance actions can be either a pair of keycodes, or a user function. The latter allows one to handle higher tap counts, or do extra things, like blink the LEDs, fiddle with the backlighting, and so on. This is accomplished by using an union, and some clever macros.
395
396In the end, let's see a full example!
397
398```c
399enum {
400 CT_SE = 0,
401 CT_CLN,
402 CT_EGG
403};
404
405/* Have the above three on the keymap, TD(CT_SE), etc... */
406
407void dance_cln (qk_tap_dance_state_t *state) {
408 if (state->count == 1) {
409 register_code (KC_RSFT);
410 register_code (KC_SCLN);
411 unregister_code (KC_SCLN);
412 unregister_code (KC_RSFT);
413 } else {
414 register_code (KC_SCLN);
415 unregister_code (KC_SCLN);
416 reset_tap_dance (state);
417 }
418}
419
420void dance_egg (qk_tap_dance_state_t *state) {
421 if (state->count >= 100) {
422 SEND_STRING ("Safety dance!");
423 reset_tap_dance (state);
424 }
425}
426
427const qk_tap_dance_action_t tap_dance_actions[] = {
428 [CT_SE] = ACTION_TAP_DANCE_DOUBLE (KC_SPC, KC_ENT)
429 ,[CT_CLN] = ACTION_TAP_DANCE_FN (dance_cln)
430 ,[CT_EGG] = ACTION_TAP_DANCE_FN (dance_egg)
431};
432```
433
356### Temporarily setting the default layer 434### Temporarily setting the default layer
357 435
358`DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does. 436`DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
@@ -704,23 +782,18 @@ For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring
704 782
705 RGBLIGHT_ENABLE = yes 783 RGBLIGHT_ENABLE = yes
706 784
707Please note that the underglow is not compatible with audio output. So you cannot enable both of them at the same time. 785In order to use the underglow timer functions, you need to have `#define RGBLIGHT_TIMER` in your `config.h`, and have audio disabled (`AUDIO_ENABLE = no` in your Makefile).
708 786
709Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the F4 by default: 787Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default:
710 788
711 #define ws2812_PORTREG PORTF 789 #define RGB_DI_PIN F4 // The pin your RGB strip is wired to
712 #define ws2812_DDRREG DDRF 790 #define RGBLIGHT_TIMER // Require for fancier stuff (not compatible with audio)
713 #define ws2812_pin PF4
714 #define RGBLED_NUM 14 // Number of LEDs 791 #define RGBLED_NUM 14 // Number of LEDs
715 #define RGBLIGHT_HUE_STEP 10 792 #define RGBLIGHT_HUE_STEP 10
716 #define RGBLIGHT_SAT_STEP 17 793 #define RGBLIGHT_SAT_STEP 17
717 #define RGBLIGHT_VAL_STEP 17 794 #define RGBLIGHT_VAL_STEP 17
718 795
719You'll need to edit `PORTF`, `DDRF`, and `PF4` on the first three lines to the port/pin you have your LED(s) wired to, eg for B3 change things to: 796You'll need to edit `RGB_DI_PIN` to the pin you have your `DI` on your RGB strip wired to.
720
721 #define ws2812_PORTREG PORTB
722 #define ws2812_DDRREG DDRB
723 #define ws2812_pin PB3
724 797
725The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects. To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations. For details, please check this keymap. `keyboards/planck/keymaps/yang/keymap.c` 798The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects. To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations. For details, please check this keymap. `keyboards/planck/keymaps/yang/keymap.c`
726 799
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index 5bae0d762..aa05b9491 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -107,7 +107,7 @@ endif
107 107
108 108
109# Version string 109# Version string
110OPT_DEFS += -DVERSION=$(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) 110OPT_DEFS += -DVERSION=$(GIT_VERSION)
111 111
112# Bootloader address 112# Bootloader address
113ifdef STM32_BOOTLOADER_ADDRESS 113ifdef STM32_BOOTLOADER_ADDRESS
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index 3a1262a9f..c46a701b3 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
29#include "sendchar.h" 29#include "sendchar.h"
30#include "eeconfig.h" 30#include "eeconfig.h"
31#include "backlight.h" 31#include "backlight.h"
32#include "action_layer.h"
32#ifdef BOOTMAGIC_ENABLE 33#ifdef BOOTMAGIC_ENABLE
33# include "bootmagic.h" 34# include "bootmagic.h"
34#else 35#else
@@ -52,6 +53,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
52#ifdef SERIAL_LINK_ENABLE 53#ifdef SERIAL_LINK_ENABLE
53# include "serial_link/system/serial_link.h" 54# include "serial_link/system/serial_link.h"
54#endif 55#endif
56#ifdef VISUALIZER_ENABLE
57# include "visualizer/visualizer.h"
58#endif
55 59
56#ifdef MATRIX_HAS_GHOST 60#ifdef MATRIX_HAS_GHOST
57static bool has_ghost_in_row(uint8_t row) 61static bool has_ghost_in_row(uint8_t row)
@@ -181,6 +185,10 @@ MATRIX_LOOP_END:
181 serial_link_update(); 185 serial_link_update();
182#endif 186#endif
183 187
188#ifdef VISUALIZER_ENABLE
189 visualizer_update(default_layer_state, layer_state, host_keyboard_leds());
190#endif
191
184 // update LED 192 // update LED
185 if (led_status != host_keyboard_leds()) { 193 if (led_status != host_keyboard_leds()) {
186 led_status = host_keyboard_leds(); 194 led_status = host_keyboard_leds();
diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h
index 448195306..2f208c54e 100644
--- a/tmk_core/common/keycode.h
+++ b/tmk_core/common/keycode.h
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
31 31
32#define IS_SPECIAL(code) ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF)) 32#define IS_SPECIAL(code) ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF))
33#define IS_SYSTEM(code) (KC_PWR <= (code) && (code) <= KC_WAKE) 33#define IS_SYSTEM(code) (KC_PWR <= (code) && (code) <= KC_WAKE)
34#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_WFAV) 34#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_MRWD)
35#define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN31) 35#define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN31)
36#define IS_MOUSEKEY(code) (KC_MS_UP <= (code) && (code) <= KC_MS_ACCEL2) 36#define IS_MOUSEKEY(code) (KC_MS_UP <= (code) && (code) <= KC_MS_ACCEL2)
37#define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT) 37#define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT)
@@ -156,8 +156,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
156#define KC_WSTP KC_WWW_STOP 156#define KC_WSTP KC_WWW_STOP
157#define KC_WREF KC_WWW_REFRESH 157#define KC_WREF KC_WWW_REFRESH
158#define KC_WFAV KC_WWW_FAVORITES 158#define KC_WFAV KC_WWW_FAVORITES
159/* Jump to bootloader */
160#define KC_BTLD KC_BOOTLOADER
161/* Transparent */ 159/* Transparent */
162#define KC_TRANSPARENT 1 160#define KC_TRANSPARENT 1
163#define KC_TRNS KC_TRANSPARENT 161#define KC_TRNS KC_TRANSPARENT
@@ -428,9 +426,6 @@ enum internal_special_keycodes {
428 KC_MEDIA_FAST_FORWARD, 426 KC_MEDIA_FAST_FORWARD,
429 KC_MEDIA_REWIND, /* 0xBC */ 427 KC_MEDIA_REWIND, /* 0xBC */
430 428
431 /* Jump to bootloader */
432 KC_BOOTLOADER = 0xBF,
433
434 /* Fn key */ 429 /* Fn key */
435 KC_FN0 = 0xC0, 430 KC_FN0 = 0xC0,
436 KC_FN1, 431 KC_FN1,
diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c
index aeb11752f..b0eb9aef8 100644
--- a/tmk_core/protocol/chibios/main.c
+++ b/tmk_core/protocol/chibios/main.c
@@ -38,6 +38,9 @@
38#ifdef SERIAL_LINK_ENABLE 38#ifdef SERIAL_LINK_ENABLE
39#include "serial_link/system/serial_link.h" 39#include "serial_link/system/serial_link.h"
40#endif 40#endif
41#ifdef VISUALIZER_ENABLE
42#include "visualizer/visualizer.h"
43#endif
41#include "suspend.h" 44#include "suspend.h"
42 45
43 46
@@ -105,6 +108,11 @@ int main(void) {
105 init_serial_link(); 108 init_serial_link();
106#endif 109#endif
107 110
111#ifdef VISUALIZER_ENABLE
112 visualizer_init();
113#endif
114
115
108 host_driver_t* driver = NULL; 116 host_driver_t* driver = NULL;
109 117
110 /* Wait until the USB or serial link is active */ 118 /* Wait until the USB or serial link is active */
@@ -147,6 +155,9 @@ int main(void) {
147 155
148 if(USB_DRIVER.state == USB_SUSPENDED) { 156 if(USB_DRIVER.state == USB_SUSPENDED) {
149 print("[s]"); 157 print("[s]");
158#ifdef VISUALIZER_ENABLE
159 visualizer_suspend();
160#endif
150 while(USB_DRIVER.state == USB_SUSPENDED) { 161 while(USB_DRIVER.state == USB_SUSPENDED) {
151 /* Do this in the suspended state */ 162 /* Do this in the suspended state */
152#ifdef SERIAL_LINK_ENABLE 163#ifdef SERIAL_LINK_ENABLE
@@ -164,6 +175,10 @@ int main(void) {
164#ifdef MOUSEKEY_ENABLE 175#ifdef MOUSEKEY_ENABLE
165 mousekey_send(); 176 mousekey_send();
166#endif /* MOUSEKEY_ENABLE */ 177#endif /* MOUSEKEY_ENABLE */
178
179#ifdef VISUALIZER_ENABLE
180 visualizer_resume();
181#endif
167 } 182 }
168 183
169 keyboard_task(); 184 keyboard_task();
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index 352e9314b..f13351ea1 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -260,7 +260,7 @@ LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst
260 260
261# Compiler flags to generate dependency files. 261# Compiler flags to generate dependency files.
262#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d 262#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
263GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$@).d 263GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$(subst $(BUILD_DIR)/,,$@)).d
264 264
265 265
266# Combine all necessary flags and optional flags. 266# Combine all necessary flags and optional flags.
@@ -271,23 +271,10 @@ ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
271ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS) 271ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
272 272
273# Default target. 273# Default target.
274all: 274all: build sizeafter
275 @$(MAKE) begin
276 @$(MAKE) gccversion
277 @$(MAKE) sizebefore
278 @$(MAKE) clean_list # force clean each time
279 @$(MAKE) build
280 @$(MAKE) sizeafter
281 @$(MAKE) end
282 275
283# Quick make that doesn't clean 276# Quick make that doesn't clean
284quick: 277quick: build sizeafter
285 @$(MAKE) begin
286 @$(MAKE) gccversion
287 @$(MAKE) sizebefore
288 @$(MAKE) build
289 @$(MAKE) sizeafter
290 @$(MAKE) end
291 278
292# Change the build target to build a HEX file or a library. 279# Change the build target to build a HEX file or a library.
293build: elf hex 280build: elf hex
@@ -303,13 +290,7 @@ sym: $(BUILD_DIR)/$(TARGET).sym
303LIBNAME=lib$(TARGET).a 290LIBNAME=lib$(TARGET).a
304lib: $(LIBNAME) 291lib: $(LIBNAME)
305 292
306 293check_submodule:
307
308# Eye candy.
309# AVR Studio 3.x does not check make's exit code but relies on
310# the following magic strings to be generated by the compile job.
311begin:
312 @$(SECHO) $(MSG_BEGIN)
313 git submodule status --recursive | \ 294 git submodule status --recursive | \
314 while IFS= read -r x; do \ 295 while IFS= read -r x; do \
315 case "$$x" in \ 296 case "$$x" in \
@@ -318,10 +299,6 @@ begin:
318 esac \ 299 esac \
319 done 300 done
320 301
321end:
322 @$(SECHO) $(MSG_END)
323
324
325# Display size of file. 302# Display size of file.
326HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex 303HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
327#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf 304#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
@@ -331,7 +308,7 @@ sizebefore:
331 @if test -f $(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \ 308 @if test -f $(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
332 2>/dev/null; $(SECHO); fi 309 2>/dev/null; $(SECHO); fi
333 310
334sizeafter: 311sizeafter: $(BUILD_DIR)/$(TARGET).hex
335 @if test -f $(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \ 312 @if test -f $(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
336 2>/dev/null; $(SECHO); fi 313 2>/dev/null; $(SECHO); fi
337 # test file sizes eventually 314 # test file sizes eventually
@@ -383,60 +360,55 @@ gccversion :
383 $(eval CMD=$(AR) $@ $(OBJ) ) 360 $(eval CMD=$(AR) $@ $(OBJ) )
384 @$(BUILD_CMD) 361 @$(BUILD_CMD)
385 362
363BEGIN = gccversion check_submodule sizebefore
364
386# Link: create ELF output file from object files. 365# Link: create ELF output file from object files.
387.SECONDARY : $(BUILD_DIR)/$(TARGET).elf 366.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
388.PRECIOUS : $(OBJ) 367.PRECIOUS : $(OBJ)
389%.elf: $(OBJ) 368%.elf: $(OBJ) | $(BEGIN)
390 @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD) 369 @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
391 $(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)) 370 $(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
392 @$(BUILD_CMD) 371 @$(BUILD_CMD)
393 372
394# Compile: create object files from C source files. 373# Compile: create object files from C source files.
395$(OBJDIR)/%.o : %.c 374$(OBJDIR)/%.o : %.c | $(BEGIN)
396 @mkdir -p $(@D) 375 @mkdir -p $(@D)
397 @$(SILENT) || printf "$(MSG_COMPILING) $<" | $(AWK_CMD) 376 @$(SILENT) || printf "$(MSG_COMPILING) $<" | $(AWK_CMD)
398 $(eval CMD=$(CC) -c $(ALL_CFLAGS) $< -o $@) 377 $(eval CMD=$(CC) -c $(ALL_CFLAGS) $< -o $@)
399 @$(BUILD_CMD) 378 @$(BUILD_CMD)
400 379
401# Compile: create object files from C++ source files. 380# Compile: create object files from C++ source files.
402$(OBJDIR)/%.o : %.cpp 381$(OBJDIR)/%.o : %.cpp | $(BEGIN)
403 @mkdir -p $(@D) 382 @mkdir -p $(@D)
404 @$(SILENT) || printf "$(MSG_COMPILING_CPP) $<" | $(AWK_CMD) 383 @$(SILENT) || printf "$(MSG_COMPILING_CPP) $<" | $(AWK_CMD)
405 $(eval CMD=$(CC) -c $(ALL_CPPFLAGS) $< -o $@) 384 $(eval CMD=$(CC) -c $(ALL_CPPFLAGS) $< -o $@)
406 @$(BUILD_CMD) 385 @$(BUILD_CMD)
407 386
408# Compile: create assembler files from C source files. 387# Compile: create assembler files from C source files.
409%.s : %.c 388%.s : %.c | $(BEGIN)
410 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD) 389 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
411 $(eval CMD=$(CC) -S $(ALL_CFLAGS) $< -o $@) 390 $(eval CMD=$(CC) -S $(ALL_CFLAGS) $< -o $@)
412 @$(BUILD_CMD) 391 @$(BUILD_CMD)
413 392
414# Compile: create assembler files from C++ source files. 393# Compile: create assembler files from C++ source files.
415%.s : %.cpp 394%.s : %.cpp | $(BEGIN)
416 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD) 395 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
417 $(eval CMD=$(CC) -S $(ALL_CPPFLAGS) $< -o $@) 396 $(eval CMD=$(CC) -S $(ALL_CPPFLAGS) $< -o $@)
418 @$(BUILD_CMD) 397 @$(BUILD_CMD)
419 398
420# Assemble: create object files from assembler source files. 399# Assemble: create object files from assembler source files.
421$(OBJDIR)/%.o : %.S 400$(OBJDIR)/%.o : %.S | $(BEGIN)
422 @mkdir -p $(@D) 401 @mkdir -p $(@D)
423 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD) 402 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
424 $(eval CMD=$(CC) -c $(ALL_ASFLAGS) $< -o $@) 403 $(eval CMD=$(CC) -c $(ALL_ASFLAGS) $< -o $@)
425 @$(BUILD_CMD) 404 @$(BUILD_CMD)
426 405
427# Create preprocessed source for use in sending a bug report. 406# Create preprocessed source for use in sending a bug report.
428%.i : %.c 407%.i : %.c | $(BEGIN)
429 $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@ 408 $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
430 409
431# Target: clean project. 410# Target: clean project.
432clean: begin clean_list end 411clean:
433
434clean_list :
435 @$(REMOVE) -r $(BUILD_DIR)
436 @$(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR)
437 @$(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR)
438 @if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi
439 @$(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR)
440 412
441show_path: 413show_path:
442 @echo VPATH=$(VPATH) 414 @echo VPATH=$(VPATH)
@@ -496,6 +468,19 @@ all-keymaps-%:
496 468
497all-keymaps: all-keymaps-all 469all-keymaps: all-keymaps-all
498 470
471GOAL=$(MAKECMDGOALS)
472ifeq ($(MAKECMDGOALS),)
473GOAL = all
474endif
475CLEANING_GOALS=clean clean_list all
476ifneq ($(findstring $(GOAL),$(CLEANING_GOALS)),)
477$(shell $(REMOVE) -r $(BUILD_DIR) 2>/dev/null)
478$(shell $(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR))
479$(shell $(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR))
480$(shell if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi)
481$(shell $(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR))
482endif
483
499# Create build directory 484# Create build directory
500$(shell mkdir $(BUILD_DIR) 2>/dev/null) 485$(shell mkdir $(BUILD_DIR) 2>/dev/null)
501 486
@@ -508,8 +493,8 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
508 493
509 494
510# Listing of phony targets. 495# Listing of phony targets.
511.PHONY : all quick begin finish end sizebefore sizeafter gccversion \ 496.PHONY : all quick finish sizebefore sizeafter gccversion \
512build elf hex eep lss sym coff extcoff \ 497build elf hex eep lss sym coff extcoff check_submodule \
513clean clean_list debug gdb-config show_path \ 498clean clean_list debug gdb-config show_path \
514program teensy dfu flip dfu-ee flip-ee dfu-start \ 499program teensy dfu flip dfu-ee flip-ee dfu-start \
515all-keyboards-defaults all-keyboards all-keymaps \ 500all-keyboards-defaults all-keyboards all-keymaps \