aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/ergodox/infinity/config.h5
-rw-r--r--keyboards/whitefox/animations.c128
-rw-r--r--keyboards/whitefox/animations.h30
-rw-r--r--keyboards/whitefox/config.h14
-rw-r--r--keyboards/whitefox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h109
-rw-r--r--keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk2
-rw-r--r--keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c312
-rw-r--r--keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h36
-rw-r--r--keyboards/whitefox/gfxconf.h329
-rw-r--r--keyboards/whitefox/halconf.h2
-rw-r--r--keyboards/whitefox/keymaps/jetpacktuxedo/Makefile5
-rw-r--r--keyboards/whitefox/keymaps/jetpacktuxedo/keymap.c14
-rw-r--r--keyboards/whitefox/rules.mk7
-rw-r--r--keyboards/whitefox/visualizer.c60
-rw-r--r--quantum/visualizer/led_keyframes.c4
-rw-r--r--quantum/visualizer/visualizer.c33
-rw-r--r--quantum/visualizer/visualizer.mk26
17 files changed, 1080 insertions, 36 deletions
diff --git a/keyboards/ergodox/infinity/config.h b/keyboards/ergodox/infinity/config.h
index 95f713819..25cc8af0f 100644
--- a/keyboards/ergodox/infinity/config.h
+++ b/keyboards/ergodox/infinity/config.h
@@ -56,6 +56,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
56 56
57#define VISUALIZER_USER_DATA_SIZE 16 57#define VISUALIZER_USER_DATA_SIZE 16
58 58
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
59/* 64/*
60 * Feature disable options 65 * Feature disable options
61 * These options are also useful to firmware size reduction. 66 * These options are also useful to firmware size reduction.
diff --git a/keyboards/whitefox/animations.c b/keyboards/whitefox/animations.c
new file mode 100644
index 000000000..ed1d75efb
--- /dev/null
+++ b/keyboards/whitefox/animations.c
@@ -0,0 +1,128 @@
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/animations.h b/keyboards/whitefox/animations.h
new file mode 100644
index 000000000..6d8b9830d
--- /dev/null
+++ b/keyboards/whitefox/animations.h
@@ -0,0 +1,30 @@
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/whitefox/config.h b/keyboards/whitefox/config.h
index b7116341f..08de9b9aa 100644
--- a/keyboards/whitefox/config.h
+++ b/keyboards/whitefox/config.h
@@ -35,6 +35,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
35#define MATRIX_ROWS 9 35#define MATRIX_ROWS 9
36#define MATRIX_COLS 8 36#define MATRIX_COLS 8
37 37
38/* number of backlight levels */
39#define BACKLIGHT_LEVELS 3
40
41#define LED_BRIGHTNESS_LO 100
42#define LED_BRIGHTNESS_HI 255
43
38/* define if matrix has ghost */ 44/* define if matrix has ghost */
39//#define MATRIX_HAS_GHOST 45//#define MATRIX_HAS_GHOST
40 46
@@ -76,3 +82,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
76//#define NO_ACTION_FUNCTION 82//#define NO_ACTION_FUNCTION
77 83
78#endif 84#endif
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/board_IS31FL3731C.h b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h
new file mode 100644
index 000000000..3dc5327a5
--- /dev/null
+++ b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h
@@ -0,0 +1,109 @@
1/*
2Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef _GDISP_LLD_BOARD_H
19#define _GDISP_LLD_BOARD_H
20
21static const I2CConfig i2ccfg = {
22 400000 // clock speed (Hz); 400kHz max for IS31
23};
24
25#define GDISP_SCREEN_WIDTH 16
26#define GDISP_SCREEN_HEIGHT 5
27
28static const uint8_t led_mask[] = {
29 0xFF, 0x00, /* C1-1 -> C1-16 */
30 0xFF, 0x00, /* C2-1 -> C2-16 */
31 0xFF, 0x00, /* C3-1 -> C3-16 */
32 0xFF, 0x00, /* C4-1 -> C4-16 */
33 0xFF, 0x00, /* C5-1 -> C5-16 */
34 0xFF, 0x00, /* C6-1 -> C6-16 */
35 0xFF, 0x00, /* C7-1 -> C7-16 */
36 0xFF, 0x00, /* C8-1 -> C8-16 */
37 0xFE, 0x00, /* C9-1 -> C9-16 */
38};
39
40// The address of the LED
41#define LA(c, r) (c + r * 16 )
42// Need to be an address that is not mapped, but inside the range of the controller matrix
43#define NA LA(8, 8)
44
45// The numbers in the comments are the led numbers DXX on the PCB
46// The mapping is taken from the schematic of left hand side
47static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = {
48// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
49 { LA(0, 0), LA(1, 0), LA(2, 0), LA(3, 0), LA(4, 0), LA(5, 0), LA(6, 0), LA(7, 0), LA(0, 1), LA(1, 1), LA(2, 1), LA(3, 1), LA(4, 1), LA(5, 1), LA(6, 1), LA(7, 1)},
50// 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
51 { LA(0, 2), LA(1, 2), LA(2, 2), LA(3, 2), LA(4, 2), LA(5, 2), LA(6, 2), LA(7, 2), LA(0, 3), LA(1, 3), NA, LA(2, 3), LA(3, 3), LA(4, 3), LA(5, 3), LA(6, 3)},
52// 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
53 { LA(7, 3), LA(0, 4), LA(1, 4), LA(2, 4), LA(3, 4), LA(4, 4), LA(5, 4), LA(6, 4), LA(7, 4), LA(0, 5), NA, LA(1, 5), LA(2, 5), LA(3, 5), LA(4, 5), LA(5, 5)},
54// 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
55 { LA(6, 5), LA(7, 5), LA(0, 6), LA(1, 6), LA(2, 6), LA(3, 6), LA(4, 6), LA(5, 6), LA(6, 6), LA(7, 6), NA, LA(0, 7), LA(1, 7), LA(2, 7), LA(3, 7), LA(4, 7)},
56// 62 63 64 65 66 67 68 69 70 71
57 { LA(5, 7), LA(6, 7), LA(7, 7), NA, NA, NA, LA(0, 8), NA, NA, NA, LA(1, 8), LA(2, 8), LA(3, 8), LA(4, 8), LA(5, 8), LA(6, 8)},
58};
59
60
61#define IS31_ADDR_DEFAULT 0x74 // AD connected to GND
62#define IS31_TIMEOUT 5000
63
64static GFXINLINE void init_board(GDisplay *g) {
65 (void) g;
66 /* I2C pins */
67 palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL
68 palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA
69 palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL);
70 palClearPad(GPIOB, 16);
71 /* start I2C */
72 i2cStart(&I2CD1, &i2ccfg);
73 // try high drive (from kiibohd)
74 I2CD1.i2c->C2 |= I2Cx_C2_HDRS;
75 // try glitch fixing (from kiibohd)
76 I2CD1.i2c->FLT = 4;
77}
78
79static GFXINLINE void post_init_board(GDisplay *g) {
80 (void) g;
81}
82
83static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) {
84 (void) g;
85 return led_mask;
86}
87
88static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y)
89{
90 (void) g;
91 return led_mapping[y][x];
92}
93
94static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) {
95 (void) g;
96 if(!shutdown) {
97 palSetPad(GPIOB, 16);
98 }
99 else {
100 palClearPad(GPIOB, 16);
101 }
102}
103
104static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
105 (void) g;
106 i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT));
107}
108
109#endif /* _GDISP_LLD_BOARD_H */
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk
new file mode 100644
index 000000000..f32d0d868
--- /dev/null
+++ b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk
@@ -0,0 +1,2 @@
1GFXINC += drivers/gdisp/IS31FL3731C
2GFXSRC += drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
new file mode 100644
index 000000000..c807cbd1e
--- /dev/null
+++ b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
@@ -0,0 +1,312 @@
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_WHITEFOX
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/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
new file mode 100644
index 000000000..bb28ad775
--- /dev/null
+++ b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
@@ -0,0 +1,36 @@
1/*
2Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef _GDISP_LLD_CONFIG_H
19#define _GDISP_LLD_CONFIG_H
20
21#if GFX_USE_GDISP
22
23/*===========================================================================*/
24/* Driver hardware support. */
25/*===========================================================================*/
26
27#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
28#define GDISP_HARDWARE_DRAWPIXEL TRUE
29#define GDISP_HARDWARE_PIXELREAD TRUE
30#define GDISP_HARDWARE_CONTROL TRUE
31
32#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
33
34#endif /* GFX_USE_GDISP */
35
36#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/keyboards/whitefox/gfxconf.h b/keyboards/whitefox/gfxconf.h
new file mode 100644
index 000000000..890317a0f
--- /dev/null
+++ b/keyboards/whitefox/gfxconf.h
@@ -0,0 +1,329 @@
1/**
2 * This file has a different license to the rest of the uGFX system.
3 * You can copy, modify and distribute this file as you see fit.
4 * You do not need to publish your source modifications to this file.
5 * The only thing you are not permitted to do is to relicense it
6 * under a different license.
7 */
8
9/**
10 * Copy this file into your project directory and rename it as gfxconf.h
11 * Edit your copy to turn on the uGFX features you want to use.
12 * The values below are the defaults.
13 *
14 * Only remove the comments from lines where you want to change the
15 * default value. This allows definitions to be included from
16 * driver makefiles when required and provides the best future
17 * compatibility for your project.
18 *
19 * Please use spaces instead of tabs in this file.
20 */
21
22#ifndef _GFXCONF_H
23#define _GFXCONF_H
24
25
26///////////////////////////////////////////////////////////////////////////
27// GOS - One of these must be defined, preferably in your Makefile //
28///////////////////////////////////////////////////////////////////////////
29//#define GFX_USE_OS_CHIBIOS TRUE
30//#define GFX_USE_OS_FREERTOS FALSE
31// #define GFX_FREERTOS_USE_TRACE FALSE
32//#define GFX_USE_OS_WIN32 FALSE
33//#define GFX_USE_OS_LINUX FALSE
34//#define GFX_USE_OS_OSX FALSE
35//#define GFX_USE_OS_ECOS FALSE
36//#define GFX_USE_OS_RAWRTOS FALSE
37//#define GFX_USE_OS_ARDUINO FALSE
38//#define GFX_USE_OS_KEIL FALSE
39//#define GFX_USE_OS_CMSIS FALSE
40//#define GFX_USE_OS_RAW32 FALSE
41// #define INTERRUPTS_OFF() optional_code
42// #define INTERRUPTS_ON() optional_code
43// These are not defined by default for some reason
44#define GOS_NEED_X_THREADS FALSE
45#define GOS_NEED_X_HEAP FALSE
46
47// Options that (should where relevant) apply to all operating systems
48 #define GFX_NO_INLINE FALSE
49// #define GFX_COMPILER GFX_COMPILER_UNKNOWN
50// #define GFX_CPU GFX_CPU_UNKNOWN
51// #define GFX_OS_HEAP_SIZE 0
52// #define GFX_OS_NO_INIT FALSE
53// #define GFX_OS_INIT_NO_WARNING FALSE
54// #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine
55// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
56// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
57
58
59///////////////////////////////////////////////////////////////////////////
60// GDISP //
61///////////////////////////////////////////////////////////////////////////
62#define GFX_USE_GDISP TRUE
63
64//#define GDISP_NEED_AUTOFLUSH FALSE
65//#define GDISP_NEED_TIMERFLUSH FALSE
66//#define GDISP_NEED_VALIDATION TRUE
67//#define GDISP_NEED_CLIP TRUE
68#define GDISP_NEED_CIRCLE TRUE
69#define GDISP_NEED_ELLIPSE TRUE
70#define GDISP_NEED_ARC TRUE
71#define GDISP_NEED_ARCSECTORS TRUE
72#define GDISP_NEED_CONVEX_POLYGON TRUE
73//#define GDISP_NEED_SCROLL FALSE
74#define GDISP_NEED_PIXELREAD TRUE
75#define GDISP_NEED_CONTROL TRUE
76//#define GDISP_NEED_QUERY FALSE
77//#define GDISP_NEED_MULTITHREAD FALSE
78//#define GDISP_NEED_STREAMING FALSE
79#define GDISP_NEED_TEXT TRUE
80// #define GDISP_NEED_TEXT_WORDWRAP FALSE
81// #define GDISP_NEED_ANTIALIAS FALSE
82// #define GDISP_NEED_UTF8 FALSE
83 #define GDISP_NEED_TEXT_KERNING TRUE
84// #define GDISP_INCLUDE_FONT_UI1 FALSE
85// #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font.
86// #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
87// #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
88// #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
89// #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
90// #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE
91// #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
92// #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
93 #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE
94// #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE
95// #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE
96 #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE
97// #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
98// #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
99// #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE
100// #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
101// #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
102// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
103// #define GDISP_INCLUDE_USER_FONTS FALSE
104
105//#define GDISP_NEED_IMAGE FALSE
106// #define GDISP_NEED_IMAGE_NATIVE FALSE
107// #define GDISP_NEED_IMAGE_GIF FALSE
108// #define GDISP_NEED_IMAGE_BMP FALSE
109// #define GDISP_NEED_IMAGE_BMP_1 FALSE
110// #define GDISP_NEED_IMAGE_BMP_4 FALSE
111// #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE
112// #define GDISP_NEED_IMAGE_BMP_8 FALSE
113// #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE
114// #define GDISP_NEED_IMAGE_BMP_16 FALSE
115// #define GDISP_NEED_IMAGE_BMP_24 FALSE
116// #define GDISP_NEED_IMAGE_BMP_32 FALSE
117// #define GDISP_NEED_IMAGE_JPG FALSE
118// #define GDISP_NEED_IMAGE_PNG FALSE
119// #define GDISP_NEED_IMAGE_ACCOUNTING FALSE
120#ifdef EMULATOR
121#define GDISP_NEED_PIXMAP TRUE
122#endif
123// #define GDISP_NEED_PIXMAP_IMAGE FALSE
124
125//#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used.
126//#define GDISP_LINEBUF_SIZE 128
127//#define GDISP_STARTUP_COLOR Black
128#define GDISP_NEED_STARTUP_LOGO FALSE
129
130//#define GDISP_TOTAL_DISPLAYS 2
131
132#ifndef EMULATOR
133#define GDISP_DRIVER_LIST GDISPVMT_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
329#endif /* _GFXCONF_H */
diff --git a/keyboards/whitefox/halconf.h b/keyboards/whitefox/halconf.h
index 46b37a4f4..b38031529 100644
--- a/keyboards/whitefox/halconf.h
+++ b/keyboards/whitefox/halconf.h
@@ -76,7 +76,7 @@
76 * @brief Enables the I2C subsystem. 76 * @brief Enables the I2C subsystem.
77 */ 77 */
78#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) 78#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
79#define HAL_USE_I2C FALSE 79#define HAL_USE_I2C TRUE
80#endif 80#endif
81 81
82/** 82/**
diff --git a/keyboards/whitefox/keymaps/jetpacktuxedo/Makefile b/keyboards/whitefox/keymaps/jetpacktuxedo/Makefile
new file mode 100644
index 000000000..8eb483103
--- /dev/null
+++ b/keyboards/whitefox/keymaps/jetpacktuxedo/Makefile
@@ -0,0 +1,5 @@
1ifndef QUANTUM_DIR
2 include ../../../Makefile
3endif
4
5BACKLIGHT_ENABLE = yes
diff --git a/keyboards/whitefox/keymaps/jetpacktuxedo/keymap.c b/keyboards/whitefox/keymaps/jetpacktuxedo/keymap.c
index 09f6ca34d..82de17173 100644
--- a/keyboards/whitefox/keymaps/jetpacktuxedo/keymap.c
+++ b/keyboards/whitefox/keymaps/jetpacktuxedo/keymap.c
@@ -31,11 +31,11 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
31 * `---------------------------------------------------------------' 31 * `---------------------------------------------------------------'
32 */ 32 */
33 [0] = KEYMAP( \ 33 [0] = KEYMAP( \
34 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL,KC_NO,KC_BSPC,KC_INS, \ 34 KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL,KC_NO,KC_BSPC,KC_INS, \
35 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC, KC_BSLS, KC_DEL, \ 35 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC, KC_BSLS, KC_DEL, \
36 MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_NUHS, KC_ENT, KC_PGUP,\ 36 MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_NUHS, KC_ENT, KC_PGUP,\
37 KC_LSFT,KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN,\ 37 KC_LSFT, KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN,\
38 KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RCTL,KC_NO, KC_LEFT,KC_DOWN,KC_RGHT \ 38 KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RCTL,KC_NO, KC_LEFT,KC_DOWN,KC_RGHT \
39 ), 39 ),
40 /* Layer 1: FN Layer 40 /* Layer 1: FN Layer
41 * ,---------------------------------------------------------------. 41 * ,---------------------------------------------------------------.
@@ -52,8 +52,8 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
52 */ 52 */
53 [1] = KEYMAP( \ 53 [1] = KEYMAP( \
54 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS,KC_TRNS,KC_MUTE,\ 54 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS,KC_TRNS,KC_MUTE,\
55 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS,KC_TRNS, KC_TRNS,\ 55 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,BL_TOGG,KC_TRNS,KC_TRNS,BL_INC, KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS,KC_TRNS, KC_TRNS,\
56 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_VOLU,\ 56 KC_TRNS,KC_TRNS,KC_TRNS,BL_DEC, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_VOLU,\
57 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_PGUP,KC_VOLD,\ 57 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_PGUP,KC_VOLD,\
58 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_HOME,KC_PGDN,KC_END \ 58 KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_HOME,KC_PGDN,KC_END \
59 ), 59 ),
diff --git a/keyboards/whitefox/rules.mk b/keyboards/whitefox/rules.mk
index 18b690f49..565381e16 100644
--- a/keyboards/whitefox/rules.mk
+++ b/keyboards/whitefox/rules.mk
@@ -1,6 +1,7 @@
1# project specific files 1# project specific files
2SRC = matrix.c \ 2SRC = matrix.c \
3 led.c 3 led.c \
4 animations.c
4 5
5## chip/board settings 6## chip/board settings
6# - the next two should match the directories in 7# - the next two should match the directories in
@@ -66,3 +67,7 @@ COMMAND_ENABLE ?= yes # Commands for debug and configuration
66#SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend 67#SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend
67NKRO_ENABLE ?= yes # USB Nkey Rollover 68NKRO_ENABLE ?= yes # USB Nkey Rollover
68CUSTOM_MATRIX ?= yes # Custom matrix file 69CUSTOM_MATRIX ?= yes # Custom matrix file
70BACKLIGHT_ENABLE ?= yes
71VISUALIZER_ENABLE ?= yes
72
73include $(KEYBOARD_PATH)/drivers/gdisp/IS31FL3731C/driver.mk
diff --git a/keyboards/whitefox/visualizer.c b/keyboards/whitefox/visualizer.c
new file mode 100644
index 000000000..167e0ec4d
--- /dev/null
+++ b/keyboards/whitefox/visualizer.c
@@ -0,0 +1,60 @@
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_WHITEFOX_SIMPLE_VISUALIZER_H_
18#define KEYBOARDS_WHITEFOX_SIMPLE_VISUALIZER_H_
19
20#include "visualizer.h"
21#include "visualizer_keyframes.h"
22#include "led.h"
23#include "animations.h"
24
25
26static bool initial_update = true;
27
28// Feel free to modify the animations below, or even add new ones if needed
29
30void initialize_user_visualizer(visualizer_state_t* state) {
31 // The brightness will be dynamically adjustable in the future
32 // But for now, change it here.
33 initial_update = true;
34 start_keyframe_animation(&default_startup_animation);
35}
36
37
38void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
39 // Add more tests, change the colors and layer texts here
40 // Usually you want to check the high bits (higher layers first)
41 // because that's the order layers are processed for keypresses
42 // You can for check for example:
43 // state->status.layer
44 // state->status.default_layer
45 // state->status.leds (see led.h for available statuses)
46
47 if (initial_update) { initial_update=false; start_keyframe_animation(&led_test_animation); }
48}
49
50
51void user_visualizer_suspend(visualizer_state_t* state) {
52 start_keyframe_animation(&default_suspend_animation);
53}
54
55void user_visualizer_resume(visualizer_state_t* state) {
56 initial_update = true;
57 start_keyframe_animation(&default_startup_animation);
58}
59
60#endif /* KEYBOARDS_WHITEFOX_SIMPLE_VISUALIZER_H_ */
diff --git a/quantum/visualizer/led_keyframes.c b/quantum/visualizer/led_keyframes.c
index 2f4e20043..7e6e5d1ab 100644
--- a/quantum/visualizer/led_keyframes.c
+++ b/quantum/visualizer/led_keyframes.c
@@ -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 7 44#define NUM_ROWS LED_NUM_ROWS
45#define NUM_COLS 7 45#define NUM_COLS LED_NUM_COLS
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];
diff --git a/quantum/visualizer/visualizer.c b/quantum/visualizer/visualizer.c
index a4b3ea7e4..cc99d1e3b 100644
--- a/quantum/visualizer/visualizer.c
+++ b/quantum/visualizer/visualizer.c
@@ -105,15 +105,19 @@ static remote_object_t* remote_objects[] = {
105GDisplay* LCD_DISPLAY = 0; 105GDisplay* LCD_DISPLAY = 0;
106GDisplay* LED_DISPLAY = 0; 106GDisplay* LED_DISPLAY = 0;
107 107
108#ifdef LCD_DISPLAY_NUMBER
108__attribute__((weak)) 109__attribute__((weak))
109GDisplay* get_lcd_display(void) { 110GDisplay* get_lcd_display(void) {
110 return gdispGetDisplay(0); 111 return gdispGetDisplay(LCD_DISPLAY_NUMBER);
111} 112}
113#endif
112 114
115#ifdef LED_DISPLAY_NUMBER
113__attribute__((weak)) 116__attribute__((weak))
114GDisplay* get_led_display(void) { 117GDisplay* get_led_display(void) {
115 return gdispGetDisplay(1); 118 return gdispGetDisplay(LED_DISPLAY_NUMBER);
116} 119}
120#endif
117 121
118void start_keyframe_animation(keyframe_animation_t* animation) { 122void start_keyframe_animation(keyframe_animation_t* animation) {
119 animation->current_frame = -1; 123 animation->current_frame = -1;
@@ -251,9 +255,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
251 .mods = 0xFF, 255 .mods = 0xFF,
252 .leds = 0xFFFFFFFF, 256 .leds = 0xFFFFFFFF,
253 .suspended = false, 257 .suspended = false,
254#ifdef VISUALIZER_USER_DATA_SIZE 258 #ifdef VISUALIZER_USER_DATA_SIZE
255 .user_data = {0}, 259 .user_data = {0},
256#endif 260 #endif
257 }; 261 };
258 262
259 visualizer_state_t state = { 263 visualizer_state_t state = {
@@ -379,25 +383,26 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
379void visualizer_init(void) { 383void visualizer_init(void) {
380 gfxInit(); 384 gfxInit();
381 385
382#ifdef LCD_BACKLIGHT_ENABLE 386 #ifdef LCD_BACKLIGHT_ENABLE
383 lcd_backlight_init(); 387 lcd_backlight_init();
384#endif 388 #endif
385 389
386#ifdef SERIAL_LINK_ENABLE 390 #ifdef SERIAL_LINK_ENABLE
387 add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) ); 391 add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) );
388#endif 392 #endif
389 393
390#ifdef LCD_ENABLE 394 #ifdef LCD_ENABLE
391 LCD_DISPLAY = get_lcd_display(); 395 LCD_DISPLAY = get_lcd_display();
392#endif 396 #endif
393#ifdef BACKLIGHT_ENABLE 397
398 #ifdef BACKLIGHT_ENABLE
394 LED_DISPLAY = get_led_display(); 399 LED_DISPLAY = get_led_display();
395#endif 400 #endif
396 401
397 // We are using a low priority thread, the idea is to have it run only 402 // We are using a low priority thread, the idea is to have it run only
398 // when the main thread is sleeping during the matrix scanning 403 // when the main thread is sleeping during the matrix scanning
399 gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack), 404 gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack),
400 VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL); 405 VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL);
401} 406}
402 407
403void update_status(bool changed) { 408void update_status(bool changed) {
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk
index 6f97603bd..0f7d8636c 100644
--- a/quantum/visualizer/visualizer.mk
+++ b/quantum/visualizer/visualizer.mk
@@ -51,19 +51,23 @@ GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC))
51GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) 51GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS)))
52 52
53ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") 53ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","")
54 SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c 54 SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c
55else 55else
56 ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","") 56 ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","")
57 ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","") 57 ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","")
58$(error "$(KEYMAP_PATH)/visualizer.c" does not exist) 58 ifeq ("$(wildcard $(KEYBOARD_PATH)/visualizer.c)","")
59 else 59$(error "visualizer.c" not found")
60 SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c 60 else
61 endif 61 SRC += keyboards/$(KEYBOARD)/visualizer.c
62 else 62 endif
63 SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c 63 else
64 endif 64 SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c
65 endif
66 else
67 SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c
68 endif
65endif 69endif
66 70
67ifdef EMULATOR 71ifdef EMULATOR
68UINCDIR += $(TMK_DIR)/common 72UINCDIR += $(TMK_DIR)/common
69endif \ No newline at end of file 73endif