Skip to content

Commit 74a6524

Browse files
committed
vfx: add gif animation support
1 parent bc3e0f0 commit 74a6524

File tree

15 files changed

+115
-20
lines changed

15 files changed

+115
-20
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Bluetooth Speaker based on ESP32 chip with dynamic vision effects output.
77

88
* A2DP Audio Streaming
99
* I2S & PDM Input / I2S Output
10-
* VFX Output (Audio FFT / Rainbow / Stars / ...)
11-
* BLE Control Interface (for VFX Output & Audio Input)
10+
* VFX Output (GIF / Audio FFT / Rainbow / Stars / ...)
11+
* BLE Control Interface (for VFX Output)
1212
* Audio Prompt (Connected / Disconnected / WakeUp / Sleep)
1313
* OTA Firmware Update (via SPP Profile)
1414
* Sleep & WakeUp Key
@@ -57,6 +57,10 @@ idf.py menuconfig
5757
idf.py flash monitor
5858
```
5959

60+
## VFX on ST7789 135x240 LCD Panel (GIF)
61+
62+
<img src="docs/st7789gif.png">
63+
6064
## VFX on ST7735 80x160 LCD Panel (Linear Spectrum)
6165

6266
<img src="docs/st7735lin.png">

components/ugfx/gfxconf.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@
117117
// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA TRUE
118118
// #define GDISP_INCLUDE_USER_FONTS FALSE
119119

120-
// #define GDISP_NEED_IMAGE TRUE
121-
// #define GDISP_NEED_IMAGE_NATIVE TRUE
122-
// #define GDISP_NEED_IMAGE_GIF TRUE
123-
// #define GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE 32
120+
#define GDISP_NEED_IMAGE TRUE
121+
#define GDISP_NEED_IMAGE_NATIVE TRUE
122+
#define GDISP_NEED_IMAGE_GIF TRUE
123+
#define GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE 32
124124
// #define GDISP_NEED_IMAGE_BMP TRUE
125125
// #define GDISP_NEED_IMAGE_BMP_1 TRUE
126126
// #define GDISP_NEED_IMAGE_BMP_4 TRUE
@@ -305,7 +305,7 @@
305305
///////////////////////////////////////////////////////////////////////////
306306
// GFILE //
307307
///////////////////////////////////////////////////////////////////////////
308-
// #define GFX_USE_GFILE TRUE
308+
#define GFX_USE_GFILE TRUE
309309

310310
// #define GFILE_NEED_PRINTG TRUE
311311
// #define GFILE_NEED_SCANG TRUE
@@ -315,7 +315,7 @@
315315
// #define GFILE_NEED_NOAUTOMOUNT TRUE
316316
// #define GFILE_NEED_NOAUTOSYNC TRUE
317317

318-
// #define GFILE_NEED_MEMFS TRUE
318+
#define GFILE_NEED_MEMFS TRUE
319319
//#define GFILE_NEED_ROMFS FALSE
320320
//#define GFILE_NEED_RAMFS FALSE
321321
//#define GFILE_NEED_FATFS FALSE

docs/st7789gif.png

1.33 MB
Loading

main/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
set(COMPONENT_SRCDIRS src src/user src/board src/chip src/core)
22
set(COMPONENT_ADD_INCLUDEDIRS inc)
3-
set(COMPONENT_EMBED_FILES res/snd/snd0.mp3 res/snd/snd1.mp3 res/snd/snd2.mp3 res/snd/snd3.mp3)
3+
set(COMPONENT_EMBED_FILES res/snd/snd0.mp3 res/snd/snd1.mp3 res/snd/snd2.mp3 res/snd/snd3.mp3 res/ani/ani0_160x80.gif res/ani/ani1_160x80.gif res/ani/ani0_240x135.gif res/ani/ani1_240x135.gif)
44

55
register_component()

main/Kconfig.projbuild

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ config AUDIO_OUTPUT_I2S_NUM
4949
choice AUDIO_INPUT
5050
prompt "Audio Input"
5151
default AUDIO_INPUT_NONE
52+
depends on ENABLE_VFX
5253
help
5354
Select Audio Input Interface.
5455

@@ -150,13 +151,13 @@ endchoice
150151

151152
choice SCREEN_PANEL_OUTPUT
152153
prompt "Screen Panel Output Mode"
153-
default SCREEN_PANEL_OUTPUT_FFT
154+
default SCREEN_PANEL_OUTPUT_VFX
154155
depends on ENABLE_VFX && !VFX_OUTPUT_CUBE0414
155156
help
156157
Select Screen Panel Output Mode.
157158

158-
config SCREEN_PANEL_OUTPUT_FFT
159-
bool "Display Audio FFT"
159+
config SCREEN_PANEL_OUTPUT_VFX
160+
bool "Display Visual Effects"
160161
config SCREEN_PANEL_OUTPUT_MMAP
161162
bool "Display CUBE0414's Memory Mapping"
162163
endchoice

main/inc/user/vfx.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626

2727
#define DEFAULT_VFX_BACKLIGHT 0xFF
2828

29+
enum vfx_mode {
30+
VFX_MODE_PAUSE = 0xFE,
31+
VFX_MODE_OFF = 0xFF,
32+
};
33+
2934
struct vfx_conf {
3035
uint8_t mode;
3136
uint16_t scale_factor;
@@ -36,6 +41,24 @@ struct vfx_conf {
3641
extern GDisplay *vfx_gdisp;
3742
extern fft_config_t *vfx_fft_plan;
3843

44+
#ifdef CONFIG_SCREEN_PANEL_OUTPUT_VFX
45+
#ifdef CONFIG_VFX_OUTPUT_ST7735
46+
// ani0.gif
47+
extern const char ani0_160x80_gif_ptr[] asm("_binary_ani0_160x80_gif_start");
48+
extern const char ani0_160x80_gif_end[] asm("_binary_ani0_160x80_gif_end");
49+
// ani1.gif
50+
extern const char ani1_160x80_gif_ptr[] asm("_binary_ani1_160x80_gif_start");
51+
extern const char ani1_160x80_gif_end[] asm("_binary_ani1_160x80_gif_end");
52+
#elif defined(CONFIG_VFX_OUTPUT_ST7789)
53+
// ani0.gif
54+
extern const char ani0_240x135_gif_ptr[] asm("_binary_ani0_240x135_gif_start");
55+
extern const char ani0_240x135_gif_end[] asm("_binary_ani0_240x135_gif_end");
56+
// ani1.gif
57+
extern const char ani1_240x135_gif_ptr[] asm("_binary_ani1_240x135_gif_start");
58+
extern const char ani1_240x135_gif_end[] asm("_binary_ani1_240x135_gif_end");
59+
#endif
60+
#endif
61+
3962
extern void vfx_set_conf(struct vfx_conf *cfg);
4063
extern struct vfx_conf *vfx_get_conf(void);
4164

main/res/ani/ani0_160x80.gif

36.4 KB
Loading

main/res/ani/ani0_240x135.gif

66.4 KB
Loading

main/res/ani/ani1_160x80.gif

12.8 KB
Loading

main/res/ani/ani1_240x135.gif

29.9 KB
Loading

0 commit comments

Comments
 (0)