aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThat-Canadian <poole.chris.11@gmail.com>2017-07-10 16:52:56 -0400
committerThat-Canadian <poole.chris.11@gmail.com>2017-07-10 16:52:56 -0400
commit07bf8522ca23a7665852bb9defff0749c76f5e91 (patch)
treea03aa70cc7e9899c605b5e3597cf15ccdf70182c
parent707f4efd99f4dfd7213540f7ee86f0fe8e6ad634 (diff)
parent65c10790d4f7b89bef849ed3896db4ea30b13a40 (diff)
downloadqmk_firmware-07bf8522ca23a7665852bb9defff0749c76f5e91.tar.gz
qmk_firmware-07bf8522ca23a7665852bb9defff0749c76f5e91.zip
Merge remote-tracking branch 'upstream/master'
-rw-r--r--Makefile2
-rw-r--r--common.mk6
-rw-r--r--common_features.mk2
-rw-r--r--drivers/avr/analog.c (renamed from quantum/analog.c)0
-rw-r--r--drivers/avr/analog.h (renamed from quantum/analog.h)0
-rw-r--r--drivers/avr/glcdfont.c (renamed from keyboards/lets_split/common/glcdfont.c)0
-rw-r--r--drivers/avr/pro_micro.h (renamed from keyboards/atreus62/pro_micro.h)0
-rw-r--r--drivers/avr/ssd1306.c (renamed from keyboards/lets_split/ssd1306.c)2
-rw-r--r--drivers/avr/ssd1306.h (renamed from keyboards/lets_split/ssd1306.h)0
-rw-r--r--[-rwxr-xr-x]drivers/avr/ws2812.c (renamed from quantum/light_ws2812.c)2
-rw-r--r--[-rwxr-xr-x]drivers/avr/ws2812.h (renamed from quantum/light_ws2812.h)0
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h)3
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/driver.mk3
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c (renamed from keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c)256
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h)14
-rw-r--r--drivers/ugfx/gdisp/st7565/board_st7565_template.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h)6
-rw-r--r--drivers/ugfx/gdisp/st7565/driver.mk3
-rw-r--r--drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c (renamed from keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c)42
-rw-r--r--drivers/ugfx/gdisp/st7565/gdisp_lld_config.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h)6
-rw-r--r--drivers/ugfx/gdisp/st7565/st7565.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h)0
-rw-r--r--keyboards/ergodox/infinity/animations.h30
-rw-r--r--keyboards/ergodox/infinity/board_is31fl3731c.h110
-rw-r--r--keyboards/ergodox/infinity/board_st7565.h113
-rw-r--r--keyboards/ergodox/infinity/config.h7
-rw-r--r--keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/driver.mk2
-rw-r--r--keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c312
-rw-r--r--keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/driver.mk2
-rw-r--r--keyboards/ergodox/infinity/gfxconf.h306
-rw-r--r--keyboards/ergodox/infinity/rules.mk12
-rw-r--r--keyboards/ergodox/infinity/simple_visualizer.h4
-rw-r--r--keyboards/ergodox/infinity/visualizer.c6
-rw-r--r--keyboards/handwired/magicforce68/README.md2
-rw-r--r--keyboards/handwired/promethium/rgbsps.c2
-rw-r--r--keyboards/handwired/promethium/rules.mk4
-rw-r--r--keyboards/lets_split/pro_micro.h362
-rw-r--r--keyboards/nyquist/pro_micro.h362
-rw-r--r--keyboards/orthodox/pro_micro.h362
-rw-r--r--keyboards/orthodox/ssd1306.c470
-rw-r--r--keyboards/orthodox/ssd1306.h17
-rw-r--r--keyboards/whitefox/animations.c128
-rw-r--r--keyboards/whitefox/board_is31fl3731c.h (renamed from keyboards/whitefox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h)3
-rw-r--r--keyboards/whitefox/config.h10
-rw-r--r--keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk2
-rw-r--r--keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h36
-rw-r--r--keyboards/whitefox/gfxconf.h304
-rw-r--r--keyboards/whitefox/rules.mk7
-rw-r--r--keyboards/whitefox/visualizer.c2
-rw-r--r--lcd_backlight_keyframes.h (renamed from quantum/visualizer/lcd_backlight_keyframes.h)8
-rw-r--r--quantum/rgblight.h2
-rw-r--r--quantum/visualizer/common_gfxconf.h325
-rw-r--r--quantum/visualizer/default_animations.c (renamed from keyboards/ergodox/infinity/animations.c)72
-rw-r--r--quantum/visualizer/default_animations.h (renamed from keyboards/whitefox/animations.h)6
-rw-r--r--quantum/visualizer/lcd_backlight_keyframes.c8
-rw-r--r--quantum/visualizer/lcd_keyframes.c4
-rw-r--r--quantum/visualizer/led_backlight_keyframes.c (renamed from quantum/visualizer/led_keyframes.c)24
-rw-r--r--quantum/visualizer/led_backlight_keyframes.h (renamed from quantum/visualizer/led_keyframes.h)22
-rw-r--r--quantum/visualizer/visualizer.c7
-rw-r--r--quantum/visualizer/visualizer.mk42
-rw-r--r--tmk_core/avr.mk34
59 files changed, 898 insertions, 2980 deletions
diff --git a/Makefile b/Makefile
index f789409b7..b429200fe 100644
--- a/Makefile
+++ b/Makefile
@@ -483,6 +483,8 @@ define RUN_TEST
483+error_occurred=0;\ 483+error_occurred=0;\
484$($(TEST)_COMMAND)\ 484$($(TEST)_COMMAND)\
485if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi; 485if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi;
486
487
486endef 488endef
487 489
488# Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps 490# Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps
diff --git a/common.mk b/common.mk
index f87c20934..5b49680ea 100644
--- a/common.mk
+++ b/common.mk
@@ -9,6 +9,9 @@ LIB_PATH = $(TOP_DIR)/lib
9QUANTUM_DIR = quantum 9QUANTUM_DIR = quantum
10QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR) 10QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
11 11
12DRIVER_DIR = drivers
13DRIVER_PATH = $(TOP_DIR)/$(DRIVER_DIR)
14
12BUILD_DIR := $(TOP_DIR)/.build 15BUILD_DIR := $(TOP_DIR)/.build
13 16
14COMMON_VPATH := $(TOP_DIR) 17COMMON_VPATH := $(TOP_DIR)
@@ -17,4 +20,5 @@ COMMON_VPATH += $(QUANTUM_PATH)
17COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras 20COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras
18COMMON_VPATH += $(QUANTUM_PATH)/audio 21COMMON_VPATH += $(QUANTUM_PATH)/audio
19COMMON_VPATH += $(QUANTUM_PATH)/process_keycode 22COMMON_VPATH += $(QUANTUM_PATH)/process_keycode
20COMMON_VPATH += $(QUANTUM_PATH)/api \ No newline at end of file 23COMMON_VPATH += $(QUANTUM_PATH)/api
24COMMON_VPATH += $(DRIVER_PATH) \ No newline at end of file
diff --git a/common_features.mk b/common_features.mk
index f5e7af01f..5eb56ccbf 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -87,7 +87,7 @@ endif
87 87
88ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) 88ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
89 OPT_DEFS += -DRGBLIGHT_ENABLE 89 OPT_DEFS += -DRGBLIGHT_ENABLE
90 SRC += $(QUANTUM_DIR)/light_ws2812.c 90 SRC += ws2812.c
91 SRC += $(QUANTUM_DIR)/rgblight.c 91 SRC += $(QUANTUM_DIR)/rgblight.c
92 CIE1931_CURVE = yes 92 CIE1931_CURVE = yes
93 LED_BREATHING_TABLE = yes 93 LED_BREATHING_TABLE = yes
diff --git a/quantum/analog.c b/drivers/avr/analog.c
index 1ec38df75..1ec38df75 100644
--- a/quantum/analog.c
+++ b/drivers/avr/analog.c
diff --git a/quantum/analog.h b/drivers/avr/analog.h
index 8d93de7dc..8d93de7dc 100644
--- a/quantum/analog.h
+++ b/drivers/avr/analog.h
diff --git a/keyboards/lets_split/common/glcdfont.c b/drivers/avr/glcdfont.c
index 6f88bd23a..6f88bd23a 100644
--- a/keyboards/lets_split/common/glcdfont.c
+++ b/drivers/avr/glcdfont.c
diff --git a/keyboards/atreus62/pro_micro.h b/drivers/avr/pro_micro.h
index f9e7ed75d..f9e7ed75d 100644
--- a/keyboards/atreus62/pro_micro.h
+++ b/drivers/avr/pro_micro.h
diff --git a/keyboards/lets_split/ssd1306.c b/drivers/avr/ssd1306.c
index 5c6dff27f..f9312d2dc 100644
--- a/keyboards/lets_split/ssd1306.c
+++ b/drivers/avr/ssd1306.c
@@ -6,7 +6,7 @@
6#include <string.h> 6#include <string.h>
7#include "print.h" 7#include "print.h"
8#include "lets_split.h" 8#include "lets_split.h"
9#include "common/glcdfont.c" 9#include "glcdfont.c"
10#ifdef ADAFRUIT_BLE_ENABLE 10#ifdef ADAFRUIT_BLE_ENABLE
11#include "adafruit_ble.h" 11#include "adafruit_ble.h"
12#endif 12#endif
diff --git a/keyboards/lets_split/ssd1306.h b/drivers/avr/ssd1306.h
index b0c74f987..b0c74f987 100644
--- a/keyboards/lets_split/ssd1306.h
+++ b/drivers/avr/ssd1306.h
diff --git a/quantum/light_ws2812.c b/drivers/avr/ws2812.c
index 2506e3d8e..59e032bf7 100755..100644
--- a/quantum/light_ws2812.c
+++ b/drivers/avr/ws2812.c
@@ -21,7 +21,7 @@
21* along with this program. If not, see <http://www.gnu.org/licenses/>. 21* along with this program. If not, see <http://www.gnu.org/licenses/>.
22*/ 22*/
23 23
24#include "light_ws2812.h" 24#include "ws2812.h"
25#include <avr/interrupt.h> 25#include <avr/interrupt.h>
26#include <avr/io.h> 26#include <avr/io.h>
27#include <util/delay.h> 27#include <util/delay.h>
diff --git a/quantum/light_ws2812.h b/drivers/avr/ws2812.h
index 60924a0fb..60924a0fb 100755..100644
--- a/quantum/light_ws2812.h
+++ b/drivers/avr/ws2812.h
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h b/drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h
index 2ea73f1fb..f248cc25b 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h
+++ b/drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h
@@ -22,9 +22,6 @@ static const I2CConfig i2ccfg = {
22 400000 // clock speed (Hz); 400kHz max for IS31 22 400000 // clock speed (Hz); 400kHz max for IS31
23}; 23};
24 24
25#define GDISP_SCREEN_WIDTH 7
26#define GDISP_SCREEN_HEIGHT 7
27
28static const uint8_t led_mask[] = { 25static const uint8_t led_mask[] = {
29 0xFF, 0x00, /* C1-1 -> C1-16 */ 26 0xFF, 0x00, /* C1-1 -> C1-16 */
30 0xFF, 0x00, /* C2-1 -> C2-16 */ 27 0xFF, 0x00, /* C2-1 -> C2-16 */
diff --git a/drivers/ugfx/gdisp/is31fl3731c/driver.mk b/drivers/ugfx/gdisp/is31fl3731c/driver.mk
new file mode 100644
index 000000000..4364787c9
--- /dev/null
+++ b/drivers/ugfx/gdisp/is31fl3731c/driver.mk
@@ -0,0 +1,3 @@
1GFXINC += drivers/ugfx/gdisp/is31fl3731c
2GFXSRC += drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
3GDISP_DRIVER_LIST += GDISPVMT_IS31FL3731C_QMK \ No newline at end of file
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
index c807cbd1e..917adadb8 100644
--- a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
+++ b/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
@@ -19,11 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20#if GFX_USE_GDISP 20#if GFX_USE_GDISP
21 21
22#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_WHITEFOX 22#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_QMK
23#include "drivers/gdisp/IS31FL3731C/gdisp_lld_config.h" 23#define GDISP_SCREEN_HEIGHT LED_HEIGHT
24#define GDISP_SCREEN_WIDTH LED_WIDTH
25
26#include "gdisp_lld_config.h"
24#include "src/gdisp/gdisp_driver.h" 27#include "src/gdisp/gdisp_driver.h"
25 28
26#include "board_IS31FL3731C.h" 29#include "board_is31fl3731c.h"
27 30
28 31
29// Can't include led_tables from here 32// Can't include led_tables from here
@@ -33,27 +36,21 @@ extern const uint8_t CIE1931_CURVE[];
33/* Driver local definitions. */ 36/* Driver local definitions. */
34/*===========================================================================*/ 37/*===========================================================================*/
35 38
36#ifndef GDISP_SCREEN_HEIGHT
37 #define GDISP_SCREEN_HEIGHT 9
38#endif
39#ifndef GDISP_SCREEN_WIDTH
40 #define GDISP_SCREEN_WIDTH 16
41#endif
42#ifndef GDISP_INITIAL_CONTRAST 39#ifndef GDISP_INITIAL_CONTRAST
43 #define GDISP_INITIAL_CONTRAST 0 40 #define GDISP_INITIAL_CONTRAST 0
44#endif 41#endif
45#ifndef GDISP_INITIAL_BACKLIGHT 42#ifndef GDISP_INITIAL_BACKLIGHT
46 #define GDISP_INITIAL_BACKLIGHT 0 43 #define GDISP_INITIAL_BACKLIGHT 0
47#endif 44#endif
48 45
49#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) 46#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
50 47
51#define IS31_ADDR_DEFAULT 0x74 48#define IS31_ADDR_DEFAULT 0x74
52 49
53#define IS31_REG_CONFIG 0x00 50#define IS31_REG_CONFIG 0x00
54// bits in reg 51// bits in reg
55#define IS31_REG_CONFIG_PICTUREMODE 0x00 52#define IS31_REG_CONFIG_PICTUREMODE 0x00
56#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08 53#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
57#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18 54#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
58// D2:D0 bits are starting frame for autoplay mode 55// D2:D0 bits are starting frame for autoplay mode
59 56
@@ -100,7 +97,6 @@ extern const uint8_t CIE1931_CURVE[];
100#define IS31_PWM_SIZE 0x90 97#define IS31_PWM_SIZE 0x90
101 98
102#define IS31_LED_MASK_SIZE 0x12 99#define IS31_LED_MASK_SIZE 0x12
103#define IS31_SCREEN_WIDTH 16
104 100
105#define IS31 101#define IS31
106 102
@@ -144,14 +140,14 @@ static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint
144} 140}
145 141
146LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { 142LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
147 // The private area is the display surface. 143 // The private area is the display surface.
148 g->priv = gfxAlloc(sizeof(PrivData)); 144 g->priv = gfxAlloc(sizeof(PrivData));
149 __builtin_memset(PRIV(g), 0, sizeof(PrivData)); 145 __builtin_memset(PRIV(g), 0, sizeof(PrivData));
150 PRIV(g)->page = 0; 146 PRIV(g)->page = 0;
151 147
152 // Initialise the board interface 148 // Initialise the board interface
153 init_board(g); 149 init_board(g);
154 gfxSleepMilliseconds(10); 150 gfxSleepMilliseconds(10);
155 151
156 // zero function page, all registers (assuming full_page is all zeroes) 152 // zero function page, all registers (assuming full_page is all zeroes)
157 write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE); 153 write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
@@ -179,134 +175,134 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
179 // Finish Init 175 // Finish Init
180 post_init_board(g); 176 post_init_board(g);
181 177
182 /* Initialise the GDISP structure */ 178 /* Initialise the GDISP structure */
183 g->g.Width = GDISP_SCREEN_WIDTH; 179 g->g.Width = GDISP_SCREEN_WIDTH;
184 g->g.Height = GDISP_SCREEN_HEIGHT; 180 g->g.Height = GDISP_SCREEN_HEIGHT;
185 g->g.Orientation = GDISP_ROTATE_0; 181 g->g.Orientation = GDISP_ROTATE_0;
186 g->g.Powermode = powerOff; 182 g->g.Powermode = powerOff;
187 g->g.Backlight = GDISP_INITIAL_BACKLIGHT; 183 g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
188 g->g.Contrast = GDISP_INITIAL_CONTRAST; 184 g->g.Contrast = GDISP_INITIAL_CONTRAST;
189 return TRUE; 185 return TRUE;
190} 186}
191 187
192#if GDISP_HARDWARE_FLUSH 188#if GDISP_HARDWARE_FLUSH
193 LLDSPEC void gdisp_lld_flush(GDisplay *g) { 189 LLDSPEC void gdisp_lld_flush(GDisplay *g) {
194 // Don't flush if we don't need it. 190 // Don't flush if we don't need it.
195 if (!(g->flags & GDISP_FLG_NEEDFLUSH)) 191 if (!(g->flags & GDISP_FLG_NEEDFLUSH))
196 return; 192 return;
197 193
198 PRIV(g)->page++; 194 PRIV(g)->page++;
199 PRIV(g)->page %= 2; 195 PRIV(g)->page %= 2;
200 // TODO: some smarter algorithm for this 196 // TODO: some smarter algorithm for this
201 // We should run only one physical page at a time 197 // We should run only one physical page at a time
202 // This way we don't need to send so much data, and 198 // This way we don't need to send so much data, and
203 // we could use slightly less memory 199 // we could use slightly less memory
204 uint8_t* src = PRIV(g)->frame_buffer; 200 uint8_t* src = PRIV(g)->frame_buffer;
205 for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) { 201 for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
206 for (int x=0;x<GDISP_SCREEN_WIDTH;x++) { 202 for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
207 uint8_t val = (uint16_t)*src * g->g.Backlight / 100; 203 uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
208 PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val]; 204 PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
209 ++src; 205 ++src;
210 } 206 }
211 } 207 }
212 write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE); 208 write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
213 gfxSleepMilliseconds(1); 209 gfxSleepMilliseconds(1);
214 write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page); 210 write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
215 211
216 g->flags &= ~GDISP_FLG_NEEDFLUSH; 212 g->flags &= ~GDISP_FLG_NEEDFLUSH;
217 } 213 }
218#endif 214#endif
219 215
220#if GDISP_HARDWARE_DRAWPIXEL 216#if GDISP_HARDWARE_DRAWPIXEL
221 LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { 217 LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
222 coord_t x, y; 218 coord_t x, y;
223 219
224 switch(g->g.Orientation) { 220 switch(g->g.Orientation) {
225 default: 221 default:
226 case GDISP_ROTATE_0: 222 case GDISP_ROTATE_0:
227 x = g->p.x; 223 x = g->p.x;
228 y = g->p.y; 224 y = g->p.y;
229 break; 225 break;
230 case GDISP_ROTATE_180: 226 case GDISP_ROTATE_180:
231 x = GDISP_SCREEN_WIDTH-1 - g->p.x; 227 x = GDISP_SCREEN_WIDTH-1 - g->p.x;
232 y = g->p.y; 228 y = g->p.y;
233 break; 229 break;
234 } 230 }
235 PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color); 231 PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
236 g->flags |= GDISP_FLG_NEEDFLUSH; 232 g->flags |= GDISP_FLG_NEEDFLUSH;
237 } 233 }
238#endif 234#endif
239 235
240#if GDISP_HARDWARE_PIXELREAD 236#if GDISP_HARDWARE_PIXELREAD
241 LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { 237 LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
242 coord_t x, y; 238 coord_t x, y;
243 239
244 switch(g->g.Orientation) { 240 switch(g->g.Orientation) {
245 default: 241 default:
246 case GDISP_ROTATE_0: 242 case GDISP_ROTATE_0:
247 x = g->p.x; 243 x = g->p.x;
248 y = g->p.y; 244 y = g->p.y;
249 break; 245 break;
250 case GDISP_ROTATE_180: 246 case GDISP_ROTATE_180:
251 x = GDISP_SCREEN_WIDTH-1 - g->p.x; 247 x = GDISP_SCREEN_WIDTH-1 - g->p.x;
252 y = g->p.y; 248 y = g->p.y;
253 break; 249 break;
254 } 250 }
255 return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]); 251 return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
256 } 252 }
257#endif 253#endif
258 254
259#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL 255#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
260 LLDSPEC void gdisp_lld_control(GDisplay *g) { 256 LLDSPEC void gdisp_lld_control(GDisplay *g) {
261 switch(g->p.x) { 257 switch(g->p.x) {
262 case GDISP_CONTROL_POWER: 258 case GDISP_CONTROL_POWER:
263 if (g->g.Powermode == (powermode_t)g->p.ptr) 259 if (g->g.Powermode == (powermode_t)g->p.ptr)
264 return; 260 return;
265 switch((powermode_t)g->p.ptr) { 261 switch((powermode_t)g->p.ptr) {
266 case powerOff: 262 case powerOff:
267 case powerSleep: 263 case powerSleep:
268 case powerDeepSleep: 264 case powerDeepSleep:
269 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF); 265 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
270 break; 266 break;
271 case powerOn: 267 case powerOn:
272 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON); 268 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
273 break; 269 break;
274 default: 270 default:
275 return; 271 return;
276 } 272 }
277 g->g.Powermode = (powermode_t)g->p.ptr; 273 g->g.Powermode = (powermode_t)g->p.ptr;
278 return; 274 return;
279 275
280 case GDISP_CONTROL_ORIENTATION: 276 case GDISP_CONTROL_ORIENTATION:
281 if (g->g.Orientation == (orientation_t)g->p.ptr) 277 if (g->g.Orientation == (orientation_t)g->p.ptr)
282 return; 278 return;
283 switch((orientation_t)g->p.ptr) { 279 switch((orientation_t)g->p.ptr) {
284 /* Rotation is handled by the drawing routines */ 280 /* Rotation is handled by the drawing routines */
285 case GDISP_ROTATE_0: 281 case GDISP_ROTATE_0:
286 case GDISP_ROTATE_180: 282 case GDISP_ROTATE_180:
287 g->g.Height = GDISP_SCREEN_HEIGHT; 283 g->g.Height = GDISP_SCREEN_HEIGHT;
288 g->g.Width = GDISP_SCREEN_WIDTH; 284 g->g.Width = GDISP_SCREEN_WIDTH;
289 break; 285 break;
290 case GDISP_ROTATE_90: 286 case GDISP_ROTATE_90:
291 case GDISP_ROTATE_270: 287 case GDISP_ROTATE_270:
292 g->g.Height = GDISP_SCREEN_WIDTH; 288 g->g.Height = GDISP_SCREEN_WIDTH;
293 g->g.Width = GDISP_SCREEN_HEIGHT; 289 g->g.Width = GDISP_SCREEN_HEIGHT;
294 break; 290 break;
295 default: 291 default:
296 return;
297 }
298 g->g.Orientation = (orientation_t)g->p.ptr;
299 return;
300
301 case GDISP_CONTROL_BACKLIGHT:
302 if (g->g.Backlight == (unsigned)g->p.ptr)
303 return; 292 return;
304 unsigned val = (unsigned)g->p.ptr; 293 }
305 g->g.Backlight = val > 100 ? 100 : val; 294 g->g.Orientation = (orientation_t)g->p.ptr;
295 return;
296
297 case GDISP_CONTROL_BACKLIGHT:
298 if (g->g.Backlight == (unsigned)g->p.ptr)
299 return;
300 unsigned val = (unsigned)g->p.ptr;
301 g->g.Backlight = val > 100 ? 100 : val;
306 g->flags |= GDISP_FLG_NEEDFLUSH; 302 g->flags |= GDISP_FLG_NEEDFLUSH;
307 return; 303 return;
308 } 304 }
309 } 305 }
310#endif // GDISP_NEED_CONTROL 306#endif // GDISP_NEED_CONTROL
311 307
312#endif // GFX_USE_GDISP 308#endif // GFX_USE_GDISP
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h b/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h
index bb28ad775..588d688cf 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
+++ b/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h
@@ -24,13 +24,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
24/* Driver hardware support. */ 24/* Driver hardware support. */
25/*===========================================================================*/ 25/*===========================================================================*/
26 26
27#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing 27#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
28#define GDISP_HARDWARE_DRAWPIXEL TRUE 28#define GDISP_HARDWARE_DRAWPIXEL TRUE
29#define GDISP_HARDWARE_PIXELREAD TRUE 29#define GDISP_HARDWARE_PIXELREAD TRUE
30#define GDISP_HARDWARE_CONTROL TRUE 30#define GDISP_HARDWARE_CONTROL TRUE
31 31
32#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256 32#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
33 33
34#endif /* GFX_USE_GDISP */ 34#endif /* GFX_USE_GDISP */
35 35
36#endif /* _GDISP_LLD_CONFIG_H */ 36#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h b/drivers/ugfx/gdisp/st7565/board_st7565_template.h
index 9650ffb44..9ab636c95 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h
+++ b/drivers/ugfx/gdisp/st7565/board_st7565_template.h
@@ -83,7 +83,7 @@ static GFXINLINE void init_board(GDisplay *g) {
83} 83}
84 84
85static GFXINLINE void post_init_board(GDisplay *g) { 85static GFXINLINE void post_init_board(GDisplay *g) {
86 (void) g; 86 (void) g;
87} 87}
88 88
89static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { 89static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
@@ -106,8 +106,8 @@ static GFXINLINE void enter_cmd_mode(GDisplay *g) {
106 106
107 107
108static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) { 108static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
109 (void) g; 109 (void) g;
110 spiSend(&SPID1, length, data); 110 spiSend(&SPID1, length, data);
111} 111}
112 112
113#endif /* _GDISP_LLD_BOARD_H */ 113#endif /* _GDISP_LLD_BOARD_H */
diff --git a/drivers/ugfx/gdisp/st7565/driver.mk b/drivers/ugfx/gdisp/st7565/driver.mk
new file mode 100644
index 000000000..31fc8f1c7
--- /dev/null
+++ b/drivers/ugfx/gdisp/st7565/driver.mk
@@ -0,0 +1,3 @@
1GFXINC += drivers/ugfx/gdisp/st7565
2GFXSRC += drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
3GDISP_DRIVER_LIST += GDISPVMT_ST7565_QMK \ No newline at end of file
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c b/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
index b04ad0293..c38194b06 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
+++ b/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
@@ -9,35 +9,35 @@
9 9
10#if GFX_USE_GDISP 10#if GFX_USE_GDISP
11 11
12#define GDISP_DRIVER_VMT GDISPVMT_ST7565_ERGODOX 12#define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK
13#include "drivers/gdisp/st7565ergodox/gdisp_lld_config.h" 13#include "gdisp_lld_config.h"
14#include "src/gdisp/gdisp_driver.h" 14#include "src/gdisp/gdisp_driver.h"
15 15
16#include "board_ST7565.h" 16#include "board_st7565.h"
17 17
18/*===========================================================================*/ 18/*===========================================================================*/
19/* Driver local definitions. */ 19/* Driver local definitions. */
20/*===========================================================================*/ 20/*===========================================================================*/
21 21
22#ifndef GDISP_SCREEN_HEIGHT 22#ifndef GDISP_SCREEN_HEIGHT
23#define GDISP_SCREEN_HEIGHT 32 23#define GDISP_SCREEN_HEIGHT LCD_HEIGHT
24#endif 24#endif
25#ifndef GDISP_SCREEN_WIDTH 25#ifndef GDISP_SCREEN_WIDTH
26#define GDISP_SCREEN_WIDTH 128 26#define GDISP_SCREEN_WIDTH LCD_WIDTH
27#endif 27#endif
28#ifndef GDISP_INITIAL_CONTRAST 28#ifndef GDISP_INITIAL_CONTRAST
29#define GDISP_INITIAL_CONTRAST 35 29#define GDISP_INITIAL_CONTRAST 35
30#endif 30#endif
31#ifndef GDISP_INITIAL_BACKLIGHT 31#ifndef GDISP_INITIAL_BACKLIGHT
32#define GDISP_INITIAL_BACKLIGHT 100 32#define GDISP_INITIAL_BACKLIGHT 100
33#endif 33#endif
34 34
35#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) 35#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
36 36
37#include "drivers/gdisp/st7565ergodox/st7565.h" 37#include "st7565.h"
38 38
39/*===========================================================================*/ 39/*===========================================================================*/
40/* Driver config defaults for backward compatibility. */ 40/* Driver config defaults for backward compatibility. */
41/*===========================================================================*/ 41/*===========================================================================*/
42#ifndef ST7565_LCD_BIAS 42#ifndef ST7565_LCD_BIAS
43#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7 43#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
@@ -65,7 +65,7 @@ typedef struct{
65 65
66// Some common routines and macros 66// Some common routines and macros
67#define PRIV(g) ((PrivData*)g->priv) 67#define PRIV(g) ((PrivData*)g->priv)
68#define RAM(g) (PRIV(g)->ram) 68#define RAM(g) (PRIV(g)->ram)
69 69
70static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) { 70static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) {
71 PRIV(g)->data[PRIV(g)->data_pos++] = cmd; 71 PRIV(g)->data[PRIV(g)->data_pos++] = cmd;
@@ -76,15 +76,15 @@ static GFXINLINE void flush_cmd(GDisplay* g) {
76 PRIV(g)->data_pos = 0; 76 PRIV(g)->data_pos = 0;
77} 77}
78 78
79#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); } 79#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
80#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); } 80#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
81 81
82// Some common routines and macros 82// Some common routines and macros
83#define delay(us) gfxSleepMicroseconds(us) 83#define delay(us) gfxSleepMicroseconds(us)
84#define delay_ms(ms) gfxSleepMilliseconds(ms) 84#define delay_ms(ms) gfxSleepMilliseconds(ms)
85 85
86#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH) 86#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH)
87#define xybit(y) (1<<((y)&7)) 87#define xybit(y) (1<<((y)&7))
88 88
89/*===========================================================================*/ 89/*===========================================================================*/
90/* Driver exported functions. */ 90/* Driver exported functions. */
@@ -150,7 +150,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
150 150
151#if GDISP_HARDWARE_FLUSH 151#if GDISP_HARDWARE_FLUSH
152LLDSPEC void gdisp_lld_flush(GDisplay *g) { 152LLDSPEC void gdisp_lld_flush(GDisplay *g) {
153 unsigned p; 153 unsigned p;
154 154
155 // Don't flush if we don't need it. 155 // Don't flush if we don't need it.
156 if (!(g->flags & GDISP_FLG_NEEDFLUSH)) 156 if (!(g->flags & GDISP_FLG_NEEDFLUSH))
@@ -181,7 +181,7 @@ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
181 181
182#if GDISP_HARDWARE_DRAWPIXEL 182#if GDISP_HARDWARE_DRAWPIXEL
183LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { 183LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
184 coord_t x, y; 184 coord_t x, y;
185 185
186 switch(g->g.Orientation) { 186 switch(g->g.Orientation) {
187 default: 187 default:
@@ -212,7 +212,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
212 212
213#if GDISP_HARDWARE_PIXELREAD 213#if GDISP_HARDWARE_PIXELREAD
214LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { 214LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
215 coord_t x, y; 215 coord_t x, y;
216 216
217 switch(g->g.Orientation) { 217 switch(g->g.Orientation) {
218 default: 218 default:
@@ -257,7 +257,7 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
257 else { 257 else {
258 *dst &= ~xybit(dsty); 258 *dst &= ~xybit(dsty);
259 } 259 }
260 dstx++; 260 dstx++;
261 srcbit++; 261 srcbit++;
262 } 262 }
263 } 263 }
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h b/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
index 2b66a877c..4446bd38b 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h
+++ b/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
@@ -14,7 +14,7 @@
14/* Driver hardware support. */ 14/* Driver hardware support. */
15/*===========================================================================*/ 15/*===========================================================================*/
16 16
17#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing 17#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
18#define GDISP_HARDWARE_DRAWPIXEL TRUE 18#define GDISP_HARDWARE_DRAWPIXEL TRUE
19#define GDISP_HARDWARE_PIXELREAD TRUE 19#define GDISP_HARDWARE_PIXELREAD TRUE
20#define GDISP_HARDWARE_CONTROL TRUE 20#define GDISP_HARDWARE_CONTROL TRUE
@@ -22,6 +22,6 @@
22 22
23#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO 23#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
24 24
25#endif /* GFX_USE_GDISP */ 25#endif /* GFX_USE_GDISP */
26 26
27#endif /* _GDISP_LLD_CONFIG_H */ 27#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h b/drivers/ugfx/gdisp/st7565/st7565.h
index 24924ff05..24924ff05 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h
+++ b/drivers/ugfx/gdisp/st7565/st7565.h
diff --git a/keyboards/ergodox/infinity/animations.h b/keyboards/ergodox/infinity/animations.h
deleted file mode 100644
index 6d8b9830d..000000000
--- a/keyboards/ergodox/infinity/animations.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/* Copyright 2017 Fred Sundvik
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_
18#define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_
19
20#include "visualizer.h"
21
22// You can use these default animations, but of course you can also write your own custom ones instead
23extern keyframe_animation_t default_startup_animation;
24extern keyframe_animation_t default_suspend_animation;
25
26// An animation for testing and demonstrating the led support, should probably not be used for real world
27// cases
28extern keyframe_animation_t led_test_animation;
29
30#endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ */
diff --git a/keyboards/ergodox/infinity/board_is31fl3731c.h b/keyboards/ergodox/infinity/board_is31fl3731c.h
new file mode 100644
index 000000000..f248cc25b
--- /dev/null
+++ b/keyboards/ergodox/infinity/board_is31fl3731c.h
@@ -0,0 +1,110 @@
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
25static const uint8_t led_mask[] = {
26 0xFF, 0x00, /* C1-1 -> C1-16 */
27 0xFF, 0x00, /* C2-1 -> C2-16 */
28 0xFF, 0x00, /* C3-1 -> C3-16 */
29 0xFF, 0x00, /* C4-1 -> C4-16 */
30 0x3F, 0x00, /* C5-1 -> C5-16 */
31 0x00, 0x00, /* C6-1 -> C6-16 */
32 0x00, 0x00, /* C7-1 -> C7-16 */
33 0x00, 0x00, /* C8-1 -> C8-16 */
34 0x00, 0x00, /* C9-1 -> C9-16 */
35};
36
37// The address of the LED
38#define LA(c, r) (c + r * 16 )
39// Need to be an address that is not mapped, but inside the range of the controller matrix
40#define NA LA(8, 8)
41
42// The numbers in the comments are the led numbers DXX on the PCB
43// The mapping is taken from the schematic of left hand side
44static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = {
45// 45 44 43 42 41 40 39
46 { LA(1, 1), LA(1, 0), LA(0, 4), LA(0, 3), LA(0, 2), LA(0, 1), LA(0, 0)},
47// 52 51 50 49 48 47 46
48 { LA(2, 3), LA(2, 2), LA(2, 1), LA(2, 0), LA(1, 4), LA(1, 3), LA(1, 2) },
49// 58 57 56 55 54 53 N/A
50 { LA(3, 4), LA(3, 3), LA(3, 2), LA(3, 1), LA(3, 0), LA(2, 4), NA },
51// 67 66 65 64 63 62 61
52 { LA(5, 3), LA(5, 2), LA(5, 1), LA(5, 0), LA(4, 4), LA(4, 3), LA(4, 2) },
53// 76 75 74 73 72 60 59
54 { LA(7, 3), LA(7, 2), LA(7, 1), LA(7, 0), LA(6, 3), LA(4, 1), LA(4, 0) },
55// N/A N/A N/A N/A N/A N/A 68
56 { NA, NA, NA, NA, NA, NA, LA(5, 4) },
57// N/A N/A N/A N/A 71 70 69
58 { NA, NA, NA, NA, LA(6, 2), LA(6, 1), LA(6, 0) },
59};
60
61
62#define IS31_ADDR_DEFAULT 0x74 // AD connected to GND
63#define IS31_TIMEOUT 5000
64
65static GFXINLINE void init_board(GDisplay *g) {
66 (void) g;
67 /* I2C pins */
68 palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL
69 palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA
70 palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL);
71 palClearPad(GPIOB, 16);
72 /* start I2C */
73 i2cStart(&I2CD1, &i2ccfg);
74 // try high drive (from kiibohd)
75 I2CD1.i2c->C2 |= I2Cx_C2_HDRS;
76 // try glitch fixing (from kiibohd)
77 I2CD1.i2c->FLT = 4;
78}
79
80static GFXINLINE void post_init_board(GDisplay *g) {
81 (void) g;
82}
83
84static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) {
85 (void) g;
86 return led_mask;
87}
88
89static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y)
90{
91 (void) g;
92 return led_mapping[y][x];
93}
94
95static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) {
96 (void) g;
97 if(!shutdown) {
98 palSetPad(GPIOB, 16);
99 }
100 else {
101 palClearPad(GPIOB, 16);
102 }
103}
104
105static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
106 (void) g;
107 i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT));
108}
109
110#endif /* _GDISP_LLD_BOARD_H */
diff --git a/keyboards/ergodox/infinity/board_st7565.h b/keyboards/ergodox/infinity/board_st7565.h
new file mode 100644
index 000000000..9ab636c95
--- /dev/null
+++ b/keyboards/ergodox/infinity/board_st7565.h
@@ -0,0 +1,113 @@
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#define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6
12#define ST7565_ADC ST7565_ADC_NORMAL
13#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
14#define ST7565_PAGE_ORDER 0,1,2,3
15/*
16 * Custom page order for several LCD boards, e.g. HEM12864-99
17 * #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
18 */
19
20#define ST7565_GPIOPORT GPIOC
21#define ST7565_PORT PORTC
22#define ST7565_A0_PIN 7
23#define ST7565_RST_PIN 8
24#define ST7565_MOSI_PIN 6
25#define ST7565_SLCK_PIN 5
26#define ST7565_SS_PIN 4
27
28#define palSetPadModeRaw(portname, bits) \
29 ST7565_PORT->PCR[ST7565_##portname##_PIN] = bits
30
31#define palSetPadModeNamed(portname, portmode) \
32 palSetPadMode(ST7565_GPIOPORT, ST7565_##portname##_PIN, portmode)
33
34#define ST7565_SPI_MODE PORTx_PCRn_DSE | PORTx_PCRn_MUX(2)
35// DSPI Clock and Transfer Attributes
36// Frame Size: 8 bits
37// MSB First
38// CLK Low by default
39static const SPIConfig spi1config = {
40 // Operation complete callback or @p NULL.
41 .end_cb = NULL,
42 //The chip select line port - when not using pcs.
43 .ssport = ST7565_GPIOPORT,
44 // brief The chip select line pad number - when not using pcs.
45 .sspad=ST7565_SS_PIN,
46 // SPI initialization data.
47 .tar0 =
48 SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
49 | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
50 | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns
51 | SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns
52 | SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2
53 | SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns
54};
55
56static GFXINLINE void acquire_bus(GDisplay *g) {
57 (void) g;
58 // Only the LCD is using the SPI bus, so no need to acquire
59 // spiAcquireBus(&SPID1);
60 spiSelect(&SPID1);
61}
62
63static GFXINLINE void release_bus(GDisplay *g) {
64 (void) g;
65 // Only the LCD is using the SPI bus, so no need to release
66 //spiReleaseBus(&SPID1);
67 spiUnselect(&SPID1);
68}
69
70static GFXINLINE void init_board(GDisplay *g) {
71 (void) g;
72 palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL);
73 palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
74 palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL);
75 palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
76 palSetPadModeRaw(MOSI, ST7565_SPI_MODE);
77 palSetPadModeRaw(SLCK, ST7565_SPI_MODE);
78 palSetPadModeNamed(SS, PAL_MODE_OUTPUT_PUSHPULL);
79
80 spiInit();
81 spiStart(&SPID1, &spi1config);
82 release_bus(g);
83}
84
85static GFXINLINE void post_init_board(GDisplay *g) {
86 (void) g;
87}
88
89static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
90 (void) g;
91 if (state) {
92 palClearPad(ST7565_GPIOPORT, ST7565_RST_PIN);
93 }
94 else {
95 palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
96 }
97}
98
99static GFXINLINE void enter_data_mode(GDisplay *g) {
100 palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
101}
102
103static GFXINLINE void enter_cmd_mode(GDisplay *g) {
104 palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN);
105}
106
107
108static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
109 (void) g;
110 spiSend(&SPID1, length, data);
111}
112
113#endif /* _GDISP_LLD_BOARD_H */
diff --git a/keyboards/ergodox/infinity/config.h b/keyboards/ergodox/infinity/config.h
index 25cc8af0f..c46edeb7b 100644
--- a/keyboards/ergodox/infinity/config.h
+++ b/keyboards/ergodox/infinity/config.h
@@ -51,16 +51,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
51 51
52#define SERIAL_LINK_BAUD 562500 52#define SERIAL_LINK_BAUD 562500
53#define SERIAL_LINK_THREAD_PRIORITY (NORMALPRIO - 1) 53#define SERIAL_LINK_THREAD_PRIORITY (NORMALPRIO - 1)
54// The visualizer needs gfx thread priorities
55#define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2)
56 54
57#define VISUALIZER_USER_DATA_SIZE 16 55#define VISUALIZER_USER_DATA_SIZE 16
58 56
59#define LCD_DISPLAY_NUMBER 0
60#define LED_DISPLAY_NUMBER 1
61
62#define LED_NUM_ROWS 7
63#define LED_NUM_COLS 7
64/* 57/*
65 * Feature disable options 58 * Feature disable options
66 * These options are also useful to firmware size reduction. 59 * These options are also useful to firmware size reduction.
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/driver.mk b/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/driver.mk
deleted file mode 100644
index f32d0d868..000000000
--- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/driver.mk
+++ /dev/null
@@ -1,2 +0,0 @@
1GFXINC += drivers/gdisp/IS31FL3731C
2GFXSRC += drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
deleted file mode 100644
index b4a5c84b0..000000000
--- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
+++ /dev/null
@@ -1,312 +0,0 @@
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// Can't include led_tables from here
30extern const uint8_t CIE1931_CURVE[];
31
32/*===========================================================================*/
33/* Driver local definitions. */
34/*===========================================================================*/
35
36#ifndef GDISP_SCREEN_HEIGHT
37 #define GDISP_SCREEN_HEIGHT 9
38#endif
39#ifndef GDISP_SCREEN_WIDTH
40 #define GDISP_SCREEN_WIDTH 16
41#endif
42#ifndef GDISP_INITIAL_CONTRAST
43 #define GDISP_INITIAL_CONTRAST 0
44#endif
45#ifndef GDISP_INITIAL_BACKLIGHT
46 #define GDISP_INITIAL_BACKLIGHT 0
47#endif
48
49#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
50
51#define IS31_ADDR_DEFAULT 0x74
52
53#define IS31_REG_CONFIG 0x00
54// bits in reg
55#define IS31_REG_CONFIG_PICTUREMODE 0x00
56#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
57#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
58// D2:D0 bits are starting frame for autoplay mode
59
60#define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode
61
62#define IS31_REG_AUTOPLAYCTRL1 0x02
63// D6:D4 number of loops (000=infty)
64// D2:D0 number of frames to be used
65
66#define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms)
67
68#define IS31_REG_DISPLAYOPT 0x05
69#define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames
70#define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8
71// D2:D0 bits blink period time (*0.27s)
72
73#define IS31_REG_AUDIOSYNC 0x06
74#define IS31_REG_AUDIOSYNC_ENABLE 0x1
75
76#define IS31_REG_FRAMESTATE 0x07
77
78#define IS31_REG_BREATHCTRL1 0x08
79// D6:D4 fade out time (26ms*2^i)
80// D2:D0 fade in time (26ms*2^i)
81
82#define IS31_REG_BREATHCTRL2 0x09
83#define IS31_REG_BREATHCTRL2_ENABLE 0x10
84// D2:D0 extinguish time (3.5ms*2^i)
85
86#define IS31_REG_SHUTDOWN 0x0A
87#define IS31_REG_SHUTDOWN_OFF 0x0
88#define IS31_REG_SHUTDOWN_ON 0x1
89
90#define IS31_REG_AGCCTRL 0x0B
91#define IS31_REG_ADCRATE 0x0C
92
93#define IS31_COMMANDREGISTER 0xFD
94#define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine'
95#define IS31_FUNCTIONREG_SIZE 0xD
96
97#define IS31_FRAME_SIZE 0xB4
98
99#define IS31_PWM_REG 0x24
100#define IS31_PWM_SIZE 0x90
101
102#define IS31_LED_MASK_SIZE 0x12
103#define IS31_SCREEN_WIDTH 16
104
105#define IS31
106
107/*===========================================================================*/
108/* Driver local functions. */
109/*===========================================================================*/
110
111typedef struct{
112 uint8_t write_buffer_offset;
113 uint8_t write_buffer[IS31_FRAME_SIZE];
114 uint8_t frame_buffer[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH];
115 uint8_t page;
116}__attribute__((__packed__)) PrivData;
117
118// Some common routines and macros
119#define PRIV(g) ((PrivData*)g->priv)
120
121/*===========================================================================*/
122/* Driver exported functions. */
123/*===========================================================================*/
124
125static GFXINLINE void write_page(GDisplay* g, uint8_t page) {
126 uint8_t tx[2] __attribute__((aligned(2)));
127 tx[0] = IS31_COMMANDREGISTER;
128 tx[1] = page;
129 write_data(g, tx, 2);
130}
131
132static GFXINLINE void write_register(GDisplay* g, uint8_t page, uint8_t reg, uint8_t data) {
133 uint8_t tx[2] __attribute__((aligned(2)));
134 tx[0] = reg;
135 tx[1] = data;
136 write_page(g, page);
137 write_data(g, tx, 2);
138}
139
140static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint16_t length) {
141 PRIV(g)->write_buffer_offset = offset;
142 write_page(g, page);
143 write_data(g, (uint8_t*)PRIV(g), length + 1);
144}
145
146LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
147 // The private area is the display surface.
148 g->priv = gfxAlloc(sizeof(PrivData));
149 __builtin_memset(PRIV(g), 0, sizeof(PrivData));
150 PRIV(g)->page = 0;
151
152 // Initialise the board interface
153 init_board(g);
154 gfxSleepMilliseconds(10);
155
156 // zero function page, all registers (assuming full_page is all zeroes)
157 write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
158 set_hardware_shutdown(g, false);
159 gfxSleepMilliseconds(10);
160 // software shutdown
161 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
162 gfxSleepMilliseconds(10);
163 // zero function page, all registers
164 write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
165 gfxSleepMilliseconds(10);
166
167
168 // zero all LED registers on all 8 pages, and enable the mask
169 __builtin_memcpy(PRIV(g)->write_buffer, get_led_mask(g), IS31_LED_MASK_SIZE);
170 for(uint8_t i=0; i<8; i++) {
171 write_ram(g, i, 0, IS31_FRAME_SIZE);
172 gfxSleepMilliseconds(1);
173 }
174
175 // software shutdown disable (i.e. turn stuff on)
176 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
177 gfxSleepMilliseconds(10);
178
179 // Finish Init
180 post_init_board(g);
181
182 /* Initialise the GDISP structure */
183 g->g.Width = GDISP_SCREEN_WIDTH;
184 g->g.Height = GDISP_SCREEN_HEIGHT;
185 g->g.Orientation = GDISP_ROTATE_0;
186 g->g.Powermode = powerOff;
187 g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
188 g->g.Contrast = GDISP_INITIAL_CONTRAST;
189 return TRUE;
190}
191
192#if GDISP_HARDWARE_FLUSH
193 LLDSPEC void gdisp_lld_flush(GDisplay *g) {
194 // Don't flush if we don't need it.
195 if (!(g->flags & GDISP_FLG_NEEDFLUSH))
196 return;
197
198 PRIV(g)->page++;
199 PRIV(g)->page %= 2;
200 // TODO: some smarter algorithm for this
201 // We should run only one physical page at a time
202 // This way we don't need to send so much data, and
203 // we could use slightly less memory
204 uint8_t* src = PRIV(g)->frame_buffer;
205 for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
206 for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
207 uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
208 PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
209 ++src;
210 }
211 }
212 write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
213 gfxSleepMilliseconds(1);
214 write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
215
216 g->flags &= ~GDISP_FLG_NEEDFLUSH;
217 }
218#endif
219
220#if GDISP_HARDWARE_DRAWPIXEL
221 LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
222 coord_t x, y;
223
224 switch(g->g.Orientation) {
225 default:
226 case GDISP_ROTATE_0:
227 x = g->p.x;
228 y = g->p.y;
229 break;
230 case GDISP_ROTATE_180:
231 x = GDISP_SCREEN_WIDTH-1 - g->p.x;
232 y = g->p.y;
233 break;
234 }
235 PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
236 g->flags |= GDISP_FLG_NEEDFLUSH;
237 }
238#endif
239
240#if GDISP_HARDWARE_PIXELREAD
241 LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
242 coord_t x, y;
243
244 switch(g->g.Orientation) {
245 default:
246 case GDISP_ROTATE_0:
247 x = g->p.x;
248 y = g->p.y;
249 break;
250 case GDISP_ROTATE_180:
251 x = GDISP_SCREEN_WIDTH-1 - g->p.x;
252 y = g->p.y;
253 break;
254 }
255 return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
256 }
257#endif
258
259#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
260 LLDSPEC void gdisp_lld_control(GDisplay *g) {
261 switch(g->p.x) {
262 case GDISP_CONTROL_POWER:
263 if (g->g.Powermode == (powermode_t)g->p.ptr)
264 return;
265 switch((powermode_t)g->p.ptr) {
266 case powerOff:
267 case powerSleep:
268 case powerDeepSleep:
269 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
270 break;
271 case powerOn:
272 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
273 break;
274 default:
275 return;
276 }
277 g->g.Powermode = (powermode_t)g->p.ptr;
278 return;
279
280 case GDISP_CONTROL_ORIENTATION:
281 if (g->g.Orientation == (orientation_t)g->p.ptr)
282 return;
283 switch((orientation_t)g->p.ptr) {
284 /* Rotation is handled by the drawing routines */
285 case GDISP_ROTATE_0:
286 case GDISP_ROTATE_180:
287 g->g.Height = GDISP_SCREEN_HEIGHT;
288 g->g.Width = GDISP_SCREEN_WIDTH;
289 break;
290 case GDISP_ROTATE_90:
291 case GDISP_ROTATE_270:
292 g->g.Height = GDISP_SCREEN_WIDTH;
293 g->g.Width = GDISP_SCREEN_HEIGHT;
294 break;
295 default:
296 return;
297 }
298 g->g.Orientation = (orientation_t)g->p.ptr;
299 return;
300
301 case GDISP_CONTROL_BACKLIGHT:
302 if (g->g.Backlight == (unsigned)g->p.ptr)
303 return;
304 unsigned val = (unsigned)g->p.ptr;
305 g->g.Backlight = val > 100 ? 100 : val;
306 g->flags |= GDISP_FLG_NEEDFLUSH;
307 return;
308 }
309 }
310#endif // GDISP_NEED_CONTROL
311
312#endif // GFX_USE_GDISP
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/driver.mk b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/driver.mk
deleted file mode 100644
index 889a1a031..000000000
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/driver.mk
+++ /dev/null
@@ -1,2 +0,0 @@
1GFXINC += drivers/gdisp/st7565ergodox
2GFXSRC += drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
diff --git a/keyboards/ergodox/infinity/gfxconf.h b/keyboards/ergodox/infinity/gfxconf.h
index 45b9f5858..ca338399d 100644
--- a/keyboards/ergodox/infinity/gfxconf.h
+++ b/keyboards/ergodox/infinity/gfxconf.h
@@ -22,310 +22,6 @@
22#ifndef _GFXCONF_H 22#ifndef _GFXCONF_H
23#define _GFXCONF_H 23#define _GFXCONF_H
24 24
25 25#include "common_gfxconf.h"
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 26
331#endif /* _GFXCONF_H */ 27#endif /* _GFXCONF_H */
diff --git a/keyboards/ergodox/infinity/rules.mk b/keyboards/ergodox/infinity/rules.mk
index bbb0f6efe..a341bbfce 100644
--- a/keyboards/ergodox/infinity/rules.mk
+++ b/keyboards/ergodox/infinity/rules.mk
@@ -1,7 +1,6 @@
1# project specific files 1# project specific files
2SRC = matrix.c \ 2SRC = matrix.c \
3 led.c \ 3 led.c
4 animations.c
5 4
6## chip/board settings 5## chip/board settings
7# - the next two should match the directories in 6# - the next two should match the directories in
@@ -67,5 +66,10 @@ LCD_BACKLIGHT_ENABLE = yes
67MIDI_ENABLE = no 66MIDI_ENABLE = no
68RGBLIGHT_ENABLE = no 67RGBLIGHT_ENABLE = no
69 68
70include $(SUBPROJECT_PATH)/drivers/gdisp/st7565ergodox/driver.mk 69LCD_DRIVER = st7565
71include $(SUBPROJECT_PATH)/drivers/gdisp/IS31FL3731C/driver.mk \ No newline at end of file 70LCD_WIDTH = 128
71LCD_HEIGHT = 32
72
73LED_DRIVER = is31fl3731c
74LED_WIDTH = 7
75LED_HEIGHT = 7 \ No newline at end of file
diff --git a/keyboards/ergodox/infinity/simple_visualizer.h b/keyboards/ergodox/infinity/simple_visualizer.h
index ded8a3222..73d0e0887 100644
--- a/keyboards/ergodox/infinity/simple_visualizer.h
+++ b/keyboards/ergodox/infinity/simple_visualizer.h
@@ -34,7 +34,7 @@
34#include "lcd_backlight_keyframes.h" 34#include "lcd_backlight_keyframes.h"
35#include "system/serial_link.h" 35#include "system/serial_link.h"
36#include "led.h" 36#include "led.h"
37#include "animations.h" 37#include "default_animations.h"
38 38
39static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); 39static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
40static const uint32_t initial_color = LCD_COLOR(0, 0, 0); 40static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
@@ -58,7 +58,7 @@ static keyframe_animation_t color_animation = {
58 // this prevents the color from changing when activating the layer 58 // this prevents the color from changing when activating the layer
59 // momentarily 59 // momentarily
60 .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)}, 60 .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)},
61 .frame_functions = {keyframe_no_operation, backlight_keyframe_animate_color}, 61 .frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color},
62}; 62};
63 63
64void initialize_user_visualizer(visualizer_state_t* state) { 64void initialize_user_visualizer(visualizer_state_t* state) {
diff --git a/keyboards/ergodox/infinity/visualizer.c b/keyboards/ergodox/infinity/visualizer.c
index 5b6b32007..4b16021ab 100644
--- a/keyboards/ergodox/infinity/visualizer.c
+++ b/keyboards/ergodox/infinity/visualizer.c
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
31#include "lcd_keyframes.h" 31#include "lcd_keyframes.h"
32#include "lcd_backlight_keyframes.h" 32#include "lcd_backlight_keyframes.h"
33#include "system/serial_link.h" 33#include "system/serial_link.h"
34#include "animations.h" 34#include "default_animations.h"
35 35
36static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); 36static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
37static const uint32_t initial_color = LCD_COLOR(0, 0, 0); 37static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
@@ -79,7 +79,7 @@ static keyframe_animation_t one_led_color = {
79 .num_frames = 1, 79 .num_frames = 1,
80 .loop = false, 80 .loop = false,
81 .frame_lengths = {gfxMillisecondsToTicks(0)}, 81 .frame_lengths = {gfxMillisecondsToTicks(0)},
82 .frame_functions = {backlight_keyframe_set_color}, 82 .frame_functions = {lcd_backlight_keyframe_set_color},
83}; 83};
84 84
85bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) { 85bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) {
@@ -94,7 +94,7 @@ static keyframe_animation_t two_led_colors = {
94 .num_frames = 2, 94 .num_frames = 2,
95 .loop = true, 95 .loop = true,
96 .frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)}, 96 .frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)},
97 .frame_functions = {backlight_keyframe_set_color, swap_led_target_color}, 97 .frame_functions = {lcd_backlight_keyframe_set_color, swap_led_target_color},
98}; 98};
99 99
100// The LCD animation alternates between the layer name display and a 100// The LCD animation alternates between the layer name display and a
diff --git a/keyboards/handwired/magicforce68/README.md b/keyboards/handwired/magicforce68/README.md
index 2877169ef..a0de66069 100644
--- a/keyboards/handwired/magicforce68/README.md
+++ b/keyboards/handwired/magicforce68/README.md
@@ -5,7 +5,7 @@ This firmware is for a Magicforce 68 that's had its PCB removed and is handwired
5 5
6## Wiring Layout 6## Wiring Layout
7 7
8![Wiring Layout](http://imgur.com/NmTCv5u) 8![Wiring Layout](http://i.imgur.com/NmTCv5u.png)
9 9
10## Pinout 10## Pinout
11 11
diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c
index f30badd35..84fac1ae1 100644
--- a/keyboards/handwired/promethium/rgbsps.c
+++ b/keyboards/handwired/promethium/rgbsps.c
@@ -1,4 +1,4 @@
1#include "light_ws2812.h" 1#include "ws2812.h"
2#include "rgbsps.h" 2#include "rgbsps.h"
3 3
4struct cRGB led[RGBSPS_NUM]; 4struct cRGB led[RGBSPS_NUM];
diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk
index 6fa45b42b..69903dceb 100644
--- a/keyboards/handwired/promethium/rules.mk
+++ b/keyboards/handwired/promethium/rules.mk
@@ -72,7 +72,7 @@ BLUETOOTH = AdafruitBLE
72# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 72# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
73SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 73SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
74 74
75SRC += $(QUANTUM_DIR)/light_ws2812.c 75SRC += ws2812.c
76SRC += rgbsps.c 76SRC += rgbsps.c
77SRC += $(QUANTUM_DIR)/analog.c 77SRC += analog.c
78SRC += matrix.c 78SRC += matrix.c
diff --git a/keyboards/lets_split/pro_micro.h b/keyboards/lets_split/pro_micro.h
deleted file mode 100644
index f9e7ed75d..000000000
--- a/keyboards/lets_split/pro_micro.h
+++ /dev/null
@@ -1,362 +0,0 @@
1/*
2 pins_arduino.h - Pin definition functions for Arduino
3 Part of Arduino - http://www.arduino.cc/
4
5 Copyright (c) 2007 David A. Mellis
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General
18 Public License along with this library; if not, write to the
19 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 Boston, MA 02111-1307 USA
21
22 $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
23*/
24
25#ifndef Pins_Arduino_h
26#define Pins_Arduino_h
27
28#include <avr/pgmspace.h>
29
30// Workaround for wrong definitions in "iom32u4.h".
31// This should be fixed in the AVR toolchain.
32#undef UHCON
33#undef UHINT
34#undef UHIEN
35#undef UHADDR
36#undef UHFNUM
37#undef UHFNUML
38#undef UHFNUMH
39#undef UHFLEN
40#undef UPINRQX
41#undef UPINTX
42#undef UPNUM
43#undef UPRST
44#undef UPCONX
45#undef UPCFG0X
46#undef UPCFG1X
47#undef UPSTAX
48#undef UPCFG2X
49#undef UPIENX
50#undef UPDATX
51#undef TCCR2A
52#undef WGM20
53#undef WGM21
54#undef COM2B0
55#undef COM2B1
56#undef COM2A0
57#undef COM2A1
58#undef TCCR2B
59#undef CS20
60#undef CS21
61#undef CS22
62#undef WGM22
63#undef FOC2B
64#undef FOC2A
65#undef TCNT2
66#undef TCNT2_0
67#undef TCNT2_1
68#undef TCNT2_2
69#undef TCNT2_3
70#undef TCNT2_4
71#undef TCNT2_5
72#undef TCNT2_6
73#undef TCNT2_7
74#undef OCR2A
75#undef OCR2_0
76#undef OCR2_1
77#undef OCR2_2
78#undef OCR2_3
79#undef OCR2_4
80#undef OCR2_5
81#undef OCR2_6
82#undef OCR2_7
83#undef OCR2B
84#undef OCR2_0
85#undef OCR2_1
86#undef OCR2_2
87#undef OCR2_3
88#undef OCR2_4
89#undef OCR2_5
90#undef OCR2_6
91#undef OCR2_7
92
93#define NUM_DIGITAL_PINS 30
94#define NUM_ANALOG_INPUTS 12
95
96#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
97#define TXLED0 PORTD |= (1<<5)
98#define TXLED1 PORTD &= ~(1<<5)
99#define RXLED0 PORTB |= (1<<0)
100#define RXLED1 PORTB &= ~(1<<0)
101
102static const uint8_t SDA = 2;
103static const uint8_t SCL = 3;
104#define LED_BUILTIN 13
105
106// Map SPI port to 'new' pins D14..D17
107static const uint8_t SS = 17;
108static const uint8_t MOSI = 16;
109static const uint8_t MISO = 14;
110static const uint8_t SCK = 15;
111
112// Mapping of analog pins as digital I/O
113// A6-A11 share with digital pins
114static const uint8_t ADC0 = 18;
115static const uint8_t ADC1 = 19;
116static const uint8_t ADC2 = 20;
117static const uint8_t ADC3 = 21;
118static const uint8_t ADC4 = 22;
119static const uint8_t ADC5 = 23;
120static const uint8_t ADC6 = 24; // D4
121static const uint8_t ADC7 = 25; // D6
122static const uint8_t ADC8 = 26; // D8
123static const uint8_t ADC9 = 27; // D9
124static const uint8_t ADC10 = 28; // D10
125static const uint8_t ADC11 = 29; // D12
126
127#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
128#define digitalPinToPCICRbit(p) 0
129#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
130#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
131
132// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
133extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
134#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
135
136#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
137
138#ifdef ARDUINO_MAIN
139
140// On the Arduino board, digital pins are also used
141// for the analog output (software PWM). Analog input
142// pins are a separate set.
143
144// ATMEL ATMEGA32U4 / ARDUINO LEONARDO
145//
146// D0 PD2 RXD1/INT2
147// D1 PD3 TXD1/INT3
148// D2 PD1 SDA SDA/INT1
149// D3# PD0 PWM8/SCL OC0B/SCL/INT0
150// D4 A6 PD4 ADC8
151// D5# PC6 ??? OC3A/#OC4A
152// D6# A7 PD7 FastPWM #OC4D/ADC10
153// D7 PE6 INT6/AIN0
154//
155// D8 A8 PB4 ADC11/PCINT4
156// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5
157// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6
158// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7
159// D12 A11 PD6 T1/#OC4D/ADC9
160// D13# PC7 PWM10 CLK0/OC4A
161//
162// A0 D18 PF7 ADC7
163// A1 D19 PF6 ADC6
164// A2 D20 PF5 ADC5
165// A3 D21 PF4 ADC4
166// A4 D22 PF1 ADC1
167// A5 D23 PF0 ADC0
168//
169// New pins D14..D17 to map SPI port to digital pins
170//
171// MISO D14 PB3 MISO,PCINT3
172// SCK D15 PB1 SCK,PCINT1
173// MOSI D16 PB2 MOSI,PCINT2
174// SS D17 PB0 RXLED,SS/PCINT0
175//
176// Connected LEDs on board for TX and RX
177// TXLED D24 PD5 XCK1
178// RXLED D17 PB0
179// HWB PE2 HWB
180
181// these arrays map port names (e.g. port B) to the
182// appropriate addresses for various functions (e.g. reading
183// and writing)
184const uint16_t PROGMEM port_to_mode_PGM[] = {
185 NOT_A_PORT,
186 NOT_A_PORT,
187 (uint16_t) &DDRB,
188 (uint16_t) &DDRC,
189 (uint16_t) &DDRD,
190 (uint16_t) &DDRE,
191 (uint16_t) &DDRF,
192};
193
194const uint16_t PROGMEM port_to_output_PGM[] = {
195 NOT_A_PORT,
196 NOT_A_PORT,
197 (uint16_t) &PORTB,
198 (uint16_t) &PORTC,
199 (uint16_t) &PORTD,
200 (uint16_t) &PORTE,
201 (uint16_t) &PORTF,
202};
203
204const uint16_t PROGMEM port_to_input_PGM[] = {
205 NOT_A_PORT,
206 NOT_A_PORT,
207 (uint16_t) &PINB,
208 (uint16_t) &PINC,
209 (uint16_t) &PIND,
210 (uint16_t) &PINE,
211 (uint16_t) &PINF,
212};
213
214const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
215 PD, // D0 - PD2
216 PD, // D1 - PD3
217 PD, // D2 - PD1
218 PD, // D3 - PD0
219 PD, // D4 - PD4
220 PC, // D5 - PC6
221 PD, // D6 - PD7
222 PE, // D7 - PE6
223
224 PB, // D8 - PB4
225 PB, // D9 - PB5
226 PB, // D10 - PB6
227 PB, // D11 - PB7
228 PD, // D12 - PD6
229 PC, // D13 - PC7
230
231 PB, // D14 - MISO - PB3
232 PB, // D15 - SCK - PB1
233 PB, // D16 - MOSI - PB2
234 PB, // D17 - SS - PB0
235
236 PF, // D18 - A0 - PF7
237 PF, // D19 - A1 - PF6
238 PF, // D20 - A2 - PF5
239 PF, // D21 - A3 - PF4
240 PF, // D22 - A4 - PF1
241 PF, // D23 - A5 - PF0
242
243 PD, // D24 - PD5
244 PD, // D25 / D6 - A7 - PD7
245 PB, // D26 / D8 - A8 - PB4
246 PB, // D27 / D9 - A9 - PB5
247 PB, // D28 / D10 - A10 - PB6
248 PD, // D29 / D12 - A11 - PD6
249};
250
251const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
252 _BV(2), // D0 - PD2
253 _BV(3), // D1 - PD3
254 _BV(1), // D2 - PD1
255 _BV(0), // D3 - PD0
256 _BV(4), // D4 - PD4
257 _BV(6), // D5 - PC6
258 _BV(7), // D6 - PD7
259 _BV(6), // D7 - PE6
260
261 _BV(4), // D8 - PB4
262 _BV(5), // D9 - PB5
263 _BV(6), // D10 - PB6
264 _BV(7), // D11 - PB7
265 _BV(6), // D12 - PD6
266 _BV(7), // D13 - PC7
267
268 _BV(3), // D14 - MISO - PB3
269 _BV(1), // D15 - SCK - PB1
270 _BV(2), // D16 - MOSI - PB2
271 _BV(0), // D17 - SS - PB0
272
273 _BV(7), // D18 - A0 - PF7
274 _BV(6), // D19 - A1 - PF6
275 _BV(5), // D20 - A2 - PF5
276 _BV(4), // D21 - A3 - PF4
277 _BV(1), // D22 - A4 - PF1
278 _BV(0), // D23 - A5 - PF0
279
280 _BV(5), // D24 - PD5
281 _BV(7), // D25 / D6 - A7 - PD7
282 _BV(4), // D26 / D8 - A8 - PB4
283 _BV(5), // D27 / D9 - A9 - PB5
284 _BV(6), // D28 / D10 - A10 - PB6
285 _BV(6), // D29 / D12 - A11 - PD6
286};
287
288const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
289 NOT_ON_TIMER,
290 NOT_ON_TIMER,
291 NOT_ON_TIMER,
292 TIMER0B, /* 3 */
293 NOT_ON_TIMER,
294 TIMER3A, /* 5 */
295 TIMER4D, /* 6 */
296 NOT_ON_TIMER,
297
298 NOT_ON_TIMER,
299 TIMER1A, /* 9 */
300 TIMER1B, /* 10 */
301 TIMER0A, /* 11 */
302
303 NOT_ON_TIMER,
304 TIMER4A, /* 13 */
305
306 NOT_ON_TIMER,
307 NOT_ON_TIMER,
308 NOT_ON_TIMER,
309 NOT_ON_TIMER,
310 NOT_ON_TIMER,
311 NOT_ON_TIMER,
312
313 NOT_ON_TIMER,
314 NOT_ON_TIMER,
315 NOT_ON_TIMER,
316 NOT_ON_TIMER,
317 NOT_ON_TIMER,
318 NOT_ON_TIMER,
319 NOT_ON_TIMER,
320 NOT_ON_TIMER,
321 NOT_ON_TIMER,
322 NOT_ON_TIMER,
323};
324
325const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
326 7, // A0 PF7 ADC7
327 6, // A1 PF6 ADC6
328 5, // A2 PF5 ADC5
329 4, // A3 PF4 ADC4
330 1, // A4 PF1 ADC1
331 0, // A5 PF0 ADC0
332 8, // A6 D4 PD4 ADC8
333 10, // A7 D6 PD7 ADC10
334 11, // A8 D8 PB4 ADC11
335 12, // A9 D9 PB5 ADC12
336 13, // A10 D10 PB6 ADC13
337 9 // A11 D12 PD6 ADC9
338};
339
340#endif /* ARDUINO_MAIN */
341
342// These serial port names are intended to allow libraries and architecture-neutral
343// sketches to automatically default to the correct port name for a particular type
344// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
345// the first hardware serial port whose RX/TX pins are not dedicated to another use.
346//
347// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
348//
349// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
350//
351// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
352//
353// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
354//
355// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
356// pins are NOT connected to anything by default.
357#define SERIAL_PORT_MONITOR Serial
358#define SERIAL_PORT_USBVIRTUAL Serial
359#define SERIAL_PORT_HARDWARE Serial1
360#define SERIAL_PORT_HARDWARE_OPEN Serial1
361
362#endif /* Pins_Arduino_h */
diff --git a/keyboards/nyquist/pro_micro.h b/keyboards/nyquist/pro_micro.h
deleted file mode 100644
index f9e7ed75d..000000000
--- a/keyboards/nyquist/pro_micro.h
+++ /dev/null
@@ -1,362 +0,0 @@
1/*
2 pins_arduino.h - Pin definition functions for Arduino
3 Part of Arduino - http://www.arduino.cc/
4
5 Copyright (c) 2007 David A. Mellis
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General
18 Public License along with this library; if not, write to the
19 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 Boston, MA 02111-1307 USA
21
22 $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
23*/
24
25#ifndef Pins_Arduino_h
26#define Pins_Arduino_h
27
28#include <avr/pgmspace.h>
29
30// Workaround for wrong definitions in "iom32u4.h".
31// This should be fixed in the AVR toolchain.
32#undef UHCON
33#undef UHINT
34#undef UHIEN
35#undef UHADDR
36#undef UHFNUM
37#undef UHFNUML
38#undef UHFNUMH
39#undef UHFLEN
40#undef UPINRQX
41#undef UPINTX
42#undef UPNUM
43#undef UPRST
44#undef UPCONX
45#undef UPCFG0X
46#undef UPCFG1X
47#undef UPSTAX
48#undef UPCFG2X
49#undef UPIENX
50#undef UPDATX
51#undef TCCR2A
52#undef WGM20
53#undef WGM21
54#undef COM2B0
55#undef COM2B1
56#undef COM2A0
57#undef COM2A1
58#undef TCCR2B
59#undef CS20
60#undef CS21
61#undef CS22
62#undef WGM22
63#undef FOC2B
64#undef FOC2A
65#undef TCNT2
66#undef TCNT2_0
67#undef TCNT2_1
68#undef TCNT2_2
69#undef TCNT2_3
70#undef TCNT2_4
71#undef TCNT2_5
72#undef TCNT2_6
73#undef TCNT2_7
74#undef OCR2A
75#undef OCR2_0
76#undef OCR2_1
77#undef OCR2_2
78#undef OCR2_3
79#undef OCR2_4
80#undef OCR2_5
81#undef OCR2_6
82#undef OCR2_7
83#undef OCR2B
84#undef OCR2_0
85#undef OCR2_1
86#undef OCR2_2
87#undef OCR2_3
88#undef OCR2_4
89#undef OCR2_5
90#undef OCR2_6
91#undef OCR2_7
92
93#define NUM_DIGITAL_PINS 30
94#define NUM_ANALOG_INPUTS 12
95
96#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
97#define TXLED0 PORTD |= (1<<5)
98#define TXLED1 PORTD &= ~(1<<5)
99#define RXLED0 PORTB |= (1<<0)
100#define RXLED1 PORTB &= ~(1<<0)
101
102static const uint8_t SDA = 2;
103static const uint8_t SCL = 3;
104#define LED_BUILTIN 13
105
106// Map SPI port to 'new' pins D14..D17
107static const uint8_t SS = 17;
108static const uint8_t MOSI = 16;
109static const uint8_t MISO = 14;
110static const uint8_t SCK = 15;
111
112// Mapping of analog pins as digital I/O
113// A6-A11 share with digital pins
114static const uint8_t ADC0 = 18;
115static const uint8_t ADC1 = 19;
116static const uint8_t ADC2 = 20;
117static const uint8_t ADC3 = 21;
118static const uint8_t ADC4 = 22;
119static const uint8_t ADC5 = 23;
120static const uint8_t ADC6 = 24; // D4
121static const uint8_t ADC7 = 25; // D6
122static const uint8_t ADC8 = 26; // D8
123static const uint8_t ADC9 = 27; // D9
124static const uint8_t ADC10 = 28; // D10
125static const uint8_t ADC11 = 29; // D12
126
127#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
128#define digitalPinToPCICRbit(p) 0
129#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
130#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
131
132// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
133extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
134#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
135
136#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
137
138#ifdef ARDUINO_MAIN
139
140// On the Arduino board, digital pins are also used
141// for the analog output (software PWM). Analog input
142// pins are a separate set.
143
144// ATMEL ATMEGA32U4 / ARDUINO LEONARDO
145//
146// D0 PD2 RXD1/INT2
147// D1 PD3 TXD1/INT3
148// D2 PD1 SDA SDA/INT1
149// D3# PD0 PWM8/SCL OC0B/SCL/INT0
150// D4 A6 PD4 ADC8
151// D5# PC6 ??? OC3A/#OC4A
152// D6# A7 PD7 FastPWM #OC4D/ADC10
153// D7 PE6 INT6/AIN0
154//
155// D8 A8 PB4 ADC11/PCINT4
156// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5
157// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6
158// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7
159// D12 A11 PD6 T1/#OC4D/ADC9
160// D13# PC7 PWM10 CLK0/OC4A
161//
162// A0 D18 PF7 ADC7
163// A1 D19 PF6 ADC6
164// A2 D20 PF5 ADC5
165// A3 D21 PF4 ADC4
166// A4 D22 PF1 ADC1
167// A5 D23 PF0 ADC0
168//
169// New pins D14..D17 to map SPI port to digital pins
170//
171// MISO D14 PB3 MISO,PCINT3
172// SCK D15 PB1 SCK,PCINT1
173// MOSI D16 PB2 MOSI,PCINT2
174// SS D17 PB0 RXLED,SS/PCINT0
175//
176// Connected LEDs on board for TX and RX
177// TXLED D24 PD5 XCK1
178// RXLED D17 PB0
179// HWB PE2 HWB
180
181// these arrays map port names (e.g. port B) to the
182// appropriate addresses for various functions (e.g. reading
183// and writing)
184const uint16_t PROGMEM port_to_mode_PGM[] = {
185 NOT_A_PORT,
186 NOT_A_PORT,
187 (uint16_t) &DDRB,
188 (uint16_t) &DDRC,
189 (uint16_t) &DDRD,
190 (uint16_t) &DDRE,
191 (uint16_t) &DDRF,
192};
193
194const uint16_t PROGMEM port_to_output_PGM[] = {
195 NOT_A_PORT,
196 NOT_A_PORT,
197 (uint16_t) &PORTB,
198 (uint16_t) &PORTC,
199 (uint16_t) &PORTD,
200 (uint16_t) &PORTE,
201 (uint16_t) &PORTF,
202};
203
204const uint16_t PROGMEM port_to_input_PGM[] = {
205 NOT_A_PORT,
206 NOT_A_PORT,
207 (uint16_t) &PINB,
208 (uint16_t) &PINC,
209 (uint16_t) &PIND,
210 (uint16_t) &PINE,
211 (uint16_t) &PINF,
212};
213
214const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
215 PD, // D0 - PD2
216 PD, // D1 - PD3
217 PD, // D2 - PD1
218 PD, // D3 - PD0
219 PD, // D4 - PD4
220 PC, // D5 - PC6
221 PD, // D6 - PD7
222 PE, // D7 - PE6
223
224 PB, // D8 - PB4
225 PB, // D9 - PB5
226 PB, // D10 - PB6
227 PB, // D11 - PB7
228 PD, // D12 - PD6
229 PC, // D13 - PC7
230
231 PB, // D14 - MISO - PB3
232 PB, // D15 - SCK - PB1
233 PB, // D16 - MOSI - PB2
234 PB, // D17 - SS - PB0
235
236 PF, // D18 - A0 - PF7
237 PF, // D19 - A1 - PF6
238 PF, // D20 - A2 - PF5
239 PF, // D21 - A3 - PF4
240 PF, // D22 - A4 - PF1
241 PF, // D23 - A5 - PF0
242
243 PD, // D24 - PD5
244 PD, // D25 / D6 - A7 - PD7
245 PB, // D26 / D8 - A8 - PB4
246 PB, // D27 / D9 - A9 - PB5
247 PB, // D28 / D10 - A10 - PB6
248 PD, // D29 / D12 - A11 - PD6
249};
250
251const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
252 _BV(2), // D0 - PD2
253 _BV(3), // D1 - PD3
254 _BV(1), // D2 - PD1
255 _BV(0), // D3 - PD0
256 _BV(4), // D4 - PD4
257 _BV(6), // D5 - PC6
258 _BV(7), // D6 - PD7
259 _BV(6), // D7 - PE6
260
261 _BV(4), // D8 - PB4
262 _BV(5), // D9 - PB5
263 _BV(6), // D10 - PB6
264 _BV(7), // D11 - PB7
265 _BV(6), // D12 - PD6
266 _BV(7), // D13 - PC7
267
268 _BV(3), // D14 - MISO - PB3
269 _BV(1), // D15 - SCK - PB1
270 _BV(2), // D16 - MOSI - PB2
271 _BV(0), // D17 - SS - PB0
272
273 _BV(7), // D18 - A0 - PF7
274 _BV(6), // D19 - A1 - PF6
275 _BV(5), // D20 - A2 - PF5
276 _BV(4), // D21 - A3 - PF4
277 _BV(1), // D22 - A4 - PF1
278 _BV(0), // D23 - A5 - PF0
279
280 _BV(5), // D24 - PD5
281 _BV(7), // D25 / D6 - A7 - PD7
282 _BV(4), // D26 / D8 - A8 - PB4
283 _BV(5), // D27 / D9 - A9 - PB5
284 _BV(6), // D28 / D10 - A10 - PB6
285 _BV(6), // D29 / D12 - A11 - PD6
286};
287
288const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
289 NOT_ON_TIMER,
290 NOT_ON_TIMER,
291 NOT_ON_TIMER,
292 TIMER0B, /* 3 */
293 NOT_ON_TIMER,
294 TIMER3A, /* 5 */
295 TIMER4D, /* 6 */
296 NOT_ON_TIMER,
297
298 NOT_ON_TIMER,
299 TIMER1A, /* 9 */
300 TIMER1B, /* 10 */
301 TIMER0A, /* 11 */
302
303 NOT_ON_TIMER,
304 TIMER4A, /* 13 */
305
306 NOT_ON_TIMER,
307 NOT_ON_TIMER,
308 NOT_ON_TIMER,
309 NOT_ON_TIMER,
310 NOT_ON_TIMER,
311 NOT_ON_TIMER,
312
313 NOT_ON_TIMER,
314 NOT_ON_TIMER,
315 NOT_ON_TIMER,
316 NOT_ON_TIMER,
317 NOT_ON_TIMER,
318 NOT_ON_TIMER,
319 NOT_ON_TIMER,
320 NOT_ON_TIMER,
321 NOT_ON_TIMER,
322 NOT_ON_TIMER,
323};
324
325const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
326 7, // A0 PF7 ADC7
327 6, // A1 PF6 ADC6
328 5, // A2 PF5 ADC5
329 4, // A3 PF4 ADC4
330 1, // A4 PF1 ADC1
331 0, // A5 PF0 ADC0
332 8, // A6 D4 PD4 ADC8
333 10, // A7 D6 PD7 ADC10
334 11, // A8 D8 PB4 ADC11
335 12, // A9 D9 PB5 ADC12
336 13, // A10 D10 PB6 ADC13
337 9 // A11 D12 PD6 ADC9
338};
339
340#endif /* ARDUINO_MAIN */
341
342// These serial port names are intended to allow libraries and architecture-neutral
343// sketches to automatically default to the correct port name for a particular type
344// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
345// the first hardware serial port whose RX/TX pins are not dedicated to another use.
346//
347// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
348//
349// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
350//
351// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
352//
353// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
354//
355// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
356// pins are NOT connected to anything by default.
357#define SERIAL_PORT_MONITOR Serial
358#define SERIAL_PORT_USBVIRTUAL Serial
359#define SERIAL_PORT_HARDWARE Serial1
360#define SERIAL_PORT_HARDWARE_OPEN Serial1
361
362#endif /* Pins_Arduino_h */
diff --git a/keyboards/orthodox/pro_micro.h b/keyboards/orthodox/pro_micro.h
deleted file mode 100644
index f9e7ed75d..000000000
--- a/keyboards/orthodox/pro_micro.h
+++ /dev/null
@@ -1,362 +0,0 @@
1/*
2 pins_arduino.h - Pin definition functions for Arduino
3 Part of Arduino - http://www.arduino.cc/
4
5 Copyright (c) 2007 David A. Mellis
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General
18 Public License along with this library; if not, write to the
19 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 Boston, MA 02111-1307 USA
21
22 $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
23*/
24
25#ifndef Pins_Arduino_h
26#define Pins_Arduino_h
27
28#include <avr/pgmspace.h>
29
30// Workaround for wrong definitions in "iom32u4.h".
31// This should be fixed in the AVR toolchain.
32#undef UHCON
33#undef UHINT
34#undef UHIEN
35#undef UHADDR
36#undef UHFNUM
37#undef UHFNUML
38#undef UHFNUMH
39#undef UHFLEN
40#undef UPINRQX
41#undef UPINTX
42#undef UPNUM
43#undef UPRST
44#undef UPCONX
45#undef UPCFG0X
46#undef UPCFG1X
47#undef UPSTAX
48#undef UPCFG2X
49#undef UPIENX
50#undef UPDATX
51#undef TCCR2A
52#undef WGM20
53#undef WGM21
54#undef COM2B0
55#undef COM2B1
56#undef COM2A0
57#undef COM2A1
58#undef TCCR2B
59#undef CS20
60#undef CS21
61#undef CS22
62#undef WGM22
63#undef FOC2B
64#undef FOC2A
65#undef TCNT2
66#undef TCNT2_0
67#undef TCNT2_1
68#undef TCNT2_2
69#undef TCNT2_3
70#undef TCNT2_4
71#undef TCNT2_5
72#undef TCNT2_6
73#undef TCNT2_7
74#undef OCR2A
75#undef OCR2_0
76#undef OCR2_1
77#undef OCR2_2
78#undef OCR2_3
79#undef OCR2_4
80#undef OCR2_5
81#undef OCR2_6
82#undef OCR2_7
83#undef OCR2B
84#undef OCR2_0
85#undef OCR2_1
86#undef OCR2_2
87#undef OCR2_3
88#undef OCR2_4
89#undef OCR2_5
90#undef OCR2_6
91#undef OCR2_7
92
93#define NUM_DIGITAL_PINS 30
94#define NUM_ANALOG_INPUTS 12
95
96#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
97#define TXLED0 PORTD |= (1<<5)
98#define TXLED1 PORTD &= ~(1<<5)
99#define RXLED0 PORTB |= (1<<0)
100#define RXLED1 PORTB &= ~(1<<0)
101
102static const uint8_t SDA = 2;
103static const uint8_t SCL = 3;
104#define LED_BUILTIN 13
105
106// Map SPI port to 'new' pins D14..D17
107static const uint8_t SS = 17;
108static const uint8_t MOSI = 16;
109static const uint8_t MISO = 14;
110static const uint8_t SCK = 15;
111
112// Mapping of analog pins as digital I/O
113// A6-A11 share with digital pins
114static const uint8_t ADC0 = 18;
115static const uint8_t ADC1 = 19;
116static const uint8_t ADC2 = 20;
117static const uint8_t ADC3 = 21;
118static const uint8_t ADC4 = 22;
119static const uint8_t ADC5 = 23;
120static const uint8_t ADC6 = 24; // D4
121static const uint8_t ADC7 = 25; // D6
122static const uint8_t ADC8 = 26; // D8
123static const uint8_t ADC9 = 27; // D9
124static const uint8_t ADC10 = 28; // D10
125static const uint8_t ADC11 = 29; // D12
126
127#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
128#define digitalPinToPCICRbit(p) 0
129#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
130#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
131
132// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
133extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
134#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
135
136#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
137
138#ifdef ARDUINO_MAIN
139
140// On the Arduino board, digital pins are also used
141// for the analog output (software PWM). Analog input
142// pins are a separate set.
143
144// ATMEL ATMEGA32U4 / ARDUINO LEONARDO
145//
146// D0 PD2 RXD1/INT2
147// D1 PD3 TXD1/INT3
148// D2 PD1 SDA SDA/INT1
149// D3# PD0 PWM8/SCL OC0B/SCL/INT0
150// D4 A6 PD4 ADC8
151// D5# PC6 ??? OC3A/#OC4A
152// D6# A7 PD7 FastPWM #OC4D/ADC10
153// D7 PE6 INT6/AIN0
154//
155// D8 A8 PB4 ADC11/PCINT4
156// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5
157// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6
158// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7
159// D12 A11 PD6 T1/#OC4D/ADC9
160// D13# PC7 PWM10 CLK0/OC4A
161//
162// A0 D18 PF7 ADC7
163// A1 D19 PF6 ADC6
164// A2 D20 PF5 ADC5
165// A3 D21 PF4 ADC4
166// A4 D22 PF1 ADC1
167// A5 D23 PF0 ADC0
168//
169// New pins D14..D17 to map SPI port to digital pins
170//
171// MISO D14 PB3 MISO,PCINT3
172// SCK D15 PB1 SCK,PCINT1
173// MOSI D16 PB2 MOSI,PCINT2
174// SS D17 PB0 RXLED,SS/PCINT0
175//
176// Connected LEDs on board for TX and RX
177// TXLED D24 PD5 XCK1
178// RXLED D17 PB0
179// HWB PE2 HWB
180
181// these arrays map port names (e.g. port B) to the
182// appropriate addresses for various functions (e.g. reading
183// and writing)
184const uint16_t PROGMEM port_to_mode_PGM[] = {
185 NOT_A_PORT,
186 NOT_A_PORT,
187 (uint16_t) &DDRB,
188 (uint16_t) &DDRC,
189 (uint16_t) &DDRD,
190 (uint16_t) &DDRE,
191 (uint16_t) &DDRF,
192};
193
194const uint16_t PROGMEM port_to_output_PGM[] = {
195 NOT_A_PORT,
196 NOT_A_PORT,
197 (uint16_t) &PORTB,
198 (uint16_t) &PORTC,
199 (uint16_t) &PORTD,
200 (uint16_t) &PORTE,
201 (uint16_t) &PORTF,
202};
203
204const uint16_t PROGMEM port_to_input_PGM[] = {
205 NOT_A_PORT,
206 NOT_A_PORT,
207 (uint16_t) &PINB,
208 (uint16_t) &PINC,
209 (uint16_t) &PIND,
210 (uint16_t) &PINE,
211 (uint16_t) &PINF,
212};
213
214const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
215 PD, // D0 - PD2
216 PD, // D1 - PD3
217 PD, // D2 - PD1
218 PD, // D3 - PD0
219 PD, // D4 - PD4
220 PC, // D5 - PC6
221 PD, // D6 - PD7
222 PE, // D7 - PE6
223
224 PB, // D8 - PB4
225 PB, // D9 - PB5
226 PB, // D10 - PB6
227 PB, // D11 - PB7
228 PD, // D12 - PD6
229 PC, // D13 - PC7
230
231 PB, // D14 - MISO - PB3
232 PB, // D15 - SCK - PB1
233 PB, // D16 - MOSI - PB2
234 PB, // D17 - SS - PB0
235
236 PF, // D18 - A0 - PF7
237 PF, // D19 - A1 - PF6
238 PF, // D20 - A2 - PF5
239 PF, // D21 - A3 - PF4
240 PF, // D22 - A4 - PF1
241 PF, // D23 - A5 - PF0
242
243 PD, // D24 - PD5
244 PD, // D25 / D6 - A7 - PD7
245 PB, // D26 / D8 - A8 - PB4
246 PB, // D27 / D9 - A9 - PB5
247 PB, // D28 / D10 - A10 - PB6
248 PD, // D29 / D12 - A11 - PD6
249};
250
251const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
252 _BV(2), // D0 - PD2
253 _BV(3), // D1 - PD3
254 _BV(1), // D2 - PD1
255 _BV(0), // D3 - PD0
256 _BV(4), // D4 - PD4
257 _BV(6), // D5 - PC6
258 _BV(7), // D6 - PD7
259 _BV(6), // D7 - PE6
260
261 _BV(4), // D8 - PB4
262 _BV(5), // D9 - PB5
263 _BV(6), // D10 - PB6
264 _BV(7), // D11 - PB7
265 _BV(6), // D12 - PD6
266 _BV(7), // D13 - PC7
267
268 _BV(3), // D14 - MISO - PB3
269 _BV(1), // D15 - SCK - PB1
270 _BV(2), // D16 - MOSI - PB2
271 _BV(0), // D17 - SS - PB0
272
273 _BV(7), // D18 - A0 - PF7
274 _BV(6), // D19 - A1 - PF6
275 _BV(5), // D20 - A2 - PF5
276 _BV(4), // D21 - A3 - PF4
277 _BV(1), // D22 - A4 - PF1
278 _BV(0), // D23 - A5 - PF0
279
280 _BV(5), // D24 - PD5
281 _BV(7), // D25 / D6 - A7 - PD7
282 _BV(4), // D26 / D8 - A8 - PB4
283 _BV(5), // D27 / D9 - A9 - PB5
284 _BV(6), // D28 / D10 - A10 - PB6
285 _BV(6), // D29 / D12 - A11 - PD6
286};
287
288const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
289 NOT_ON_TIMER,
290 NOT_ON_TIMER,
291 NOT_ON_TIMER,
292 TIMER0B, /* 3 */
293 NOT_ON_TIMER,
294 TIMER3A, /* 5 */
295 TIMER4D, /* 6 */
296 NOT_ON_TIMER,
297
298 NOT_ON_TIMER,
299 TIMER1A, /* 9 */
300 TIMER1B, /* 10 */
301 TIMER0A, /* 11 */
302
303 NOT_ON_TIMER,
304 TIMER4A, /* 13 */
305
306 NOT_ON_TIMER,
307 NOT_ON_TIMER,
308 NOT_ON_TIMER,
309 NOT_ON_TIMER,
310 NOT_ON_TIMER,
311 NOT_ON_TIMER,
312
313 NOT_ON_TIMER,
314 NOT_ON_TIMER,
315 NOT_ON_TIMER,
316 NOT_ON_TIMER,
317 NOT_ON_TIMER,
318 NOT_ON_TIMER,
319 NOT_ON_TIMER,
320 NOT_ON_TIMER,
321 NOT_ON_TIMER,
322 NOT_ON_TIMER,
323};
324
325const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
326 7, // A0 PF7 ADC7
327 6, // A1 PF6 ADC6
328 5, // A2 PF5 ADC5
329 4, // A3 PF4 ADC4
330 1, // A4 PF1 ADC1
331 0, // A5 PF0 ADC0
332 8, // A6 D4 PD4 ADC8
333 10, // A7 D6 PD7 ADC10
334 11, // A8 D8 PB4 ADC11
335 12, // A9 D9 PB5 ADC12
336 13, // A10 D10 PB6 ADC13
337 9 // A11 D12 PD6 ADC9
338};
339
340#endif /* ARDUINO_MAIN */
341
342// These serial port names are intended to allow libraries and architecture-neutral
343// sketches to automatically default to the correct port name for a particular type
344// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
345// the first hardware serial port whose RX/TX pins are not dedicated to another use.
346//
347// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
348//
349// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
350//
351// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
352//
353// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
354//
355// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
356// pins are NOT connected to anything by default.
357#define SERIAL_PORT_MONITOR Serial
358#define SERIAL_PORT_USBVIRTUAL Serial
359#define SERIAL_PORT_HARDWARE Serial1
360#define SERIAL_PORT_HARDWARE_OPEN Serial1
361
362#endif /* Pins_Arduino_h */
diff --git a/keyboards/orthodox/ssd1306.c b/keyboards/orthodox/ssd1306.c
deleted file mode 100644
index 5c6dff27f..000000000
--- a/keyboards/orthodox/ssd1306.c
+++ /dev/null
@@ -1,470 +0,0 @@
1#ifdef SSD1306OLED
2
3#include "ssd1306.h"
4#include "config.h"
5#include "i2c.h"
6#include <string.h>
7#include "print.h"
8#include "lets_split.h"
9#include "common/glcdfont.c"
10#ifdef ADAFRUIT_BLE_ENABLE
11#include "adafruit_ble.h"
12#endif
13#ifdef PROTOCOL_LUFA
14#include "lufa.h"
15#endif
16#include "sendchar.h"
17#include "pincontrol.h"
18
19//assign the right code to your layers
20#define _BASE 0
21#define _LOWER 8
22#define _RAISE 16
23#define _FNLAYER 64
24#define _NUMLAY 128
25#define _NLOWER 136
26#define _NFNLAYER 192
27#define _MOUSECURSOR 256
28#define _ADJUST 65560
29
30// Set this to 1 to help diagnose early startup problems
31// when testing power-on with ble. Turn it off otherwise,
32// as the latency of printing most of the debug info messes
33// with the matrix scan, causing keys to drop.
34#define DEBUG_TO_SCREEN 0
35
36// Controls the SSD1306 128x32 OLED display via i2c
37
38#define i2cAddress 0x3C
39
40#define DisplayHeight 32
41#define DisplayWidth 128
42
43#define FontHeight 8
44#define FontWidth 6
45
46#define MatrixRows (DisplayHeight / FontHeight)
47#define MatrixCols (DisplayWidth / FontWidth)
48
49struct CharacterMatrix {
50 uint8_t display[MatrixRows][MatrixCols];
51 uint8_t *cursor;
52 bool dirty;
53};
54
55static struct CharacterMatrix display;
56//static uint16_t last_battery_update;
57//static uint32_t vbat;
58//#define BatteryUpdateInterval 10000 /* milliseconds */
59#define ScreenOffInterval 300000 /* milliseconds */
60#if DEBUG_TO_SCREEN
61static uint8_t displaying;
62#endif
63static uint16_t last_flush;
64
65enum ssd1306_cmds {
66 DisplayOff = 0xAE,
67 DisplayOn = 0xAF,
68
69 SetContrast = 0x81,
70 DisplayAllOnResume = 0xA4,
71
72 DisplayAllOn = 0xA5,
73 NormalDisplay = 0xA6,
74 InvertDisplay = 0xA7,
75 SetDisplayOffset = 0xD3,
76 SetComPins = 0xda,
77 SetVComDetect = 0xdb,
78 SetDisplayClockDiv = 0xD5,
79 SetPreCharge = 0xd9,
80 SetMultiPlex = 0xa8,
81 SetLowColumn = 0x00,
82 SetHighColumn = 0x10,
83 SetStartLine = 0x40,
84
85 SetMemoryMode = 0x20,
86 ColumnAddr = 0x21,
87 PageAddr = 0x22,
88
89 ComScanInc = 0xc0,
90 ComScanDec = 0xc8,
91 SegRemap = 0xa0,
92 SetChargePump = 0x8d,
93 ExternalVcc = 0x01,
94 SwitchCapVcc = 0x02,
95
96 ActivateScroll = 0x2f,
97 DeActivateScroll = 0x2e,
98 SetVerticalScrollArea = 0xa3,
99 RightHorizontalScroll = 0x26,
100 LeftHorizontalScroll = 0x27,
101 VerticalAndRightHorizontalScroll = 0x29,
102 VerticalAndLeftHorizontalScroll = 0x2a,
103};
104
105
106// Write command sequence.
107// Returns true on success.
108static inline bool _send_cmd1(uint8_t cmd) {
109 bool res = false;
110
111 if (i2c_start_write(i2cAddress)) {
112 xprintf("failed to start write to %d\n", i2cAddress);
113 goto done;
114 }
115
116 if (i2c_master_write(0x0 /* command byte follows */)) {
117 print("failed to write control byte\n");
118
119 goto done;
120 }
121
122 if (i2c_master_write(cmd)) {
123 xprintf("failed to write command %d\n", cmd);
124 goto done;
125 }
126 res = true;
127done:
128 i2c_master_stop();
129 return res;
130}
131
132// Write 2-byte command sequence.
133// Returns true on success
134static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) {
135 if (!_send_cmd1(cmd)) {
136 return false;
137 }
138 return _send_cmd1(opr);
139}
140
141// Write 3-byte command sequence.
142// Returns true on success
143static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) {
144 if (!_send_cmd1(cmd)) {
145 return false;
146 }
147 if (!_send_cmd1(opr1)) {
148 return false;
149 }
150 return _send_cmd1(opr2);
151}
152
153#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;}
154#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;}
155#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;}
156
157static void matrix_clear(struct CharacterMatrix *matrix);
158
159static void clear_display(void) {
160 matrix_clear(&display);
161
162 // Clear all of the display bits (there can be random noise
163 // in the RAM on startup)
164 send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1);
165 send_cmd3(ColumnAddr, 0, DisplayWidth - 1);
166
167 if (i2c_start_write(i2cAddress)) {
168 goto done;
169 }
170 if (i2c_master_write(0x40)) {
171 // Data mode
172 goto done;
173 }
174 for (uint8_t row = 0; row < MatrixRows; ++row) {
175 for (uint8_t col = 0; col < DisplayWidth; ++col) {
176 i2c_master_write(0);
177 }
178 }
179
180 display.dirty = false;
181
182done:
183 i2c_master_stop();
184}
185
186#if DEBUG_TO_SCREEN
187#undef sendchar
188static int8_t capture_sendchar(uint8_t c) {
189 sendchar(c);
190 iota_gfx_write_char(c);
191
192 if (!displaying) {
193 iota_gfx_flush();
194 }
195 return 0;
196}
197#endif
198
199bool iota_gfx_init(void) {
200 bool success = false;
201
202 send_cmd1(DisplayOff);
203 send_cmd2(SetDisplayClockDiv, 0x80);
204 send_cmd2(SetMultiPlex, DisplayHeight - 1);
205
206 send_cmd2(SetDisplayOffset, 0);
207
208
209 send_cmd1(SetStartLine | 0x0);
210 send_cmd2(SetChargePump, 0x14 /* Enable */);
211 send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);
212
213/// Flips the display orientation 0 degrees
214 send_cmd1(SegRemap | 0x1);
215 send_cmd1(ComScanDec);
216/*
217// the following Flip the display orientation 180 degrees
218 send_cmd1(SegRemap);
219 send_cmd1(ComScanInc);
220// end flip */
221 send_cmd2(SetComPins, 0x2);
222 send_cmd2(SetContrast, 0x8f);
223 send_cmd2(SetPreCharge, 0xf1);
224 send_cmd2(SetVComDetect, 0x40);
225 send_cmd1(DisplayAllOnResume);
226 send_cmd1(NormalDisplay);
227 send_cmd1(DeActivateScroll);
228 send_cmd1(DisplayOn);
229
230 send_cmd2(SetContrast, 0); // Dim
231
232 clear_display();
233
234 success = true;
235
236 iota_gfx_flush();
237
238#if DEBUG_TO_SCREEN
239 print_set_sendchar(capture_sendchar);
240#endif
241
242done:
243 return success;
244}
245
246bool iota_gfx_off(void) {
247 bool success = false;
248
249 send_cmd1(DisplayOff);
250 success = true;
251
252done:
253 return success;
254}
255
256bool iota_gfx_on(void) {
257 bool success = false;
258
259 send_cmd1(DisplayOn);
260 success = true;
261
262done:
263 return success;
264}
265
266static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
267 *matrix->cursor = c;
268 ++matrix->cursor;
269
270 if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) {
271 // We went off the end; scroll the display upwards by one line
272 memmove(&matrix->display[0], &matrix->display[1],
273 MatrixCols * (MatrixRows - 1));
274 matrix->cursor = &matrix->display[MatrixRows - 1][0];
275 memset(matrix->cursor, ' ', MatrixCols);
276 }
277}
278
279static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
280 matrix->dirty = true;
281
282 if (c == '\n') {
283 // Clear to end of line from the cursor and then move to the
284 // start of the next line
285 uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols;
286
287 while (cursor_col++ < MatrixCols) {
288 matrix_write_char_inner(matrix, ' ');
289 }
290 return;
291 }
292
293 matrix_write_char_inner(matrix, c);
294}
295
296void iota_gfx_write_char(uint8_t c) {
297 matrix_write_char(&display, c);
298}
299
300static void matrix_write(struct CharacterMatrix *matrix, const char *data) {
301 const char *end = data + strlen(data);
302 while (data < end) {
303 matrix_write_char(matrix, *data);
304 ++data;
305 }
306}
307
308void iota_gfx_write(const char *data) {
309 matrix_write(&display, data);
310}
311
312static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
313 while (true) {
314 uint8_t c = pgm_read_byte(data);
315 if (c == 0) {
316 return;
317 }
318 matrix_write_char(matrix, c);
319 ++data;
320 }
321}
322
323void iota_gfx_write_P(const char *data) {
324 matrix_write_P(&display, data);
325}
326
327static void matrix_clear(struct CharacterMatrix *matrix) {
328 memset(matrix->display, ' ', sizeof(matrix->display));
329 matrix->cursor = &matrix->display[0][0];
330 matrix->dirty = true;
331}
332
333void iota_gfx_clear_screen(void) {
334 matrix_clear(&display);
335}
336
337static void matrix_render(struct CharacterMatrix *matrix) {
338 last_flush = timer_read();
339 iota_gfx_on();
340#if DEBUG_TO_SCREEN
341 ++displaying;
342#endif
343
344 // Move to the home position
345 send_cmd3(PageAddr, 0, MatrixRows - 1);
346 send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);
347
348 if (i2c_start_write(i2cAddress)) {
349 goto done;
350 }
351 if (i2c_master_write(0x40)) {
352 // Data mode
353 goto done;
354 }
355
356 for (uint8_t row = 0; row < MatrixRows; ++row) {
357 for (uint8_t col = 0; col < MatrixCols; ++col) {
358 const uint8_t *glyph = font + (matrix->display[row][col] * (FontWidth - 1));
359
360 for (uint8_t glyphCol = 0; glyphCol < FontWidth - 1; ++glyphCol) {
361 uint8_t colBits = pgm_read_byte(glyph + glyphCol);
362 i2c_master_write(colBits);
363 }
364
365 // 1 column of space between chars (it's not included in the glyph)
366 i2c_master_write(0);
367 }
368 }
369
370 matrix->dirty = false;
371
372done:
373 i2c_master_stop();
374#if DEBUG_TO_SCREEN
375 --displaying;
376#endif
377}
378
379void iota_gfx_flush(void) {
380 matrix_render(&display);
381}
382
383static void matrix_update(struct CharacterMatrix *dest,
384 const struct CharacterMatrix *source) {
385 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
386 memcpy(dest->display, source->display, sizeof(dest->display));
387 dest->dirty = true;
388 }
389}
390
391static void render_status_info(void) {
392#if DEBUG_TO_SCREEN
393 if (debug_enable) {
394 return;
395 }
396#endif
397
398 struct CharacterMatrix matrix;
399
400 matrix_clear(&matrix);
401 matrix_write_P(&matrix, PSTR("USB: "));
402#ifdef PROTOCOL_LUFA
403 switch (USB_DeviceState) {
404 case DEVICE_STATE_Unattached:
405 matrix_write_P(&matrix, PSTR("Unattached"));
406 break;
407 case DEVICE_STATE_Suspended:
408 matrix_write_P(&matrix, PSTR("Suspended"));
409 break;
410 case DEVICE_STATE_Configured:
411 matrix_write_P(&matrix, PSTR("Connected"));
412 break;
413 case DEVICE_STATE_Powered:
414 matrix_write_P(&matrix, PSTR("Powered"));
415 break;
416 case DEVICE_STATE_Default:
417 matrix_write_P(&matrix, PSTR("Default"));
418 break;
419 case DEVICE_STATE_Addressed:
420 matrix_write_P(&matrix, PSTR("Addressed"));
421 break;
422 default:
423 matrix_write_P(&matrix, PSTR("Invalid"));
424 }
425#endif
426
427// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
428
429 char buf[40];
430 snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
431 matrix_write_P(&matrix, PSTR("\n\nLayer: "));
432 switch (layer_state) {
433 case _BASE:
434 matrix_write_P(&matrix, PSTR("Default"));
435 break;
436 case _RAISE:
437 matrix_write_P(&matrix, PSTR("Raise"));
438 break;
439 case _LOWER:
440 matrix_write_P(&matrix, PSTR("Lower"));
441 break;
442 case _ADJUST:
443 matrix_write_P(&matrix, PSTR("ADJUST"));
444 break;
445 default:
446 matrix_write(&matrix, buf);
447 }
448
449 // Host Keyboard LED Status
450 char led[40];
451 snprintf(led, sizeof(led), "\n%s %s %s",
452 (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
453 (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
454 (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
455 matrix_write(&matrix, led);
456 matrix_update(&display, &matrix);
457}
458
459void iota_gfx_task(void) {
460 render_status_info();
461
462 if (display.dirty) {
463 iota_gfx_flush();
464 }
465
466 if (timer_elapsed(last_flush) > ScreenOffInterval) {
467 iota_gfx_off();
468 }
469}
470#endif
diff --git a/keyboards/orthodox/ssd1306.h b/keyboards/orthodox/ssd1306.h
deleted file mode 100644
index b0c74f987..000000000
--- a/keyboards/orthodox/ssd1306.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef SSD1306_H
2#define SSD1306_H
3
4#include <stdbool.h>
5#include <stdio.h>
6
7bool iota_gfx_init(void);
8void iota_gfx_task(void);
9bool iota_gfx_off(void);
10bool iota_gfx_on(void);
11void iota_gfx_flush(void);
12void iota_gfx_write_char(uint8_t c);
13void iota_gfx_write(const char *data);
14void iota_gfx_write_P(const char *data);
15void iota_gfx_clear_screen(void);
16
17#endif
diff --git a/keyboards/whitefox/animations.c b/keyboards/whitefox/animations.c
deleted file mode 100644
index ed1d75efb..000000000
--- a/keyboards/whitefox/animations.c
+++ /dev/null
@@ -1,128 +0,0 @@
1/* Copyright 2017 Fred Sundvik
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#if defined(VISUALIZER_ENABLE)
18
19#include "animations.h"
20#include "visualizer.h"
21
22#ifdef BACKLIGHT_ENABLE
23#include "led_keyframes.h"
24#endif
25
26#include "visualizer_keyframes.h"
27
28
29#if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE)
30
31static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
32#ifdef BACKLIGHT_ENABLE
33 led_keyframe_enable(animation, state);
34#endif
35 return false;
36}
37
38static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
39#ifdef BACKLIGHT_ENABLE
40 led_keyframe_disable(animation, state);
41#endif
42 return false;
43}
44
45static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
46 bool ret = false;
47#ifdef BACKLIGHT_ENABLE
48 ret |= led_keyframe_fade_in_all(animation, state);
49#endif
50 return ret;
51}
52
53static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
54 bool ret = false;
55#ifdef BACKLIGHT_ENABLE
56 ret |= led_keyframe_fade_out_all(animation, state);
57#endif
58 return ret;
59}
60
61
62// Don't worry, if the startup animation is long, you can use the keyboard like normal
63// during that time
64keyframe_animation_t default_startup_animation = {
65 .num_frames = 2,
66 .loop = false,
67 .frame_lengths = {0, gfxMillisecondsToTicks(5000)},
68 .frame_functions = {
69 keyframe_enable,
70 keyframe_fade_in,
71 },
72};
73
74keyframe_animation_t default_suspend_animation = {
75 .num_frames = 2,
76 .loop = false,
77 .frame_lengths = {gfxMillisecondsToTicks(1000), 0},
78 .frame_functions = {
79 keyframe_fade_out,
80 keyframe_disable,
81 },
82};
83#endif
84
85#if defined(BACKLIGHT_ENABLE)
86#define CROSSFADE_TIME 1000
87#define GRADIENT_TIME 3000
88
89keyframe_animation_t led_test_animation = {
90 .num_frames = 14,
91 .loop = true,
92 .frame_lengths = {
93 gfxMillisecondsToTicks(1000), // fade in
94 gfxMillisecondsToTicks(1000), // no op (leds on)
95 gfxMillisecondsToTicks(1000), // fade out
96 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
97 gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in)
98 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
99 gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
100 0, // mirror leds
101 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
102 gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out)
103 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
104 gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
105 0, // normal leds
106 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
107
108 },
109 .frame_functions = {
110 led_keyframe_fade_in_all,
111 keyframe_no_operation,
112 led_keyframe_fade_out_all,
113 led_keyframe_crossfade,
114 led_keyframe_left_to_right_gradient,
115 led_keyframe_crossfade,
116 led_keyframe_top_to_bottom_gradient,
117 led_keyframe_mirror_orientation,
118 led_keyframe_crossfade,
119 led_keyframe_left_to_right_gradient,
120 led_keyframe_crossfade,
121 led_keyframe_top_to_bottom_gradient,
122 led_keyframe_normal_orientation,
123 led_keyframe_crossfade,
124 },
125};
126#endif
127
128#endif
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h b/keyboards/whitefox/board_is31fl3731c.h
index 3dc5327a5..dea643f10 100644
--- a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h
+++ b/keyboards/whitefox/board_is31fl3731c.h
@@ -22,9 +22,6 @@ static const I2CConfig i2ccfg = {
22 400000 // clock speed (Hz); 400kHz max for IS31 22 400000 // clock speed (Hz); 400kHz max for IS31
23}; 23};
24 24
25#define GDISP_SCREEN_WIDTH 16
26#define GDISP_SCREEN_HEIGHT 5
27
28static const uint8_t led_mask[] = { 25static const uint8_t led_mask[] = {
29 0xFF, 0x00, /* C1-1 -> C1-16 */ 26 0xFF, 0x00, /* C1-1 -> C1-16 */
30 0xFF, 0x00, /* C2-1 -> C2-16 */ 27 0xFF, 0x00, /* C2-1 -> C2-16 */
diff --git a/keyboards/whitefox/config.h b/keyboards/whitefox/config.h
index 08de9b9aa..dc33a7ce5 100644
--- a/keyboards/whitefox/config.h
+++ b/keyboards/whitefox/config.h
@@ -81,12 +81,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
81//#define NO_ACTION_MACRO 81//#define NO_ACTION_MACRO
82//#define NO_ACTION_FUNCTION 82//#define NO_ACTION_FUNCTION
83 83
84#endif 84#endif \ No newline at end of file
85
86// The visualizer needs gfx thread priorities
87#define LED_DISPLAY_NUMBER 0
88
89#define LED_NUM_ROWS 5
90#define LED_NUM_COLS 16
91
92#define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2)
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk
deleted file mode 100644
index f32d0d868..000000000
--- a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk
+++ /dev/null
@@ -1,2 +0,0 @@
1GFXINC += drivers/gdisp/IS31FL3731C
2GFXSRC += drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
deleted file mode 100644
index bb28ad775..000000000
--- a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
+++ /dev/null
@@ -1,36 +0,0 @@
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/whitefox/gfxconf.h b/keyboards/whitefox/gfxconf.h
index 890317a0f..ca338399d 100644
--- a/keyboards/whitefox/gfxconf.h
+++ b/keyboards/whitefox/gfxconf.h
@@ -22,308 +22,6 @@
22#ifndef _GFXCONF_H 22#ifndef _GFXCONF_H
23#define _GFXCONF_H 23#define _GFXCONF_H
24 24
25 25#include "common_gfxconf.h"
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_IS31FL3731C_WHITEFOX
134#endif
135
136 #ifdef GDISP_DRIVER_LIST
137 // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
138 #define GDISP_HARDWARE_STREAM_WRITE FALSE
139 #define GDISP_HARDWARE_STREAM_READ FALSE
140 #define GDISP_HARDWARE_STREAM_POS FALSE
141 #define GDISP_HARDWARE_DRAWPIXEL TRUE
142 #define GDISP_HARDWARE_CLEARS FALSE
143 #define GDISP_HARDWARE_FILLS FALSE
144 //#define GDISP_HARDWARE_BITFILLS FALSE
145 #define GDISP_HARDWARE_SCROLL FALSE
146 #define GDISP_HARDWARE_PIXELREAD TRUE
147 #define GDISP_HARDWARE_CONTROL TRUE
148 #define GDISP_HARDWARE_QUERY FALSE
149 #define GDISP_HARDWARE_CLIP FALSE
150
151 #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
152 #endif
153
154// The custom format is not defined for some reason, so define it as error
155// so we don't get compiler warnings
156#define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR
157
158#define GDISP_USE_GFXNET FALSE
159// #define GDISP_GFXNET_PORT 13001
160// #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE
161// #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE
162// #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE
163
164
165///////////////////////////////////////////////////////////////////////////
166// GWIN //
167///////////////////////////////////////////////////////////////////////////
168#define GFX_USE_GWIN FALSE
169
170//#define GWIN_NEED_WINDOWMANAGER FALSE
171// #define GWIN_REDRAW_IMMEDIATE FALSE
172// #define GWIN_REDRAW_SINGLEOP FALSE
173// #define GWIN_NEED_FLASHING FALSE
174// #define GWIN_FLASHING_PERIOD 250
175
176//#define GWIN_NEED_CONSOLE FALSE
177// #define GWIN_CONSOLE_USE_HISTORY FALSE
178// #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE
179// #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE
180// #define GWIN_CONSOLE_ESCSEQ FALSE
181// #define GWIN_CONSOLE_USE_BASESTREAM FALSE
182// #define GWIN_CONSOLE_USE_FLOAT FALSE
183//#define GWIN_NEED_GRAPH FALSE
184//#define GWIN_NEED_GL3D FALSE
185
186//#define GWIN_NEED_WIDGET FALSE
187//#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1
188// #define GWIN_NEED_LABEL FALSE
189// #define GWIN_LABEL_ATTRIBUTE FALSE
190// #define GWIN_NEED_BUTTON FALSE
191// #define GWIN_BUTTON_LAZY_RELEASE FALSE
192// #define GWIN_NEED_SLIDER FALSE
193// #define GWIN_SLIDER_NOSNAP FALSE
194// #define GWIN_SLIDER_DEAD_BAND 5
195// #define GWIN_SLIDER_TOGGLE_INC 20
196// #define GWIN_NEED_CHECKBOX FALSE
197// #define GWIN_NEED_IMAGE FALSE
198// #define GWIN_NEED_IMAGE_ANIMATION FALSE
199// #define GWIN_NEED_RADIO FALSE
200// #define GWIN_NEED_LIST FALSE
201// #define GWIN_NEED_LIST_IMAGES FALSE
202// #define GWIN_NEED_PROGRESSBAR FALSE
203// #define GWIN_PROGRESSBAR_AUTO FALSE
204// #define GWIN_NEED_KEYBOARD FALSE
205// #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1
206// #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE
207// #define GWIN_NEED_TEXTEDIT FALSE
208// #define GWIN_FLAT_STYLING FALSE
209// #define GWIN_WIDGET_TAGS FALSE
210
211//#define GWIN_NEED_CONTAINERS FALSE
212// #define GWIN_NEED_CONTAINER FALSE
213// #define GWIN_NEED_FRAME FALSE
214// #define GWIN_NEED_TABSET FALSE
215// #define GWIN_TABSET_TABHEIGHT 18
216
217
218///////////////////////////////////////////////////////////////////////////
219// GEVENT //
220///////////////////////////////////////////////////////////////////////////
221#define GFX_USE_GEVENT TRUE
222
223//#define GEVENT_ASSERT_NO_RESOURCE FALSE
224//#define GEVENT_MAXIMUM_SIZE 32
225//#define GEVENT_MAX_SOURCE_LISTENERS 32
226
227
228///////////////////////////////////////////////////////////////////////////
229// GTIMER //
230///////////////////////////////////////////////////////////////////////////
231#define GFX_USE_GTIMER FALSE
232
233//#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
234//#define GTIMER_THREAD_WORKAREA_SIZE 2048
235
236
237///////////////////////////////////////////////////////////////////////////
238// GQUEUE //
239///////////////////////////////////////////////////////////////////////////
240#define GFX_USE_GQUEUE FALSE
241
242//#define GQUEUE_NEED_ASYNC FALSE
243//#define GQUEUE_NEED_GSYNC FALSE
244//#define GQUEUE_NEED_FSYNC FALSE
245//#define GQUEUE_NEED_BUFFERS FALSE
246
247///////////////////////////////////////////////////////////////////////////
248// GINPUT //
249///////////////////////////////////////////////////////////////////////////
250#define GFX_USE_GINPUT FALSE
251
252//#define GINPUT_NEED_MOUSE FALSE
253// #define GINPUT_TOUCH_STARTRAW FALSE
254// #define GINPUT_TOUCH_NOTOUCH FALSE
255// #define GINPUT_TOUCH_NOCALIBRATE FALSE
256// #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
257// #define GINPUT_MOUSE_POLL_PERIOD 25
258// #define GINPUT_MOUSE_CLICK_TIME 300
259// #define GINPUT_TOUCH_CXTCLICK_TIME 700
260// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
261// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
262// #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32
263//#define GINPUT_NEED_KEYBOARD FALSE
264// #define GINPUT_KEYBOARD_POLL_PERIOD 200
265// #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
266// #define GKEYBOARD_LAYOUT_OFF FALSE
267// #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE
268//#define GINPUT_NEED_TOGGLE FALSE
269//#define GINPUT_NEED_DIAL FALSE
270
271
272///////////////////////////////////////////////////////////////////////////
273// GFILE //
274///////////////////////////////////////////////////////////////////////////
275#define GFX_USE_GFILE FALSE
276
277//#define GFILE_NEED_PRINTG FALSE
278//#define GFILE_NEED_SCANG FALSE
279//#define GFILE_NEED_STRINGS FALSE
280//#define GFILE_NEED_FILELISTS FALSE
281//#define GFILE_NEED_STDIO FALSE
282//#define GFILE_NEED_NOAUTOMOUNT FALSE
283//#define GFILE_NEED_NOAUTOSYNC FALSE
284
285//#define GFILE_NEED_MEMFS FALSE
286//#define GFILE_NEED_ROMFS FALSE
287//#define GFILE_NEED_RAMFS FALSE
288//#define GFILE_NEED_FATFS FALSE
289//#define GFILE_NEED_NATIVEFS FALSE
290//#define GFILE_NEED_CHBIOSFS FALSE
291
292//#define GFILE_ALLOW_FLOATS FALSE
293//#define GFILE_ALLOW_DEVICESPECIFIC FALSE
294//#define GFILE_MAX_GFILES 3
295
296///////////////////////////////////////////////////////////////////////////
297// GADC //
298///////////////////////////////////////////////////////////////////////////
299#define GFX_USE_GADC FALSE
300
301//#define GADC_MAX_LOWSPEED_DEVICES 4
302
303
304///////////////////////////////////////////////////////////////////////////
305// GAUDIO //
306///////////////////////////////////////////////////////////////////////////
307#define GFX_USE_GAUDIO FALSE
308// There seems to be a bug in the ugfx code, the wrong define is used
309// So define it in order to avoid warnings
310#define GFX_USE_GAUDIN GFX_USE_GAUDIO
311// #define GAUDIO_NEED_PLAY FALSE
312// #define GAUDIO_NEED_RECORD FALSE
313
314
315///////////////////////////////////////////////////////////////////////////
316// GMISC //
317///////////////////////////////////////////////////////////////////////////
318#define GFX_USE_GMISC TRUE
319
320//#define GMISC_NEED_ARRAYOPS FALSE
321//#define GMISC_NEED_FASTTRIG FALSE
322//#define GMISC_NEED_FIXEDTRIG FALSE
323//#define GMISC_NEED_INVSQRT FALSE
324// #define GMISC_INVSQRT_MIXED_ENDIAN FALSE
325// #define GMISC_INVSQRT_REAL_SLOW FALSE
326#define GMISC_NEED_MATRIXFLOAT2D TRUE
327#define GMISC_NEED_MATRIXFIXED2D FALSE
328 26
329#endif /* _GFXCONF_H */ 27#endif /* _GFXCONF_H */
diff --git a/keyboards/whitefox/rules.mk b/keyboards/whitefox/rules.mk
index fb34dbb9a..32273e08a 100644
--- a/keyboards/whitefox/rules.mk
+++ b/keyboards/whitefox/rules.mk
@@ -1,7 +1,6 @@
1# project specific files 1# project specific files
2SRC = matrix.c \ 2SRC = matrix.c \
3 led.c \ 3 led.c
4 animations.c
5 4
6## chip/board settings 5## chip/board settings
7# - the next two should match the directories in 6# - the next two should match the directories in
@@ -70,4 +69,6 @@ CUSTOM_MATRIX = yes # Custom matrix file
70BACKLIGHT_ENABLE = yes 69BACKLIGHT_ENABLE = yes
71VISUALIZER_ENABLE = yes 70VISUALIZER_ENABLE = yes
72 71
73include $(KEYBOARD_PATH)/drivers/gdisp/IS31FL3731C/driver.mk 72LED_DRIVER = is31fl3731c
73LED_WIDTH = 16
74LED_HEIGHT = 5 \ No newline at end of file
diff --git a/keyboards/whitefox/visualizer.c b/keyboards/whitefox/visualizer.c
index 167e0ec4d..e5bafcbe9 100644
--- a/keyboards/whitefox/visualizer.c
+++ b/keyboards/whitefox/visualizer.c
@@ -20,7 +20,7 @@
20#include "visualizer.h" 20#include "visualizer.h"
21#include "visualizer_keyframes.h" 21#include "visualizer_keyframes.h"
22#include "led.h" 22#include "led.h"
23#include "animations.h" 23#include "default_animations.h"
24 24
25 25
26static bool initial_update = true; 26static bool initial_update = true;
diff --git a/quantum/visualizer/lcd_backlight_keyframes.h b/lcd_backlight_keyframes.h
index e1c125cf9..bde118449 100644
--- a/quantum/visualizer/lcd_backlight_keyframes.h
+++ b/lcd_backlight_keyframes.h
@@ -20,11 +20,11 @@
20#include "visualizer.h" 20#include "visualizer.h"
21 21
22// Animates the LCD backlight color between the current color and the target color (of the state) 22// Animates the LCD backlight color between the current color and the target color (of the state)
23bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state); 23bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state);
24// Sets the backlight color to the target color 24// Sets the backlight color to the target color
25bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state); 25bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state);
26 26
27bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); 27bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
28bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); 28bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
29 29
30#endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */ 30#endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 92130192c..8fea96a9e 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -61,7 +61,7 @@
61#include <stdint.h> 61#include <stdint.h>
62#include <stdbool.h> 62#include <stdbool.h>
63#include "eeconfig.h" 63#include "eeconfig.h"
64#include "light_ws2812.h" 64#include "ws2812.h"
65 65
66extern LED_TYPE led[RGBLED_NUM]; 66extern LED_TYPE led[RGBLED_NUM];
67 67
diff --git a/quantum/visualizer/common_gfxconf.h b/quantum/visualizer/common_gfxconf.h
new file mode 100644
index 000000000..eb705b188
--- /dev/null
+++ b/quantum/visualizer/common_gfxconf.h
@@ -0,0 +1,325 @@
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 COMMON_GFXCONF_H
23#define COMMON_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 #ifdef GDISP_DRIVER_LIST
133 // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
134 #define GDISP_HARDWARE_STREAM_WRITE FALSE
135 #define GDISP_HARDWARE_STREAM_READ FALSE
136 #define GDISP_HARDWARE_STREAM_POS FALSE
137 #define GDISP_HARDWARE_DRAWPIXEL TRUE
138 #define GDISP_HARDWARE_CLEARS FALSE
139 #define GDISP_HARDWARE_FILLS FALSE
140 //#define GDISP_HARDWARE_BITFILLS FALSE
141 #define GDISP_HARDWARE_SCROLL FALSE
142 #define GDISP_HARDWARE_PIXELREAD TRUE
143 #define GDISP_HARDWARE_CONTROL TRUE
144 #define GDISP_HARDWARE_QUERY FALSE
145 #define GDISP_HARDWARE_CLIP FALSE
146
147 #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
148 #endif
149
150// The custom format is not defined for some reason, so define it as error
151// so we don't get compiler warnings
152#define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR
153
154#define GDISP_USE_GFXNET FALSE
155// #define GDISP_GFXNET_PORT 13001
156// #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE
157// #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE
158// #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE
159
160
161///////////////////////////////////////////////////////////////////////////
162// GWIN //
163///////////////////////////////////////////////////////////////////////////
164#define GFX_USE_GWIN FALSE
165
166//#define GWIN_NEED_WINDOWMANAGER FALSE
167// #define GWIN_REDRAW_IMMEDIATE FALSE
168// #define GWIN_REDRAW_SINGLEOP FALSE
169// #define GWIN_NEED_FLASHING FALSE
170// #define GWIN_FLASHING_PERIOD 250
171
172//#define GWIN_NEED_CONSOLE FALSE
173// #define GWIN_CONSOLE_USE_HISTORY FALSE
174// #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE
175// #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE
176// #define GWIN_CONSOLE_ESCSEQ FALSE
177// #define GWIN_CONSOLE_USE_BASESTREAM FALSE
178// #define GWIN_CONSOLE_USE_FLOAT FALSE
179//#define GWIN_NEED_GRAPH FALSE
180//#define GWIN_NEED_GL3D FALSE
181
182//#define GWIN_NEED_WIDGET FALSE
183//#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1
184// #define GWIN_NEED_LABEL FALSE
185// #define GWIN_LABEL_ATTRIBUTE FALSE
186// #define GWIN_NEED_BUTTON FALSE
187// #define GWIN_BUTTON_LAZY_RELEASE FALSE
188// #define GWIN_NEED_SLIDER FALSE
189// #define GWIN_SLIDER_NOSNAP FALSE
190// #define GWIN_SLIDER_DEAD_BAND 5
191// #define GWIN_SLIDER_TOGGLE_INC 20
192// #define GWIN_NEED_CHECKBOX FALSE
193// #define GWIN_NEED_IMAGE FALSE
194// #define GWIN_NEED_IMAGE_ANIMATION FALSE
195// #define GWIN_NEED_RADIO FALSE
196// #define GWIN_NEED_LIST FALSE
197// #define GWIN_NEED_LIST_IMAGES FALSE
198// #define GWIN_NEED_PROGRESSBAR FALSE
199// #define GWIN_PROGRESSBAR_AUTO FALSE
200// #define GWIN_NEED_KEYBOARD FALSE
201// #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1
202// #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE
203// #define GWIN_NEED_TEXTEDIT FALSE
204// #define GWIN_FLAT_STYLING FALSE
205// #define GWIN_WIDGET_TAGS FALSE
206
207//#define GWIN_NEED_CONTAINERS FALSE
208// #define GWIN_NEED_CONTAINER FALSE
209// #define GWIN_NEED_FRAME FALSE
210// #define GWIN_NEED_TABSET FALSE
211// #define GWIN_TABSET_TABHEIGHT 18
212
213
214///////////////////////////////////////////////////////////////////////////
215// GEVENT //
216///////////////////////////////////////////////////////////////////////////
217#define GFX_USE_GEVENT TRUE
218
219//#define GEVENT_ASSERT_NO_RESOURCE FALSE
220//#define GEVENT_MAXIMUM_SIZE 32
221//#define GEVENT_MAX_SOURCE_LISTENERS 32
222
223
224///////////////////////////////////////////////////////////////////////////
225// GTIMER //
226///////////////////////////////////////////////////////////////////////////
227#define GFX_USE_GTIMER FALSE
228
229//#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
230//#define GTIMER_THREAD_WORKAREA_SIZE 2048
231
232
233///////////////////////////////////////////////////////////////////////////
234// GQUEUE //
235///////////////////////////////////////////////////////////////////////////
236#define GFX_USE_GQUEUE FALSE
237
238//#define GQUEUE_NEED_ASYNC FALSE
239//#define GQUEUE_NEED_GSYNC FALSE
240//#define GQUEUE_NEED_FSYNC FALSE
241//#define GQUEUE_NEED_BUFFERS FALSE
242
243///////////////////////////////////////////////////////////////////////////
244// GINPUT //
245///////////////////////////////////////////////////////////////////////////
246#define GFX_USE_GINPUT FALSE
247
248//#define GINPUT_NEED_MOUSE FALSE
249// #define GINPUT_TOUCH_STARTRAW FALSE
250// #define GINPUT_TOUCH_NOTOUCH FALSE
251// #define GINPUT_TOUCH_NOCALIBRATE FALSE
252// #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
253// #define GINPUT_MOUSE_POLL_PERIOD 25
254// #define GINPUT_MOUSE_CLICK_TIME 300
255// #define GINPUT_TOUCH_CXTCLICK_TIME 700
256// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
257// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
258// #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32
259//#define GINPUT_NEED_KEYBOARD FALSE
260// #define GINPUT_KEYBOARD_POLL_PERIOD 200
261// #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
262// #define GKEYBOARD_LAYOUT_OFF FALSE
263// #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE
264//#define GINPUT_NEED_TOGGLE FALSE
265//#define GINPUT_NEED_DIAL FALSE
266
267
268///////////////////////////////////////////////////////////////////////////
269// GFILE //
270///////////////////////////////////////////////////////////////////////////
271#define GFX_USE_GFILE FALSE
272
273//#define GFILE_NEED_PRINTG FALSE
274//#define GFILE_NEED_SCANG FALSE
275//#define GFILE_NEED_STRINGS FALSE
276//#define GFILE_NEED_FILELISTS FALSE
277//#define GFILE_NEED_STDIO FALSE
278//#define GFILE_NEED_NOAUTOMOUNT FALSE
279//#define GFILE_NEED_NOAUTOSYNC FALSE
280
281//#define GFILE_NEED_MEMFS FALSE
282//#define GFILE_NEED_ROMFS FALSE
283//#define GFILE_NEED_RAMFS FALSE
284//#define GFILE_NEED_FATFS FALSE
285//#define GFILE_NEED_NATIVEFS FALSE
286//#define GFILE_NEED_CHBIOSFS FALSE
287
288//#define GFILE_ALLOW_FLOATS FALSE
289//#define GFILE_ALLOW_DEVICESPECIFIC FALSE
290//#define GFILE_MAX_GFILES 3
291
292///////////////////////////////////////////////////////////////////////////
293// GADC //
294///////////////////////////////////////////////////////////////////////////
295#define GFX_USE_GADC FALSE
296
297//#define GADC_MAX_LOWSPEED_DEVICES 4
298
299
300///////////////////////////////////////////////////////////////////////////
301// GAUDIO //
302///////////////////////////////////////////////////////////////////////////
303#define GFX_USE_GAUDIO FALSE
304// There seems to be a bug in the ugfx code, the wrong define is used
305// So define it in order to avoid warnings
306#define GFX_USE_GAUDIN GFX_USE_GAUDIO
307// #define GAUDIO_NEED_PLAY FALSE
308// #define GAUDIO_NEED_RECORD FALSE
309
310
311///////////////////////////////////////////////////////////////////////////
312// GMISC //
313///////////////////////////////////////////////////////////////////////////
314#define GFX_USE_GMISC TRUE
315
316//#define GMISC_NEED_ARRAYOPS FALSE
317//#define GMISC_NEED_FASTTRIG FALSE
318//#define GMISC_NEED_FIXEDTRIG FALSE
319//#define GMISC_NEED_INVSQRT FALSE
320// #define GMISC_INVSQRT_MIXED_ENDIAN FALSE
321// #define GMISC_INVSQRT_REAL_SLOW FALSE
322#define GMISC_NEED_MATRIXFLOAT2D TRUE
323#define GMISC_NEED_MATRIXFIXED2D FALSE
324
325#endif /* COMMON_GFXCONF_H */
diff --git a/keyboards/ergodox/infinity/animations.c b/quantum/visualizer/default_animations.c
index ebc08fde3..2d0327372 100644
--- a/keyboards/ergodox/infinity/animations.c
+++ b/quantum/visualizer/default_animations.c
@@ -16,7 +16,7 @@
16 16
17#if defined(VISUALIZER_ENABLE) 17#if defined(VISUALIZER_ENABLE)
18 18
19#include "animations.h" 19#include "default_animations.h"
20#include "visualizer.h" 20#include "visualizer.h"
21#ifdef LCD_ENABLE 21#ifdef LCD_ENABLE
22#include "lcd_keyframes.h" 22#include "lcd_keyframes.h"
@@ -26,7 +26,7 @@
26#endif 26#endif
27 27
28#ifdef BACKLIGHT_ENABLE 28#ifdef BACKLIGHT_ENABLE
29#include "led_keyframes.h" 29#include "led_backlight_keyframes.h"
30#endif 30#endif
31 31
32#include "visualizer_keyframes.h" 32#include "visualizer_keyframes.h"
@@ -39,10 +39,10 @@ static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t*
39 lcd_keyframe_enable(animation, state); 39 lcd_keyframe_enable(animation, state);
40#endif 40#endif
41#ifdef LCD_BACKLIGHT_ENABLE 41#ifdef LCD_BACKLIGHT_ENABLE
42 backlight_keyframe_enable(animation, state); 42 lcd_backlight_keyframe_enable(animation, state);
43#endif 43#endif
44#ifdef BACKLIGHT_ENABLE 44#ifdef BACKLIGHT_ENABLE
45 led_keyframe_enable(animation, state); 45 led_backlight_keyframe_enable(animation, state);
46#endif 46#endif
47 return false; 47 return false;
48} 48}
@@ -52,10 +52,10 @@ static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t
52 lcd_keyframe_disable(animation, state); 52 lcd_keyframe_disable(animation, state);
53#endif 53#endif
54#ifdef LCD_BACKLIGHT_ENABLE 54#ifdef LCD_BACKLIGHT_ENABLE
55 backlight_keyframe_disable(animation, state); 55 lcd_backlight_keyframe_disable(animation, state);
56#endif 56#endif
57#ifdef BACKLIGHT_ENABLE 57#ifdef BACKLIGHT_ENABLE
58 led_keyframe_disable(animation, state); 58 led_backlight_keyframe_disable(animation, state);
59#endif 59#endif
60 return false; 60 return false;
61} 61}
@@ -63,10 +63,10 @@ static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t
63static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) { 63static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
64 bool ret = false; 64 bool ret = false;
65#ifdef LCD_BACKLIGHT_ENABLE 65#ifdef LCD_BACKLIGHT_ENABLE
66 ret |= backlight_keyframe_animate_color(animation, state); 66 ret |= lcd_backlight_keyframe_animate_color(animation, state);
67#endif 67#endif
68#ifdef BACKLIGHT_ENABLE 68#ifdef BACKLIGHT_ENABLE
69 ret |= led_keyframe_fade_in_all(animation, state); 69 ret |= led_backlight_keyframe_fade_in_all(animation, state);
70#endif 70#endif
71 return ret; 71 return ret;
72} 72}
@@ -74,10 +74,10 @@ static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t
74static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) { 74static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
75 bool ret = false; 75 bool ret = false;
76#ifdef LCD_BACKLIGHT_ENABLE 76#ifdef LCD_BACKLIGHT_ENABLE
77 ret |= backlight_keyframe_animate_color(animation, state); 77 ret |= lcd_backlight_keyframe_animate_color(animation, state);
78#endif 78#endif
79#ifdef BACKLIGHT_ENABLE 79#ifdef BACKLIGHT_ENABLE
80 ret |= led_keyframe_fade_out_all(animation, state); 80 ret |= led_backlight_keyframe_fade_out_all(animation, state);
81#endif 81#endif
82 return ret; 82 return ret;
83} 83}
@@ -86,22 +86,44 @@ static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_
86// Don't worry, if the startup animation is long, you can use the keyboard like normal 86// Don't worry, if the startup animation is long, you can use the keyboard like normal
87// during that time 87// during that time
88keyframe_animation_t default_startup_animation = { 88keyframe_animation_t default_startup_animation = {
89#if LCD_ENABLE
89 .num_frames = 3, 90 .num_frames = 3,
91#else
92 .num_frames = 2,
93#endif
90 .loop = false, 94 .loop = false,
91 .frame_lengths = {0, 0, gfxMillisecondsToTicks(5000)}, 95 .frame_lengths = {
96 0,
97#if LCD_ENABLE
98 0,
99#endif
100 gfxMillisecondsToTicks(5000)},
92 .frame_functions = { 101 .frame_functions = {
93 keyframe_enable, 102 keyframe_enable,
103#if LCD_ENABLE
94 lcd_keyframe_draw_logo, 104 lcd_keyframe_draw_logo,
105#endif
95 keyframe_fade_in, 106 keyframe_fade_in,
96 }, 107 },
97}; 108};
98 109
99keyframe_animation_t default_suspend_animation = { 110keyframe_animation_t default_suspend_animation = {
111#if LCD_ENABLE
100 .num_frames = 3, 112 .num_frames = 3,
113#else
114 .num_frames = 2,
115#endif
101 .loop = false, 116 .loop = false,
102 .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, 117 .frame_lengths = {
118#if LCD_ENABLE
119 0,
120#endif
121 gfxMillisecondsToTicks(1000),
122 0},
103 .frame_functions = { 123 .frame_functions = {
124#if LCD_ENABLE
104 lcd_keyframe_display_layer_text, 125 lcd_keyframe_display_layer_text,
126#endif
105 keyframe_fade_out, 127 keyframe_fade_out,
106 keyframe_disable, 128 keyframe_disable,
107 }, 129 },
@@ -133,20 +155,20 @@ keyframe_animation_t led_test_animation = {
133 155
134 }, 156 },
135 .frame_functions = { 157 .frame_functions = {
136 led_keyframe_fade_in_all, 158 led_backlight_keyframe_fade_in_all,
137 keyframe_no_operation, 159 keyframe_no_operation,
138 led_keyframe_fade_out_all, 160 led_backlight_keyframe_fade_out_all,
139 led_keyframe_crossfade, 161 led_backlight_keyframe_crossfade,
140 led_keyframe_left_to_right_gradient, 162 led_backlight_keyframe_left_to_right_gradient,
141 led_keyframe_crossfade, 163 led_backlight_keyframe_crossfade,
142 led_keyframe_top_to_bottom_gradient, 164 led_backlight_keyframe_top_to_bottom_gradient,
143 led_keyframe_mirror_orientation, 165 led_backlight_keyframe_mirror_orientation,
144 led_keyframe_crossfade, 166 led_backlight_keyframe_crossfade,
145 led_keyframe_left_to_right_gradient, 167 led_backlight_keyframe_left_to_right_gradient,
146 led_keyframe_crossfade, 168 led_backlight_keyframe_crossfade,
147 led_keyframe_top_to_bottom_gradient, 169 led_backlight_keyframe_top_to_bottom_gradient,
148 led_keyframe_normal_orientation, 170 led_backlight_keyframe_normal_orientation,
149 led_keyframe_crossfade, 171 led_backlight_keyframe_crossfade,
150 }, 172 },
151}; 173};
152#endif 174#endif
diff --git a/keyboards/whitefox/animations.h b/quantum/visualizer/default_animations.h
index 6d8b9830d..51320b8b8 100644
--- a/keyboards/whitefox/animations.h
+++ b/quantum/visualizer/default_animations.h
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#ifndef KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ 17#ifndef DEFAULT_ANIMATIONS_H_
18#define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ 18#define DEFAULT_ANIMATIONS_H_
19 19
20#include "visualizer.h" 20#include "visualizer.h"
21 21
@@ -27,4 +27,4 @@ extern keyframe_animation_t default_suspend_animation;
27// cases 27// cases
28extern keyframe_animation_t led_test_animation; 28extern keyframe_animation_t led_test_animation;
29 29
30#endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ */ 30#endif /* DEFAULT_ANIMATIONS_H_ */
diff --git a/quantum/visualizer/lcd_backlight_keyframes.c b/quantum/visualizer/lcd_backlight_keyframes.c
index 8436d4e3d..8c402baf6 100644
--- a/quantum/visualizer/lcd_backlight_keyframes.c
+++ b/quantum/visualizer/lcd_backlight_keyframes.c
@@ -16,7 +16,7 @@
16 16
17#include "lcd_backlight_keyframes.h" 17#include "lcd_backlight_keyframes.h"
18 18
19bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) { 19bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) {
20 int frame_length = animation->frame_lengths[animation->current_frame]; 20 int frame_length = animation->frame_lengths[animation->current_frame];
21 int current_pos = frame_length - animation->time_left_in_frame; 21 int current_pos = frame_length - animation->time_left_in_frame;
22 uint8_t t_h = LCD_HUE(state->target_lcd_color); 22 uint8_t t_h = LCD_HUE(state->target_lcd_color);
@@ -49,7 +49,7 @@ bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualize
49 return true; 49 return true;
50} 50}
51 51
52bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) { 52bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) {
53 (void)animation; 53 (void)animation;
54 state->prev_lcd_color = state->target_lcd_color; 54 state->prev_lcd_color = state->target_lcd_color;
55 state->current_lcd_color = state->target_lcd_color; 55 state->current_lcd_color = state->target_lcd_color;
@@ -60,14 +60,14 @@ bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_st
60 return false; 60 return false;
61} 61}
62 62
63bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { 63bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
64 (void)animation; 64 (void)animation;
65 (void)state; 65 (void)state;
66 lcd_backlight_hal_color(0, 0, 0); 66 lcd_backlight_hal_color(0, 0, 0);
67 return false; 67 return false;
68} 68}
69 69
70bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { 70bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
71 (void)animation; 71 (void)animation;
72 (void)state; 72 (void)state;
73 lcd_backlight_color(LCD_HUE(state->current_lcd_color), 73 lcd_backlight_color(LCD_HUE(state->current_lcd_color),
diff --git a/quantum/visualizer/lcd_keyframes.c b/quantum/visualizer/lcd_keyframes.c
index 82e4184d2..75eb45700 100644
--- a/quantum/visualizer/lcd_keyframes.c
+++ b/quantum/visualizer/lcd_keyframes.c
@@ -166,8 +166,8 @@ bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t*
166 // or state structs, here we use the image 166 // or state structs, here we use the image
167 167
168 //gdispGBlitArea is a tricky function to use since it supports blitting part of the image 168 //gdispGBlitArea is a tricky function to use since it supports blitting part of the image
169 // if you have full screen image, then just use 128 and 32 for both source and target dimensions 169 // if you have full screen image, then just use LCD_WIDTH and LCD_HEIGHT for both source and target dimensions
170 gdispGBlitArea(GDISP, 0, 0, 128, 32, 0, 0, 128, (pixel_t*)resource_lcd_logo); 170 gdispGBlitArea(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, LCD_WIDTH, (pixel_t*)resource_lcd_logo);
171 171
172 return false; 172 return false;
173} 173}
diff --git a/quantum/visualizer/led_keyframes.c b/quantum/visualizer/led_backlight_keyframes.c
index 7e6e5d1ab..eb3f5561d 100644
--- a/quantum/visualizer/led_keyframes.c
+++ b/quantum/visualizer/led_backlight_keyframes.c
@@ -23,7 +23,7 @@ SOFTWARE.
23*/ 23*/
24#include "gfx.h" 24#include "gfx.h"
25#include "math.h" 25#include "math.h"
26#include "led_keyframes.h" 26#include "led_backlight_keyframes.h"
27 27
28static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) { 28static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) {
29 int frame_length = animation->frame_lengths[animation->current_frame]; 29 int frame_length = animation->frame_lengths[animation->current_frame];
@@ -41,8 +41,8 @@ static void keyframe_fade_all_leds_from_to(keyframe_animation_t* animation, uint
41} 41}
42 42
43// TODO: Should be customizable per keyboard 43// TODO: Should be customizable per keyboard
44#define NUM_ROWS LED_NUM_ROWS 44#define NUM_ROWS LED_HEIGHT
45#define NUM_COLS LED_NUM_COLS 45#define NUM_COLS LED_WIDTH
46 46
47static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS]; 47static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS];
48static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS]; 48static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS];
@@ -55,19 +55,19 @@ static uint8_t compute_gradient_color(float t, float index, float num) {
55 return (uint8_t)(255.0f * v); 55 return (uint8_t)(255.0f * v);
56} 56}
57 57
58bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) { 58bool led_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) {
59 (void)state; 59 (void)state;
60 keyframe_fade_all_leds_from_to(animation, 0, 255); 60 keyframe_fade_all_leds_from_to(animation, 0, 255);
61 return true; 61 return true;
62} 62}
63 63
64bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) { 64bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) {
65 (void)state; 65 (void)state;
66 keyframe_fade_all_leds_from_to(animation, 255, 0); 66 keyframe_fade_all_leds_from_to(animation, 255, 0);
67 return true; 67 return true;
68} 68}
69 69
70bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { 70bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
71 (void)state; 71 (void)state;
72 float frame_length = animation->frame_lengths[animation->current_frame]; 72 float frame_length = animation->frame_lengths[animation->current_frame];
73 float current_pos = frame_length - animation->time_left_in_frame; 73 float current_pos = frame_length - animation->time_left_in_frame;
@@ -79,7 +79,7 @@ bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visual
79 return true; 79 return true;
80} 80}
81 81
82bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { 82bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
83 (void)state; 83 (void)state;
84 float frame_length = animation->frame_lengths[animation->current_frame]; 84 float frame_length = animation->frame_lengths[animation->current_frame];
85 float current_pos = frame_length - animation->time_left_in_frame; 85 float current_pos = frame_length - animation->time_left_in_frame;
@@ -98,7 +98,7 @@ static void copy_current_led_state(uint8_t* dest) {
98 } 98 }
99 } 99 }
100} 100}
101bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) { 101bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) {
102 (void)state; 102 (void)state;
103 if (animation->first_update_of_frame) { 103 if (animation->first_update_of_frame) {
104 copy_current_led_state(&crossfade_start_frame[0][0]); 104 copy_current_led_state(&crossfade_start_frame[0][0]);
@@ -114,28 +114,28 @@ bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t*
114 return true; 114 return true;
115} 115}
116 116
117bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { 117bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
118 (void)state; 118 (void)state;
119 (void)animation; 119 (void)animation;
120 gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180); 120 gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180);
121 return false; 121 return false;
122} 122}
123 123
124bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { 124bool led_backlight_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
125 (void)state; 125 (void)state;
126 (void)animation; 126 (void)animation;
127 gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0); 127 gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0);
128 return false; 128 return false;
129} 129}
130 130
131bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { 131bool led_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
132 (void)state; 132 (void)state;
133 (void)animation; 133 (void)animation;
134 gdispGSetPowerMode(LED_DISPLAY, powerOff); 134 gdispGSetPowerMode(LED_DISPLAY, powerOff);
135 return false; 135 return false;
136} 136}
137 137
138bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { 138bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
139 (void)state; 139 (void)state;
140 (void)animation; 140 (void)animation;
141 gdispGSetPowerMode(LED_DISPLAY, powerOn); 141 gdispGSetPowerMode(LED_DISPLAY, powerOn);
diff --git a/quantum/visualizer/led_keyframes.h b/quantum/visualizer/led_backlight_keyframes.h
index a59a4f37d..487151013 100644
--- a/quantum/visualizer/led_keyframes.h
+++ b/quantum/visualizer/led_backlight_keyframes.h
@@ -22,21 +22,21 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE. 22SOFTWARE.
23*/ 23*/
24 24
25#ifndef LED_KEYFRAMES_H 25#ifndef LED_BACKLIGHT_KEYFRAMES_H
26#define LED_KEYFRAMES_H 26#define LED_BACKLIGHT_KEYFRAMES_H
27 27
28#include "visualizer.h" 28#include "visualizer.h"
29 29
30bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state); 30bool led_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state);
31bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state); 31bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state);
32bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state); 32bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
33bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state); 33bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
34bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state); 34bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state);
35bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state); 35bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
36bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state); 36bool led_backlight_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
37 37
38bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); 38bool led_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
39bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); 39bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
40 40
41extern keyframe_animation_t led_test_animation; 41extern keyframe_animation_t led_test_animation;
42 42
diff --git a/quantum/visualizer/visualizer.c b/quantum/visualizer/visualizer.c
index cc99d1e3b..5b4d8d603 100644
--- a/quantum/visualizer/visualizer.c
+++ b/quantum/visualizer/visualizer.c
@@ -52,7 +52,8 @@ SOFTWARE.
52 52
53// Define this in config.h 53// Define this in config.h
54#ifndef VISUALIZER_THREAD_PRIORITY 54#ifndef VISUALIZER_THREAD_PRIORITY
55#define "Visualizer thread priority not defined" 55// The visualizer needs gfx thread priorities
56#define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2)
56#endif 57#endif
57 58
58static visualizer_keyboard_status_t current_status = { 59static visualizer_keyboard_status_t current_status = {
@@ -255,6 +256,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
255 .mods = 0xFF, 256 .mods = 0xFF,
256 .leds = 0xFFFFFFFF, 257 .leds = 0xFFFFFFFF,
257 .suspended = false, 258 .suspended = false,
259 #ifdef BACKLIGHT_ENABLE
260 .backlight_level = 0,
261 #endif
258 #ifdef VISUALIZER_USER_DATA_SIZE 262 #ifdef VISUALIZER_USER_DATA_SIZE
259 .user_data = {0}, 263 .user_data = {0},
260 #endif 264 #endif
@@ -299,6 +303,7 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
299 else { 303 else {
300 gdispGSetPowerMode(LED_DISPLAY, powerOff); 304 gdispGSetPowerMode(LED_DISPLAY, powerOff);
301 } 305 }
306 state.status.backlight_level = current_status.backlight_level;
302 } 307 }
303 #endif 308 #endif
304 if (visualizer_enabled) { 309 if (visualizer_enabled) {
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk
index 0f7d8636c..102d23b7e 100644
--- a/quantum/visualizer/visualizer.mk
+++ b/quantum/visualizer/visualizer.mk
@@ -20,6 +20,30 @@
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
23define ADD_DRIVER
24 $(1)_DRIVER:=$(strip $($(1)_DRIVER))
25 $(1)_WIDTH:=$(strip $($(1)_WIDTH))
26 $(1)_HEIGHT:=$(strip $($(1)_HEIGHT))
27 ifeq ($($(1)_DRIVER),)
28 $$(error $(1)_DRIVER is not defined)
29 endif
30 ifeq ($($(1)_WIDTH),)
31 $$(error $(1)_WIDTH is not defined)
32 endif
33 ifeq ($($(1)_HEIGHT),)
34 $$(error $(1)_HEIGHT is not defined)
35 endif
36 OPT_DEFS+=-D$(1)_WIDTH=$($(1)_WIDTH)
37 OPT_DEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT)
38 GFXDEFS+=-D$(1)_WIDTH=$($(1)_WIDTH)
39 GFXDEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT)
40 $(1)_DISPLAY_NUMBER:=$$(words $$(GDISP_DRIVER_LIST))
41 OPT_DEFS+=-D$(1)_DISPLAY_NUMBER=$$($(1)_DISPLAY_NUMBER)
42 include $(TOP_DIR)/drivers/ugfx/gdisp/$($(1)_DRIVER)/driver.mk
43endef
44
45GDISP_DRIVER_LIST:=
46
23SRC += $(VISUALIZER_DIR)/visualizer.c \ 47SRC += $(VISUALIZER_DIR)/visualizer.c \
24 $(VISUALIZER_DIR)/visualizer_keyframes.c 48 $(VISUALIZER_DIR)/visualizer_keyframes.c
25EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR) 49EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR)
@@ -40,16 +64,32 @@ SRC += $(VISUALIZER_DIR)/lcd_backlight_keyframes.c
40# Note, that the linker will strip out any resources that are not actually in use 64# Note, that the linker will strip out any resources that are not actually in use
41SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c 65SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c
42OPT_DEFS += -DLCD_BACKLIGHT_ENABLE 66OPT_DEFS += -DLCD_BACKLIGHT_ENABLE
67$(eval $(call ADD_DRIVER,LCD))
43endif 68endif
44 69
45ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) 70ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
46SRC += $(VISUALIZER_DIR)/led_keyframes.c 71SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c
72$(eval $(call ADD_DRIVER,LED))
47endif 73endif
48 74
75SRC += $(VISUALIZER_DIR)/default_animations.c
76
49include $(GFXLIB)/gfx.mk 77include $(GFXLIB)/gfx.mk
78# For the common_gfxconf.h
79GFXINC += quantum/visualizer
80
50GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC)) 81GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC))
51GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) 82GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS)))
52 83
84GDISP_LIST_COMMA=,
85GDISP_LIST_EMPTY=
86GDISP_LIST_SPACE=$(GDISP_LIST_EMPTY) $(GDISP_LIST_EMPTY)
87
88GDISP_DRIVER_LIST := $(strip $(GDISP_DRIVER_LIST))
89GDISP_DRIVER_LIST := $(subst $(GDISP_LIST_SPACE),$(GDISP_LIST_COMMA),$(GDISP_DRIVER_LIST))
90
91GFXDEFS +=-DGDISP_DRIVER_LIST="$(GDISP_DRIVER_LIST)"
92
53ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") 93ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","")
54 SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c 94 SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c
55else 95else
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index ccecdb192..4af34ba57 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -12,7 +12,7 @@ HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature
12EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) 12EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT)
13BIN = 13BIN =
14 14
15 15COMMON_VPATH += $(DRIVER_PATH)/avr
16 16
17COMPILEFLAGS += -funsigned-char 17COMPILEFLAGS += -funsigned-char
18COMPILEFLAGS += -funsigned-bitfields 18COMPILEFLAGS += -funsigned-bitfields
@@ -87,11 +87,13 @@ DEBUG_PORT = 4242
87DEBUG_HOST = localhost 87DEBUG_HOST = localhost
88 88
89#============================================================================ 89#============================================================================
90# Autodecct teensy loader 90# Autodetect teensy loader
91ifneq (, $(shell which teensy-loader-cli 2>/dev/null)) 91ifndef TEENSY_LOADER_CLI
92 TEENSY_LOADER_CLI ?= teensy-loader-cli 92 ifneq (, $(shell which teensy-loader-cli 2>/dev/null))
93else 93 TEENSY_LOADER_CLI ?= teensy-loader-cli
94 TEENSY_LOADER_CLI ?= teensy_loader_cli 94 else
95 TEENSY_LOADER_CLI ?= teensy_loader_cli
96 endif
95endif 97endif
96 98
97# Program the device. 99# Program the device.
@@ -115,11 +117,11 @@ dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter
115 echo "Error: Bootloader not found. Trying again in 5s." ;\ 117 echo "Error: Bootloader not found. Trying again in 5s." ;\
116 sleep 5 ;\ 118 sleep 5 ;\
117 done 119 done
118ifneq (, $(findstring 0.7, $(shell $(DFU_PROGRAMMER) --version 2>&1))) 120 if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\
119 $(DFU_PROGRAMMER) $(MCU) erase --force 121 $(DFU_PROGRAMMER) $(MCU) erase --force;\
120else 122 else\
121 $(DFU_PROGRAMMER) $(MCU) erase 123 $(DFU_PROGRAMMER) $(MCU) erase;\
122endif 124 fi
123 $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex 125 $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex
124 $(DFU_PROGRAMMER) $(MCU) reset 126 $(DFU_PROGRAMMER) $(MCU) reset
125 127
@@ -135,11 +137,11 @@ flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
135 $(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex 137 $(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex
136 138
137dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep 139dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
138ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1))) 140 if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\
139 $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep 141 $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep;\
140else 142 else\
141 $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep 143 $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep;\
142endif 144 fi
143 $(DFU_PROGRAMMER) $(MCU) reset 145 $(DFU_PROGRAMMER) $(MCU) reset
144 146
145# Convert hex to bin. 147# Convert hex to bin.