diff --git a/examples/ui.c b/examples/ui.c index 5a6e582..05e4369 100644 --- a/examples/ui.c +++ b/examples/ui.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "ui.h" +#include "ui_gen.h" /********************* * DEFINES @@ -37,15 +37,11 @@ lv_font_t * inter_xl; void ui_init(void) { - static bool inited = false; - if(inited) return; - inited = true; + ui_init_gen(); inter_sm = lv_tiny_ttf_create_file("A:/fonts/Inter-SemiBold.ttf", 14); inter_md = lv_tiny_ttf_create_file("A:/fonts/Inter-SemiBold.ttf", 18); inter_xl = lv_tiny_ttf_create_file("A:/fonts/Inter-SemiBold.ttf", 22); - - example_init(); } /********************** diff --git a/examples/ui_gen.c b/examples/ui_gen.c new file mode 100644 index 0000000..ebb45f1 --- /dev/null +++ b/examples/ui_gen.c @@ -0,0 +1,42 @@ +/** + * @file ui_gen.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "ui_gen.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void ui_init_gen(void) +{ + example_init(); +} + +/********************** + * STATIC FUNCTIONS + **********************/ diff --git a/examples/ui_gen.h b/examples/ui_gen.h new file mode 100644 index 0000000..3e94655 --- /dev/null +++ b/examples/ui_gen.h @@ -0,0 +1,50 @@ +/** + * @file ui_gen.h + * + */ + +#ifndef UI_GEN_H +#define UI_GEN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +/*Include all the UI libraryes*/ +#include "lvgl/lvgl.h" +#include "example.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL VARIABLES + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize all the custom component libraries (doesn't call `lv_init()`) + */ +void ui_gen_init(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*UI_H*/