-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3dbe88
commit 7f30594
Showing
2 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/** | ||
* @file ui_test.c | ||
* | ||
*/ | ||
|
||
/********************* | ||
* INCLUDES | ||
*********************/ | ||
#include "ui_test.h" | ||
|
||
#if LV_USE_XML == 0 | ||
#error "Enable LV_USE_XML in lv_conf.h" | ||
#endif | ||
|
||
/********************* | ||
* DEFINES | ||
*********************/ | ||
|
||
/********************** | ||
* TYPEDEFS | ||
**********************/ | ||
|
||
/********************** | ||
* GLOBAL PROTOTYPES | ||
**********************/ | ||
void dark_slider_register(void); | ||
void slider_box_register(void); | ||
|
||
/********************** | ||
* STATIC PROTOTYPES | ||
**********************/ | ||
|
||
/********************** | ||
* STATIC VARIABLES | ||
**********************/ | ||
|
||
/********************** | ||
* MACROS | ||
**********************/ | ||
|
||
/********************** | ||
* GLOBAL FUNCTIONS | ||
**********************/ | ||
|
||
void ui_test_from_c(void) | ||
{ | ||
ui_init("A:xml_examples/"); | ||
|
||
/*Create the home component by calling a C function*/ | ||
home_create(lv_screen_active()); | ||
|
||
} | ||
void ui_test_from_xml(void) | ||
{ | ||
ui_init("A:xml_examples/"); | ||
|
||
/*Register the fonts. Will be required for XML parsing.*/ | ||
lv_xml_register_font("inter_sm", inter_sm); | ||
lv_xml_register_font("inter_md", inter_md); | ||
lv_xml_register_font("inter_xl", inter_xl); | ||
|
||
/*Register the components and widgets*/ | ||
lv_xml_component_register_from_file("A:xml_examples/components/buttons/button_default.xml"); | ||
lv_xml_component_register_from_file("A:xml_examples/components/buttons/button_warning.xml"); | ||
lv_xml_component_register_from_file("A:xml_examples/components/buttons/button_error.xml"); | ||
lv_xml_component_register_from_file("A:xml_examples/components/headings/h1.xml"); | ||
lv_xml_component_register_from_file("A:xml_examples/components/headings/h2.xml"); | ||
lv_xml_component_register_from_file("A:xml_examples/components/headings/h3.xml"); | ||
lv_xml_component_register_from_file("A:xml_examples/components/home.xml"); | ||
lv_xml_component_register_from_file("A:xml_examples/components/scratchpad.xml"); | ||
|
||
dark_slider_register(); | ||
slider_box_register(); | ||
|
||
/*Create the home component directly from XML*/ | ||
lv_xml_create(lv_screen_active(), "home", NULL); | ||
} | ||
|
||
/********************** | ||
* STATIC FUNCTIONS | ||
**********************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @file ui_test.h | ||
* | ||
*/ | ||
|
||
#ifndef UI_TEST_H | ||
#define UI_TEST_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/********************* | ||
* INCLUDES | ||
*********************/ | ||
#include "ui.h" | ||
|
||
|
||
/********************* | ||
* DEFINES | ||
*********************/ | ||
|
||
/********************** | ||
* TYPEDEFS | ||
**********************/ | ||
|
||
/********************** | ||
* GLOBAL VARIABLES | ||
**********************/ | ||
|
||
/********************** | ||
* GLOBAL PROTOTYPES | ||
**********************/ | ||
|
||
/** | ||
* Call after lv_init() and your driver inits to test the example UI | ||
* directly from C. | ||
*/ | ||
void ui_test_from_c(void); | ||
|
||
/** | ||
* Call after lv_init() and your driver inits to test the example UI | ||
* directly from XML. | ||
*/ | ||
void ui_test_from_xml(void); | ||
|
||
/********************** | ||
* MACROS | ||
**********************/ | ||
|
||
#ifdef __cplusplus | ||
} /*extern "C"*/ | ||
#endif | ||
|
||
#endif /*UI_TEST_H*/ |