2018-02-21 19:36:38 +08:00
|
|
|
/**
|
2018-03-10 22:01:10 +08:00
|
|
|
* File: demo_main.c
|
2018-02-21 19:36:38 +08:00
|
|
|
* Author: Li XianJing <xianjimli@hotmail.com>
|
2018-03-10 22:01:10 +08:00
|
|
|
* Brief: demo main
|
2018-02-21 19:36:38 +08:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-03-18 11:29:31 +08:00
|
|
|
#include "lftk.h"
|
2018-04-26 16:09:53 +08:00
|
|
|
#include "resource.h"
|
|
|
|
#include "base/system_info.h"
|
2018-02-22 18:07:22 +08:00
|
|
|
|
|
|
|
ret_t application_init(void);
|
2018-02-21 19:36:38 +08:00
|
|
|
|
|
|
|
#ifdef WITH_STM32F103ZE_RAW
|
|
|
|
#include "button.h"
|
2018-02-22 08:36:54 +08:00
|
|
|
#include "delay.h"
|
|
|
|
#include "flash.h"
|
2018-02-21 19:36:38 +08:00
|
|
|
#include "gui.h"
|
2018-02-22 08:36:54 +08:00
|
|
|
#include "lcd_driver.h"
|
|
|
|
#include "led.h"
|
2018-02-21 19:36:38 +08:00
|
|
|
#include "rtc.h"
|
|
|
|
#include "stdlib.h"
|
2018-02-22 08:36:54 +08:00
|
|
|
#include "sys.h"
|
|
|
|
#include "tim.h"
|
2018-02-21 19:36:38 +08:00
|
|
|
#include "touch.h"
|
2018-02-22 08:36:54 +08:00
|
|
|
#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-04-26 16:09:53 +08:00
|
|
|
system_info_t* info = system_info();
|
2018-02-24 20:40:44 +08:00
|
|
|
|
2018-03-04 08:32:52 +08:00
|
|
|
lftk_init(320, 480, s_heap_mem, sizeof(s_heap_mem));
|
2018-02-21 19:36:38 +08:00
|
|
|
|
2018-04-26 16:09:53 +08:00
|
|
|
log_debug("system_info: lcd_w=%d lcd_h=%d lcd_type=%d device_pixel_ratio=%f\n",
|
|
|
|
info->lcd_w, info->lcd_h, info->lcd_type, info->device_pixel_ratio);
|
2018-02-21 19:36:38 +08:00
|
|
|
resource_init();
|
|
|
|
application_init();
|
|
|
|
|
2018-03-04 08:32:52 +08:00
|
|
|
lftk_run();
|
2018-02-21 19:36:38 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|