From 2347b738c58481d75ebb5b1a1324e113ccb6551d Mon Sep 17 00:00:00 2001 From: "Jasper v. Blanckenburg" Date: Tue, 23 May 2023 02:19:46 +0200 Subject: [PATCH] Make header structure compatible with simulator Currently, the generated Makefile doesn't successfully compile. But it is possible to run the simulator again by manually editing the Makefile. --- Core/Inc/vehicle.h | 154 +---------------- Core/Inc/vehicle_state.h | 156 ++++++++++++++++++ Core/Src/leds.c | 2 +- Core/Src/vehicle.c | 3 +- Core/Src/vehicle_state.c | 3 + STM32Make.make | 1 + .../gui/driverview_screen/DriverViewView.hpp | 3 +- TouchGFX/gui/include/gui/model/Model.hpp | 3 +- TouchGFX/gui/src/ami_screen/AMIPresenter.cpp | 3 +- TouchGFX/gui/src/common/NamedField.cpp | 5 +- .../src/containers/DriverViewStatusItem.cpp | 3 +- TouchGFX/gui/src/containers/ErrorPopup.cpp | 2 +- .../driverview_screen/DriverViewPresenter.cpp | 3 +- .../src/driverview_screen/DriverViewView.cpp | 26 +-- .../MissionSelectPresenter.cpp | 5 +- .../MissionSelectView.cpp | 6 +- TouchGFX/gui/src/model/Model.cpp | 18 +- .../VehicleConfigView.cpp | 3 +- TouchGFX/simulator/main.cpp | 60 ++++--- 19 files changed, 255 insertions(+), 204 deletions(-) create mode 100644 Core/Inc/vehicle_state.h create mode 100644 Core/Src/vehicle_state.c diff --git a/Core/Inc/vehicle.h b/Core/Inc/vehicle.h index 90a8b4c..e2fb15f 100644 --- a/Core/Inc/vehicle.h +++ b/Core/Inc/vehicle.h @@ -1,164 +1,28 @@ #ifndef __INC_VEHICLE_H #define __INC_VEHICLE_H -#include "params.h" -#include "stw_defines.h" -#include "tx_port.h" - -#include "stm32h7xx_hal.h" - #ifdef __cplusplus extern "C" { #endif -typedef enum { - TS_INACTIVE = 0, - TS_ACTIVE = 1, - TS_PRECHARGE = 2, - TS_DISCHARGE = 3, - TS_ERROR = 4, - TS_CHARGING_CHECK = 5, - TS_CHARGING = 6 -} TSState; +#include "params.h" +#include "stw_defines.h" -typedef enum { - AS_OFF = 0, - AS_MANUAL = 1, - AS_READY = 2, - AS_DRIVING = 3, - AS_FINISHED = 4, - AS_EMERGENCY = 5 -} ASState; +void vehicle_select_mission(Mission mission); +void vehicle_broadcast_param(ParamType param, int32_t value); -typedef enum { - R2D_NONE = 0, - R2D_TSMS = 1, - R2D_TSACTIVE = 2, - R2D_RESETTING_NODES = 3, - R2D_RESETTING_COMMS = 4, - R2D_WAITING_INIT = 5, - R2D_INIT_STAGE1 = 6, - R2D_INIT_STAGE2 = 7, - R2D_INIT_SUCCESS = 0xF -} R2DProgress; +#ifndef SIMULATOR -typedef enum { - INICHK_START = 0, - INICHK_WD_CHECK = 1, - INICHK_WD_OK = 2, - INICHK_ASB_CHECK_1 = 3, - INICHK_ASB_CHECK_2 = 4, - INICHK_WAIT_TS = 5, - INICHK_EBS_CHECK_A = 6, - INICHK_EBS_CHECK_B = 7, - INICHK_DONE = 8, - INICHK_ERROR = 9 -} IniChkState; +#include "tx_port.h" -typedef enum { - AMS_ERROR_NONE = 0x00, - AMS_ERROR_SLAVE_TIMEOUT = 0x01, - AMS_ERROR_SLAVE_PANIC = 0x02, - AMS_ERROR_SHUNT_TIMEOUT = 0x03, - AMS_ERROR_SHUNT_OVERCURRENT = 0x04, - AMS_ERROR_SHUNT_OVERTEMP = 0x05 -} AMSErrorKind; -typedef enum { - AMS_SLAVEPANIC_OVERTEMP = 0x00, - AMS_SLAVEPANIC_UNDERTEMP = 0x01, - AMS_SLAVEPANIC_OVERVOLTAGE = 0x02, - AMS_SLAVEPANIC_UNDERVOLTAGE = 0x03, - AMS_SLAVEPANIC_TOO_FEW_TEMP = 0x04, - AMS_SLAVEPANIC_OPENWIRE = 0x05 -} AMSSlavePanicKind; - -typedef struct { - float tire_fl; - float tire_fr; - float tire_rl; - float tire_rr; - - float brake_fl; - float brake_fr; - float brake_rl; - float brake_rr; - - float inv_l; - float inv_r; - float mot_l; - float mot_r; - float bat_l; - float bat_r; -} Temperatures; - -typedef struct { - TSState ts_state; - ASState as_state; - Mission active_mission; - - int sdc_closed; - - R2DProgress r2d_progress; - struct { - int invl_ready : 1; - int invr_ready : 1; - int sdc_bfl : 1; - int sdc_brl : 1; - int sdc_acc : 1; - int sdc_hvb : 1; - int err_sdc : 1; - int err_ams : 1; - int err_pdu : 1; - int err_ini_chk : 1; - int err_con_mon : 1; - int err_scs : 1; - int err_sbspd : 1; - int err_appsp : 1; - int err_as : 1; - int err_ros : 1; - int err_res : 1; - int err_invl : 1; - int err_invr : 1; - } errors; - struct { - AMSErrorKind kind; - uint8_t arg; - } last_ams_error; - struct { - uint8_t id; - AMSSlavePanicKind kind; - uint32_t arg; - } last_ams_slave_panic; - IniChkState ini_chk_state; - - unsigned lap_count; - Temperatures temps; - - float min_cell_volt; - float max_cell_temp; - int soc; - - float ts_current; - float ts_voltage_bat; - float ts_voltage_veh; - - float speed; - - float brake_press_f; - float brake_press_r; - - float distance_total; -} VehicleState; - -extern VehicleState vehicle_state; +#include "stm32h7xx_hal.h" void vehicle_thread_entry(ULONG hfdcan_addr); -void vehicle_select_mission(Mission mission); - -void vehicle_broadcast_param(ParamType param, int32_t value); void vehicle_broadcast_buttons(GPIO_PinState *button_states); +#endif // SIMULATOR + #ifdef __cplusplus } #endif diff --git a/Core/Inc/vehicle_state.h b/Core/Inc/vehicle_state.h new file mode 100644 index 0000000..38868f4 --- /dev/null +++ b/Core/Inc/vehicle_state.h @@ -0,0 +1,156 @@ +#ifndef __INC_VEHICLE_STATE_H +#define __INC_VEHICLE_STATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "stw_defines.h" +#include + +typedef enum { + TS_INACTIVE = 0, + TS_ACTIVE = 1, + TS_PRECHARGE = 2, + TS_DISCHARGE = 3, + TS_ERROR = 4, + TS_CHARGING_CHECK = 5, + TS_CHARGING = 6 +} TSState; + +typedef enum { + AS_OFF = 0, + AS_MANUAL = 1, + AS_READY = 2, + AS_DRIVING = 3, + AS_FINISHED = 4, + AS_EMERGENCY = 5 +} ASState; + +typedef enum { + R2D_NONE = 0, + R2D_TSMS = 1, + R2D_TSACTIVE = 2, + R2D_RESETTING_NODES = 3, + R2D_RESETTING_COMMS = 4, + R2D_WAITING_INIT = 5, + R2D_INIT_STAGE1 = 6, + R2D_INIT_STAGE2 = 7, + R2D_INIT_SUCCESS = 0xF +} R2DProgress; + +typedef enum { + INICHK_START = 0, + INICHK_WD_CHECK = 1, + INICHK_WD_OK = 2, + INICHK_ASB_CHECK_1 = 3, + INICHK_ASB_CHECK_2 = 4, + INICHK_WAIT_TS = 5, + INICHK_EBS_CHECK_A = 6, + INICHK_EBS_CHECK_B = 7, + INICHK_DONE = 8, + INICHK_ERROR = 9 +} IniChkState; + +typedef enum { + AMS_ERROR_NONE = 0x00, + AMS_ERROR_SLAVE_TIMEOUT = 0x01, + AMS_ERROR_SLAVE_PANIC = 0x02, + AMS_ERROR_SHUNT_TIMEOUT = 0x03, + AMS_ERROR_SHUNT_OVERCURRENT = 0x04, + AMS_ERROR_SHUNT_OVERTEMP = 0x05 +} AMSErrorKind; +typedef enum { + AMS_SLAVEPANIC_OVERTEMP = 0x00, + AMS_SLAVEPANIC_UNDERTEMP = 0x01, + AMS_SLAVEPANIC_OVERVOLTAGE = 0x02, + AMS_SLAVEPANIC_UNDERVOLTAGE = 0x03, + AMS_SLAVEPANIC_TOO_FEW_TEMP = 0x04, + AMS_SLAVEPANIC_OPENWIRE = 0x05 +} AMSSlavePanicKind; + +typedef struct { + float tire_fl; + float tire_fr; + float tire_rl; + float tire_rr; + + float brake_fl; + float brake_fr; + float brake_rl; + float brake_rr; + + float inv_l; + float inv_r; + float mot_l; + float mot_r; + float bat_l; + float bat_r; +} Temperatures; + +typedef struct { + TSState ts_state; + ASState as_state; + Mission active_mission; + + int sdc_closed; + + R2DProgress r2d_progress; + struct { + int invl_ready : 1; + int invr_ready : 1; + int sdc_bfl : 1; + int sdc_brl : 1; + int sdc_acc : 1; + int sdc_hvb : 1; + int err_sdc : 1; + int err_ams : 1; + int err_pdu : 1; + int err_ini_chk : 1; + int err_con_mon : 1; + int err_scs : 1; + int err_sbspd : 1; + int err_appsp : 1; + int err_as : 1; + int err_ros : 1; + int err_res : 1; + int err_invl : 1; + int err_invr : 1; + } errors; + struct { + AMSErrorKind kind; + uint8_t arg; + } last_ams_error; + struct { + uint8_t id; + AMSSlavePanicKind kind; + uint32_t arg; + } last_ams_slave_panic; + IniChkState ini_chk_state; + + unsigned lap_count; + Temperatures temps; + + float min_cell_volt; + float max_cell_temp; + int soc; + + float ts_current; + float ts_voltage_bat; + float ts_voltage_veh; + + float speed; + + float brake_press_f; + float brake_press_r; + + float distance_total; +} VehicleState; + +extern VehicleState vehicle_state; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // __INC_VEHICLE_STATE_H diff --git a/Core/Src/leds.c b/Core/Src/leds.c index 2117c35..4b56859 100644 --- a/Core/Src/leds.c +++ b/Core/Src/leds.c @@ -9,7 +9,7 @@ #include "stm32h7xx_hal_spi.h" #include "stm32h7xx_hal_tim.h" #include "tx_api.h" -#include "vehicle.h" +#include "vehicle_state.h" #include #define LED_SPEED_MIN 15 // km/h diff --git a/Core/Src/vehicle.c b/Core/Src/vehicle.c index 98adc58..b10ec0a 100644 --- a/Core/Src/vehicle.c +++ b/Core/Src/vehicle.c @@ -2,6 +2,7 @@ #include "main.h" #include "ui.h" +#include "vehicle_state.h" #include "can-halal.h" @@ -32,8 +33,6 @@ #define CAN_CS_INTERNAL_TEMP_FACTOR 0.01 #define CAN_ABX_MISC_DISTANCE_TOTAL_FACTOR 0.01 -VehicleState vehicle_state = {0}; - void vehicle_thread_entry(ULONG hfdcan_addr) { memset(&vehicle_state, 0, sizeof(vehicle_state)); ftcan_init((void *)hfdcan_addr); diff --git a/Core/Src/vehicle_state.c b/Core/Src/vehicle_state.c new file mode 100644 index 0000000..e170181 --- /dev/null +++ b/Core/Src/vehicle_state.c @@ -0,0 +1,3 @@ +#include "vehicle_state.h" + +VehicleState vehicle_state = {0}; diff --git a/STM32Make.make b/STM32Make.make index 032b768..84e1f56 100644 --- a/STM32Make.make +++ b/STM32Make.make @@ -50,6 +50,7 @@ Core/Src/stm32h7xx_it.c \ Core/Src/system_stm32h7xx.c \ Core/Src/ui.c \ Core/Src/vehicle.c \ +Core/Src/vehicle_state.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc.c \ diff --git a/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp b/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp index d3c2de1..35acff0 100644 --- a/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp +++ b/TouchGFX/gui/include/gui/driverview_screen/DriverViewView.hpp @@ -5,10 +5,11 @@ #include "gui/containers/DriverViewFieldSelection.hpp" #include "touchgfx/Unicode.hpp" #include "touchgfx/containers/scrollers/DrawableList.hpp" -#include "vehicle.h" #include #include +#include "vehicle_state.h" + enum class DriverViewProgressType { PRECHARGE, R2D }; class DriverViewView : public DriverViewViewBase { diff --git a/TouchGFX/gui/include/gui/model/Model.hpp b/TouchGFX/gui/include/gui/model/Model.hpp index 763a843..d1a06e0 100644 --- a/TouchGFX/gui/include/gui/model/Model.hpp +++ b/TouchGFX/gui/include/gui/model/Model.hpp @@ -2,7 +2,8 @@ #define MODEL_HPP #include "stw_defines.h" -#include "vehicle.h" +#include "vehicle_state.h" + class ModelListener; class Model { diff --git a/TouchGFX/gui/src/ami_screen/AMIPresenter.cpp b/TouchGFX/gui/src/ami_screen/AMIPresenter.cpp index c1ef9a4..843ca85 100644 --- a/TouchGFX/gui/src/ami_screen/AMIPresenter.cpp +++ b/TouchGFX/gui/src/ami_screen/AMIPresenter.cpp @@ -1,8 +1,7 @@ #include #include -#include "main.h" -#include "vehicle.h" +#include "vehicle_state.h" AMIPresenter::AMIPresenter(AMIView &v) : view(v) {} diff --git a/TouchGFX/gui/src/common/NamedField.cpp b/TouchGFX/gui/src/common/NamedField.cpp index 52e3296..15d8a81 100644 --- a/TouchGFX/gui/src/common/NamedField.cpp +++ b/TouchGFX/gui/src/common/NamedField.cpp @@ -1,9 +1,10 @@ #include "gui/common/NamedField.hpp" #include "texts/TextKeysAndLanguages.hpp" -#include "params.h" #include "touchgfx/Unicode.hpp" -#include "vehicle.h" + +#include "params.h" +#include "vehicle_state.h" #define VEH_FIELD(FIELD) []() { return (void *)&vehicle_state.FIELD; } #define VEH_BIT_FIELD(FIELD) \ diff --git a/TouchGFX/gui/src/containers/DriverViewStatusItem.cpp b/TouchGFX/gui/src/containers/DriverViewStatusItem.cpp index 585b0f6..425504a 100644 --- a/TouchGFX/gui/src/containers/DriverViewStatusItem.cpp +++ b/TouchGFX/gui/src/containers/DriverViewStatusItem.cpp @@ -1,7 +1,8 @@ #include #include "texts/TextKeysAndLanguages.hpp" -#include "vehicle.h" + +#include "vehicle_state.h" DriverViewStatusItem::DriverViewStatusItem() {} diff --git a/TouchGFX/gui/src/containers/ErrorPopup.cpp b/TouchGFX/gui/src/containers/ErrorPopup.cpp index 4a760f9..71fde36 100644 --- a/TouchGFX/gui/src/containers/ErrorPopup.cpp +++ b/TouchGFX/gui/src/containers/ErrorPopup.cpp @@ -2,7 +2,7 @@ #include "texts/TextKeysAndLanguages.hpp" #include "touchgfx/Unicode.hpp" -#include "vehicle.h" +#include "vehicle_state.h" #include diff --git a/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp b/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp index 3825794..222b03a 100644 --- a/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp +++ b/TouchGFX/gui/src/driverview_screen/DriverViewPresenter.cpp @@ -2,7 +2,8 @@ #include #include "gui/common/NamedField.hpp" -#include "vehicle.h" + +#include "vehicle_state.h" DriverViewPresenter::DriverViewPresenter(DriverViewView &v) : view(v), fields{DF_MinCellVolt, DF_Speed, DF_MaxCellTemp} {} diff --git a/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp b/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp index 1b5817c..ae43d82 100644 --- a/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp +++ b/TouchGFX/gui/src/driverview_screen/DriverViewView.cpp @@ -6,10 +6,12 @@ #include "touchgfx/Callback.hpp" #include "touchgfx/Drawable.hpp" #include "touchgfx/Unicode.hpp" -#include "vehicle.h" #include -#include +#include +#include + +#include "vehicle_state.h" DriverViewView::DriverViewView() : fieldTypes{DF_MinCellVolt, DF_Speed, DF_TSCurrent} {} @@ -87,16 +89,16 @@ void DriverViewView::updateStatusItems() { } void DriverViewView::setTemps(const Temperatures &temps) { - brakeTempFL.setTemp(roundf(temps.brake_fl)); - brakeTempFR.setTemp(roundf(temps.brake_fr)); - brakeTempRL.setTemp(roundf(temps.brake_rl)); - brakeTempRR.setTemp(roundf(temps.brake_rr)); - invTempL.setTemp(roundf(temps.inv_l)); - invTempR.setTemp(roundf(temps.inv_r)); - motorTempL.setTemp(roundf(temps.mot_l)); - motorTempR.setTemp(roundf(temps.mot_r)); - batTempL.setTemp(roundf(temps.bat_l)); - batTempR.setTemp(roundf(temps.bat_r)); + brakeTempFL.setTemp(std::round(temps.brake_fl)); + brakeTempFR.setTemp(std::round(temps.brake_fr)); + brakeTempRL.setTemp(std::round(temps.brake_rl)); + brakeTempRR.setTemp(std::round(temps.brake_rr)); + invTempL.setTemp(std::round(temps.inv_l)); + invTempR.setTemp(std::round(temps.inv_r)); + motorTempL.setTemp(std::round(temps.mot_l)); + motorTempR.setTemp(std::round(temps.mot_r)); + batTempL.setTemp(std::round(temps.bat_l)); + batTempR.setTemp(std::round(temps.bat_r)); } void DriverViewView::setTSSoC(uint8_t soc) { diff --git a/TouchGFX/gui/src/missionselect_screen/MissionSelectPresenter.cpp b/TouchGFX/gui/src/missionselect_screen/MissionSelectPresenter.cpp index d23a697..e8c79c3 100644 --- a/TouchGFX/gui/src/missionselect_screen/MissionSelectPresenter.cpp +++ b/TouchGFX/gui/src/missionselect_screen/MissionSelectPresenter.cpp @@ -1,10 +1,11 @@ #include "gui/common/FrontendApplication.hpp" -#include "stw_defines.h" #include "touchgfx/Application.hpp" -#include "vehicle.h" #include #include +#include "stw_defines.h" +#include "vehicle_state.h" + MissionSelectPresenter::MissionSelectPresenter(MissionSelectView &v) : view(v) {} diff --git a/TouchGFX/gui/src/missionselect_screen/MissionSelectView.cpp b/TouchGFX/gui/src/missionselect_screen/MissionSelectView.cpp index f6dae46..4239ee7 100644 --- a/TouchGFX/gui/src/missionselect_screen/MissionSelectView.cpp +++ b/TouchGFX/gui/src/missionselect_screen/MissionSelectView.cpp @@ -1,9 +1,11 @@ #include "gui/missionselect_screen/MissionSelectPresenter.hpp" -#include "stw_defines.h" #include "texts/TextKeysAndLanguages.hpp" -#include "vehicle.h" #include +#include "stw_defines.h" +#include "vehicle.h" +#include "vehicle_state.h" + MissionSelectView::MissionSelectView() : selected{nullptr}, selectedMission{MISSION_NONE} {} diff --git a/TouchGFX/gui/src/model/Model.cpp b/TouchGFX/gui/src/model/Model.cpp index 68672f4..9e65e3a 100644 --- a/TouchGFX/gui/src/model/Model.cpp +++ b/TouchGFX/gui/src/model/Model.cpp @@ -1,15 +1,19 @@ +#include +#include + +Model::Model() : modelListener(0) {} + +#ifdef SIMULATOR +void Model::tick() { modelListener->vehicleStateUpdated(); } +#else + #include "main.h" #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_gpio.h" #include "stw_defines.h" #include "tx_api.h" #include "ui.h" -#include "vehicle.h" - -#include -#include - -Model::Model() : modelListener(0) {} +#include "vehicle_state.h" void Model::tick() { ULONG events; @@ -25,3 +29,5 @@ void Model::tick() { modelListener->vehicleStateUpdated(); } } + +#endif // SIMULATOR diff --git a/TouchGFX/gui/src/vehicleconfig_screen/VehicleConfigView.cpp b/TouchGFX/gui/src/vehicleconfig_screen/VehicleConfigView.cpp index 52b8a39..7d59da8 100644 --- a/TouchGFX/gui/src/vehicleconfig_screen/VehicleConfigView.cpp +++ b/TouchGFX/gui/src/vehicleconfig_screen/VehicleConfigView.cpp @@ -1,6 +1,5 @@ #include "gui/common/NamedField.hpp" #include "gui/containers/ConfigItem.hpp" -#include "main.h" #include "params.h" #include #include @@ -76,7 +75,7 @@ void VehicleConfigView::updateSelectedParam(int select) { int16_t firstVisible = firstItem->getType(); int16_t lastVisible = lastItem->getType(); if (lastVisible < firstVisible) { - Error_Handler(); + return; } int16_t numVisible = lastVisible - firstVisible + 1; if (selectedParam >= firstVisible && selectedParam <= lastVisible) { diff --git a/TouchGFX/simulator/main.cpp b/TouchGFX/simulator/main.cpp index 2804fdd..ba1cb34 100644 --- a/TouchGFX/simulator/main.cpp +++ b/TouchGFX/simulator/main.cpp @@ -1,44 +1,58 @@ -#include -#include +#include "gui/model/Model.hpp" +#include "params.h" +#include "vehicle.h" +#include "vehicle_state.h" #include #include #include -#include -#include +#include #include +#include +#include +#include using namespace touchgfx; #ifdef __linux__ -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { #else #include #ifdef _UNICODE #error Cannot run in unicode mode #endif -int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) -{ - int argc; - char** argv = touchgfx::HALSDL2::getArgv(&argc); +int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) { + int argc; + char **argv = touchgfx::HALSDL2::getArgv(&argc); #endif - touchgfx::NoDMA dma; //For windows/linux, DMA transfers are simulated - LCD& lcd = setupLCD(); - touchgfx::SDL2TouchController tc; + touchgfx::NoDMA dma; // For windows/linux, DMA transfers are simulated + LCD &lcd = setupLCD(); + touchgfx::SDL2TouchController tc; - touchgfx::HAL& hal = touchgfx::touchgfx_generic_init(dma, lcd, tc, SIM_WIDTH, SIM_HEIGHT, 0, 0); + touchgfx::HAL &hal = touchgfx::touchgfx_generic_init( + dma, lcd, tc, SIM_WIDTH, SIM_HEIGHT, 0, 0); - setupSimulator(argc, argv, hal); + setupSimulator(argc, argv, hal); - // 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(); + // 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(); - touchgfx::HAL::getInstance()->taskEntry(); //Never returns + touchgfx::HAL::getInstance()->taskEntry(); // Never returns - return EXIT_SUCCESS; + return EXIT_SUCCESS; +} + +// Stubs +extern "C" { +VehicleState vehicle_state; +void params_dec(ParamType param) {} +void params_inc(ParamType param) {} +void params_broadcast(ParamType param) {} +void vehicle_select_mission(Mission mission) {} +Params params; }