diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2024-01-29 23:58:04 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2024-01-30 01:16:18 +0100 |
| commit | a27a35bd778d9afe9f04e7aed69d950bc4d980e8 (patch) | |
| tree | cad17cb68da4a210538c15a7fba2289374c4fcc1 /src/main | |
| parent | c2e2343054e8d11ebaaf426d6ca105e79e93da6a (diff) | |
| download | jancity-a27a35bd778d9afe9f04e7aed69d950bc4d980e8.tar.gz | |
WIP ESP32 port
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | src/main/esp32/src/main.c | 6 | ||||
| -rw-r--r-- | src/main/inc/engine_main.h | 15 | ||||
| -rw-r--r-- | src/main/src/main.c | 15 | ||||
| -rw-r--r-- | src/main/std/src/main.c | 14 |
5 files changed, 59 insertions, 0 deletions
diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt new file mode 100644 index 0000000..a9a02a7 --- /dev/null +++ b/src/main/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(main "src/main.c") +target_include_directories(main PUBLIC "inc") +target_link_libraries(main PRIVATE menu system) + +if(ESP32_BUILD) + target_sources(${PROJECT_NAME} PRIVATE "esp32/src/main.c") +else() + target_sources(${PROJECT_NAME} PRIVATE "std/src/main.c") +endif() diff --git a/src/main/esp32/src/main.c b/src/main/esp32/src/main.c new file mode 100644 index 0000000..77ca051 --- /dev/null +++ b/src/main/esp32/src/main.c @@ -0,0 +1,6 @@ +#include <engine_main.h> + +void app_main(void) +{ + engine_main(); +} diff --git a/src/main/inc/engine_main.h b/src/main/inc/engine_main.h new file mode 100644 index 0000000..9cb7fb3 --- /dev/null +++ b/src/main/inc/engine_main.h @@ -0,0 +1,15 @@ +#ifndef MAIN_PRIVATE_H +#define MAIN_PRIVATE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +int engine_main(void); + +#ifdef __cplusplus +} +#endif + +#endif /* MAIN_PRIVATE_H */ diff --git a/src/main/src/main.c b/src/main/src/main.c new file mode 100644 index 0000000..246cb7b --- /dev/null +++ b/src/main/src/main.c @@ -0,0 +1,15 @@ +#include <engine_main.h> +#include <menu.h> +#include <system.h> +#include <stdlib.h> + +int engine_main(void) +{ + int ret = 0; + + if (system_init() || menu()) + ret = -1; + + system_deinit(); + return ret; +} diff --git a/src/main/std/src/main.c b/src/main/std/src/main.c new file mode 100644 index 0000000..8933639 --- /dev/null +++ b/src/main/std/src/main.c @@ -0,0 +1,14 @@ +#include <menu.h> +#include <system.h> +#include <stdlib.h> + +int main(void) +{ + int ret = EXIT_SUCCESS; + + if (system_init() || menu()) + ret = EXIT_FAILURE; + + system_deinit(); + return ret; +} |
