awtk/demos/demo1_main.c

84 lines
1.8 KiB
C
Raw Normal View History

2018-02-21 19:36:38 +08:00
/**
* File: demo1_main.c
* Author: Li XianJing <xianjimli@hotmail.com>
* Brief: demo1 main
*
* Copyright (c) 2018 - 2018 Li XianJing <xianjimli@hotmail.com>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* License file for more details.
*
*/
/**
* History:
* ================================================================
* 2018-02-16 Li XianJing <xianjimli@hotmail.com> created
*
*/
#include "resource.h"
2018-02-22 18:07:22 +08:00
#include "base/platform.h"
ret_t application_init(void);
2018-02-21 19:36:38 +08:00
#ifdef WITH_STM32F103ZE_RAW
#include "button.h"
#include "delay.h"
#include "flash.h"
2018-02-21 19:36:38 +08:00
#include "gui.h"
#include "lcd_driver.h"
#include "led.h"
2018-02-21 19:36:38 +08:00
#include "rtc.h"
#include "stdlib.h"
#include "sys.h"
#include "tim.h"
2018-02-21 19:36:38 +08:00
#include "touch.h"
#include "usart.h"
2018-02-22 18:07:22 +08:00
#include "main_loop/main_loop_stm32_raw.h"
2018-02-21 19:36:38 +08:00
static __align(8) uint32_t s_heap_mem[2048];
2018-02-22 18:07:22 +08:00
#elif defined(WITH_RT_THREAD)
#include "main_loop/main_loop_rtthread.h"
static uint32_t s_heap_mem[2048];
2018-02-21 19:36:38 +08:00
#else
#include "main_loop/main_loop_sdl2.h"
static uint32_t s_heap_mem[2048];
#endif
2018-02-24 20:40:44 +08:00
#ifdef WITH_RT_THREAD
#include "base/mem.h"
int gui_app_start(void* params) {
#elif defined(WIN32)
2018-02-21 19:36:38 +08:00
#include <windows.h>
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) {
#else
#include "base/mem.h"
int main(void) {
#endif
2018-02-24 20:40:44 +08:00
2018-02-22 18:07:22 +08:00
platform_prepare();
2018-02-21 19:36:38 +08:00
mem_init(s_heap_mem, sizeof(s_heap_mem));
resource_init();
application_init();
#ifdef WITH_STM32F103ZE_RAW
main_loop_stm32_raw_init(320, 480);
2018-02-24 20:40:44 +08:00
#elif defined(WITH_RT_THREAD)
main_loop_rtthread_init(320, 480);
2018-02-21 19:36:38 +08:00
#else
main_loop_sdl2_init(320, 480);
#endif
application_init();
main_loop_run(default_main_loop());
main_loop_destroy(default_main_loop());
return 0;
}