steering-wheel/Core/Inc/vehicle.h

114 lines
1.9 KiB
C
Raw Normal View History

2023-03-08 20:20:01 +01:00
#ifndef __INC_VEHICLE_H
#define __INC_VEHICLE_H
2023-03-18 21:44:01 +01:00
#include "stw_defines.h"
2023-03-08 20:20:01 +01:00
#include "tx_port.h"
2023-03-15 18:43:38 +01:00
#ifdef __cplusplus
extern "C" {
#endif
2023-03-18 21:44:01 +01:00
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;
2023-03-15 18:43:38 +01:00
typedef struct {
2023-03-18 21:44:01 +01:00
float fl;
float fr;
float rl;
float rr;
2023-03-15 18:43:38 +01:00
} TireTemps;
2023-03-18 21:44:01 +01:00
typedef struct {
TSState ts_state;
ASState as_state;
Mission active_mission;
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;
IniChkState ini_chk_state;
unsigned lap_count;
TireTemps tire_temps;
float min_cell_volt;
float max_cell_temp;
int soc;
float ts_current;
float ts_voltage_bat;
float ts_voltage_veh;
} VehicleState;
extern VehicleState vehicle_state;
2023-03-08 20:20:01 +01:00
void vehicle_thread_entry(ULONG hfdcan_addr);
2023-03-18 21:44:01 +01:00
void vehicle_select_mission(Mission mission);
2023-03-15 18:43:38 +01:00
#ifdef __cplusplus
}
#endif
2023-03-08 20:20:01 +01:00
#endif // __INC_VEHICLE_H