music demo is functional
This commit is contained in:
parent
fc9abcd724
commit
b58fe79f2a
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* @file lv_ex_conf.h
|
||||
* Configuration file for v7.11.0
|
||||
* @file lv_demo_conf.h
|
||||
* Configuration file for v8.0.0
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* COPY THIS FILE AS lv_ex_conf.h
|
||||
* COPY THIS FILE AS lv_demo_conf.h
|
||||
*/
|
||||
|
||||
#if 1 /*Set it to "1" to enable the content*/
|
||||
@ -16,34 +16,37 @@
|
||||
/*******************
|
||||
* GENERAL SETTING
|
||||
*******************/
|
||||
#define LV_EX_PRINTF 1 /*Enable printf-ing data in demoes and examples*/
|
||||
#define LV_EX_KEYBOARD 1 /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/
|
||||
#define LV_EX_MOUSEWHEEL 1 /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/
|
||||
#define LV_EX_PRINTF 0 /*Enable printf-ing data in demoes and examples*/
|
||||
#define LV_EX_KEYBOARD 0 /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/
|
||||
#define LV_EX_MOUSEWHEEL 0 /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/
|
||||
|
||||
/*********************
|
||||
* DEMO USAGE
|
||||
*********************/
|
||||
|
||||
/*Show some widget*/
|
||||
#define LV_USE_DEMO_WIDGETS 1
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#if LV_USE_DEMO_WIDGETS
|
||||
#define LV_DEMO_WIDGETS_SLIDESHOW 0
|
||||
#endif
|
||||
|
||||
/*Printer demo, optimized for 800x480*/
|
||||
#define LV_USE_DEMO_PRINTER 1
|
||||
#define LV_USE_DEMO_PRINTER 0
|
||||
|
||||
/*Demonstrate the usage of encoder and keyboard*/
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 1
|
||||
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
|
||||
|
||||
/*Benchmark your system*/
|
||||
#define LV_USE_DEMO_BENCHMARK 1
|
||||
#define LV_USE_DEMO_BENCHMARK 0
|
||||
|
||||
/*Stress test for LVGL*/
|
||||
#define LV_USE_DEMO_STRESS 1
|
||||
/*Music player for LVGL*/
|
||||
#define LV_USE_DEMO_STRESS 0
|
||||
|
||||
/*Music player demo*/
|
||||
#define LV_USE_DEMO_MUSIC 1
|
||||
#if LV_USE_DEMO_MUSIC
|
||||
# define LV_DEMO_MUSIC_LANDSCAPE 0
|
||||
# define LV_DEMO_MUSIC_LARGE 0
|
||||
#define LV_DEMO_MUSIC_AUTO_PLAY 0
|
||||
#endif
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 8c96359f4199297809ab205870eb603b03d98b4e
|
||||
Subproject commit f14e31612409fc9216892cb58eb9d851667f8a11
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_drv_conf.h
|
||||
* Configuration file for v7.11.0
|
||||
* Configuration file for v8.0.0
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -87,14 +87,14 @@
|
||||
#endif
|
||||
|
||||
#if USE_MONITOR
|
||||
# define MONITOR_HOR_RES LV_HOR_RES
|
||||
# define MONITOR_VER_RES LV_VER_RES
|
||||
# define MONITOR_HOR_RES 800
|
||||
# define MONITOR_VER_RES 600
|
||||
|
||||
/* Scale window by this factor (useful when simulating small screens) */
|
||||
# define MONITOR_ZOOM 1
|
||||
|
||||
/* Used to test true double buffering with only address changing.
|
||||
* Set LV_VDB_SIZE = (LV_HOR_RES * LV_VER_RES) and LV_VDB_DOUBLE = 1 and LV_COLOR_DEPTH = 32" */
|
||||
* Use 2 draw buffers, bith with MONITOR_HOR_RES x MONITOR_VER_RES size*/
|
||||
# define MONITOR_DOUBLE_BUFFERED 0
|
||||
|
||||
/*Eclipse: <SDL2/SDL.h> Visual Studio: <SDL.h>*/
|
||||
@ -123,6 +123,11 @@
|
||||
# define USE_WIN32DRV 0
|
||||
#endif
|
||||
|
||||
#if USE_WIN32DRV
|
||||
/* Scale window by this factor (useful when simulating small screens) */
|
||||
# define WIN32DRV_MONITOR_ZOOM 1
|
||||
#endif
|
||||
|
||||
/*----------------------------------------
|
||||
* GTK drivers (monitor, mouse, keyboard
|
||||
*---------------------------------------*/
|
||||
@ -130,6 +135,19 @@
|
||||
# define USE_GTK 0
|
||||
#endif
|
||||
|
||||
/*----------------------------------------
|
||||
* Wayland drivers (monitor, mouse, keyboard, touchscreen)
|
||||
*---------------------------------------*/
|
||||
#ifndef USE_WAYLAND
|
||||
# define USE_WAYLAND 0
|
||||
#endif
|
||||
|
||||
#if USE_WAYLAND
|
||||
# define WAYLAND_HOR_RES 480
|
||||
# define WAYLAND_VER_RES 320
|
||||
# define WAYLAND_SURF_TITLE "LVGL"
|
||||
#endif
|
||||
|
||||
/*----------------
|
||||
* SSD1963
|
||||
*--------------*/
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 5f685373743f6999a5b6c0f2782767f2815e151b
|
||||
Subproject commit d322399eb0741fdfb08f383bb3fac92916c54b1b
|
||||
2
lvgl
2
lvgl
@ -1 +1 @@
|
||||
Subproject commit ec9de515b36641be565d7bace5863ab631ce3b69
|
||||
Subproject commit c597d257984e2cd3a1c883dc97a26d4512b5e60a
|
||||
@ -18,7 +18,7 @@
|
||||
#include "lv_drivers/indev/mouse.h"
|
||||
#include "lv_drivers/indev/keyboard.h"
|
||||
#include "lv_drivers/indev/mousewheel.h"
|
||||
#include "lv_examples/lv_examples.h"
|
||||
#include "lv_examples/lv_demo.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -33,13 +33,12 @@
|
||||
**********************/
|
||||
static void hal_init(void);
|
||||
static int tick_thread(void *data);
|
||||
static void memory_monitor(lv_task_t *param);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
lv_disp_buf_t disp_buf1;
|
||||
lv_color_t buf1_1[LV_HOR_RES_MAX * 120];
|
||||
lv_disp_draw_buf_t disp_buf1;
|
||||
lv_color_t buf1_1[MONITOR_HOR_RES * 120];
|
||||
lv_disp_drv_t disp_drv;
|
||||
lv_indev_drv_t mouse_drv;
|
||||
lv_indev_drv_t keyb_drv;
|
||||
@ -64,13 +63,13 @@ int main(int argc, char **argv)
|
||||
/*Initialize the HAL (display, input devices, tick) for LVGL*/
|
||||
hal_init();
|
||||
|
||||
lv_demo_widgets();
|
||||
// lv_demo_widgets();
|
||||
/* For printer demo set resolution to 800x480 */
|
||||
// lv_demo_printer();
|
||||
// lv_demo_keypad_encoder();
|
||||
// lv_demo_benchmark();
|
||||
// lv_demo_stress();
|
||||
// lv_demo_music();
|
||||
lv_demo_music();
|
||||
|
||||
while (1) {
|
||||
/* Periodically call the lv_task handler.
|
||||
@ -95,12 +94,14 @@ static void hal_init(void) {
|
||||
monitor_init();
|
||||
|
||||
/*Create a display buffer*/
|
||||
lv_disp_buf_init(&disp_buf1, buf1_1, NULL, LV_HOR_RES_MAX * 120);
|
||||
lv_disp_draw_buf_init(&disp_buf1, buf1_1, NULL, MONITOR_HOR_RES * 120);
|
||||
|
||||
/*Create a display*/
|
||||
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
|
||||
disp_drv.buffer = &disp_buf1;
|
||||
disp_drv.draw_buf = &disp_buf1;
|
||||
disp_drv.flush_cb = monitor_flush;
|
||||
disp_drv.hor_res = MONITOR_HOR_RES;
|
||||
disp_drv.ver_res = MONITOR_VER_RES;
|
||||
lv_disp_drv_register(&disp_drv);
|
||||
|
||||
/* Add the mouse as input device
|
||||
@ -115,7 +116,7 @@ static void hal_init(void) {
|
||||
|
||||
/*Set a cursor for the mouse*/
|
||||
LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image file.*/
|
||||
lv_obj_t * cursor_obj = lv_img_create(lv_scr_act(), NULL); /*Create an image object for the cursor */
|
||||
lv_obj_t * cursor_obj = lv_img_create(lv_scr_act()); /*Create an image object for the cursor */
|
||||
lv_img_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/
|
||||
lv_indev_set_cursor(mouse_indev, cursor_obj); /*Connect the image object to the driver*/
|
||||
|
||||
@ -137,11 +138,6 @@ static void hal_init(void) {
|
||||
* You have to call 'lv_tick_inc()' in periodically to inform LittelvGL about
|
||||
* how much time were elapsed Create an SDL thread to do this*/
|
||||
SDL_CreateThread(tick_thread, "tick", NULL);
|
||||
|
||||
/* Optional:
|
||||
* Create a memory monitor task which prints the memory usage in
|
||||
* periodically.*/
|
||||
lv_task_create(memory_monitor, 5000, LV_TASK_PRIO_MID, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,17 +155,3 @@ static int tick_thread(void *data) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the memory usage periodically
|
||||
* @param param
|
||||
*/
|
||||
static void memory_monitor(lv_task_t *param) {
|
||||
(void)param; /*Unused*/
|
||||
|
||||
lv_mem_monitor_t mon;
|
||||
lv_mem_monitor(&mon);
|
||||
printf("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d\n",
|
||||
(int)mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
|
||||
(int)mon.free_biggest_size);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user