Skip to content

Commit

Permalink
add ui_gen.c/h
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Dec 18, 2024
1 parent b5b616c commit 212ca08
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 6 deletions.
8 changes: 2 additions & 6 deletions examples/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/*********************
* INCLUDES
*********************/
#include "ui.h"
#include "ui_gen.h"

/*********************
* DEFINES
Expand Down Expand Up @@ -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();
}

/**********************
Expand Down
42 changes: 42 additions & 0 deletions examples/ui_gen.c
Original file line number Diff line number Diff line change
@@ -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
**********************/
50 changes: 50 additions & 0 deletions examples/ui_gen.h
Original file line number Diff line number Diff line change
@@ -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*/

0 comments on commit 212ca08

Please sign in to comment.