aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules4
-rw-r--r--Makefile1
-rw-r--r--build_keyboard.mk6
-rw-r--r--common_features.mk4
-rw-r--r--disable_features.mk1
-rw-r--r--docs/es/hardware_drivers.md4
-rw-r--r--docs/es/hardware_keyboard_guidelines.md2
-rw-r--r--docs/fr-fr/getting_started_github.md1
-rw-r--r--docs/getting_started_github.md1
-rw-r--r--docs/hardware_drivers.md4
-rw-r--r--docs/hardware_keyboard_guidelines.md2
-rw-r--r--docs/he-il/getting_started_github.md1
-rw-r--r--docs/ja/getting_started_github.md1
-rw-r--r--docs/ja/hardware_drivers.md4
-rw-r--r--docs/ja/hardware_keyboard_guidelines.md2
-rw-r--r--docs/ja/understanding_qmk.md4
-rw-r--r--docs/ru-ru/getting_started_github.md1
-rw-r--r--docs/understanding_qmk.md5
-rw-r--r--docs/zh-cn/getting_started_github.md1
-rw-r--r--doxygen-todo6
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h105
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/driver.mk3
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c302
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h36
-rw-r--r--drivers/ugfx/gdisp/st7565/board_st7565_template.h96
-rw-r--r--drivers/ugfx/gdisp/st7565/driver.mk3
-rw-r--r--drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c314
-rw-r--r--drivers/ugfx/gdisp/st7565/gdisp_lld_config.h27
-rw-r--r--drivers/ugfx/gdisp/st7565/st7565.h39
-rw-r--r--keyboards/ergodox_infinity/board_is31fl3731c.h110
-rw-r--r--keyboards/ergodox_infinity/board_st7565.h96
-rw-r--r--keyboards/ergodox_infinity/config.h2
-rw-r--r--keyboards/ergodox_infinity/ergodox_infinity.c11
-rw-r--r--keyboards/ergodox_infinity/ergodox_infinity.h2
-rw-r--r--keyboards/ergodox_infinity/gfxconf.h27
-rw-r--r--keyboards/ergodox_infinity/rules.mk7
-rw-r--r--keyboards/ergodox_infinity/simple_visualizer.h123
-rw-r--r--keyboards/ergodox_infinity/visualizer.c328
-rw-r--r--keyboards/whitefox/gfxconf.h27
-rw-r--r--keyboards/whitefox/visualizer.c54
m---------lib/ugfx0
-rw-r--r--quantum/keyboard.c8
-rw-r--r--quantum/visualizer/LICENSE.md29
-rw-r--r--quantum/visualizer/common_gfxconf.h354
-rw-r--r--quantum/visualizer/default_animations.c177
-rw-r--r--quantum/visualizer/default_animations.h27
-rw-r--r--quantum/visualizer/lcd_backlight.c87
-rw-r--r--quantum/visualizer/lcd_backlight.h43
-rw-r--r--quantum/visualizer/lcd_backlight_keyframes.c69
-rw-r--r--quantum/visualizer/lcd_backlight_keyframes.h27
-rw-r--r--quantum/visualizer/lcd_keyframes.c184
-rw-r--r--quantum/visualizer/lcd_keyframes.h35
-rw-r--r--quantum/visualizer/led_backlight_keyframes.c143
-rw-r--r--quantum/visualizer/led_backlight_keyframes.h40
-rw-r--r--quantum/visualizer/readme.md18
-rw-r--r--quantum/visualizer/resources/lcd_logo.c45
-rw-r--r--quantum/visualizer/resources/lcd_logo.pngbin271 -> 0 bytes
-rw-r--r--quantum/visualizer/resources/resources.h23
-rw-r--r--quantum/visualizer/visualizer.c483
-rw-r--r--quantum/visualizer/visualizer.h154
-rw-r--r--quantum/visualizer/visualizer.mk123
-rw-r--r--quantum/visualizer/visualizer_keyframes.c23
-rw-r--r--quantum/visualizer/visualizer_keyframes.h23
-rw-r--r--show_options.mk1
-rw-r--r--tmk_core/protocol/chibios/chibios.c14
-rwxr-xr-xutil/chibios_conf_updater.sh2
66 files changed, 2 insertions, 3897 deletions
diff --git a/.gitmodules b/.gitmodules
index 324ef790d..681693a5a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -6,10 +6,6 @@
6 path = lib/chibios-contrib 6 path = lib/chibios-contrib
7 url = https://github.com/qmk/ChibiOS-Contrib 7 url = https://github.com/qmk/ChibiOS-Contrib
8 branch = master 8 branch = master
9[submodule "lib/ugfx"]
10 path = lib/ugfx
11 url = https://github.com/qmk/uGFX
12 branch = master
13[submodule "lib/googletest"] 9[submodule "lib/googletest"]
14 path = lib/googletest 10 path = lib/googletest
15 url = https://github.com/qmk/googletest 11 url = https://github.com/qmk/googletest
diff --git a/Makefile b/Makefile
index 041b4d15a..220a55191 100644
--- a/Makefile
+++ b/Makefile
@@ -490,7 +490,6 @@ endef
490ifndef SKIP_GIT 490ifndef SKIP_GIT
491 if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi 491 if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi
492 if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 50 --init lib/chibios-contrib; fi 492 if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 50 --init lib/chibios-contrib; fi
493 if [ ! -e lib/ugfx ]; then git submodule sync lib/ugfx && git submodule update --depth 50 --init lib/ugfx; fi
494 if [ ! -e lib/lufa ]; then git submodule sync lib/lufa && git submodule update --depth 50 --init lib/lufa; fi 493 if [ ! -e lib/lufa ]; then git submodule sync lib/lufa && git submodule update --depth 50 --init lib/lufa; fi
495 if [ ! -e lib/vusb ]; then git submodule sync lib/vusb && git submodule update --depth 50 --init lib/vusb; fi 494 if [ ! -e lib/vusb ]; then git submodule sync lib/vusb && git submodule update --depth 50 --init lib/vusb; fi
496 if [ ! -e lib/printf ]; then git submodule sync lib/printf && git submodule update --depth 50 --init lib/printf; fi 495 if [ ! -e lib/printf ]; then git submodule sync lib/printf && git submodule update --depth 50 --init lib/printf; fi
diff --git a/build_keyboard.mk b/build_keyboard.mk
index 420643c3e..691045853 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -429,12 +429,6 @@ PROJECT_DEFS := $(OPT_DEFS)
429PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS) 429PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
430PROJECT_CONFIG := $(CONFIG_H) 430PROJECT_CONFIG := $(CONFIG_H)
431 431
432ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
433 VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer
434 VISUALIZER_PATH = $(QUANTUM_PATH)/visualizer
435 include $(VISUALIZER_PATH)/visualizer.mk
436endif
437
438CONFIG_H += $(POST_CONFIG_H) 432CONFIG_H += $(POST_CONFIG_H)
439ALL_CONFIGS := $(PROJECT_CONFIG) $(CONFIG_H) 433ALL_CONFIGS := $(PROJECT_CONFIG) $(CONFIG_H)
440 434
diff --git a/common_features.mk b/common_features.mk
index e3b42a961..fc9595ddd 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -450,10 +450,6 @@ ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes)
450 SRC += apa102.c 450 SRC += apa102.c
451endif 451endif
452 452
453ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
454 CIE1931_CURVE := yes
455endif
456
457ifeq ($(strip $(CIE1931_CURVE)), yes) 453ifeq ($(strip $(CIE1931_CURVE)), yes)
458 OPT_DEFS += -DUSE_CIE1931_CURVE 454 OPT_DEFS += -DUSE_CIE1931_CURVE
459 LED_TABLES := yes 455 LED_TABLES := yes
diff --git a/disable_features.mk b/disable_features.mk
index eeae68885..6733e4e80 100644
--- a/disable_features.mk
+++ b/disable_features.mk
@@ -22,7 +22,6 @@ FEATURE_NAMES += SLEEP_LED
22FEATURE_NAMES += SERIAL_LINK 22FEATURE_NAMES += SERIAL_LINK
23FEATURE_NAMES += STENO 23FEATURE_NAMES += STENO
24FEATURE_NAMES += SWAP_HANDS 24FEATURE_NAMES += SWAP_HANDS
25FEATURE_NAMES += VISUALIZER
26FEATURE_NAMES += WATCHDOG 25FEATURE_NAMES += WATCHDOG
27FEATURE_NAMES += XT 26FEATURE_NAMES += XT
28 27
diff --git a/docs/es/hardware_drivers.md b/docs/es/hardware_drivers.md
index e0a973606..788de2c5e 100644
--- a/docs/es/hardware_drivers.md
+++ b/docs/es/hardware_drivers.md
@@ -18,10 +18,6 @@ Soporte para direccionar pines en el ProMicro por su nombre Arduino en lugar de
18 18
19Soporte para pantallas OLED basadas en SSD1306. Para obtener más información consulta la página de [Característica de Controlador OLED](feature_oled_driver.md). 19Soporte para pantallas OLED basadas en SSD1306. Para obtener más información consulta la página de [Característica de Controlador OLED](feature_oled_driver.md).
20 20
21## uGFX
22
23Puedes hacer uso de uGFX dentro de QMK para manejar LCDs de caracteres y gráficos, matrices de LED, OLED, TFT, y otras tecnologías de visualización. Esto necesita ser mejor documentado. Si estás tratando de hacer esto y leer el código no ayuda por favor [abre una issue](https://github.com/qmk/qmk_firmware/issues/new) y podemos ayudarte por el proceso.
24
25## WS2812 (Solo AVR) 21## WS2812 (Solo AVR)
26 22
27Soporte para LEDs WS2811/WS2812{a,b,c}. Para obtener más información consulta la página de [Luz RGB](feature_rgblight.md). 23Soporte para LEDs WS2811/WS2812{a,b,c}. Para obtener más información consulta la página de [Luz RGB](feature_rgblight.md).
diff --git a/docs/es/hardware_keyboard_guidelines.md b/docs/es/hardware_keyboard_guidelines.md
index a505cc5ce..298a3b7ce 100644
--- a/docs/es/hardware_keyboard_guidelines.md
+++ b/docs/es/hardware_keyboard_guidelines.md
@@ -142,8 +142,6 @@ El año debe ser el primer año en que se crea el archivo. Si el trabajo se hizo
142 142
143El núcleo de QMC está licenciado bajo la [GNU General Public License](https://www.gnu.org/licenses/licenses.en.html). Si estás enviando binarios para los procesadores AVR puedes elegir cualquiera [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) o [GPLv3](https://www.gnu.org/licenses/gpl.html). Si estás enviando binarios para ARM procesadores debes elegir [GPL Versión 3](https://www.gnu.org/licenses/gpl.html) para cumplir con los [ChibiOS](https://www.chibios.org) licencia GPLv3. 143El núcleo de QMC está licenciado bajo la [GNU General Public License](https://www.gnu.org/licenses/licenses.en.html). Si estás enviando binarios para los procesadores AVR puedes elegir cualquiera [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) o [GPLv3](https://www.gnu.org/licenses/gpl.html). Si estás enviando binarios para ARM procesadores debes elegir [GPL Versión 3](https://www.gnu.org/licenses/gpl.html) para cumplir con los [ChibiOS](https://www.chibios.org) licencia GPLv3.
144 144
145Si tu teclado hace uso de la [uGFX](https://gfx.io) características dentro de QMK debes cumplir con la [Licencia de uGFX](https://ugfx.io/license.html), que requiere una licencia comercial separada antes de vender un dispositivo que contiene uGFX.
146
147## Detalles técnicos 145## Detalles técnicos
148 146
149Si estás buscando más información sobre cómo hacer que su teclado funcione con QMK, [echa un vistazo a la sección hardware](hardware.md)! 147Si estás buscando más información sobre cómo hacer que su teclado funcione con QMK, [echa un vistazo a la sección hardware](hardware.md)!
diff --git a/docs/fr-fr/getting_started_github.md b/docs/fr-fr/getting_started_github.md
index 0f3982ea2..522b09a03 100644
--- a/docs/fr-fr/getting_started_github.md
+++ b/docs/fr-fr/getting_started_github.md
@@ -32,7 +32,6 @@ Submodule path 'lib/chibios': checked out '587968d6cbc2b0e1c7147540872f2a67e59ca
32Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486' 32Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486'
33Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780' 33Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780'
34Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d' 34Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d'
35Submodule path 'lib/ugfx': checked out '3e97b74e03c93631cdd3ddb2ce43b963fdce19b2'
36``` 35```
37 36
38Vous avez maintenant votre fork QMK sur votre machine locale, vous pouvez ajouter votre keymap, la compiler et la flasher sur votre board. Une fois heureux avec vos changements, vous pouvez les ajouter, commit, et pousser vers votre fork comme suit: 37Vous avez maintenant votre fork QMK sur votre machine locale, vous pouvez ajouter votre keymap, la compiler et la flasher sur votre board. Une fois heureux avec vos changements, vous pouvez les ajouter, commit, et pousser vers votre fork comme suit:
diff --git a/docs/getting_started_github.md b/docs/getting_started_github.md
index e3720b886..9232bc622 100644
--- a/docs/getting_started_github.md
+++ b/docs/getting_started_github.md
@@ -32,7 +32,6 @@ Submodule path 'lib/chibios': checked out '587968d6cbc2b0e1c7147540872f2a67e59ca
32Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486' 32Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486'
33Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780' 33Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780'
34Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d' 34Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d'
35Submodule path 'lib/ugfx': checked out '3e97b74e03c93631cdd3ddb2ce43b963fdce19b2'
36``` 35```
37 36
38You now have your QMK fork on your local machine, and you can add your keymap, compile it and flash it to your board. Once you're happy with your changes, you can add, commit, and push them to your fork like this: 37You now have your QMK fork on your local machine, and you can add your keymap, compile it and flash it to your board. Once you're happy with your changes, you can add, commit, and push them to your fork like this:
diff --git a/docs/hardware_drivers.md b/docs/hardware_drivers.md
index 7e89c0d2b..a15750132 100644
--- a/docs/hardware_drivers.md
+++ b/docs/hardware_drivers.md
@@ -18,10 +18,6 @@ Support for addressing pins on the ProMicro by their Arduino name rather than th
18 18
19Support for SSD1306 based OLED displays. For more information see the [OLED Driver Feature](feature_oled_driver.md) page. 19Support for SSD1306 based OLED displays. For more information see the [OLED Driver Feature](feature_oled_driver.md) page.
20 20
21## uGFX
22
23You can make use of uGFX within QMK to drive character and graphic LCDs, LED arrays, OLED, TFT, and other display technologies. This needs to be better documented, if you are trying to do this and reading the code doesn't help please [open an issue](https://github.com/qmk/qmk_firmware/issues/new) and we can help you through the process.
24
25## WS2812 21## WS2812
26 22
27Support for WS2811/WS2812{a,b,c} LED's. For more information see the [RGB Light](feature_rgblight.md) page. 23Support for WS2811/WS2812{a,b,c} LED's. For more information see the [RGB Light](feature_rgblight.md) page.
diff --git a/docs/hardware_keyboard_guidelines.md b/docs/hardware_keyboard_guidelines.md
index f975f37f5..be55356b1 100644
--- a/docs/hardware_keyboard_guidelines.md
+++ b/docs/hardware_keyboard_guidelines.md
@@ -255,8 +255,6 @@ The year should be the first year the file is created. If work was done to that
255 255
256The core of QMK is licensed under the [GNU General Public License](https://www.gnu.org/licenses/licenses.en.html). If you are shipping binaries for AVR processors you may choose either [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) or [GPLv3](https://www.gnu.org/licenses/gpl.html). If you are shipping binaries for ARM processors you must choose [GPL Version 3](https://www.gnu.org/licenses/gpl.html) to comply with the [ChibiOS](https://www.chibios.org) GPLv3 license. 256The core of QMK is licensed under the [GNU General Public License](https://www.gnu.org/licenses/licenses.en.html). If you are shipping binaries for AVR processors you may choose either [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) or [GPLv3](https://www.gnu.org/licenses/gpl.html). If you are shipping binaries for ARM processors you must choose [GPL Version 3](https://www.gnu.org/licenses/gpl.html) to comply with the [ChibiOS](https://www.chibios.org) GPLv3 license.
257 257
258If your keyboard makes use of the [uGFX](https://ugfx.io) features within QMK you must comply with the [uGFX License](https://ugfx.io/license.html), which requires a separate commercial license before selling a device containing uGFX.
259
260## Technical Details 258## Technical Details
261 259
262If you're looking for more information on making your keyboard work with QMK, [check out the hardware section](hardware.md)! 260If you're looking for more information on making your keyboard work with QMK, [check out the hardware section](hardware.md)!
diff --git a/docs/he-il/getting_started_github.md b/docs/he-il/getting_started_github.md
index 900852eff..ca79e40f9 100644
--- a/docs/he-il/getting_started_github.md
+++ b/docs/he-il/getting_started_github.md
@@ -35,7 +35,6 @@ Submodule path 'lib/chibios': checked out '587968d6cbc2b0e1c7147540872f2a67e59ca
35Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486' 35Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486'
36Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780' 36Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780'
37Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d' 37Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d'
38Submodule path 'lib/ugfx': checked out '3e97b74e03c93631cdd3ddb2ce43b963fdce19b2'
39``` 38```
40 39
41</div> 40</div>
diff --git a/docs/ja/getting_started_github.md b/docs/ja/getting_started_github.md
index 6d9b70c41..640701148 100644
--- a/docs/ja/getting_started_github.md
+++ b/docs/ja/getting_started_github.md
@@ -37,7 +37,6 @@ Submodule path 'lib/chibios': checked out '587968d6cbc2b0e1c7147540872f2a67e59ca
37Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486' 37Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486'
38Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780' 38Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780'
39Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d' 39Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d'
40Submodule path 'lib/ugfx': checked out '3e97b74e03c93631cdd3ddb2ce43b963fdce19b2'
41``` 40```
42 41
43ローカルマシンに QMK のフォークができるので、キーマップの追加、コンパイル、キーボードへの書き込みができます。変更に満足したら、以下のようにそれらをフォークへ追加、コミットおよびプッシュすることができます: 42ローカルマシンに QMK のフォークができるので、キーマップの追加、コンパイル、キーボードへの書き込みができます。変更に満足したら、以下のようにそれらをフォークへ追加、コミットおよびプッシュすることができます:
diff --git a/docs/ja/hardware_drivers.md b/docs/ja/hardware_drivers.md
index f77b48ba8..e0061cb32 100644
--- a/docs/ja/hardware_drivers.md
+++ b/docs/ja/hardware_drivers.md
@@ -24,10 +24,6 @@ ProMicro のピンを AVR の名前ではなく、Arduino の名前で指定で
24 24
25SSD1306 ベースの OLED ディスプレイのサポート。詳しくは[OLED ドライバ](ja/feature_oled_driver.md)を参照して下さい。 25SSD1306 ベースの OLED ディスプレイのサポート。詳しくは[OLED ドライバ](ja/feature_oled_driver.md)を参照して下さい。
26 26
27## uGFX
28
29QMK 内で uGFX を使用して、キャラクタ LCD やグラフィック LCD、LED アレイ、OLED ディスプレイ、TFT 液晶や他のディスプレイを制御できます。この部分はより詳しく文書化される必要があります。もしこれを使用したい場合にコードを読んでも分からない場合、[issue を開く](https://github.com/qmk/qmk_firmware/issues/new)を通して助けることができるかもしれません。
30
31## WS2812 27## WS2812
32 28
33WS2811/WS2812{a,b,c} LED のサポート。 詳しくは [RGB ライト](ja/feature_rgblight.md)を参照して下さい。 29WS2811/WS2812{a,b,c} LED のサポート。 詳しくは [RGB ライト](ja/feature_rgblight.md)を参照して下さい。
diff --git a/docs/ja/hardware_keyboard_guidelines.md b/docs/ja/hardware_keyboard_guidelines.md
index 8a9127abc..c0e7c18be 100644
--- a/docs/ja/hardware_keyboard_guidelines.md
+++ b/docs/ja/hardware_keyboard_guidelines.md
@@ -234,8 +234,6 @@ QMK が提供する機能の量を考えれば、新しいユーザーが混乱
234 234
235QMK のコア部分は [GNU General Public License](https://www.gnu.org/licenses/licenses.en.html) でライセンスされます。AVR マイコン用のバイナリを提供する場合は、[GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) か、[GPLv3](https://www.gnu.org/licenses/gpl.html) のどちらかから選択出来ます。ARM マイコン用のバイナリを提供する場合は、 [ChibiOS](https://www.chibios.org) の GPLv3 ライセンスに準拠するため、[GPL Version 3](https://www.gnu.org/licenses/gpl.html) を選択しなければいけません。 235QMK のコア部分は [GNU General Public License](https://www.gnu.org/licenses/licenses.en.html) でライセンスされます。AVR マイコン用のバイナリを提供する場合は、[GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) か、[GPLv3](https://www.gnu.org/licenses/gpl.html) のどちらかから選択出来ます。ARM マイコン用のバイナリを提供する場合は、 [ChibiOS](https://www.chibios.org) の GPLv3 ライセンスに準拠するため、[GPL Version 3](https://www.gnu.org/licenses/gpl.html) を選択しなければいけません。
236 236
237[uGFX](https://ugfx.io) を使用している場合は、[uGFX License](https://ugfx.io/license.html) に準拠する必要があります。uGFX を利用したデバイスを販売するには個別に商用ライセンスを取得しなければいけません。
238
239## 技術的な詳細 237## 技術的な詳細
240 238
241キーボードを QMK で動作させるための詳細は[ハードウェア](ja/hardware.md)を参照して下さい! 239キーボードを QMK で動作させるための詳細は[ハードウェア](ja/hardware.md)を参照して下さい!
diff --git a/docs/ja/understanding_qmk.md b/docs/ja/understanding_qmk.md
index 5fcb7be85..f88655ebc 100644
--- a/docs/ja/understanding_qmk.md
+++ b/docs/ja/understanding_qmk.md
@@ -183,10 +183,6 @@ FIXME: This needs to be written
183 183
184FIXME: This needs to be written 184FIXME: This needs to be written
185 185
186#### Visualizer
187
188FIXME: This needs to be written
189
190#### Keyboard state LEDs (Caps Lock, Num Lock, Scroll Lock) 186#### Keyboard state LEDs (Caps Lock, Num Lock, Scroll Lock)
191 187
192FIXME: This needs to be written 188FIXME: This needs to be written
diff --git a/docs/ru-ru/getting_started_github.md b/docs/ru-ru/getting_started_github.md
index 120f3c24e..7a70926f5 100644
--- a/docs/ru-ru/getting_started_github.md
+++ b/docs/ru-ru/getting_started_github.md
@@ -31,7 +31,6 @@ Submodule path 'lib/chibios': checked out '587968d6cbc2b0e1c7147540872f2a67e59ca
31Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486' 31Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486'
32Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780' 32Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780'
33Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d' 33Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d'
34Submodule path 'lib/ugfx': checked out '3e97b74e03c93631cdd3ddb2ce43b963fdce19b2'
35``` 34```
36 35
37Теперь у вас есть форк QMK на вашем локальном компьютере, и вы можете добавить свою раскладку, скомпилировать ее и прошить ей свою клавиатуру. Как только вы будете довольны своими изменениями, есть возможность добавить, зафиксировать их и сделать коммит в свой форк следующим образом: 36Теперь у вас есть форк QMK на вашем локальном компьютере, и вы можете добавить свою раскладку, скомпилировать ее и прошить ей свою клавиатуру. Как только вы будете довольны своими изменениями, есть возможность добавить, зафиксировать их и сделать коммит в свой форк следующим образом:
diff --git a/docs/understanding_qmk.md b/docs/understanding_qmk.md
index da622044c..42a41fbe2 100644
--- a/docs/understanding_qmk.md
+++ b/docs/understanding_qmk.md
@@ -29,7 +29,6 @@ Within `keyboard_task()` you'll find code to handle:
29* [Matrix Scanning](#matrix-scanning) 29* [Matrix Scanning](#matrix-scanning)
30* Mouse Handling 30* Mouse Handling
31* Serial Link(s) 31* Serial Link(s)
32* Visualizer
33* Keyboard status LEDs (Caps Lock, Num Lock, Scroll Lock) 32* Keyboard status LEDs (Caps Lock, Num Lock, Scroll Lock)
34 33
35#### Matrix Scanning 34#### Matrix Scanning
@@ -180,10 +179,6 @@ FIXME: This needs to be written
180 179
181FIXME: This needs to be written 180FIXME: This needs to be written
182 181
183#### Visualizer
184
185FIXME: This needs to be written
186
187#### Keyboard state LEDs (Caps Lock, Num Lock, Scroll Lock) 182#### Keyboard state LEDs (Caps Lock, Num Lock, Scroll Lock)
188 183
189FIXME: This needs to be written 184FIXME: This needs to be written
diff --git a/docs/zh-cn/getting_started_github.md b/docs/zh-cn/getting_started_github.md
index 65994754b..b4e8e9fa5 100644
--- a/docs/zh-cn/getting_started_github.md
+++ b/docs/zh-cn/getting_started_github.md
@@ -32,7 +32,6 @@ Submodule path 'lib/chibios': checked out '587968d6cbc2b0e1c7147540872f2a67e59ca
32Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486' 32Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486'
33Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780' 33Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780'
34Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d' 34Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d'
35Submodule path 'lib/ugfx': checked out '3e97b74e03c93631cdd3ddb2ce43b963fdce19b2'
36``` 35```
37 36
38现在你本地计算机有QMK的分叉了,你可以添加你的布局了, 为你的键盘编译并刷新固件吧。如果你觉得你的修改很不错, 你可以添加,提交,然后想你的分叉推出(pull)你的改变,像这样: 37现在你本地计算机有QMK的分叉了,你可以添加你的布局了, 为你的键盘编译并刷新固件吧。如果你觉得你的修改很不错, 你可以添加,提交,然后想你的分叉推出(pull)你的改变,像这样:
diff --git a/doxygen-todo b/doxygen-todo
index 643a0df1d..54d7e9ef7 100644
--- a/doxygen-todo
+++ b/doxygen-todo
@@ -18,10 +18,4 @@ quantum/serial_link/protocol
18quantum/serial_link/system 18quantum/serial_link/system
19quantum/serial_link/tests 19quantum/serial_link/tests
20quantum/tools 20quantum/tools
21quantum/visualizer
22quantum/visualizer/resources
23drivers 21drivers
24drivers/ugfx
25drivers/ugfx/gdisp
26drivers/ugfx/gdisp/is31fl3731c
27drivers/ugfx/gdisp/st7565
diff --git a/drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h b/drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h
deleted file mode 100644
index 0755ddf6c..000000000
--- a/drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h
+++ /dev/null
@@ -1,105 +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_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#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) { (void)g; }
80
81static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) {
82 (void)g;
83 return led_mask;
84}
85
86static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y) {
87 (void)g;
88 return led_mapping[y][x];
89}
90
91static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) {
92 (void)g;
93 if (!shutdown) {
94 palSetPad(GPIOB, 16);
95 } else {
96 palClearPad(GPIOB, 16);
97 }
98}
99
100static GFXINLINE void write_data(GDisplay* g, uint8_t* data, uint16_t length) {
101 (void)g;
102 i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT));
103}
104
105#endif /* _GDISP_LLD_BOARD_H */
diff --git a/drivers/ugfx/gdisp/is31fl3731c/driver.mk b/drivers/ugfx/gdisp/is31fl3731c/driver.mk
deleted file mode 100644
index a53131bf3..000000000
--- a/drivers/ugfx/gdisp/is31fl3731c/driver.mk
+++ /dev/null
@@ -1,3 +0,0 @@
1GFXINC += drivers/ugfx/gdisp/is31fl3731c
2GFXSRC += drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
3GDISP_DRIVER_LIST += GDISPVMT_IS31FL3731C_QMK
diff --git a/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c b/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
deleted file mode 100644
index 718824402..000000000
--- a/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
+++ /dev/null
@@ -1,302 +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_QMK
23# define GDISP_SCREEN_HEIGHT LED_HEIGHT
24# define GDISP_SCREEN_WIDTH LED_WIDTH
25
26# include "gdisp_lld_config.h"
27# include "src/gdisp/gdisp_driver.h"
28
29# include "board_is31fl3731c.h"
30
31// Can't include led_tables from here
32extern const uint8_t CIE1931_CURVE[];
33
34/*===========================================================================*/
35/* Driver local definitions. */
36/*===========================================================================*/
37
38# ifndef GDISP_INITIAL_CONTRAST
39# define GDISP_INITIAL_CONTRAST 0
40# endif
41# ifndef GDISP_INITIAL_BACKLIGHT
42# define GDISP_INITIAL_BACKLIGHT 0
43# endif
44
45# define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER << 0)
46
47# define IS31_ADDR_DEFAULT 0x74
48
49# define IS31_REG_CONFIG 0x00
50// bits in reg
51# define IS31_REG_CONFIG_PICTUREMODE 0x00
52# define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
53# define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
54// D2:D0 bits are starting frame for autoplay mode
55
56# define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode
57
58# define IS31_REG_AUTOPLAYCTRL1 0x02
59// D6:D4 number of loops (000=infty)
60// D2:D0 number of frames to be used
61
62# define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms)
63
64# define IS31_REG_DISPLAYOPT 0x05
65# define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames
66# define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8
67// D2:D0 bits blink period time (*0.27s)
68
69# define IS31_REG_AUDIOSYNC 0x06
70# define IS31_REG_AUDIOSYNC_ENABLE 0x1
71
72# define IS31_REG_FRAMESTATE 0x07
73
74# define IS31_REG_BREATHCTRL1 0x08
75// D6:D4 fade out time (26ms*2^i)
76// D2:D0 fade in time (26ms*2^i)
77
78# define IS31_REG_BREATHCTRL2 0x09
79# define IS31_REG_BREATHCTRL2_ENABLE 0x10
80// D2:D0 extinguish time (3.5ms*2^i)
81
82# define IS31_REG_SHUTDOWN 0x0A
83# define IS31_REG_SHUTDOWN_OFF 0x0
84# define IS31_REG_SHUTDOWN_ON 0x1
85
86# define IS31_REG_AGCCTRL 0x0B
87# define IS31_REG_ADCRATE 0x0C
88
89# define IS31_COMMANDREGISTER 0xFD
90# define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine'
91# define IS31_FUNCTIONREG_SIZE 0xD
92
93# define IS31_FRAME_SIZE 0xB4
94
95# define IS31_PWM_REG 0x24
96# define IS31_PWM_SIZE 0x90
97
98# define IS31_LED_MASK_SIZE 0x12
99
100# define IS31
101
102/*===========================================================================*/
103/* Driver local functions. */
104/*===========================================================================*/
105
106typedef struct {
107 uint8_t write_buffer_offset;
108 uint8_t write_buffer[IS31_FRAME_SIZE];
109 uint8_t frame_buffer[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH];
110 uint8_t page;
111} __attribute__((__packed__)) PrivData;
112
113// Some common routines and macros
114# define PRIV(g) ((PrivData *)g->priv)
115
116/*===========================================================================*/
117/* Driver exported functions. */
118/*===========================================================================*/
119
120static GFXINLINE void write_page(GDisplay *g, uint8_t page) {
121 uint8_t tx[2] __attribute__((aligned(2)));
122 tx[0] = IS31_COMMANDREGISTER;
123 tx[1] = page;
124 write_data(g, tx, 2);
125}
126
127static GFXINLINE void write_register(GDisplay *g, uint8_t page, uint8_t reg, uint8_t data) {
128 uint8_t tx[2] __attribute__((aligned(2)));
129 tx[0] = reg;
130 tx[1] = data;
131 write_page(g, page);
132 write_data(g, tx, 2);
133}
134
135static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint16_t length) {
136 PRIV(g)->write_buffer_offset = offset;
137 write_page(g, page);
138 write_data(g, (uint8_t *)PRIV(g), length + 1);
139}
140
141LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
142 // The private area is the display surface.
143 g->priv = gfxAlloc(sizeof(PrivData));
144 __builtin_memset(PRIV(g), 0, sizeof(PrivData));
145 PRIV(g)->page = 0;
146
147 // Initialise the board interface
148 init_board(g);
149 gfxSleepMilliseconds(10);
150
151 // zero function page, all registers (assuming full_page is all zeroes)
152 write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
153 set_hardware_shutdown(g, false);
154 gfxSleepMilliseconds(10);
155 // software shutdown
156 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
157 gfxSleepMilliseconds(10);
158 // zero function page, all registers
159 write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
160 gfxSleepMilliseconds(10);
161
162 // zero all LED registers on all 8 pages, and enable the mask
163 __builtin_memcpy(PRIV(g)->write_buffer, get_led_mask(g), IS31_LED_MASK_SIZE);
164 for (uint8_t i = 0; i < 8; i++) {
165 write_ram(g, i, 0, IS31_FRAME_SIZE);
166 gfxSleepMilliseconds(1);
167 }
168
169 // software shutdown disable (i.e. turn stuff on)
170 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
171 gfxSleepMilliseconds(10);
172
173 // Finish Init
174 post_init_board(g);
175
176 /* Initialise the GDISP structure */
177 g->g.Width = GDISP_SCREEN_WIDTH;
178 g->g.Height = GDISP_SCREEN_HEIGHT;
179 g->g.Orientation = GDISP_ROTATE_0;
180 g->g.Powermode = powerOff;
181 g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
182 g->g.Contrast = GDISP_INITIAL_CONTRAST;
183 return TRUE;
184}
185
186# if GDISP_HARDWARE_FLUSH
187LLDSPEC void gdisp_lld_flush(GDisplay *g) {
188 // Don't flush if we don't need it.
189 if (!(g->flags & GDISP_FLG_NEEDFLUSH)) return;
190
191 PRIV(g)->page++;
192 PRIV(g)->page %= 2;
193 // TODO: some smarter algorithm for this
194 // We should run only one physical page at a time
195 // This way we don't need to send so much data, and
196 // we could use slightly less memory
197 uint8_t *src = PRIV(g)->frame_buffer;
198 for (int y = 0; y < GDISP_SCREEN_HEIGHT; y++) {
199 for (int x = 0; x < GDISP_SCREEN_WIDTH; x++) {
200 uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
201 PRIV(g)->write_buffer[get_led_address(g, x, y)] = CIE1931_CURVE[val];
202 ++src;
203 }
204 }
205 write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
206 gfxSleepMilliseconds(1);
207 write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
208
209 g->flags &= ~GDISP_FLG_NEEDFLUSH;
210}
211# endif
212
213# if GDISP_HARDWARE_DRAWPIXEL
214LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
215 coord_t x, y;
216
217 switch (g->g.Orientation) {
218 default:
219 case GDISP_ROTATE_0:
220 x = g->p.x;
221 y = g->p.y;
222 break;
223 case GDISP_ROTATE_180:
224 x = GDISP_SCREEN_WIDTH - 1 - g->p.x;
225 y = g->p.y;
226 break;
227 }
228 PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
229 g->flags |= GDISP_FLG_NEEDFLUSH;
230}
231# endif
232
233# if GDISP_HARDWARE_PIXELREAD
234LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
235 coord_t x, y;
236
237 switch (g->g.Orientation) {
238 default:
239 case GDISP_ROTATE_0:
240 x = g->p.x;
241 y = g->p.y;
242 break;
243 case GDISP_ROTATE_180:
244 x = GDISP_SCREEN_WIDTH - 1 - g->p.x;
245 y = g->p.y;
246 break;
247 }
248 return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
249}
250# endif
251
252# if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
253LLDSPEC void gdisp_lld_control(GDisplay *g) {
254 switch (g->p.x) {
255 case GDISP_CONTROL_POWER:
256 if (g->g.Powermode == (powermode_t)g->p.ptr) return;
257 switch ((powermode_t)g->p.ptr) {
258 case powerOff:
259 case powerSleep:
260 case powerDeepSleep:
261 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
262 break;
263 case powerOn:
264 write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
265 break;
266 default:
267 return;
268 }
269 g->g.Powermode = (powermode_t)g->p.ptr;
270 return;
271
272 case GDISP_CONTROL_ORIENTATION:
273 if (g->g.Orientation == (orientation_t)g->p.ptr) return;
274 switch ((orientation_t)g->p.ptr) {
275 /* Rotation is handled by the drawing routines */
276 case GDISP_ROTATE_0:
277 case GDISP_ROTATE_180:
278 g->g.Height = GDISP_SCREEN_HEIGHT;
279 g->g.Width = GDISP_SCREEN_WIDTH;
280 break;
281 case GDISP_ROTATE_90:
282 case GDISP_ROTATE_270:
283 g->g.Height = GDISP_SCREEN_WIDTH;
284 g->g.Width = GDISP_SCREEN_HEIGHT;
285 break;
286 default:
287 return;
288 }
289 g->g.Orientation = (orientation_t)g->p.ptr;
290 return;
291
292 case GDISP_CONTROL_BACKLIGHT:
293 if (g->g.Backlight == (unsigned)g->p.ptr) return;
294 unsigned val = (unsigned)g->p.ptr;
295 g->g.Backlight = val > 100 ? 100 : val;
296 g->flags |= GDISP_FLG_NEEDFLUSH;
297 return;
298 }
299}
300# endif // GDISP_NEED_CONTROL
301
302#endif // GFX_USE_GDISP
diff --git a/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h b/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h
deleted file mode 100644
index 403c6b040..000000000
--- a/drivers/ugfx/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 GFXON // This controller requires flushing
28# define GDISP_HARDWARE_DRAWPIXEL GFXON
29# define GDISP_HARDWARE_PIXELREAD GFXON
30# define GDISP_HARDWARE_CONTROL GFXON
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/drivers/ugfx/gdisp/st7565/board_st7565_template.h b/drivers/ugfx/gdisp/st7565/board_st7565_template.h
deleted file mode 100644
index 875ed9e65..000000000
--- a/drivers/ugfx/gdisp/st7565/board_st7565_template.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#ifndef _GDISP_LLD_BOARD_H
9#define _GDISP_LLD_BOARD_H
10
11#include "quantum.h"
12
13#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
14#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
15#define ST7565_PAGE_ORDER 0, 1, 2, 3
16/*
17 * Custom page order for several LCD boards, e.g. HEM12864-99
18 * #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
19 */
20
21#define ST7565_A0_PIN C7
22#define ST7565_RST_PIN C8
23#define ST7565_MOSI_PIN C6
24#define ST7565_SCLK_PIN C5
25#define ST7565_SS_PIN C4
26
27// DSPI Clock and Transfer Attributes
28// Frame Size: 8 bits
29// MSB First
30// CLK Low by default
31static const SPIConfig spi1config = {
32 // Operation complete callback or @p NULL.
33 .end_cb = NULL,
34 // The chip select line port - when not using pcs.
35 .ssport = PAL_PORT(ST7565_SS_PIN),
36 // brief The chip select line pad number - when not using pcs.
37 .sspad = PAL_PAD(ST7565_SS_PIN),
38 // SPI initialization data.
39 .tar0 = SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
40 | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
41 | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns
42 | SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns
43 | SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2
44 | SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns
45};
46
47static GFXINLINE void acquire_bus(GDisplay *g) {
48 (void)g;
49 // Only the LCD is using the SPI bus, so no need to acquire
50 // spiAcquireBus(&SPID1);
51 spiSelect(&SPID1);
52}
53
54static GFXINLINE void release_bus(GDisplay *g) {
55 (void)g;
56 // Only the LCD is using the SPI bus, so no need to release
57 // spiReleaseBus(&SPID1);
58 spiUnselect(&SPID1);
59}
60
61static GFXINLINE void init_board(GDisplay *g) {
62 (void)g;
63 setPinOutput(ST7565_A0_PIN);
64 writePinHigh(ST7565_A0_PIN);
65 setPinOutput(ST7565_RST_PIN);
66 writePinHigh(ST7565_RST_PIN);
67 setPinOutput(ST7565_SS_PIN);
68
69 palSetPadMode(PAL_PORT(ST7565_MOSI_PIN), PAL_PAD(ST7565_MOSI_PIN), PAL_MODE_ALTERNATIVE_2);
70 palSetPadMode(PAL_PORT(ST7565_SCLK_PIN), PAL_PAD(ST7565_SCLK_PIN), PAL_MODE_ALTERNATIVE_2);
71
72 spiInit();
73 spiStart(&SPID1, &spi1config);
74 release_bus(g);
75}
76
77static GFXINLINE void post_init_board(GDisplay *g) { (void)g; }
78
79static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
80 (void)g;
81 writePin(ST7565_RST_PIN, !state);
82}
83
84static GFXINLINE void write_cmd(GDisplay *g, gU8 cmd) {
85 (void)g;
86 writePinLow(ST7565_A0_PIN);
87 spiSend(&SPID1, 1, &cmd);
88}
89
90static GFXINLINE void write_data(GDisplay *g, gU8 *data, gU16 length) {
91 (void)g;
92 writePinHigh(ST7565_A0_PIN);
93 spiSend(&SPID1, length, data);
94}
95
96#endif /* _GDISP_LLD_BOARD_H */
diff --git a/drivers/ugfx/gdisp/st7565/driver.mk b/drivers/ugfx/gdisp/st7565/driver.mk
deleted file mode 100644
index 799a986b0..000000000
--- a/drivers/ugfx/gdisp/st7565/driver.mk
+++ /dev/null
@@ -1,3 +0,0 @@
1GFXINC += drivers/ugfx/gdisp/st7565
2GFXSRC += drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
3GDISP_DRIVER_LIST += GDISPVMT_ST7565_QMK
diff --git a/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c b/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
deleted file mode 100644
index f586f97e3..000000000
--- a/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
+++ /dev/null
@@ -1,314 +0,0 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#include "gfx.h"
9
10#if GFX_USE_GDISP
11
12# define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK
13# include "gdisp_lld_config.h"
14# include "src/gdisp/gdisp_driver.h"
15
16# include "board_st7565.h"
17
18/*===========================================================================*/
19/* Driver local definitions. */
20/*===========================================================================*/
21
22# ifndef GDISP_SCREEN_HEIGHT
23# define GDISP_SCREEN_HEIGHT LCD_HEIGHT
24# endif
25# ifndef GDISP_SCREEN_WIDTH
26# define GDISP_SCREEN_WIDTH LCD_WIDTH
27# endif
28# ifndef GDISP_INITIAL_CONTRAST
29# define GDISP_INITIAL_CONTRAST 35
30# endif
31# ifndef GDISP_INITIAL_BACKLIGHT
32# define GDISP_INITIAL_BACKLIGHT 100
33# endif
34
35# define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER << 0)
36
37# include "st7565.h"
38
39/*===========================================================================*/
40/* Driver config defaults for backward compatibility. */
41/*===========================================================================*/
42# ifndef ST7565_LCD_BIAS
43# define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
44# endif
45# ifndef ST7565_ADC
46# define ST7565_ADC ST7565_ADC_NORMAL
47# endif
48# ifndef ST7565_COM_SCAN
49# define ST7565_COM_SCAN ST7565_COM_SCAN_INC
50# endif
51# ifndef ST7565_PAGE_ORDER
52# define ST7565_PAGE_ORDER 0, 1, 2, 3, 4, 5, 6, 7
53# endif
54
55/*===========================================================================*/
56/* Driver local functions. */
57/*===========================================================================*/
58
59// Some common routines and macros
60# define RAM(g) ((gU8 *)g->priv)
61# define write_cmd2(g, cmd1, cmd2) \
62 { \
63 write_cmd(g, cmd1); \
64 write_cmd(g, cmd2); \
65 }
66# define write_cmd3(g, cmd1, cmd2, cmd3) \
67 { \
68 write_cmd(g, cmd1); \
69 write_cmd(g, cmd2); \
70 write_cmd(g, cmd3); \
71 }
72
73// Some common routines and macros
74# define delay(us) gfxSleepMicroseconds(us)
75# define delay_ms(ms) gfxSleepMilliseconds(ms)
76
77# define xyaddr(x, y) ((x) + ((y) >> 3) * GDISP_SCREEN_WIDTH)
78# define xybit(y) (1 << ((y)&7))
79
80/*===========================================================================*/
81/* Driver exported functions. */
82/*===========================================================================*/
83
84/*
85 * As this controller can't update on a pixel boundary we need to maintain the
86 * the entire display surface in memory so that we can do the necessary bit
87 * operations. Fortunately it is a small display in monochrome.
88 * 64 * 128 / 8 = 1024 bytes.
89 */
90
91LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
92 // The private area is the display surface.
93 g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8);
94 if (!g->priv) {
95 return gFalse;
96 }
97
98 // Initialise the board interface
99 init_board(g);
100
101 // Hardware reset
102 setpin_reset(g, TRUE);
103 gfxSleepMilliseconds(20);
104 setpin_reset(g, FALSE);
105 gfxSleepMilliseconds(20);
106 acquire_bus(g);
107
108 write_cmd(g, ST7565_LCD_BIAS);
109 write_cmd(g, ST7565_ADC);
110 write_cmd(g, ST7565_COM_SCAN);
111
112 write_cmd(g, ST7565_START_LINE | 0);
113
114 write_cmd2(g, ST7565_CONTRAST, GDISP_INITIAL_CONTRAST * 64 / 101);
115 write_cmd(g, ST7565_RESISTOR_RATIO | 0x1);
116
117 // turn on voltage converter (VC=1, VR=0, VF=0)
118 write_cmd(g, ST7565_POWER_CONTROL | 0x04);
119 delay_ms(50);
120
121 // turn on voltage regulator (VC=1, VR=1, VF=0)
122 write_cmd(g, ST7565_POWER_CONTROL | 0x06);
123 delay_ms(50);
124
125 // turn on voltage follower (VC=1, VR=1, VF=1)
126 write_cmd(g, ST7565_POWER_CONTROL | 0x07);
127 delay_ms(50);
128
129 write_cmd(g, ST7565_DISPLAY_ON);
130 write_cmd(g, ST7565_ALLON_NORMAL);
131 write_cmd(g, ST7565_INVERT_DISPLAY); // Disable Inversion of display.
132
133 write_cmd(g, ST7565_RMW);
134
135 // Finish Init
136 post_init_board(g);
137
138 // Release the bus
139 release_bus(g);
140
141 /* Initialise the GDISP structure */
142 g->g.Width = GDISP_SCREEN_WIDTH;
143 g->g.Height = GDISP_SCREEN_HEIGHT;
144 g->g.Orientation = GDISP_ROTATE_0;
145 g->g.Powermode = powerOff;
146 g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
147 g->g.Contrast = GDISP_INITIAL_CONTRAST;
148 return TRUE;
149}
150
151# if GDISP_HARDWARE_FLUSH
152LLDSPEC void gdisp_lld_flush(GDisplay *g) {
153 unsigned p;
154
155 // Don't flush if we don't need it.
156 if (!(g->flags & GDISP_FLG_NEEDFLUSH)) return;
157
158 acquire_bus(g);
159 gU8 pagemap[] = {ST7565_PAGE_ORDER};
160 for (p = 0; p < sizeof(pagemap); p++) {
161 write_cmd(g, ST7565_PAGE | pagemap[p]);
162 write_cmd(g, ST7565_COLUMN_MSB | 0);
163 write_cmd(g, ST7565_COLUMN_LSB | 0);
164 write_cmd(g, ST7565_RMW);
165 write_data(g, RAM(g) + (p * GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH);
166 }
167 release_bus(g);
168
169 g->flags &= ~GDISP_FLG_NEEDFLUSH;
170}
171# endif
172
173# if GDISP_HARDWARE_DRAWPIXEL
174LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
175 coord_t x, y;
176
177 switch (g->g.Orientation) {
178 default:
179 case GDISP_ROTATE_0:
180 x = g->p.x;
181 y = g->p.y;
182 break;
183 case GDISP_ROTATE_90:
184 x = g->p.y;
185 y = GDISP_SCREEN_HEIGHT - 1 - g->p.x;
186 break;
187 case GDISP_ROTATE_180:
188 x = GDISP_SCREEN_WIDTH - 1 - g->p.x;
189 y = GDISP_SCREEN_HEIGHT - 1 - g->p.y;
190 break;
191 case GDISP_ROTATE_270:
192 x = GDISP_SCREEN_HEIGHT - 1 - g->p.y;
193 y = g->p.x;
194 break;
195 }
196 if (gdispColor2Native(g->p.color) != Black)
197 RAM(g)[xyaddr(x, y)] |= xybit(y);
198 else
199 RAM(g)[xyaddr(x, y)] &= ~xybit(y);
200 g->flags |= GDISP_FLG_NEEDFLUSH;
201}
202# endif
203
204# if GDISP_HARDWARE_PIXELREAD
205LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
206 coord_t x, y;
207
208 switch (g->g.Orientation) {
209 default:
210 case GDISP_ROTATE_0:
211 x = g->p.x;
212 y = g->p.y;
213 break;
214 case GDISP_ROTATE_90:
215 x = g->p.y;
216 y = GDISP_SCREEN_HEIGHT - 1 - g->p.x;
217 break;
218 case GDISP_ROTATE_180:
219 x = GDISP_SCREEN_WIDTH - 1 - g->p.x;
220 y = GDISP_SCREEN_HEIGHT - 1 - g->p.y;
221 break;
222 case GDISP_ROTATE_270:
223 x = GDISP_SCREEN_HEIGHT - 1 - g->p.y;
224 y = g->p.x;
225 break;
226 }
227 return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black;
228}
229# endif
230
231# if GDISP_HARDWARE_BITFILLS
232LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
233 uint8_t *buffer = (uint8_t *)g->p.ptr;
234 int linelength = g->p.cx;
235 for (int i = 0; i < g->p.cy; i++) {
236 unsigned dstx = g->p.x;
237 unsigned dsty = g->p.y + i;
238 unsigned srcx = g->p.x1;
239 unsigned srcy = g->p.y1 + i;
240 unsigned srcbit = srcy * g->p.x2 + srcx;
241 for (int j = 0; j < linelength; j++) {
242 uint8_t src = buffer[srcbit / 8];
243 uint8_t bit = 7 - (srcbit % 8);
244 uint8_t bitset = (src >> bit) & 1;
245 uint8_t *dst = &(RAM(g)[xyaddr(dstx, dsty)]);
246 if (bitset) {
247 *dst |= xybit(dsty);
248 } else {
249 *dst &= ~xybit(dsty);
250 }
251 dstx++;
252 srcbit++;
253 }
254 }
255 g->flags |= GDISP_FLG_NEEDFLUSH;
256}
257# endif
258
259# if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
260LLDSPEC 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) return;
264 switch ((powermode_t)g->p.ptr) {
265 case powerOff:
266 case powerSleep:
267 case powerDeepSleep:
268 acquire_bus(g);
269 write_cmd(g, ST7565_DISPLAY_OFF);
270 release_bus(g);
271 break;
272 case powerOn:
273 acquire_bus(g);
274 write_cmd(g, ST7565_DISPLAY_ON);
275 release_bus(g);
276 break;
277 default:
278 return;
279 }
280 g->g.Powermode = (powermode_t)g->p.ptr;
281 return;
282
283 case GDISP_CONTROL_ORIENTATION:
284 if (g->g.Orientation == (orientation_t)g->p.ptr) return;
285 switch ((orientation_t)g->p.ptr) {
286 /* Rotation is handled by the drawing routines */
287 case GDISP_ROTATE_0:
288 case GDISP_ROTATE_180:
289 g->g.Height = GDISP_SCREEN_HEIGHT;
290 g->g.Width = GDISP_SCREEN_WIDTH;
291 break;
292 case GDISP_ROTATE_90:
293 case GDISP_ROTATE_270:
294 g->g.Height = GDISP_SCREEN_WIDTH;
295 g->g.Width = GDISP_SCREEN_HEIGHT;
296 break;
297 default:
298 return;
299 }
300 g->g.Orientation = (orientation_t)g->p.ptr;
301 return;
302
303 case GDISP_CONTROL_CONTRAST:
304 if ((unsigned)g->p.ptr > 100) g->p.ptr = (void *)100;
305 acquire_bus(g);
306 write_cmd2(g, ST7565_CONTRAST, ((((unsigned)g->p.ptr) << 6) / 101) & 0x3F);
307 release_bus(g);
308 g->g.Contrast = (unsigned)g->p.ptr;
309 return;
310 }
311}
312# endif // GDISP_NEED_CONTROL
313
314#endif // GFX_USE_GDISP
diff --git a/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h b/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
deleted file mode 100644
index 6052058ec..000000000
--- a/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#ifndef _GDISP_LLD_CONFIG_H
9#define _GDISP_LLD_CONFIG_H
10
11#if GFX_USE_GDISP
12
13/*===========================================================================*/
14/* Driver hardware support. */
15/*===========================================================================*/
16
17# define GDISP_HARDWARE_FLUSH GFXON // This controller requires flushing
18# define GDISP_HARDWARE_DRAWPIXEL GFXON
19# define GDISP_HARDWARE_PIXELREAD GFXON
20# define GDISP_HARDWARE_CONTROL GFXON
21# define GDISP_HARDWARE_BITFILLS GFXON
22
23# define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
24
25#endif /* GFX_USE_GDISP */
26
27#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/drivers/ugfx/gdisp/st7565/st7565.h b/drivers/ugfx/gdisp/st7565/st7565.h
deleted file mode 100644
index 3c77a8856..000000000
--- a/drivers/ugfx/gdisp/st7565/st7565.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#ifndef _ST7565_H
9#define _ST7565_H
10
11#define ST7565_CONTRAST 0x81
12#define ST7565_ALLON_NORMAL 0xA4
13#define ST7565_ALLON 0xA5
14#define ST7565_POSITIVE_DISPLAY 0xA6
15#define ST7565_INVERT_DISPLAY 0xA7
16#define ST7565_DISPLAY_OFF 0xAE
17#define ST7565_DISPLAY_ON 0xAF
18
19#define ST7565_LCD_BIAS_7 0xA3
20#define ST7565_LCD_BIAS_9 0xA2
21
22#define ST7565_ADC_NORMAL 0xA0
23#define ST7565_ADC_REVERSE 0xA1
24
25#define ST7565_COM_SCAN_INC 0xC0
26#define ST7565_COM_SCAN_DEC 0xC8
27
28#define ST7565_START_LINE 0x40
29#define ST7565_PAGE 0xB0
30#define ST7565_COLUMN_MSB 0x10
31#define ST7565_COLUMN_LSB 0x00
32#define ST7565_RMW 0xE0
33
34#define ST7565_RESISTOR_RATIO 0x20
35#define ST7565_POWER_CONTROL 0x28
36
37#define ST7565_RESET 0xE2
38
39#endif /* _ST7565_H */
diff --git a/keyboards/ergodox_infinity/board_is31fl3731c.h b/keyboards/ergodox_infinity/board_is31fl3731c.h
deleted file mode 100644
index b2ed2b003..000000000
--- a/keyboards/ergodox_infinity/board_is31fl3731c.h
+++ /dev/null
@@ -1,110 +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_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, TIME_US2I(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
deleted file mode 100644
index 875ed9e65..000000000
--- a/keyboards/ergodox_infinity/board_st7565.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * This file is subject to the terms of the GFX License. If a copy of
3 * the license was not distributed with this file, you can obtain one at:
4 *
5 * http://ugfx.org/license.html
6 */
7
8#ifndef _GDISP_LLD_BOARD_H
9#define _GDISP_LLD_BOARD_H
10
11#include "quantum.h"
12
13#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
14#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
15#define ST7565_PAGE_ORDER 0, 1, 2, 3
16/*
17 * Custom page order for several LCD boards, e.g. HEM12864-99
18 * #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
19 */
20
21#define ST7565_A0_PIN C7
22#define ST7565_RST_PIN C8
23#define ST7565_MOSI_PIN C6
24#define ST7565_SCLK_PIN C5
25#define ST7565_SS_PIN C4
26
27// DSPI Clock and Transfer Attributes
28// Frame Size: 8 bits
29// MSB First
30// CLK Low by default
31static const SPIConfig spi1config = {
32 // Operation complete callback or @p NULL.
33 .end_cb = NULL,
34 // The chip select line port - when not using pcs.
35 .ssport = PAL_PORT(ST7565_SS_PIN),
36 // brief The chip select line pad number - when not using pcs.
37 .sspad = PAL_PAD(ST7565_SS_PIN),
38 // SPI initialization data.
39 .tar0 = SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
40 | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
41 | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns
42 | SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns
43 | SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2
44 | SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns
45};
46
47static GFXINLINE void acquire_bus(GDisplay *g) {
48 (void)g;
49 // Only the LCD is using the SPI bus, so no need to acquire
50 // spiAcquireBus(&SPID1);
51 spiSelect(&SPID1);
52}
53
54static GFXINLINE void release_bus(GDisplay *g) {
55 (void)g;
56 // Only the LCD is using the SPI bus, so no need to release
57 // spiReleaseBus(&SPID1);
58 spiUnselect(&SPID1);
59}
60
61static GFXINLINE void init_board(GDisplay *g) {
62 (void)g;
63 setPinOutput(ST7565_A0_PIN);
64 writePinHigh(ST7565_A0_PIN);
65 setPinOutput(ST7565_RST_PIN);
66 writePinHigh(ST7565_RST_PIN);
67 setPinOutput(ST7565_SS_PIN);
68
69 palSetPadMode(PAL_PORT(ST7565_MOSI_PIN), PAL_PAD(ST7565_MOSI_PIN), PAL_MODE_ALTERNATIVE_2);
70 palSetPadMode(PAL_PORT(ST7565_SCLK_PIN), PAL_PAD(ST7565_SCLK_PIN), PAL_MODE_ALTERNATIVE_2);
71
72 spiInit();
73 spiStart(&SPID1, &spi1config);
74 release_bus(g);
75}
76
77static GFXINLINE void post_init_board(GDisplay *g) { (void)g; }
78
79static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
80 (void)g;
81 writePin(ST7565_RST_PIN, !state);
82}
83
84static GFXINLINE void write_cmd(GDisplay *g, gU8 cmd) {
85 (void)g;
86 writePinLow(ST7565_A0_PIN);
87 spiSend(&SPID1, 1, &cmd);
88}
89
90static GFXINLINE void write_data(GDisplay *g, gU8 *data, gU16 length) {
91 (void)g;
92 writePinHigh(ST7565_A0_PIN);
93 spiSend(&SPID1, length, data);
94}
95
96#endif /* _GDISP_LLD_BOARD_H */
diff --git a/keyboards/ergodox_infinity/config.h b/keyboards/ergodox_infinity/config.h
index 357ddf6c5..5dcc707a5 100644
--- a/keyboards/ergodox_infinity/config.h
+++ b/keyboards/ergodox_infinity/config.h
@@ -112,8 +112,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
112/* Set 0 if debouncing isn't needed */ 112/* Set 0 if debouncing isn't needed */
113#define DEBOUNCE 5 113#define DEBOUNCE 5
114 114
115#define VISUALIZER_USER_DATA_SIZE 16
116
117/* 115/*
118 * Feature disable options 116 * Feature disable options
119 * These options are also useful to firmware size reduction. 117 * These options are also useful to firmware size reduction.
diff --git a/keyboards/ergodox_infinity/ergodox_infinity.c b/keyboards/ergodox_infinity/ergodox_infinity.c
index 8f5b068a7..d2a311ee8 100644
--- a/keyboards/ergodox_infinity/ergodox_infinity.c
+++ b/keyboards/ergodox_infinity/ergodox_infinity.c
@@ -4,9 +4,6 @@
4#include <string.h> 4#include <string.h>
5#include "eeconfig.h" 5#include "eeconfig.h"
6#include "serial_link/system/serial_link.h" 6#include "serial_link/system/serial_link.h"
7#ifdef VISUALIZER_ENABLE
8# include "lcd_backlight.h"
9#endif
10 7
11#define RED_PIN 1 8#define RED_PIN 1
12#define GREEN_PIN 2 9#define GREEN_PIN 2
@@ -87,11 +84,7 @@ static uint16_t cie_lightness(uint16_t v) {
87 return y * 65535.0f; 84 return y * 65535.0f;
88} 85}
89 86
90#ifdef VISUALIZER_ENABLE
91void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b) {
92#else
93void ergodox_infinity_lcd_color(uint16_t r, uint16_t g, uint16_t b) { 87void ergodox_infinity_lcd_color(uint16_t r, uint16_t g, uint16_t b) {
94#endif
95 CHANNEL_RED.CnV = cie_lightness(r); 88 CHANNEL_RED.CnV = cie_lightness(r);
96 CHANNEL_GREEN.CnV = cie_lightness(g); 89 CHANNEL_GREEN.CnV = cie_lightness(g);
97 CHANNEL_BLUE.CnV = cie_lightness(b); 90 CHANNEL_BLUE.CnV = cie_lightness(b);
@@ -108,12 +101,10 @@ void keyboard_pre_init_kb() {
108 setPinOutput(B16); 101 setPinOutput(B16);
109 writePinHigh(B16); 102 writePinHigh(B16);
110#endif 103#endif
111#ifndef VISUALIZER_ENABLE
112 // The backlight always has to be initialized, otherwise it will stay lit 104 // The backlight always has to be initialized, otherwise it will stay lit
113 lcd_backlight_hal_init(); 105 lcd_backlight_hal_init();
114# ifdef ST7565_ENABLE 106#ifdef ST7565_ENABLE
115 ergodox_infinity_lcd_color(UINT16_MAX / 2, UINT16_MAX / 2, UINT16_MAX / 2); 107 ergodox_infinity_lcd_color(UINT16_MAX / 2, UINT16_MAX / 2, UINT16_MAX / 2);
116# endif
117#endif 108#endif
118 keyboard_pre_init_user(); 109 keyboard_pre_init_user();
119} 110}
diff --git a/keyboards/ergodox_infinity/ergodox_infinity.h b/keyboards/ergodox_infinity/ergodox_infinity.h
index 39a82e46d..b9636b69b 100644
--- a/keyboards/ergodox_infinity/ergodox_infinity.h
+++ b/keyboards/ergodox_infinity/ergodox_infinity.h
@@ -79,9 +79,7 @@ inline void ergodox_led_all_set(uint8_t n) {
79 ergodox_right_led_3_set(n); 79 ergodox_right_led_3_set(n);
80} 80}
81 81
82#ifndef VISUALIZER_ENABLE
83void ergodox_infinity_lcd_color(uint16_t r, uint16_t g, uint16_t b); 82void ergodox_infinity_lcd_color(uint16_t r, uint16_t g, uint16_t b);
84#endif
85 83
86#define XXX KC_NO 84#define XXX KC_NO
87 85
diff --git a/keyboards/ergodox_infinity/gfxconf.h b/keyboards/ergodox_infinity/gfxconf.h
deleted file mode 100644
index ca338399d..000000000
--- a/keyboards/ergodox_infinity/gfxconf.h
+++ /dev/null
@@ -1,27 +0,0 @@
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#include "common_gfxconf.h"
26
27#endif /* _GFXCONF_H */
diff --git a/keyboards/ergodox_infinity/rules.mk b/keyboards/ergodox_infinity/rules.mk
index 06b62f547..b6922e1ee 100644
--- a/keyboards/ergodox_infinity/rules.mk
+++ b/keyboards/ergodox_infinity/rules.mk
@@ -34,11 +34,4 @@ ST7565_ENABLE = yes
34LED_MATRIX_ENABLE = yes 34LED_MATRIX_ENABLE = yes
35LED_MATRIX_DRIVER = IS31FL3731 35LED_MATRIX_DRIVER = IS31FL3731
36 36
37# Config for Visualizer (set VISUALIZER_ENABLE = yes and ST7565_ENABLE = no to use)
38LCD_ENABLE = yes
39LCD_BACKLIGHT_ENABLE = yes
40LCD_DRIVER = st7565
41LCD_WIDTH = 128
42LCD_HEIGHT = 32
43
44LAYOUTS = ergodox 37LAYOUTS = ergodox
diff --git a/keyboards/ergodox_infinity/simple_visualizer.h b/keyboards/ergodox_infinity/simple_visualizer.h
deleted file mode 100644
index 73d0e0887..000000000
--- a/keyboards/ergodox_infinity/simple_visualizer.h
+++ /dev/null
@@ -1,123 +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_SIMPLE_VISUALIZER_H_
18#define KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_
19
20// Currently we are assuming that both the backlight and LCD are enabled
21// But it's entirely possible to write a custom visualizer that use only
22// one of them
23#ifndef LCD_BACKLIGHT_ENABLE
24#error This visualizer needs that LCD backlight is enabled
25#endif
26
27#ifndef LCD_ENABLE
28#error This visualizer needs that LCD is enabled
29#endif
30
31#include "visualizer.h"
32#include "visualizer_keyframes.h"
33#include "lcd_keyframes.h"
34#include "lcd_backlight_keyframes.h"
35#include "system/serial_link.h"
36#include "led.h"
37#include "default_animations.h"
38
39static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
40static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
41
42static bool initial_update = true;
43
44// Feel free to modify the animations below, or even add new ones if needed
45
46static keyframe_animation_t lcd_layer_display = {
47 .num_frames = 1,
48 .loop = false,
49 .frame_lengths = {gfxMillisecondsToTicks(0)},
50 .frame_functions = {lcd_keyframe_display_layer_and_led_states}
51};
52
53// The color animation animates the LCD color when you change layers
54static keyframe_animation_t color_animation = {
55 .num_frames = 2,
56 .loop = false,
57 // Note that there's a 200 ms no-operation frame,
58 // this prevents the color from changing when activating the layer
59 // momentarily
60 .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)},
61 .frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color},
62};
63
64void initialize_user_visualizer(visualizer_state_t* state) {
65 // The brightness will be dynamically adjustable in the future
66 // But for now, change it here.
67 lcd_backlight_brightness(130);
68 state->current_lcd_color = initial_color;
69 state->target_lcd_color = logo_background_color;
70 initial_update = true;
71 start_keyframe_animation(&default_startup_animation);
72}
73
74
75// This function should be implemented by the keymap visualizer
76// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
77// that the simple_visualizer assumes that you are updating
78// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
79// stopped. This can be done by either double buffering it or by using constant strings
80static void get_visualizer_layer_and_color(visualizer_state_t* state);
81
82void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
83 // Add more tests, change the colors and layer texts here
84 // Usually you want to check the high bits (higher layers first)
85 // because that's the order layers are processed for keypresses
86 // You can for check for example:
87 // state->status.layer
88 // state->status.default_layer
89 // state->status.leds (see led.h for available statuses)
90
91 uint32_t prev_color = state->target_lcd_color;
92 const char* prev_layer_text = state->layer_text;
93
94 get_visualizer_layer_and_color(state);
95
96 if (initial_update || prev_color != state->target_lcd_color) {
97 start_keyframe_animation(&color_animation);
98 }
99
100 if (initial_update || prev_layer_text != state->layer_text) {
101 start_keyframe_animation(&lcd_layer_display);
102 }
103 // You can also stop existing animations, and start your custom ones here
104 // remember that you should normally have only one animation for the LCD
105 // and one for the background. But you can also combine them if you want.
106}
107
108void user_visualizer_suspend(visualizer_state_t* state) {
109 state->layer_text = "Suspending...";
110 uint8_t hue = LCD_HUE(state->current_lcd_color);
111 uint8_t sat = LCD_SAT(state->current_lcd_color);
112 state->target_lcd_color = LCD_COLOR(hue, sat, 0);
113 start_keyframe_animation(&default_suspend_animation);
114}
115
116void user_visualizer_resume(visualizer_state_t* state) {
117 state->current_lcd_color = initial_color;
118 state->target_lcd_color = logo_background_color;
119 initial_update = true;
120 start_keyframe_animation(&default_startup_animation);
121}
122
123#endif /* KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ */
diff --git a/keyboards/ergodox_infinity/visualizer.c b/keyboards/ergodox_infinity/visualizer.c
deleted file mode 100644
index 1ea891e83..000000000
--- a/keyboards/ergodox_infinity/visualizer.c
+++ /dev/null
@@ -1,328 +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// Currently we are assuming that both the backlight and LCD are enabled
19// But it's entirely possible to write a custom visualizer that use only
20// one of them
21#ifndef LCD_BACKLIGHT_ENABLE
22#error This visualizer needs that LCD backlight is enabled
23#endif
24
25#ifndef LCD_ENABLE
26#error This visualizer needs that LCD is enabled
27#endif
28
29#include "visualizer.h"
30#include "visualizer_keyframes.h"
31#include "lcd_keyframes.h"
32#include "lcd_backlight_keyframes.h"
33#include "default_animations.h"
34
35static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
36static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
37
38static const uint32_t led_emulation_colors[4] = {
39 LCD_COLOR(0, 0, 0),
40 LCD_COLOR(255, 255, 255),
41 LCD_COLOR(84, 255, 255),
42 LCD_COLOR(168, 255, 255),
43};
44
45static uint32_t next_led_target_color = 0;
46
47typedef enum {
48 LCD_STATE_INITIAL,
49 LCD_STATE_LAYER_BITMAP,
50 LCD_STATE_BITMAP_AND_LEDS,
51} lcd_state_t;
52
53static lcd_state_t lcd_state = LCD_STATE_INITIAL;
54
55typedef struct {
56 uint8_t led_on;
57 uint8_t led1;
58 uint8_t led2;
59 uint8_t led3;
60} visualizer_user_data_t;
61
62// Don't access from visualization function, use the visualizer state instead
63static visualizer_user_data_t user_data_keyboard = {
64 .led_on = 0,
65 .led1 = LED_BRIGHTNESS_HI,
66 .led2 = LED_BRIGHTNESS_HI,
67 .led3 = LED_BRIGHTNESS_HI,
68};
69
70_Static_assert(sizeof(visualizer_user_data_t) <= VISUALIZER_USER_DATA_SIZE,
71 "Please increase the VISUALIZER_USER_DATA_SIZE");
72
73// Feel free to modify the animations below, or even add new ones if needed
74
75
76// The color animation animates the LCD color when you change layers
77static keyframe_animation_t one_led_color = {
78 .num_frames = 1,
79 .loop = false,
80 .frame_lengths = {gfxMillisecondsToTicks(0)},
81 .frame_functions = {lcd_backlight_keyframe_set_color},
82};
83
84bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) {
85 uint32_t temp = next_led_target_color;
86 next_led_target_color = state->target_lcd_color;
87 state->target_lcd_color = temp;
88 return false;
89}
90
91// The color animation animates the LCD color when you change layers
92static keyframe_animation_t two_led_colors = {
93 .num_frames = 2,
94 .loop = true,
95 .frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)},
96 .frame_functions = {lcd_backlight_keyframe_set_color, swap_led_target_color},
97};
98
99// The LCD animation alternates between the layer name display and a
100// bitmap that displays all active layers
101static keyframe_animation_t lcd_bitmap_animation = {
102 .num_frames = 1,
103 .loop = false,
104 .frame_lengths = {gfxMillisecondsToTicks(0)},
105 .frame_functions = {lcd_keyframe_display_layer_bitmap},
106};
107
108static keyframe_animation_t lcd_bitmap_leds_animation = {
109 .num_frames = 2,
110 .loop = true,
111 .frame_lengths = {gfxMillisecondsToTicks(2000), gfxMillisecondsToTicks(2000)},
112 .frame_functions = {lcd_keyframe_display_layer_bitmap, lcd_keyframe_display_led_states},
113};
114
115void initialize_user_visualizer(visualizer_state_t* state) {
116 // The brightness will be dynamically adjustable in the future
117 // But for now, change it here.
118 lcd_backlight_brightness(130);
119 state->current_lcd_color = initial_color;
120 state->target_lcd_color = logo_background_color;
121 lcd_state = LCD_STATE_INITIAL;
122 start_keyframe_animation(&default_startup_animation);
123}
124
125static inline bool is_led_on(visualizer_user_data_t* user_data, uint8_t num) {
126 return user_data->led_on & (1u << num);
127}
128
129static uint8_t get_led_index_master(visualizer_user_data_t* user_data) {
130 for (int i=0; i < 3; i++) {
131 if (is_led_on(user_data, i)) {
132 return i + 1;
133 }
134 }
135 return 0;
136}
137
138static uint8_t get_led_index_slave(visualizer_user_data_t* user_data) {
139 uint8_t master_index = get_led_index_master(user_data);
140 if (master_index!=0) {
141 for (int i=master_index; i < 3; i++) {
142 if (is_led_on(user_data, i)) {
143 return i + 1;
144 }
145 }
146 }
147
148 return 0;
149}
150
151static uint8_t get_secondary_led_index(visualizer_user_data_t* user_data) {
152 if (is_led_on(user_data, 0) &&
153 is_led_on(user_data, 1) &&
154 is_led_on(user_data, 2)) {
155 return 3;
156 }
157 return 0;
158}
159
160static uint8_t get_brightness(visualizer_user_data_t* user_data, uint8_t index) {
161 switch (index) {
162 case 1:
163 return user_data->led1;
164 case 2:
165 return user_data->led2;
166 case 3:
167 return user_data->led3;
168 }
169 return 0;
170}
171
172static void update_emulated_leds(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
173 visualizer_user_data_t* user_data_new = (visualizer_user_data_t*)state->status.user_data;
174 visualizer_user_data_t* user_data_old = (visualizer_user_data_t*)prev_status->user_data;
175
176 uint8_t new_index;
177 uint8_t old_index;
178
179 if (is_keyboard_master()) {
180 new_index = get_led_index_master(user_data_new);
181 old_index = get_led_index_master(user_data_old);
182 }
183 else {
184 new_index = get_led_index_slave(user_data_new);
185 old_index = get_led_index_slave(user_data_old);
186 }
187 uint8_t new_secondary_index = get_secondary_led_index(user_data_new);
188 uint8_t old_secondary_index = get_secondary_led_index(user_data_old);
189
190 uint8_t old_brightness = get_brightness(user_data_old, old_index);
191 uint8_t new_brightness = get_brightness(user_data_new, new_index);
192
193 uint8_t old_secondary_brightness = get_brightness(user_data_old, old_secondary_index);
194 uint8_t new_secondary_brightness = get_brightness(user_data_new, new_secondary_index);
195
196 if (lcd_state == LCD_STATE_INITIAL ||
197 new_index != old_index ||
198 new_secondary_index != old_secondary_index ||
199 new_brightness != old_brightness ||
200 new_secondary_brightness != old_secondary_brightness) {
201
202 if (new_secondary_index != 0) {
203 state->target_lcd_color = change_lcd_color_intensity(
204 led_emulation_colors[new_index], new_brightness);
205 next_led_target_color = change_lcd_color_intensity(
206 led_emulation_colors[new_secondary_index], new_secondary_brightness);
207
208 stop_keyframe_animation(&one_led_color);
209 start_keyframe_animation(&two_led_colors);
210 } else {
211 state->target_lcd_color = change_lcd_color_intensity(
212 led_emulation_colors[new_index], new_brightness);
213 stop_keyframe_animation(&two_led_colors);
214 start_keyframe_animation(&one_led_color);
215 }
216 }
217}
218
219static void update_lcd_text(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
220 if (state->status.leds) {
221 if (lcd_state != LCD_STATE_BITMAP_AND_LEDS ||
222 state->status.leds != prev_status->leds ||
223 state->status.layer != prev_status->layer ||
224 state->status.default_layer != prev_status->default_layer) {
225
226 // NOTE: that it doesn't matter if the animation isn't playing, stop will do nothing in that case
227 stop_keyframe_animation(&lcd_bitmap_animation);
228
229 lcd_state = LCD_STATE_BITMAP_AND_LEDS;
230 // For information:
231 // The logic in this function makes sure that this doesn't happen, but if you call start on an
232 // animation that is already playing it will be restarted.
233 start_keyframe_animation(&lcd_bitmap_leds_animation);
234 }
235 } else {
236 if (lcd_state != LCD_STATE_LAYER_BITMAP ||
237 state->status.layer != prev_status->layer ||
238 state->status.default_layer != prev_status->default_layer) {
239
240 stop_keyframe_animation(&lcd_bitmap_leds_animation);
241
242 lcd_state = LCD_STATE_LAYER_BITMAP;
243 start_keyframe_animation(&lcd_bitmap_animation);
244 }
245 }
246}
247
248void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) {
249 // Check the status here to start and stop animations
250 // You might have to save some state, like the current animation here so that you can start the right
251 // This function is called every time the status changes
252
253 // NOTE that this is called from the visualizer thread, so don't access anything else outside the status
254 // This is also important because the slave won't have access to the active layer for example outside the
255 // status.
256
257 update_emulated_leds(state, prev_status);
258 update_lcd_text(state, prev_status);
259
260}
261
262void user_visualizer_suspend(visualizer_state_t* state) {
263 state->layer_text = "Suspending...";
264 uint8_t hue = LCD_HUE(state->current_lcd_color);
265 uint8_t sat = LCD_SAT(state->current_lcd_color);
266 state->target_lcd_color = LCD_COLOR(hue, sat, 0);
267 start_keyframe_animation(&default_suspend_animation);
268}
269
270void user_visualizer_resume(visualizer_state_t* state) {
271 state->current_lcd_color = initial_color;
272 state->target_lcd_color = logo_background_color;
273 lcd_state = LCD_STATE_INITIAL;
274 start_keyframe_animation(&default_startup_animation);
275}
276
277void ergodox_board_led_on(void){
278 // No board led support
279}
280
281void ergodox_right_led_1_on(void){
282 user_data_keyboard.led_on |= (1u << 0);
283 visualizer_set_user_data(&user_data_keyboard);
284}
285
286void ergodox_right_led_2_on(void){
287 user_data_keyboard.led_on |= (1u << 1);
288 visualizer_set_user_data(&user_data_keyboard);
289}
290
291void ergodox_right_led_3_on(void){
292 user_data_keyboard.led_on |= (1u << 2);
293 visualizer_set_user_data(&user_data_keyboard);
294}
295
296void ergodox_board_led_off(void){
297 // No board led support
298}
299
300void ergodox_right_led_1_off(void){
301 user_data_keyboard.led_on &= ~(1u << 0);
302 visualizer_set_user_data(&user_data_keyboard);
303}
304
305void ergodox_right_led_2_off(void){
306 user_data_keyboard.led_on &= ~(1u << 1);
307 visualizer_set_user_data(&user_data_keyboard);
308}
309
310void ergodox_right_led_3_off(void){
311 user_data_keyboard.led_on &= ~(1u << 2);
312 visualizer_set_user_data(&user_data_keyboard);
313}
314
315void ergodox_right_led_1_set(uint8_t n) {
316 user_data_keyboard.led1 = n;
317 visualizer_set_user_data(&user_data_keyboard);
318}
319
320void ergodox_right_led_2_set(uint8_t n) {
321 user_data_keyboard.led2 = n;
322 visualizer_set_user_data(&user_data_keyboard);
323}
324
325void ergodox_right_led_3_set(uint8_t n) {
326 user_data_keyboard.led3 = n;
327 visualizer_set_user_data(&user_data_keyboard);
328}
diff --git a/keyboards/whitefox/gfxconf.h b/keyboards/whitefox/gfxconf.h
deleted file mode 100644
index ca338399d..000000000
--- a/keyboards/whitefox/gfxconf.h
+++ /dev/null
@@ -1,27 +0,0 @@
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#include "common_gfxconf.h"
26
27#endif /* _GFXCONF_H */
diff --git a/keyboards/whitefox/visualizer.c b/keyboards/whitefox/visualizer.c
deleted file mode 100644
index 3846e9278..000000000
--- a/keyboards/whitefox/visualizer.c
+++ /dev/null
@@ -1,54 +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#include "visualizer.h"
18#include "visualizer_keyframes.h"
19#include "default_animations.h"
20
21static bool initial_update = true;
22
23// Feel free to modify the animations below, or even add new ones if needed
24
25void initialize_user_visualizer(visualizer_state_t *state) {
26 // The brightness will be dynamically adjustable in the future
27 // But for now, change it here.
28 initial_update = true;
29 start_keyframe_animation(&default_startup_animation);
30}
31
32void update_user_visualizer_state(visualizer_state_t *state, visualizer_keyboard_status_t *prev_status) {
33 // Add more tests, change the colors and layer texts here
34 // Usually you want to check the high bits (higher layers first)
35 // because that's the order layers are processed for keypresses
36 // You can for check for example:
37 // state->status.layer
38 // state->status.default_layer
39 // state->status.leds (see led.h for available statuses)
40
41 if (initial_update) {
42 initial_update = false;
43 start_keyframe_animation(&led_test_animation);
44 }
45}
46
47void user_visualizer_suspend(visualizer_state_t *state) {
48 start_keyframe_animation(&default_suspend_animation);
49}
50
51void user_visualizer_resume(visualizer_state_t *state) {
52 initial_update = true;
53 start_keyframe_animation(&default_startup_animation);
54}
diff --git a/lib/ugfx b/lib/ugfx
deleted file mode 160000
Subproject 40b48f470addad6a4fb1177de1a69a181158739
diff --git a/quantum/keyboard.c b/quantum/keyboard.c
index 6054faa03..c2e2234f9 100644
--- a/quantum/keyboard.c
+++ b/quantum/keyboard.c
@@ -64,9 +64,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
64#ifdef SERIAL_LINK_ENABLE 64#ifdef SERIAL_LINK_ENABLE
65# include "serial_link/system/serial_link.h" 65# include "serial_link/system/serial_link.h"
66#endif 66#endif
67#ifdef VISUALIZER_ENABLE
68# include "visualizer/visualizer.h"
69#endif
70#ifdef POINTING_DEVICE_ENABLE 67#ifdef POINTING_DEVICE_ENABLE
71# include "pointing_device.h" 68# include "pointing_device.h"
72#endif 69#endif
@@ -381,7 +378,6 @@ void switch_events(uint8_t row, uint8_t col, bool pressed) {
381 * 378 *
382 * * scan matrix 379 * * scan matrix
383 * * handle mouse movements 380 * * handle mouse movements
384 * * run visualizer code
385 * * handle midi commands 381 * * handle midi commands
386 * * light LEDs 382 * * light LEDs
387 * 383 *
@@ -519,10 +515,6 @@ MATRIX_LOOP_END:
519 serial_link_update(); 515 serial_link_update();
520#endif 516#endif
521 517
522#ifdef VISUALIZER_ENABLE
523 visualizer_update(default_layer_state, layer_state, visualizer_get_mods(), host_keyboard_leds());
524#endif
525
526#ifdef POINTING_DEVICE_ENABLE 518#ifdef POINTING_DEVICE_ENABLE
527 pointing_device_task(); 519 pointing_device_task();
528#endif 520#endif
diff --git a/quantum/visualizer/LICENSE.md b/quantum/visualizer/LICENSE.md
deleted file mode 100644
index 22d4c3f08..000000000
--- a/quantum/visualizer/LICENSE.md
+++ /dev/null
@@ -1,29 +0,0 @@
1The files in this project are licensed under the MIT license
2It uses the following libraries
3uGFX - with it's own license, see the license.html file in the uGFX subfolder for more information
4tmk_core - is indirectly used and not included in the repository. It's licensed under the GPLv2 license
5Chibios - which is used by tmk_core is licensed under GPLv3.
6
7Therefore the effective license for any project using the library is GPLv3
8
9The MIT License (MIT)
10
11Copyright (c) 2016 Fred Sundvik
12
13Permission is hereby granted, free of charge, to any person obtaining a copy
14of this software and associated documentation files (the "Software"), to deal
15in the Software without restriction, including without limitation the rights
16to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17copies of the Software, and to permit persons to whom the Software is
18furnished to do so, subject to the following conditions:
19
20The above copyright notice and this permission notice shall be included in all
21copies or substantial portions of the Software.
22
23THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29SOFTWARE.
diff --git a/quantum/visualizer/common_gfxconf.h b/quantum/visualizer/common_gfxconf.h
deleted file mode 100644
index e0735b37d..000000000
--- a/quantum/visualizer/common_gfxconf.h
+++ /dev/null
@@ -1,354 +0,0 @@
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#pragma once
23
24///////////////////////////////////////////////////////////////////////////
25// GFX - Compatibility options //
26///////////////////////////////////////////////////////////////////////////
27//#define GFX_COMPAT_V2 GFXON
28//#define GFX_COMPAT_OLDCOLORS GFXON
29
30///////////////////////////////////////////////////////////////////////////
31// GOS - One of these must be defined, preferably in your Makefile //
32///////////////////////////////////////////////////////////////////////////
33//#define GFX_USE_OS_CHIBIOS GFXOFF
34//#define GFX_USE_OS_FREERTOS GFXOFF
35// #define GFX_FREERTOS_USE_TRACE GFXOFF
36//#define GFX_USE_OS_WIN32 GFXOFF
37//#define GFX_USE_OS_LINUX GFXOFF
38//#define GFX_USE_OS_OSX GFXOFF
39//#define GFX_USE_OS_ECOS GFXOFF
40//#define GFX_USE_OS_RAWRTOS GFXOFF
41//#define GFX_USE_OS_ARDUINO GFXOFF
42//#define GFX_USE_OS_KEIL GFXOFF
43//#define GFX_USE_OS_RTX5 GFXOFF
44//#define GFX_USE_OS_CMSIS GFXOFF
45//#define GFX_USE_OS_CMSIS2 GFXOFF
46//#define GFX_USE_OS_RAW32 GFXOFF
47//#define GFX_USE_OS_ZEPHYR GFXOFF
48//#define GFX_USE_OS_NIOS GFXOFF
49//#define GFX_USE_OS_QT GFXOFF
50// #define INTERRUPTS_OFF() optional_code
51// #define INTERRUPTS_ON() optional_code
52
53// Options that (should where relevant) apply to all operating systems
54#define GFX_NO_INLINE GFXON
55// #define GFX_COMPILER GFX_COMPILER_UNKNOWN
56// #define GFX_SHOW_COMPILER GFXOFF
57// #define GFX_CPU GFX_CPU_UNKNOWN
58// #define GFX_CPU_NO_ALIGNMENT_FAULTS GFXOFF
59// #define GFX_CPU_ENDIAN GFX_CPU_ENDIAN_UNKNOWN
60// #define GFX_OS_HEAP_SIZE 0
61// #define GFX_OS_NO_INIT GFXOFF
62// #define GFX_OS_INIT_NO_WARNING GFXOFF
63// #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine
64// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
65// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
66// #define GFX_OS_CALL_UGFXMAIN GFXOFF
67// #define GFX_OS_UGFXMAIN_STACKSIZE 0
68// #define GFX_EMULATE_MALLOC GFXOFF
69// #define GFX_MEM_LT64K GFXOFF
70
71///////////////////////////////////////////////////////////////////////////
72// GDISP //
73///////////////////////////////////////////////////////////////////////////
74#define GFX_USE_GDISP GFXON
75
76//#define GDISP_NEED_AUTOFLUSH GFXOFF
77//#define GDISP_NEED_TIMERFLUSH GFXOFF
78//#define GDISP_NEED_VALIDATION GFXON
79//#define GDISP_NEED_CLIP GFXON
80#define GDISP_NEED_CIRCLE GFXON
81//#define GDISP_NEED_DUALCIRCLE GFXOFF
82#define GDISP_NEED_ELLIPSE GFXON
83#define GDISP_NEED_ARC GFXON
84#define GDISP_NEED_ARCSECTORS GFXON
85#define GDISP_NEED_CONVEX_POLYGON GFXON
86//#define GDISP_NEED_SCROLL GFXOFF
87#define GDISP_NEED_PIXELREAD GFXON
88#define GDISP_NEED_CONTROL GFXON
89//#define GDISP_NEED_QUERY GFXOFF
90//#define GDISP_NEED_MULTITHREAD GFXOFF
91//#define GDISP_NEED_STREAMING GFXOFF
92#define GDISP_NEED_TEXT GFXON
93// #define GDISP_NEED_TEXT_WORDWRAP GFXOFF
94// #define GDISP_NEED_TEXT_BOXPADLR 1
95// #define GDISP_NEED_TEXT_BOXPADTB 1
96// #define GDISP_NEED_ANTIALIAS GFXOFF
97// #define GDISP_NEED_UTF8 GFXOFF
98#define GDISP_NEED_TEXT_KERNING GFXON
99// #define GDISP_INCLUDE_FONT_UI1 GFXOFF
100// #define GDISP_INCLUDE_FONT_UI2 GFXOFF // The smallest preferred font.
101// #define GDISP_INCLUDE_FONT_LARGENUMBERS GFXOFF
102// #define GDISP_INCLUDE_FONT_DEJAVUSANS10 GFXOFF
103// #define GDISP_INCLUDE_FONT_DEJAVUSANS12 GFXOFF
104// #define GDISP_INCLUDE_FONT_DEJAVUSANS16 GFXOFF
105// #define GDISP_INCLUDE_FONT_DEJAVUSANS20 GFXOFF
106// #define GDISP_INCLUDE_FONT_DEJAVUSANS24 GFXOFF
107// #define GDISP_INCLUDE_FONT_DEJAVUSANS32 GFXOFF
108#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 GFXON
109// #define GDISP_INCLUDE_FONT_FIXED_10X20 GFXOFF
110// #define GDISP_INCLUDE_FONT_FIXED_7X14 GFXOFF
111#define GDISP_INCLUDE_FONT_FIXED_5X8 GFXON
112// #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA GFXOFF
113// #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA GFXOFF
114// #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA GFXOFF
115// #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA GFXOFF
116// #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA GFXOFF
117// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA GFXOFF
118// #define GDISP_INCLUDE_USER_FONTS GFXOFF
119
120//#define GDISP_NEED_IMAGE GFXOFF
121// #define GDISP_NEED_IMAGE_NATIVE GFXOFF
122// #define GDISP_NEED_IMAGE_GIF GFXOFF
123// #define GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE 32
124// #define GDISP_NEED_IMAGE_BMP GFXOFF
125// #define GDISP_NEED_IMAGE_BMP_1 GFXON
126// #define GDISP_NEED_IMAGE_BMP_4 GFXON
127// #define GDISP_NEED_IMAGE_BMP_4_RLE GFXON
128// #define GDISP_NEED_IMAGE_BMP_8 GFXON
129// #define GDISP_NEED_IMAGE_BMP_8_RLE GFXON
130// #define GDISP_NEED_IMAGE_BMP_16 GFXON
131// #define GDISP_NEED_IMAGE_BMP_24 GFXON
132// #define GDISP_NEED_IMAGE_BMP_32 GFXON
133// #define GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE 32
134// #define GDISP_NEED_IMAGE_JPG GFXOFF
135// #define GDISP_NEED_IMAGE_PNG GFXOFF
136// #define GDISP_NEED_IMAGE_PNG_INTERLACED GFXOFF
137// #define GDISP_NEED_IMAGE_PNG_TRANSPARENCY GFXON
138// #define GDISP_NEED_IMAGE_PNG_BACKGROUND GFXON
139// #define GDISP_NEED_IMAGE_PNG_ALPHACLIFF 32
140// #define GDISP_NEED_IMAGE_PNG_PALETTE_124 GFXON
141// #define GDISP_NEED_IMAGE_PNG_PALETTE_8 GFXON
142// #define GDISP_NEED_IMAGE_PNG_GRAYSCALE_124 GFXON
143// #define GDISP_NEED_IMAGE_PNG_GRAYSCALE_8 GFXON
144// #define GDISP_NEED_IMAGE_PNG_GRAYSCALE_16 GFXON
145// #define GDISP_NEED_IMAGE_PNG_GRAYALPHA_8 GFXON
146// #define GDISP_NEED_IMAGE_PNG_GRAYALPHA_16 GFXON
147// #define GDISP_NEED_IMAGE_PNG_RGB_8 GFXON
148// #define GDISP_NEED_IMAGE_PNG_RGB_16 GFXON
149// #define GDISP_NEED_IMAGE_PNG_RGBALPHA_8 GFXON
150// #define GDISP_NEED_IMAGE_PNG_RGBALPHA_16 GFXON
151// #define GDISP_IMAGE_PNG_BLIT_BUFFER_SIZE 32
152// #define GDISP_IMAGE_PNG_FILE_BUFFER_SIZE 8
153// #define GDISP_IMAGE_PNG_Z_BUFFER_SIZE 32768
154// #define GDISP_NEED_IMAGE_ACCOUNTING GFXOFF
155
156//#define GDISP_NEED_PIXMAP GFXOFF
157// #define GDISP_NEED_PIXMAP_IMAGE GFXOFF
158
159//#define GDISP_DEFAULT_ORIENTATION gOrientationLandscape // If not defined the native hardware orientation is used.
160//#define GDISP_LINEBUF_SIZE 128
161//#define GDISP_STARTUP_COLOR GFX_BLACK
162#define GDISP_NEED_STARTUP_LOGO GFXOFF
163
164//#define GDISP_TOTAL_DISPLAYS 1
165
166//#define GDISP_DRIVER_LIST GDISPVMT_Win32, GDISPVMT_Win32
167#ifdef GDISP_DRIVER_LIST
168// // For code and speed optimization define as GFXON or GFXOFF if all controllers have the same capability
169# define GDISP_HARDWARE_STREAM_WRITE GFXOFF
170# define GDISP_HARDWARE_STREAM_READ GFXOFF
171# define GDISP_HARDWARE_STREAM_POS GFXOFF
172# define GDISP_HARDWARE_DRAWPIXEL GFXON
173# define GDISP_HARDWARE_CLEARS GFXOFF
174# define GDISP_HARDWARE_FILLS GFXOFF
175//#define GDISP_HARDWARE_BITFILLS GFXOFF
176# define GDISP_HARDWARE_SCROLL GFXOFF
177# define GDISP_HARDWARE_PIXELREAD GFXON
178# define GDISP_HARDWARE_CONTROL GFXON
179# define GDISP_HARDWARE_QUERY GFXOFF
180# define GDISP_HARDWARE_CLIP GFXOFF
181
182# define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
183#endif
184
185#define GDISP_USE_GFXNET GFXOFF
186// #define GDISP_GFXNET_PORT 13001
187// #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP GFXOFF
188// #define GDISP_DONT_WAIT_FOR_NET_DISPLAY GFXOFF
189// #define GDISP_GFXNET_UNSAFE_SOCKETS GFXOFF
190
191///////////////////////////////////////////////////////////////////////////
192// GWIN //
193///////////////////////////////////////////////////////////////////////////
194#define GFX_USE_GWIN GFXOFF
195
196//#define GWIN_NEED_WINDOWMANAGER GFXOFF
197// #define GWIN_REDRAW_IMMEDIATE GFXOFF
198// #define GWIN_REDRAW_SINGLEOP GFXOFF
199// #define GWIN_NEED_FLASHING GFXOFF
200// #define GWIN_FLASHING_PERIOD 250
201
202//#define GWIN_NEED_CONSOLE GFXOFF
203// #define GWIN_CONSOLE_USE_HISTORY GFXOFF
204// #define GWIN_CONSOLE_HISTORY_AVERAGING GFXOFF
205// #define GWIN_CONSOLE_HISTORY_ATCREATE GFXOFF
206// #define GWIN_CONSOLE_ESCSEQ GFXOFF
207// #define GWIN_CONSOLE_USE_BASESTREAM GFXOFF
208// #define GWIN_CONSOLE_USE_FLOAT GFXOFF
209//#define GWIN_NEED_GRAPH GFXOFF
210//#define GWIN_NEED_GL3D GFXOFF
211
212//#define GWIN_NEED_WIDGET GFXOFF
213//#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1
214// #define GWIN_NEED_LABEL GFXOFF
215// #define GWIN_LABEL_ATTRIBUTE GFXOFF
216// #define GWIN_NEED_BUTTON GFXOFF
217// #define GWIN_BUTTON_LAZY_RELEASE GFXOFF
218// #define GWIN_NEED_SLIDER GFXOFF
219// #define GWIN_SLIDER_NOSNAP GFXOFF
220// #define GWIN_SLIDER_DEAD_BAND 5
221// #define GWIN_SLIDER_TOGGLE_INC 20
222// #define GWIN_NEED_CHECKBOX GFXOFF
223// #define GWIN_NEED_IMAGE GFXOFF
224// #define GWIN_NEED_IMAGE_ANIMATION GFXOFF
225// #define GWIN_NEED_RADIO GFXOFF
226// #define GWIN_NEED_LIST GFXOFF
227// #define GWIN_NEED_LIST_IMAGES GFXOFF
228// #define GWIN_NEED_PROGRESSBAR GFXOFF
229// #define GWIN_PROGRESSBAR_AUTO GFXOFF
230// #define GWIN_NEED_KEYBOARD GFXOFF
231// #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1
232// #define GWIN_NEED_KEYBOARD_ENGLISH1 GFXON
233// #define GWIN_NEED_TEXTEDIT GFXOFF
234// #define GWIN_FLAT_STYLING GFXOFF
235// #define GWIN_WIDGET_TAGS GFXOFF
236
237//#define GWIN_NEED_CONTAINERS GFXOFF
238// #define GWIN_NEED_CONTAINER GFXOFF
239// #define GWIN_NEED_FRAME GFXOFF
240// #define GWIN_NEED_TABSET GFXOFF
241// #define GWIN_TABSET_TABHEIGHT 18
242
243///////////////////////////////////////////////////////////////////////////
244// GTRANS //
245///////////////////////////////////////////////////////////////////////////
246//#define GFX_USE_GTRANS GFXOFF
247
248///////////////////////////////////////////////////////////////////////////
249// GEVENT //
250///////////////////////////////////////////////////////////////////////////
251#define GFX_USE_GEVENT GFXON
252
253//#define GEVENT_ASSERT_NO_RESOURCE GFXOFF
254//#define GEVENT_MAXIMUM_SIZE 32
255//#define GEVENT_MAX_SOURCE_LISTENERS 32
256
257///////////////////////////////////////////////////////////////////////////
258// GTIMER //
259///////////////////////////////////////////////////////////////////////////
260#define GFX_USE_GTIMER GFXOFF
261
262//#define GTIMER_THREAD_PRIORITY gThreadpriorityHigh
263//#define GTIMER_THREAD_WORKAREA_SIZE 2048
264
265///////////////////////////////////////////////////////////////////////////
266// GQUEUE //
267///////////////////////////////////////////////////////////////////////////
268#define GFX_USE_GQUEUE GFXOFF
269
270//#define GQUEUE_NEED_ASYNC GFXOFF
271//#define GQUEUE_NEED_GSYNC GFXOFF
272//#define GQUEUE_NEED_FSYNC GFXOFF
273//#define GQUEUE_NEED_BUFFERS GFXOFF
274
275///////////////////////////////////////////////////////////////////////////
276// GINPUT //
277///////////////////////////////////////////////////////////////////////////
278#define GFX_USE_GINPUT GFXOFF
279
280//#define GINPUT_NEED_MOUSE GFXOFF
281// #define GINPUT_TOUCH_STARTRAW GFXOFF
282// #define GINPUT_TOUCH_NOTOUCH GFXOFF
283// #define GINPUT_TOUCH_NOCALIBRATE GFXOFF
284// #define GINPUT_TOUCH_NOCALIBRATE_GUI GFXOFF
285// #define GINPUT_MOUSE_POLL_PERIOD 25
286// #define GINPUT_MOUSE_CLICK_TIME 300
287// #define GINPUT_TOUCH_CXTCLICK_TIME 700
288// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD GFXOFF
289// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE GFXOFF
290// #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32
291// #define GINPUT_TOUCH_CALIBRATION_FONT1 "* Double"
292// #define GINPUT_TOUCH_CALIBRATION_FONT2 "* Narrow"
293// #define GINPUT_TOUCH_CALIBRATION_TITLE "Calibration"
294// #define GINPUT_TOUCH_CALIBRATION_ERROR "Calibration Failed!"
295//#define GINPUT_NEED_KEYBOARD GFXOFF
296// #define GINPUT_KEYBOARD_POLL_PERIOD 200
297// #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
298// #define GKEYBOARD_LAYOUT_OFF GFXOFF
299// #define GKEYBOARD_LAYOUT_SCANCODE2_US GFXOFF
300//#define GINPUT_NEED_TOGGLE GFXOFF
301//#define GINPUT_NEED_DIAL GFXOFF
302
303///////////////////////////////////////////////////////////////////////////
304// GFILE //
305///////////////////////////////////////////////////////////////////////////
306#define GFX_USE_GFILE GFXOFF
307
308//#define GFILE_NEED_PRINTG GFXOFF
309//#define GFILE_NEED_SCANG GFXOFF
310//#define GFILE_NEED_STRINGS GFXOFF
311//#define GFILE_NEED_FILELISTS GFXOFF
312//#define GFILE_NEED_STDIO GFXOFF
313//#define GFILE_NEED_NOAUTOMOUNT GFXOFF
314//#define GFILE_NEED_NOAUTOSYNC GFXOFF
315
316//#define GFILE_NEED_MEMFS GFXOFF
317//#define GFILE_NEED_ROMFS GFXOFF
318//#define GFILE_NEED_RAMFS GFXOFF
319//#define GFILE_NEED_FATFS GFXOFF
320//#define GFILE_NEED_NATIVEFS GFXOFF
321//#define GFILE_NEED_CHBIOSFS GFXOFF
322//#define GFILE_NEED_USERFS GFXOFF
323
324//#define GFILE_ALLOW_FLOATS GFXOFF
325//#define GFILE_ALLOW_DEVICESPECIFIC GFXOFF
326//#define GFILE_MAX_GFILES 3
327
328///////////////////////////////////////////////////////////////////////////
329// GADC //
330///////////////////////////////////////////////////////////////////////////
331#define GFX_USE_GADC GFXOFF
332// #define GADC_MAX_LOWSPEED_DEVICES 4
333
334///////////////////////////////////////////////////////////////////////////
335// GAUDIO //
336///////////////////////////////////////////////////////////////////////////
337#define GFX_USE_GAUDIO GFXOFF
338// #define GAUDIO_NEED_PLAY GFXOFF
339// #define GAUDIO_NEED_RECORD GFXOFF
340
341///////////////////////////////////////////////////////////////////////////
342// GMISC //
343///////////////////////////////////////////////////////////////////////////
344#define GFX_USE_GMISC GFXON
345
346//#define GMISC_NEED_ARRAYOPS GFXOFF
347//#define GMISC_NEED_FASTTRIG GFXOFF
348//#define GMISC_NEED_FIXEDTRIG GFXOFF
349//#define GMISC_NEED_INVSQRT GFXOFF
350// #define GMISC_INVSQRT_MIXED_ENDIAN GFXOFF
351// #define GMISC_INVSQRT_REAL_SLOW GFXOFF
352#define GMISC_NEED_MATRIXFLOAT2D GFXON
353#define GMISC_NEED_MATRIXFIXED2D GFXOFF
354//#define GMISC_NEED_HITTEST_POLY GFXOFF
diff --git a/quantum/visualizer/default_animations.c b/quantum/visualizer/default_animations.c
deleted file mode 100644
index 2f43c67cc..000000000
--- a/quantum/visualizer/default_animations.c
+++ /dev/null
@@ -1,177 +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 "default_animations.h"
20# include "visualizer.h"
21# ifdef LCD_ENABLE
22# include "lcd_keyframes.h"
23# endif
24# ifdef LCD_BACKLIGHT_ENABLE
25# include "lcd_backlight_keyframes.h"
26# endif
27
28# ifdef BACKLIGHT_ENABLE
29# include "led_backlight_keyframes.h"
30# endif
31
32# include "visualizer_keyframes.h"
33
34# if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE)
35
36static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
37# ifdef LCD_ENABLE
38 lcd_keyframe_enable(animation, state);
39# endif
40# ifdef LCD_BACKLIGHT_ENABLE
41 lcd_backlight_keyframe_enable(animation, state);
42# endif
43# ifdef BACKLIGHT_ENABLE
44 led_backlight_keyframe_enable(animation, state);
45# endif
46 return false;
47}
48
49static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
50# ifdef LCD_ENABLE
51 lcd_keyframe_disable(animation, state);
52# endif
53# ifdef LCD_BACKLIGHT_ENABLE
54 lcd_backlight_keyframe_disable(animation, state);
55# endif
56# ifdef BACKLIGHT_ENABLE
57 led_backlight_keyframe_disable(animation, state);
58# endif
59 return false;
60}
61
62static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
63 bool ret = false;
64# ifdef LCD_BACKLIGHT_ENABLE
65 ret |= lcd_backlight_keyframe_animate_color(animation, state);
66# endif
67# ifdef BACKLIGHT_ENABLE
68 ret |= led_backlight_keyframe_fade_in_all(animation, state);
69# endif
70 return ret;
71}
72
73static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
74 bool ret = false;
75# ifdef LCD_BACKLIGHT_ENABLE
76 ret |= lcd_backlight_keyframe_animate_color(animation, state);
77# endif
78# ifdef BACKLIGHT_ENABLE
79 ret |= led_backlight_keyframe_fade_out_all(animation, state);
80# endif
81 return ret;
82}
83
84// Don't worry, if the startup animation is long, you can use the keyboard like normal
85// during that time
86keyframe_animation_t default_startup_animation = {
87# if LCD_ENABLE
88 .num_frames = 3,
89# else
90 .num_frames = 2,
91# endif
92 .loop = false,
93 .frame_lengths = {0,
94# if LCD_ENABLE
95 0,
96# endif
97 gfxMillisecondsToTicks(5000)},
98 .frame_functions =
99 {
100 keyframe_enable,
101# if LCD_ENABLE
102 lcd_keyframe_draw_logo,
103# endif
104 keyframe_fade_in,
105 },
106};
107
108keyframe_animation_t default_suspend_animation = {
109# if LCD_ENABLE
110 .num_frames = 3,
111# else
112 .num_frames = 2,
113# endif
114 .loop = false,
115 .frame_lengths =
116 {
117# if LCD_ENABLE
118 0,
119# endif
120 gfxMillisecondsToTicks(1000), 0},
121 .frame_functions =
122 {
123# if LCD_ENABLE
124 lcd_keyframe_display_layer_text,
125# endif
126 keyframe_fade_out,
127 keyframe_disable,
128 },
129};
130# endif
131
132# if defined(BACKLIGHT_ENABLE)
133# define CROSSFADE_TIME 1000
134# define GRADIENT_TIME 3000
135
136keyframe_animation_t led_test_animation = {
137 .num_frames = 14,
138 .loop = true,
139 .frame_lengths =
140 {
141 gfxMillisecondsToTicks(1000), // fade in
142 gfxMillisecondsToTicks(1000), // no op (leds on)
143 gfxMillisecondsToTicks(1000), // fade out
144 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
145 gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in)
146 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
147 gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
148 0, // mirror leds
149 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
150 gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out)
151 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
152 gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
153 0, // normal leds
154 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
155
156 },
157 .frame_functions =
158 {
159 led_backlight_keyframe_fade_in_all,
160 keyframe_no_operation,
161 led_backlight_keyframe_fade_out_all,
162 led_backlight_keyframe_crossfade,
163 led_backlight_keyframe_left_to_right_gradient,
164 led_backlight_keyframe_crossfade,
165 led_backlight_keyframe_top_to_bottom_gradient,
166 led_backlight_keyframe_mirror_orientation,
167 led_backlight_keyframe_crossfade,
168 led_backlight_keyframe_left_to_right_gradient,
169 led_backlight_keyframe_crossfade,
170 led_backlight_keyframe_top_to_bottom_gradient,
171 led_backlight_keyframe_normal_orientation,
172 led_backlight_keyframe_crossfade,
173 },
174};
175# endif
176
177#endif
diff --git a/quantum/visualizer/default_animations.h b/quantum/visualizer/default_animations.h
deleted file mode 100644
index 9accd8977..000000000
--- a/quantum/visualizer/default_animations.h
+++ /dev/null
@@ -1,27 +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#pragma once
18
19#include "visualizer.h"
20
21// You can use these default animations, but of course you can also write your own custom ones instead
22extern keyframe_animation_t default_startup_animation;
23extern keyframe_animation_t default_suspend_animation;
24
25// An animation for testing and demonstrating the led support, should probably not be used for real world
26// cases
27extern keyframe_animation_t led_test_animation;
diff --git a/quantum/visualizer/lcd_backlight.c b/quantum/visualizer/lcd_backlight.c
deleted file mode 100644
index 23978974e..000000000
--- a/quantum/visualizer/lcd_backlight.c
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2The MIT License (MIT)
3
4Copyright (c) 2016 Fred Sundvik
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE.
23*/
24
25#include "lcd_backlight.h"
26#include <math.h>
27
28static uint8_t current_hue = 0;
29static uint8_t current_saturation = 0;
30static uint8_t current_intensity = 0;
31static uint8_t current_brightness = 0;
32
33void lcd_backlight_init(void) {
34 lcd_backlight_hal_init();
35 lcd_backlight_color(current_hue, current_saturation, current_intensity);
36}
37
38// This code is based on Brian Neltner's blogpost and example code
39// "Why every LED light should be using HSI colorspace".
40// http://blog.saikoled.com/post/43693602826/why-every-led-light-should-be-using-hsi
41static void hsi_to_rgb(float h, float s, float i, uint16_t* r_out, uint16_t* g_out, uint16_t* b_out) {
42 unsigned int r, g, b;
43 h = fmodf(h, 360.0f); // cycle h around to 0-360 degrees
44 h = 3.14159f * h / 180.0f; // Convert to radians.
45 s = s > 0.0f ? (s < 1.0f ? s : 1.0f) : 0.0f; // clamp s and i to interval [0,1]
46 i = i > 0.0f ? (i < 1.0f ? i : 1.0f) : 0.0f;
47
48 // Math! Thanks in part to Kyle Miller.
49 if (h < 2.09439f) {
50 r = 65535.0f * i / 3.0f * (1.0f + s * cos(h) / cosf(1.047196667f - h));
51 g = 65535.0f * i / 3.0f * (1.0f + s * (1.0f - cosf(h) / cos(1.047196667f - h)));
52 b = 65535.0f * i / 3.0f * (1.0f - s);
53 } else if (h < 4.188787) {
54 h = h - 2.09439;
55 g = 65535.0f * i / 3.0f * (1.0f + s * cosf(h) / cosf(1.047196667f - h));
56 b = 65535.0f * i / 3.0f * (1.0f + s * (1.0f - cosf(h) / cosf(1.047196667f - h)));
57 r = 65535.0f * i / 3.0f * (1.0f - s);
58 } else {
59 h = h - 4.188787;
60 b = 65535.0f * i / 3.0f * (1.0f + s * cosf(h) / cosf(1.047196667f - h));
61 r = 65535.0f * i / 3.0f * (1.0f + s * (1.0f - cosf(h) / cosf(1.047196667f - h)));
62 g = 65535.0f * i / 3.0f * (1.0f - s);
63 }
64 *r_out = r > 65535 ? 65535 : r;
65 *g_out = g > 65535 ? 65535 : g;
66 *b_out = b > 65535 ? 65535 : b;
67}
68
69void lcd_backlight_color(uint8_t hue, uint8_t saturation, uint8_t intensity) {
70 uint16_t r, g, b;
71 float hue_f = 360.0f * (float)hue / 255.0f;
72 float saturation_f = (float)saturation / 255.0f;
73 float intensity_f = (float)intensity / 255.0f;
74 intensity_f *= (float)current_brightness / 255.0f;
75 hsi_to_rgb(hue_f, saturation_f, intensity_f, &r, &g, &b);
76 current_hue = hue;
77 current_saturation = saturation;
78 current_intensity = intensity;
79 lcd_backlight_hal_color(r, g, b);
80}
81
82void lcd_backlight_brightness(uint8_t b) {
83 current_brightness = b;
84 lcd_backlight_color(current_hue, current_saturation, current_intensity);
85}
86
87uint8_t lcd_get_backlight_brightness(void) { return current_brightness; }
diff --git a/quantum/visualizer/lcd_backlight.h b/quantum/visualizer/lcd_backlight.h
deleted file mode 100644
index 4ea5b1463..000000000
--- a/quantum/visualizer/lcd_backlight.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2The MIT License (MIT)
3
4Copyright (c) 2016 Fred Sundvik
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE.
23*/
24
25#pragma once
26
27#include <stdint.h>
28
29// Helper macros for storing hue, staturation and intensity as unsigned integers
30#define LCD_COLOR(hue, saturation, intensity) (hue << 16 | saturation << 8 | intensity)
31#define LCD_HUE(color) ((color >> 16) & 0xFF)
32#define LCD_SAT(color) ((color >> 8) & 0xFF)
33#define LCD_INT(color) (color & 0xFF)
34
35static inline uint32_t change_lcd_color_intensity(uint32_t color, uint8_t new_intensity) { return (color & 0xFFFFFF00) | new_intensity; }
36
37void lcd_backlight_init(void);
38void lcd_backlight_color(uint8_t hue, uint8_t saturation, uint8_t intensity);
39void lcd_backlight_brightness(uint8_t b);
40uint8_t lcd_get_backlight_brightness(void);
41
42void lcd_backlight_hal_init(void);
43void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b);
diff --git a/quantum/visualizer/lcd_backlight_keyframes.c b/quantum/visualizer/lcd_backlight_keyframes.c
deleted file mode 100644
index c13cce311..000000000
--- a/quantum/visualizer/lcd_backlight_keyframes.c
+++ /dev/null
@@ -1,69 +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#include "lcd_backlight_keyframes.h"
18
19bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) {
20 int frame_length = animation->frame_lengths[animation->current_frame];
21 int current_pos = frame_length - animation->time_left_in_frame;
22 uint8_t t_h = LCD_HUE(state->target_lcd_color);
23 uint8_t t_s = LCD_SAT(state->target_lcd_color);
24 uint8_t t_i = LCD_INT(state->target_lcd_color);
25 uint8_t p_h = LCD_HUE(state->prev_lcd_color);
26 uint8_t p_s = LCD_SAT(state->prev_lcd_color);
27 uint8_t p_i = LCD_INT(state->prev_lcd_color);
28
29 uint8_t d_h1 = t_h - p_h; // Modulo arithmetic since we want to wrap around
30 int d_h2 = t_h - p_h;
31 // Chose the shortest way around
32 int d_h = abs(d_h2) < d_h1 ? d_h2 : d_h1;
33 int d_s = t_s - p_s;
34 int d_i = t_i - p_i;
35
36 int hue = (d_h * current_pos) / frame_length;
37 int sat = (d_s * current_pos) / frame_length;
38 int intensity = (d_i * current_pos) / frame_length;
39 // dprintf("%X -> %X = %X\n", p_h, t_h, hue);
40 hue += p_h;
41 sat += p_s;
42 intensity += p_i;
43 state->current_lcd_color = LCD_COLOR(hue, sat, intensity);
44 lcd_backlight_color(LCD_HUE(state->current_lcd_color), LCD_SAT(state->current_lcd_color), LCD_INT(state->current_lcd_color));
45
46 return true;
47}
48
49bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) {
50 (void)animation;
51 state->prev_lcd_color = state->target_lcd_color;
52 state->current_lcd_color = state->target_lcd_color;
53 lcd_backlight_color(LCD_HUE(state->current_lcd_color), LCD_SAT(state->current_lcd_color), LCD_INT(state->current_lcd_color));
54 return false;
55}
56
57bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
58 (void)animation;
59 (void)state;
60 lcd_backlight_hal_color(0, 0, 0);
61 return false;
62}
63
64bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
65 (void)animation;
66 (void)state;
67 lcd_backlight_color(LCD_HUE(state->current_lcd_color), LCD_SAT(state->current_lcd_color), LCD_INT(state->current_lcd_color));
68 return false;
69}
diff --git a/quantum/visualizer/lcd_backlight_keyframes.h b/quantum/visualizer/lcd_backlight_keyframes.h
deleted file mode 100644
index 88768dd4a..000000000
--- a/quantum/visualizer/lcd_backlight_keyframes.h
+++ /dev/null
@@ -1,27 +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#pragma once
18
19#include "visualizer.h"
20
21// Animates the LCD backlight color between the current color and the target color (of the state)
22bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state);
23// Sets the backlight color to the target color
24bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state);
25
26bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
27bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
diff --git a/quantum/visualizer/lcd_keyframes.c b/quantum/visualizer/lcd_keyframes.c
deleted file mode 100644
index 1d6f3dca1..000000000
--- a/quantum/visualizer/lcd_keyframes.c
+++ /dev/null
@@ -1,184 +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#include "lcd_keyframes.h"
18#include <string.h>
19#include "action_util.h"
20#include "led.h"
21#include "resources/resources.h"
22
23bool lcd_keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state) {
24 (void)animation;
25 gdispClear(White);
26 gdispDrawString(0, 10, state->layer_text, state->font_dejavusansbold12, Black);
27 return false;
28}
29
30static void format_layer_bitmap_string(uint16_t default_layer, uint16_t layer, char* buffer) {
31 for (int i = 0; i < 16; i++) {
32 uint32_t mask = (1u << i);
33 if (default_layer & mask) {
34 if (layer & mask) {
35 *buffer = 'B';
36 } else {
37 *buffer = 'D';
38 }
39 } else if (layer & mask) {
40 *buffer = '1';
41 } else {
42 *buffer = '0';
43 }
44 ++buffer;
45
46 if (i == 3 || i == 7 || i == 11) {
47 *buffer = ' ';
48 ++buffer;
49 }
50 }
51 *buffer = 0;
52}
53
54bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) {
55 (void)animation;
56 const char* layer_help = "1=On D=Default B=Both";
57 char layer_buffer[16 + 4]; // 3 spaces and one null terminator
58 gdispClear(White);
59 gdispDrawString(0, 0, layer_help, state->font_fixed5x8, Black);
60 format_layer_bitmap_string(state->status.default_layer, state->status.layer, layer_buffer);
61 gdispDrawString(0, 10, layer_buffer, state->font_fixed5x8, Black);
62 format_layer_bitmap_string(state->status.default_layer >> 16, state->status.layer >> 16, layer_buffer);
63 gdispDrawString(0, 20, layer_buffer, state->font_fixed5x8, Black);
64 return false;
65}
66
67static void format_mods_bitmap_string(uint8_t mods, char* buffer) {
68 *buffer = ' ';
69 ++buffer;
70
71 for (int i = 0; i < 8; i++) {
72 uint32_t mask = (1u << i);
73 if (mods & mask) {
74 *buffer = '1';
75 } else {
76 *buffer = '0';
77 }
78 ++buffer;
79
80 if (i == 3) {
81 *buffer = ' ';
82 ++buffer;
83 }
84 }
85 *buffer = 0;
86}
87
88bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) {
89 (void)animation;
90
91 const char* title = "Modifier states";
92 const char* mods_header = " CSAG CSAG ";
93 char status_buffer[12];
94
95 gdispClear(White);
96 gdispDrawString(0, 0, title, state->font_fixed5x8, Black);
97 gdispDrawString(0, 10, mods_header, state->font_fixed5x8, Black);
98 format_mods_bitmap_string(state->status.mods, status_buffer);
99 gdispDrawString(0, 20, status_buffer, state->font_fixed5x8, Black);
100
101 return false;
102}
103
104#define LED_STATE_STRING_SIZE sizeof("NUM CAPS SCRL COMP KANA")
105
106static void get_led_state_string(char* output, visualizer_state_t* state) {
107 uint8_t pos = 0;
108
109 if (state->status.leds & (1u << USB_LED_NUM_LOCK)) {
110 memcpy(output + pos, "NUM ", 4);
111 pos += 4;
112 }
113 if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
114 memcpy(output + pos, "CAPS ", 5);
115 pos += 5;
116 }
117 if (state->status.leds & (1u << USB_LED_SCROLL_LOCK)) {
118 memcpy(output + pos, "SCRL ", 5);
119 pos += 5;
120 }
121 if (state->status.leds & (1u << USB_LED_COMPOSE)) {
122 memcpy(output + pos, "COMP ", 5);
123 pos += 5;
124 }
125 if (state->status.leds & (1u << USB_LED_KANA)) {
126 memcpy(output + pos, "KANA", 4);
127 pos += 4;
128 }
129 output[pos] = 0;
130}
131
132bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer_state_t* state) {
133 (void)animation;
134 char output[LED_STATE_STRING_SIZE];
135 get_led_state_string(output, state);
136 gdispClear(White);
137 gdispDrawString(0, 10, output, state->font_dejavusansbold12, Black);
138 return false;
139}
140
141bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state) {
142 (void)animation;
143 gdispClear(White);
144 uint8_t y = 10;
145 if (state->status.leds) {
146 char output[LED_STATE_STRING_SIZE];
147 get_led_state_string(output, state);
148 gdispDrawString(0, 1, output, state->font_dejavusansbold12, Black);
149 y = 17;
150 }
151 gdispDrawString(0, y, state->layer_text, state->font_dejavusansbold12, Black);
152 return false;
153}
154
155bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t* state) {
156 (void)state;
157 (void)animation;
158 // Read the uGFX documentation for information how to use the displays
159 // http://wiki.ugfx.org/index.php/Main_Page
160 gdispClear(Black);
161
162 // You can use static variables for things that can't be found in the animation
163 // or state structs, here we use the image
164
165 // gdispGBlitArea is a tricky function to use since it supports blitting part of the image
166 // if you have full screen image, then just use LCD_WIDTH and LCD_HEIGHT for both source and target dimensions
167 gdispGBlitArea(GDISP, 0, 0, 128, 32, 0, 0, LCD_WIDTH, (pixel_t*)resource_lcd_logo);
168
169 return false;
170}
171
172bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
173 (void)animation;
174 (void)state;
175 gdispSetPowerMode(powerOff);
176 return false;
177}
178
179bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
180 (void)animation;
181 (void)state;
182 gdispSetPowerMode(powerOn);
183 return false;
184}
diff --git a/quantum/visualizer/lcd_keyframes.h b/quantum/visualizer/lcd_keyframes.h
deleted file mode 100644
index b7125e832..000000000
--- a/quantum/visualizer/lcd_keyframes.h
+++ /dev/null
@@ -1,35 +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#pragma once
18
19#include "visualizer.h"
20
21// Displays the layer text centered vertically on the screen
22bool lcd_keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state);
23// Displays a bitmap (0/1) of all the currently active layers
24bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
25// Displays a bitmap (0/1) of all the currently active mods
26bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state);
27// Displays the keyboard led states (CAPS (Caps lock), NUM (Num lock), SCRL (Scroll lock), COMP (Compose), KANA)
28bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer_state_t* state);
29// Displays both the layer text and the led states
30bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state);
31// Displays the QMK logo on the LCD screen
32bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t* state);
33
34bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
35bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
diff --git a/quantum/visualizer/led_backlight_keyframes.c b/quantum/visualizer/led_backlight_keyframes.c
deleted file mode 100644
index 338ada522..000000000
--- a/quantum/visualizer/led_backlight_keyframes.c
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2The MIT License (MIT)
3
4Copyright (c) 2016 Fred Sundvik
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE.
23*/
24#include "gfx.h"
25#include <math.h>
26#include "led_backlight_keyframes.h"
27
28static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) {
29 int frame_length = animation->frame_lengths[animation->current_frame];
30 int current_pos = frame_length - animation->time_left_in_frame;
31 int delta = to - from;
32 int luma = (delta * current_pos) / frame_length;
33 luma += from;
34 return luma;
35}
36
37static void keyframe_fade_all_leds_from_to(keyframe_animation_t* animation, uint8_t from, uint8_t to) {
38 uint8_t luma = fade_led_color(animation, from, to);
39 color_t color = LUMA2COLOR(luma);
40 gdispGClear(LED_DISPLAY, color);
41}
42
43// TODO: Should be customizable per keyboard
44#define NUM_ROWS LED_HEIGHT
45#define NUM_COLS LED_WIDTH
46
47static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS];
48static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS];
49
50static uint8_t compute_gradient_color(float t, float index, float num) {
51 const float two_pi = M_PI * 2.0f;
52 float normalized_index = (1.0f - index / (num - 1.0f)) * two_pi;
53 float x = t * two_pi + normalized_index;
54 float v = 0.5 * (cosf(x) + 1.0f);
55 return (uint8_t)(255.0f * v);
56}
57
58bool led_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) {
59 (void)state;
60 keyframe_fade_all_leds_from_to(animation, 0, 255);
61 return true;
62}
63
64bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) {
65 (void)state;
66 keyframe_fade_all_leds_from_to(animation, 255, 0);
67 return true;
68}
69
70bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
71 (void)state;
72 float frame_length = animation->frame_lengths[animation->current_frame];
73 float current_pos = frame_length - animation->time_left_in_frame;
74 float t = current_pos / frame_length;
75 for (int i = 0; i < NUM_COLS; i++) {
76 uint8_t color = compute_gradient_color(t, i, NUM_COLS);
77 gdispGDrawLine(LED_DISPLAY, i, 0, i, NUM_ROWS - 1, LUMA2COLOR(color));
78 }
79 return true;
80}
81
82bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
83 (void)state;
84 float frame_length = animation->frame_lengths[animation->current_frame];
85 float current_pos = frame_length - animation->time_left_in_frame;
86 float t = current_pos / frame_length;
87 for (int i = 0; i < NUM_ROWS; i++) {
88 uint8_t color = compute_gradient_color(t, i, NUM_ROWS);
89 gdispGDrawLine(LED_DISPLAY, 0, i, NUM_COLS - 1, i, LUMA2COLOR(color));
90 }
91 return true;
92}
93
94static void copy_current_led_state(uint8_t* dest) {
95 for (int i = 0; i < NUM_ROWS; i++) {
96 for (int j = 0; j < NUM_COLS; j++) {
97 dest[i * NUM_COLS + j] = gdispGGetPixelColor(LED_DISPLAY, j, i);
98 }
99 }
100}
101bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) {
102 (void)state;
103 if (animation->first_update_of_frame) {
104 copy_current_led_state(&crossfade_start_frame[0][0]);
105 run_next_keyframe(animation, state);
106 copy_current_led_state(&crossfade_end_frame[0][0]);
107 }
108 for (int i = 0; i < NUM_ROWS; i++) {
109 for (int j = 0; j < NUM_COLS; j++) {
110 color_t color = LUMA2COLOR(fade_led_color(animation, crossfade_start_frame[i][j], crossfade_end_frame[i][j]));
111 gdispGDrawPixel(LED_DISPLAY, j, i, color);
112 }
113 }
114 return true;
115}
116
117bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
118 (void)state;
119 (void)animation;
120 gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180);
121 return false;
122}
123
124bool led_backlight_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
125 (void)state;
126 (void)animation;
127 gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0);
128 return false;
129}
130
131bool led_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
132 (void)state;
133 (void)animation;
134 gdispGSetPowerMode(LED_DISPLAY, powerOff);
135 return false;
136}
137
138bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
139 (void)state;
140 (void)animation;
141 gdispGSetPowerMode(LED_DISPLAY, powerOn);
142 return false;
143}
diff --git a/quantum/visualizer/led_backlight_keyframes.h b/quantum/visualizer/led_backlight_keyframes.h
deleted file mode 100644
index 90153be5e..000000000
--- a/quantum/visualizer/led_backlight_keyframes.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2The MIT License (MIT)
3
4Copyright (c) 2016 Fred Sundvik
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE.
23*/
24
25#pragma once
26
27#include "visualizer.h"
28
29bool led_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state);
30bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state);
31bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
32bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
33bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state);
34bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
35bool led_backlight_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
36
37bool led_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
38bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
39
40extern keyframe_animation_t led_test_animation;
diff --git a/quantum/visualizer/readme.md b/quantum/visualizer/readme.md
deleted file mode 100644
index 298efb742..000000000
--- a/quantum/visualizer/readme.md
+++ /dev/null
@@ -1,18 +0,0 @@
1# A visualization library for the TMK keyboard firmware
2
3This library is designed to work together with the [TMK keyboard firmware](https://github.com/tmk/tmk_keyboard). Currently it only works for [Chibios](http://www.chibios.org/)
4 flavors, but it would be possible to add support for other configurations as well. The LCD display functionality is provided by the [uGFX library](https://ugfx.io/).
5
6## To use this library as a user
7You can and should modify the visualizer\_user.c file. Check the comments in the file for more information.
8
9## To add this library to custom keyboard projects
10
111. Add tmk_visualizer as a submodule to your project
121. Set VISUALIZER_DIR in the main keyboard project makefile to point to the submodule
131. Define LCD\_ENABLE and/or LCD\_BACKLIGHT\_ENABLE, to enable support
141. Include the visualizer.mk make file
151. Copy the files in the example\_integration folder to your keyboard project
161. All other files than the callback.c file are included automatically, so you will need to add callback.c to your makefile manually. If you already have a similar file in your project, you can just copy the functions instead of the whole file.
171. Edit the files to match your hardware. You might might want to read the Chibios and UGfx documentation, for more information.
181. If you enable LCD support you might also have to write a custom uGFX display driver, check the uGFX documentation for that. You probably also want to enable SPI support in your Chibios configuration.
diff --git a/quantum/visualizer/resources/lcd_logo.c b/quantum/visualizer/resources/lcd_logo.c
deleted file mode 100644
index 13bf734cb..000000000
--- a/quantum/visualizer/resources/lcd_logo.c
+++ /dev/null
@@ -1,45 +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#include "resources.h"
18
19// clang-format off
20
21// To generate an image array like this
22// Ensure the image is 128 x 32 or smaller
23// Convert the bitmap to a C array using a program like http://www.riuson.com/lcd-image-converter/
24// Ensure the the conversion process produces a monochrome format array - 1 bit/pixel, left to right, top to bottom
25// Update array in the source code with the C array produced by the conversion program
26
27// The image below is generated from lcd_logo.png
28__attribute__((weak)) const uint8_t resource_lcd_logo[512] = {
29 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
30 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31 0x00, 0x02, 0x92, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x92, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32 0x00, 0x02, 0x92, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33 0x00, 0x1F, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34 0x00, 0xFE, 0xEE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0xEE, 0xF0, 0x01, 0xC6, 0x0D, 0x8C, 0x1F, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35 0x00, 0xFE, 0xEE, 0xFE, 0x03, 0xE7, 0x1D, 0x9C, 0x1F, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0xEE, 0xF0, 0x06, 0x37, 0x1D, 0xB8, 0x18, 0x0B, 0x59, 0xC8, 0x09, 0xE5, 0x9E, 0x00,
36 0x00, 0x1E, 0xEE, 0xF0, 0x06, 0x37, 0xBD, 0xF0, 0x18, 0x6F, 0x7F, 0xEC, 0x9B, 0x37, 0xB3, 0x00, 0x00, 0xFE, 0xEE, 0xFE, 0x06, 0x37, 0xBD, 0xE0, 0x1F, 0x6C, 0x66, 0x6D, 0xD8, 0x36, 0x33, 0x00,
37 0x00, 0x1E, 0xEE, 0xF0, 0x06, 0x36, 0xED, 0xF0, 0x1F, 0x6C, 0x66, 0x6D, 0x59, 0xF6, 0x3E, 0x00, 0x00, 0x1F, 0x6D, 0xF0, 0x06, 0x36, 0xED, 0xB8, 0x18, 0x6C, 0x66, 0x67, 0x73, 0x36, 0x30, 0x00,
38 0x00, 0xFF, 0x83, 0xFE, 0x03, 0xE6, 0x4D, 0x9C, 0x18, 0x6C, 0x66, 0x67, 0x73, 0x36, 0x1F, 0x00, 0x00, 0x1F, 0xEF, 0xF0, 0x01, 0xC6, 0x0D, 0x8C, 0x18, 0x6C, 0x66, 0x62, 0x21, 0xD6, 0x0E, 0x00,
39 0x00, 0xFF, 0xEF, 0xFE, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF0, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40 0x00, 0x1F, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41 0x00, 0x02, 0x92, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x92, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
42 0x00, 0x02, 0x92, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
45};
diff --git a/quantum/visualizer/resources/lcd_logo.png b/quantum/visualizer/resources/lcd_logo.png
deleted file mode 100644
index 178ef65f1..000000000
--- a/quantum/visualizer/resources/lcd_logo.png
+++ /dev/null
Binary files differ
diff --git a/quantum/visualizer/resources/resources.h b/quantum/visualizer/resources/resources.h
deleted file mode 100644
index 5178fbe55..000000000
--- a/quantum/visualizer/resources/resources.h
+++ /dev/null
@@ -1,23 +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#pragma once
18
19#include <stdint.h>
20
21#ifdef LCD_ENABLE
22extern const uint8_t resource_lcd_logo[];
23#endif
diff --git a/quantum/visualizer/visualizer.c b/quantum/visualizer/visualizer.c
deleted file mode 100644
index 709affbb7..000000000
--- a/quantum/visualizer/visualizer.c
+++ /dev/null
@@ -1,483 +0,0 @@
1/*
2The MIT License (MIT)
3
4Copyright (c) 2016 Fred Sundvik
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE.
23*/
24
25#include "config.h"
26#include "visualizer.h"
27#include <string.h>
28#ifdef PROTOCOL_CHIBIOS
29# include <ch.h>
30#endif
31
32#include "gfx.h"
33
34#ifdef LCD_BACKLIGHT_ENABLE
35# include "lcd_backlight.h"
36#endif
37
38//#define DEBUG_VISUALIZER
39
40#ifdef DEBUG_VISUALIZER
41# include "debug.h"
42#else
43# include "nodebug.h"
44#endif
45
46#ifdef SERIAL_LINK_ENABLE
47# include "serial_link/protocol/transport.h"
48# include "serial_link/system/serial_link.h"
49#endif
50
51#include "action_util.h"
52
53// Define this in config.h
54#ifndef VISUALIZER_THREAD_PRIORITY
55// The visualizer needs gfx thread priorities
56# define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2)
57#endif
58
59static visualizer_keyboard_status_t current_status = {.layer = 0xFFFFFFFF,
60 .default_layer = 0xFFFFFFFF,
61 .leds = 0xFFFFFFFF,
62#ifdef BACKLIGHT_ENABLE
63 .backlight_level = 0,
64#endif
65 .mods = 0xFF,
66 .suspended = false,
67#ifdef VISUALIZER_USER_DATA_SIZE
68 .user_data = {0}
69#endif
70};
71
72static bool same_status(visualizer_keyboard_status_t* status1, visualizer_keyboard_status_t* status2) {
73 return status1->layer == status2->layer && status1->default_layer == status2->default_layer && status1->mods == status2->mods && status1->leds == status2->leds && status1->suspended == status2->suspended
74#ifdef BACKLIGHT_ENABLE
75 && status1->backlight_level == status2->backlight_level
76#endif
77#ifdef VISUALIZER_USER_DATA_SIZE
78 && memcmp(status1->user_data, status2->user_data, VISUALIZER_USER_DATA_SIZE) == 0
79#endif
80 ;
81}
82
83static bool visualizer_enabled = false;
84
85#ifdef VISUALIZER_USER_DATA_SIZE
86static uint8_t user_data[VISUALIZER_USER_DATA_SIZE];
87#endif
88
89#define MAX_SIMULTANEOUS_ANIMATIONS 4
90static keyframe_animation_t* animations[MAX_SIMULTANEOUS_ANIMATIONS] = {};
91
92#ifdef SERIAL_LINK_ENABLE
93MASTER_TO_ALL_SLAVES_OBJECT(current_status, visualizer_keyboard_status_t);
94
95static remote_object_t* remote_objects[] = {
96 REMOTE_OBJECT(current_status),
97};
98
99#endif
100
101GDisplay* LCD_DISPLAY = 0;
102GDisplay* LED_DISPLAY = 0;
103
104#ifdef LCD_DISPLAY_NUMBER
105__attribute__((weak)) GDisplay* get_lcd_display(void) { return gdispGetDisplay(LCD_DISPLAY_NUMBER); }
106#endif
107
108#ifdef LED_DISPLAY_NUMBER
109__attribute__((weak)) GDisplay* get_led_display(void) { return gdispGetDisplay(LED_DISPLAY_NUMBER); }
110#endif
111
112void start_keyframe_animation(keyframe_animation_t* animation) {
113 animation->current_frame = -1;
114 animation->time_left_in_frame = 0;
115 animation->need_update = true;
116 int free_index = -1;
117 for (int i = 0; i < MAX_SIMULTANEOUS_ANIMATIONS; i++) {
118 if (animations[i] == animation) {
119 return;
120 }
121 if (free_index == -1 && animations[i] == NULL) {
122 free_index = i;
123 }
124 }
125 if (free_index != -1) {
126 animations[free_index] = animation;
127 }
128}
129
130void stop_keyframe_animation(keyframe_animation_t* animation) {
131 animation->current_frame = animation->num_frames;
132 animation->time_left_in_frame = 0;
133 animation->need_update = true;
134 animation->first_update_of_frame = false;
135 animation->last_update_of_frame = false;
136 for (int i = 0; i < MAX_SIMULTANEOUS_ANIMATIONS; i++) {
137 if (animations[i] == animation) {
138 animations[i] = NULL;
139 return;
140 }
141 }
142}
143
144void stop_all_keyframe_animations(void) {
145 for (int i = 0; i < MAX_SIMULTANEOUS_ANIMATIONS; i++) {
146 if (animations[i]) {
147 animations[i]->current_frame = animations[i]->num_frames;
148 animations[i]->time_left_in_frame = 0;
149 animations[i]->need_update = true;
150 animations[i]->first_update_of_frame = false;
151 animations[i]->last_update_of_frame = false;
152 animations[i] = NULL;
153 }
154 }
155}
156
157static uint8_t get_num_running_animations(void) {
158 uint8_t count = 0;
159 for (int i = 0; i < MAX_SIMULTANEOUS_ANIMATIONS; i++) {
160 count += animations[i] ? 1 : 0;
161 }
162 return count;
163}
164
165static bool update_keyframe_animation(keyframe_animation_t* animation, visualizer_state_t* state, systemticks_t delta, systemticks_t* sleep_time) {
166 // TODO: Clean up this messy code
167 dprintf("Animation frame%d, left %d, delta %d\n", animation->current_frame, animation->time_left_in_frame, delta);
168 if (animation->current_frame == animation->num_frames) {
169 animation->need_update = false;
170 return false;
171 }
172 if (animation->current_frame == -1) {
173 animation->current_frame = 0;
174 animation->time_left_in_frame = animation->frame_lengths[0];
175 animation->need_update = true;
176 animation->first_update_of_frame = true;
177 } else {
178 animation->time_left_in_frame -= delta;
179 while (animation->time_left_in_frame <= 0) {
180 int left = animation->time_left_in_frame;
181 if (animation->need_update) {
182 animation->time_left_in_frame = 0;
183 animation->last_update_of_frame = true;
184 (*animation->frame_functions[animation->current_frame])(animation, state);
185 animation->last_update_of_frame = false;
186 }
187 animation->current_frame++;
188 animation->need_update = true;
189 animation->first_update_of_frame = true;
190 if (animation->current_frame == animation->num_frames) {
191 if (animation->loop) {
192 animation->current_frame = 0;
193 } else {
194 stop_keyframe_animation(animation);
195 return false;
196 }
197 }
198 delta = -left;
199 animation->time_left_in_frame = animation->frame_lengths[animation->current_frame];
200 animation->time_left_in_frame -= delta;
201 }
202 }
203 if (animation->need_update) {
204 animation->need_update = (*animation->frame_functions[animation->current_frame])(animation, state);
205 animation->first_update_of_frame = false;
206 }
207
208 systemticks_t wanted_sleep = animation->need_update ? gfxMillisecondsToTicks(10) : (unsigned)animation->time_left_in_frame;
209 if (wanted_sleep < *sleep_time) {
210 *sleep_time = wanted_sleep;
211 }
212
213 return true;
214}
215
216void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* state) {
217 int next_frame = animation->current_frame + 1;
218 if (next_frame == animation->num_frames) {
219 next_frame = 0;
220 }
221 keyframe_animation_t temp_animation = *animation;
222 temp_animation.current_frame = next_frame;
223 temp_animation.time_left_in_frame = animation->frame_lengths[next_frame];
224 temp_animation.first_update_of_frame = true;
225 temp_animation.last_update_of_frame = false;
226 temp_animation.need_update = false;
227 visualizer_state_t temp_state = *state;
228 (*temp_animation.frame_functions[next_frame])(&temp_animation, &temp_state);
229}
230
231// TODO: Optimize the stack size, this is probably way too big
232static DECLARE_THREAD_STACK(visualizerThreadStack, 1024);
233static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
234 (void)arg;
235
236 GListener event_listener;
237 geventListenerInit(&event_listener);
238 geventAttachSource(&event_listener, (GSourceHandle)&current_status, 0);
239
240 visualizer_keyboard_status_t initial_status = {
241 .default_layer = 0xFFFFFFFF,
242 .layer = 0xFFFFFFFF,
243 .mods = 0xFF,
244 .leds = 0xFFFFFFFF,
245 .suspended = false,
246#ifdef BACKLIGHT_ENABLE
247 .backlight_level = 0,
248#endif
249#ifdef VISUALIZER_USER_DATA_SIZE
250 .user_data = {0},
251#endif
252 };
253
254 visualizer_state_t state = {.status = initial_status,
255 .current_lcd_color = 0,
256#ifdef LCD_ENABLE
257 .font_fixed5x8 = gdispOpenFont("fixed_5x8"),
258 .font_dejavusansbold12 = gdispOpenFont("DejaVuSansBold12")
259#endif
260 };
261 initialize_user_visualizer(&state);
262 state.prev_lcd_color = state.current_lcd_color;
263
264#ifdef LCD_BACKLIGHT_ENABLE
265 lcd_backlight_color(LCD_HUE(state.current_lcd_color), LCD_SAT(state.current_lcd_color), LCD_INT(state.current_lcd_color));
266#endif
267
268 systemticks_t sleep_time = TIME_INFINITE;
269 systemticks_t current_time = gfxSystemTicks();
270 bool force_update = true;
271
272 while (true) {
273 systemticks_t new_time = gfxSystemTicks();
274 systemticks_t delta = new_time - current_time;
275 current_time = new_time;
276 bool enabled = visualizer_enabled;
277 if (force_update || !same_status(&state.status, &current_status)) {
278 force_update = false;
279#if BACKLIGHT_ENABLE
280 if (current_status.backlight_level != state.status.backlight_level) {
281 if (current_status.backlight_level != 0) {
282 gdispGSetPowerMode(LED_DISPLAY, powerOn);
283 uint16_t percent = (uint16_t)current_status.backlight_level * 100 / BACKLIGHT_LEVELS;
284 gdispGSetBacklight(LED_DISPLAY, percent);
285 } else {
286 gdispGSetPowerMode(LED_DISPLAY, powerOff);
287 }
288 state.status.backlight_level = current_status.backlight_level;
289 }
290#endif
291 if (visualizer_enabled) {
292 if (current_status.suspended) {
293 stop_all_keyframe_animations();
294 visualizer_enabled = false;
295 state.status = current_status;
296 user_visualizer_suspend(&state);
297 } else {
298 visualizer_keyboard_status_t prev_status = state.status;
299 state.status = current_status;
300 update_user_visualizer_state(&state, &prev_status);
301 }
302 state.prev_lcd_color = state.current_lcd_color;
303 }
304 }
305 if (!enabled && state.status.suspended && current_status.suspended == false) {
306 // Setting the status to the initial status will force an update
307 // when the visualizer is enabled again
308 state.status = initial_status;
309 state.status.suspended = false;
310 stop_all_keyframe_animations();
311 user_visualizer_resume(&state);
312 state.prev_lcd_color = state.current_lcd_color;
313 }
314 sleep_time = TIME_INFINITE;
315 for (int i = 0; i < MAX_SIMULTANEOUS_ANIMATIONS; i++) {
316 if (animations[i]) {
317 update_keyframe_animation(animations[i], &state, delta, &sleep_time);
318 }
319 }
320#ifdef BACKLIGHT_ENABLE
321 gdispGFlush(LED_DISPLAY);
322#endif
323
324#ifdef LCD_ENABLE
325 gdispGFlush(LCD_DISPLAY);
326#endif
327
328#ifdef EMULATOR
329 draw_emulator();
330#endif
331 // Enable the visualizer when the startup or the suspend animation has finished
332 if (!visualizer_enabled && state.status.suspended == false && get_num_running_animations() == 0) {
333 visualizer_enabled = true;
334 force_update = true;
335 sleep_time = 0;
336 }
337
338 systemticks_t after_update = gfxSystemTicks();
339 unsigned update_delta = after_update - current_time;
340 if (sleep_time != TIME_INFINITE) {
341 if (sleep_time > update_delta) {
342 sleep_time -= update_delta;
343 } else {
344 sleep_time = 0;
345 }
346 }
347 dprintf("Update took %d, last delta %d, sleep_time %d\n", update_delta, delta, sleep_time);
348#ifdef PROTOCOL_CHIBIOS
349 // The gEventWait function really takes milliseconds, even if the documentation says ticks.
350 // Unfortunately there's no generic ugfx conversion from system time to milliseconds,
351 // so let's do it in a platform dependent way.
352
353 // On windows the system ticks is the same as milliseconds anyway
354 if (sleep_time != TIME_INFINITE) {
355 sleep_time = TIME_I2MS(sleep_time);
356 }
357#endif
358 geventEventWait(&event_listener, sleep_time);
359 }
360#ifdef LCD_ENABLE
361 gdispCloseFont(state.font_fixed5x8);
362 gdispCloseFont(state.font_dejavusansbold12);
363#endif
364
365 return 0;
366}
367
368void visualizer_init(void) {
369 gfxInit();
370
371#ifdef LCD_BACKLIGHT_ENABLE
372 lcd_backlight_init();
373#endif
374
375#ifdef SERIAL_LINK_ENABLE
376 add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*));
377#endif
378
379#ifdef LCD_ENABLE
380 LCD_DISPLAY = get_lcd_display();
381#endif
382
383#ifdef BACKLIGHT_ENABLE
384 LED_DISPLAY = get_led_display();
385#endif
386
387 // We are using a low priority thread, the idea is to have it run only
388 // when the main thread is sleeping during the matrix scanning
389 gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack), VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL);
390}
391
392void update_status(bool changed) {
393 if (changed) {
394 GSourceListener* listener = geventGetSourceListener((GSourceHandle)&current_status, NULL);
395 if (listener) {
396 geventSendEvent(listener);
397 }
398 }
399#ifdef SERIAL_LINK_ENABLE
400 static systime_t last_update = 0;
401 systime_t current_update = chVTGetSystemTimeX();
402 systime_t delta = current_update - last_update;
403 if (changed || delta > TIME_MS2I(10)) {
404 last_update = current_update;
405 visualizer_keyboard_status_t* r = begin_write_current_status();
406 *r = current_status;
407 end_write_current_status();
408 }
409#endif
410}
411
412uint8_t visualizer_get_mods() {
413 uint8_t mods = get_mods();
414
415#ifndef NO_ACTION_ONESHOT
416 if (!has_oneshot_mods_timed_out()) {
417 mods |= get_oneshot_mods();
418 }
419#endif
420 return mods;
421}
422
423#ifdef VISUALIZER_USER_DATA_SIZE
424void visualizer_set_user_data(void* u) { memcpy(user_data, u, VISUALIZER_USER_DATA_SIZE); }
425#endif
426
427void visualizer_update(layer_state_t default_state, layer_state_t state, uint8_t mods, uint32_t leds) {
428 // Note that there's a small race condition here, the thread could read
429 // a state where one of these are set but not the other. But this should
430 // not really matter as it will be fixed during the next loop step.
431 // Alternatively a mutex could be used instead of the volatile variables
432
433 bool changed = false;
434#ifdef SERIAL_LINK_ENABLE
435 if (is_serial_link_connected()) {
436 visualizer_keyboard_status_t* new_status = read_current_status();
437 if (new_status) {
438 if (!same_status(&current_status, new_status)) {
439 changed = true;
440 current_status = *new_status;
441 }
442 }
443 } else {
444#else
445 {
446#endif
447 visualizer_keyboard_status_t new_status = {
448 .layer = state,
449 .default_layer = default_state,
450 .mods = mods,
451 .leds = leds,
452#ifdef BACKLIGHT_ENABLE
453 .backlight_level = current_status.backlight_level,
454#endif
455 .suspended = current_status.suspended,
456 };
457#ifdef VISUALIZER_USER_DATA_SIZE
458 memcpy(new_status.user_data, user_data, VISUALIZER_USER_DATA_SIZE);
459#endif
460 if (!same_status(&current_status, &new_status)) {
461 changed = true;
462 current_status = new_status;
463 }
464 }
465 update_status(changed);
466}
467
468void visualizer_suspend(void) {
469 current_status.suspended = true;
470 update_status(true);
471}
472
473void visualizer_resume(void) {
474 current_status.suspended = false;
475 update_status(true);
476}
477
478#ifdef BACKLIGHT_ENABLE
479void backlight_set(uint8_t level) {
480 current_status.backlight_level = level;
481 update_status(true);
482}
483#endif
diff --git a/quantum/visualizer/visualizer.h b/quantum/visualizer/visualizer.h
deleted file mode 100644
index 627c80a30..000000000
--- a/quantum/visualizer/visualizer.h
+++ /dev/null
@@ -1,154 +0,0 @@
1/*
2The MIT License (MIT)
3
4Copyright (c) 2016 Fred Sundvik
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22SOFTWARE.
23*/
24
25#pragma once
26
27#include <stdlib.h>
28#include <stdint.h>
29#include <stdbool.h>
30
31#include "config.h"
32#include "gfx.h"
33#include "action_layer.h"
34
35#ifdef LCD_BACKLIGHT_ENABLE
36# include "lcd_backlight.h"
37#endif
38
39#ifdef BACKLIGHT_ENABLE
40# include "backlight.h"
41#endif
42
43// use this function to merge both real_mods and oneshot_mods in a uint16_t
44uint8_t visualizer_get_mods(void);
45
46// This need to be called once at the start
47void visualizer_init(void);
48// This should be called at every matrix scan
49void visualizer_update(layer_state_t default_state, layer_state_t state, uint8_t mods, uint32_t leds);
50
51// This should be called when the keyboard goes to suspend state
52void visualizer_suspend(void);
53// This should be called when the keyboard wakes up from suspend state
54void visualizer_resume(void);
55
56// These functions are week, so they can be overridden by the keyboard
57// if needed
58GDisplay* get_lcd_display(void);
59GDisplay* get_led_display(void);
60
61// For emulator builds, this function need to be implemented
62#ifdef EMULATOR
63void draw_emulator(void);
64#endif
65
66// If you need support for more than 16 keyframes per animation, you can change this
67#define MAX_VISUALIZER_KEY_FRAMES 16
68
69struct keyframe_animation_t;
70
71typedef struct {
72 layer_state_t layer;
73 layer_state_t default_layer;
74 uint32_t leds; // See led.h for available statuses
75 uint8_t mods;
76 bool suspended;
77#ifdef BACKLIGHT_ENABLE
78 uint8_t backlight_level;
79#endif
80#ifdef VISUALIZER_USER_DATA_SIZE
81 uint8_t user_data[VISUALIZER_USER_DATA_SIZE];
82#endif
83} visualizer_keyboard_status_t;
84
85// The state struct is used by the various keyframe functions
86// It's also used for setting the LCD color and layer text
87// from the user customized code
88typedef struct visualizer_state_t {
89 // The user code should primarily be modifying these
90 uint32_t target_lcd_color;
91 const char* layer_text;
92
93 // The user visualizer(and animation functions) can read these
94 visualizer_keyboard_status_t status;
95
96 // These are used by the animation functions
97 uint32_t current_lcd_color;
98 uint32_t prev_lcd_color;
99#ifdef LCD_ENABLE
100 gFont font_fixed5x8;
101 gFont font_dejavusansbold12;
102#endif
103} visualizer_state_t;
104
105// Any custom keyframe function should have this signature
106// return true to get continuous updates, otherwise you will only get one
107// update per frame
108typedef bool (*frame_func)(struct keyframe_animation_t*, visualizer_state_t*);
109
110// Represents a keyframe animation, so fields are internal to the system
111// while others are meant to be initialized by the user code
112typedef struct keyframe_animation_t {
113 // These should be initialized
114 int num_frames;
115 bool loop;
116 int frame_lengths[MAX_VISUALIZER_KEY_FRAMES];
117 frame_func frame_functions[MAX_VISUALIZER_KEY_FRAMES];
118
119 // Used internally by the system, and can also be read by
120 // keyframe update functions
121 int current_frame;
122 int time_left_in_frame;
123 bool first_update_of_frame;
124 bool last_update_of_frame;
125 bool need_update;
126
127} keyframe_animation_t;
128
129extern GDisplay* LCD_DISPLAY;
130extern GDisplay* LED_DISPLAY;
131
132void start_keyframe_animation(keyframe_animation_t* animation);
133void stop_keyframe_animation(keyframe_animation_t* animation);
134// This runs the next keyframe, but does not update the animation state
135// Useful for crossfades for example
136void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* state);
137
138// The master can set userdata which will be transferred to the slave
139#ifdef VISUALIZER_USER_DATA_SIZE
140void visualizer_set_user_data(void* user_data);
141#endif
142
143// These functions have to be implemented by the user
144// Called regularly each time the state has changed (but not every scan loop)
145void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status);
146// Called when the computer goes to suspend, will also stop calling update_user_visualizer_state
147void user_visualizer_suspend(visualizer_state_t* state);
148// You have to start at least one animation as a response to the following two functions
149// When the animation has finished the visualizer will resume normal operation and start calling the
150// update_user_visualizer_state again
151// Called when the keyboard boots up
152void initialize_user_visualizer(visualizer_state_t* state);
153// Called when the computer resumes from a suspend
154void user_visualizer_resume(visualizer_state_t* state);
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk
deleted file mode 100644
index 4c961ac59..000000000
--- a/quantum/visualizer/visualizer.mk
+++ /dev/null
@@ -1,123 +0,0 @@
1# The MIT License (MIT)
2#
3# Copyright (c) 2016 Fred Sundvik
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to deal
7# in the Software without restriction, including without limitation the rights
8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9# copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included in all
13# copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21# SOFTWARE.
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
47SRC += $(VISUALIZER_DIR)/visualizer.c \
48 $(VISUALIZER_DIR)/visualizer_keyframes.c
49EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR)
50GFXLIB = $(LIB_PATH)/ugfx
51VPATH += $(VISUALIZER_PATH)
52
53OPT_DEFS += -DVISUALIZER_ENABLE
54
55ifdef LCD_ENABLE
56OPT_DEFS += -DLCD_ENABLE
57ULIBS += -lm
58endif
59
60ifeq ($(strip $(LCD_ENABLE)), yes)
61 SRC += $(VISUALIZER_DIR)/lcd_keyframes.c
62 ifeq ($(strip $(LCD_BACKLIGHT_ENABLE)), yes)
63 OPT_DEFS += -DLCD_BACKLIGHT_ENABLE
64 SRC += $(VISUALIZER_DIR)/lcd_backlight.c
65 SRC += $(VISUALIZER_DIR)/lcd_backlight_keyframes.c
66 endif
67# Note, that the linker will strip out any resources that are not actually in use
68SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c
69$(eval $(call ADD_DRIVER,LCD))
70endif
71
72ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
73SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c
74$(eval $(call ADD_DRIVER,LED))
75endif
76
77SRC += $(VISUALIZER_DIR)/default_animations.c
78
79include $(GFXLIB)/gfx.mk
80# For the common_gfxconf.h
81GFXINC += quantum/visualizer
82
83GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC))
84GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS)))
85
86GDISP_LIST_COMMA=,
87GDISP_LIST_EMPTY=
88GDISP_LIST_SPACE=$(GDISP_LIST_EMPTY) $(GDISP_LIST_EMPTY)
89
90GDISP_DRIVER_LIST := $(strip $(GDISP_DRIVER_LIST))
91GDISP_DRIVER_LIST := $(subst $(GDISP_LIST_SPACE),$(GDISP_LIST_COMMA),$(GDISP_DRIVER_LIST))
92
93GFXDEFS +=-DGDISP_DRIVER_LIST="$(GDISP_DRIVER_LIST)"
94
95ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","")
96 SRC += $(KEYMAP_PATH)/visualizer.c
97else
98 VISUALIZER_1 := $(KEYBOARD_PATH_1)/visualizer.c
99 VISUALIZER_2 := $(KEYBOARD_PATH_2)/visualizer.c
100 VISUALIZER_3 := $(KEYBOARD_PATH_3)/visualizer.c
101 VISUALIZER_4 := $(KEYBOARD_PATH_4)/visualizer.c
102 VISUALIZER_5 := $(KEYBOARD_PATH_5)/visualizer.c
103
104 ifneq ("$(wildcard $(VISUALIZER_5))","")
105 SRC += $(VISUALIZER_5)
106 endif
107 ifneq ("$(wildcard $(VISUALIZER_4))","")
108 SRC += $(VISUALIZER_4)
109 endif
110 ifneq ("$(wildcard $(VISUALIZER_3))","")
111 SRC += $(VISUALIZER_3)
112 endif
113 ifneq ("$(wildcard $(VISUALIZER_2))","")
114 SRC += $(VISUALIZER_2)
115 endif
116 ifneq ("$(wildcard $(VISUALIZER_1))","")
117 SRC += $(VISUALIZER_1)
118 endif
119endif
120
121ifdef EMULATOR
122UINCDIR += $(TMK_DIR)/common
123endif
diff --git a/quantum/visualizer/visualizer_keyframes.c b/quantum/visualizer/visualizer_keyframes.c
deleted file mode 100644
index 8f6a7e15a..000000000
--- a/quantum/visualizer/visualizer_keyframes.c
+++ /dev/null
@@ -1,23 +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#include "visualizer_keyframes.h"
18
19bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state) {
20 (void)animation;
21 (void)state;
22 return false;
23}
diff --git a/quantum/visualizer/visualizer_keyframes.h b/quantum/visualizer/visualizer_keyframes.h
deleted file mode 100644
index c92ff1611..000000000
--- a/quantum/visualizer/visualizer_keyframes.h
+++ /dev/null
@@ -1,23 +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#pragma once
18
19#include "visualizer.h"
20
21// Some predefined keyframe functions that can be used by the user code
22// Does nothing, useful for adding delays
23bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state);
diff --git a/show_options.mk b/show_options.mk
index 35fca9c6b..03008ccab 100644
--- a/show_options.mk
+++ b/show_options.mk
@@ -32,7 +32,6 @@ HARDWARE_OPTION_NAMES = \
32 LCD_ENABLE \ 32 LCD_ENABLE \
33 LED_TABLES \ 33 LED_TABLES \
34 POINTING_DEVICE_ENABLE \ 34 POINTING_DEVICE_ENABLE \
35 VISUALIZER_ENABLE \
36 DIP_SWITCH_ENABLE 35 DIP_SWITCH_ENABLE
37 36
38OTHER_OPTION_NAMES = \ 37OTHER_OPTION_NAMES = \
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c
index e5d3a4c54..26181d8c7 100644
--- a/tmk_core/protocol/chibios/chibios.c
+++ b/tmk_core/protocol/chibios/chibios.c
@@ -46,9 +46,6 @@
46#ifdef SERIAL_LINK_ENABLE 46#ifdef SERIAL_LINK_ENABLE
47# include "serial_link/system/serial_link.h" 47# include "serial_link/system/serial_link.h"
48#endif 48#endif
49#ifdef VISUALIZER_ENABLE
50# include "visualizer/visualizer.h"
51#endif
52#ifdef MIDI_ENABLE 49#ifdef MIDI_ENABLE
53# include "qmk_midi.h" 50# include "qmk_midi.h"
54#endif 51#endif
@@ -161,10 +158,6 @@ void protocol_init(void) {
161 init_serial_link(); 158 init_serial_link();
162#endif 159#endif
163 160
164#ifdef VISUALIZER_ENABLE
165 visualizer_init();
166#endif
167
168 host_driver_t *driver = NULL; 161 host_driver_t *driver = NULL;
169 162
170 /* Wait until the USB or serial link is active */ 163 /* Wait until the USB or serial link is active */
@@ -214,9 +207,6 @@ void protocol_task(void) {
214#if !defined(NO_USB_STARTUP_CHECK) 207#if !defined(NO_USB_STARTUP_CHECK)
215 if (USB_DRIVER.state == USB_SUSPENDED) { 208 if (USB_DRIVER.state == USB_SUSPENDED) {
216 print("[s]"); 209 print("[s]");
217# ifdef VISUALIZER_ENABLE
218 visualizer_suspend();
219# endif
220 while (USB_DRIVER.state == USB_SUSPENDED) { 210 while (USB_DRIVER.state == USB_SUSPENDED) {
221 /* Do this in the suspended state */ 211 /* Do this in the suspended state */
222# ifdef SERIAL_LINK_ENABLE 212# ifdef SERIAL_LINK_ENABLE
@@ -235,10 +225,6 @@ void protocol_task(void) {
235# ifdef MOUSEKEY_ENABLE 225# ifdef MOUSEKEY_ENABLE
236 mousekey_send(); 226 mousekey_send();
237# endif /* MOUSEKEY_ENABLE */ 227# endif /* MOUSEKEY_ENABLE */
238
239# ifdef VISUALIZER_ENABLE
240 visualizer_resume();
241# endif
242 } 228 }
243#endif 229#endif
244 230
diff --git a/util/chibios_conf_updater.sh b/util/chibios_conf_updater.sh
index 5ba8aa677..d1640b672 100755
--- a/util/chibios_conf_updater.sh
+++ b/util/chibios_conf_updater.sh
@@ -38,7 +38,7 @@ find_chibi_files() {
38 local search_path="$1" 38 local search_path="$1"
39 shift 39 shift
40 local conditions=( "$@" ) 40 local conditions=( "$@" )
41 for file in $(find -L "$search_path" -not -path '*/lib/chibios*' -and -not -path '*/lib/ugfx*' -and -not -path '*/util/*' -and \( "${conditions[@]}" \) | sort) ; do 41 for file in $(find -L "$search_path" -not -path '*/lib/chibios*' -and -not -path '*/util/*' -and \( "${conditions[@]}" \) | sort) ; do
42 if [ -z "$(grep 'include_next' "$file")" ] ; then 42 if [ -z "$(grep 'include_next' "$file")" ] ; then
43 echo $file 43 echo $file
44 fi 44 fi