2023-05-23 02:19:46 +02:00
|
|
|
#include "gui/model/Model.hpp"
|
|
|
|
#include "params.h"
|
|
|
|
#include "vehicle.h"
|
|
|
|
#include "vehicle_state.h"
|
2023-03-06 21:21:00 +01:00
|
|
|
#include <common/TouchGFXInit.hpp>
|
|
|
|
#include <gui_generated/common/SimConstants.hpp>
|
|
|
|
#include <platform/driver/touch/SDL2TouchController.hpp>
|
2023-05-23 02:19:46 +02:00
|
|
|
#include <platform/hal/simulator/sdl2/HALSDL2.hpp>
|
2023-03-06 21:21:00 +01:00
|
|
|
#include <simulator/mainBase.hpp>
|
2023-05-23 02:19:46 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <touchgfx/hal/NoDMA.hpp>
|
|
|
|
#include <touchgfx/lcd/LCD.hpp>
|
2023-03-06 21:21:00 +01:00
|
|
|
|
|
|
|
using namespace touchgfx;
|
|
|
|
|
|
|
|
#ifdef __linux__
|
2023-05-23 02:19:46 +02:00
|
|
|
int main(int argc, char **argv) {
|
2023-03-06 21:21:00 +01:00
|
|
|
#else
|
|
|
|
#include <shellapi.h>
|
|
|
|
#ifdef _UNICODE
|
|
|
|
#error Cannot run in unicode mode
|
|
|
|
#endif
|
2023-05-23 02:19:46 +02:00
|
|
|
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|
|
|
LPSTR lpCmdLine, int nCmdShow) {
|
|
|
|
int argc;
|
|
|
|
char **argv = touchgfx::HALSDL2::getArgv(&argc);
|
2023-03-06 21:21:00 +01:00
|
|
|
#endif
|
|
|
|
|
2023-05-23 02:19:46 +02:00
|
|
|
touchgfx::NoDMA dma; // For windows/linux, DMA transfers are simulated
|
|
|
|
LCD &lcd = setupLCD();
|
|
|
|
touchgfx::SDL2TouchController tc;
|
2023-03-06 21:21:00 +01:00
|
|
|
|
2023-05-23 02:19:46 +02:00
|
|
|
touchgfx::HAL &hal = touchgfx::touchgfx_generic_init<touchgfx::HALSDL2>(
|
|
|
|
dma, lcd, tc, SIM_WIDTH, SIM_HEIGHT, 0, 0);
|
2023-03-06 21:21:00 +01:00
|
|
|
|
2023-05-23 02:19:46 +02:00
|
|
|
setupSimulator(argc, argv, hal);
|
2023-03-06 21:21:00 +01:00
|
|
|
|
2023-05-23 02:19:46 +02:00
|
|
|
// Ensure there is a console window to print to using printf() or
|
|
|
|
// std::cout, and read from using e.g. fgets or std::cin.
|
|
|
|
// Alternatively, instead of using printf(), always use
|
|
|
|
// touchgfx_printf() which will ensure there is a console to write
|
|
|
|
// to.
|
|
|
|
// touchgfx_enable_stdio();
|
2023-03-06 21:21:00 +01:00
|
|
|
|
2023-05-23 02:19:46 +02:00
|
|
|
touchgfx::HAL::getInstance()->taskEntry(); // Never returns
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
2023-03-06 21:21:00 +01:00
|
|
|
|
2023-05-23 02:19:46 +02:00
|
|
|
// Stubs
|
|
|
|
extern "C" {
|
|
|
|
void params_dec(ParamType param) {}
|
|
|
|
void params_inc(ParamType param) {}
|
|
|
|
void params_broadcast(ParamType param) {}
|
|
|
|
void vehicle_select_mission(Mission mission) {}
|
|
|
|
Params params;
|
2023-03-06 21:21:00 +01:00
|
|
|
}
|