firmware
IEM Firmware Documentation
Loading...
Searching...
No Matches
state.h
Go to the documentation of this file.
1
10
11
#ifndef STATE_H
12
#define STATE_H
13
14
#include "
rtos.h
"
15
16
enum
__attribute__((packed))
car_state
{
17
LV_ON
= 0,
18
PRECHARGED
,
19
BRAKE_PRESSED
,
20
RTDS
,
21
ZOOM
,
22
SOFT_FAULT
,
23
HARD_FAULT
,
24
};
25
26
enum
btsf_fault
{
27
BTSF_OK
,
28
BTSF_SKILL_ISSUE
,
29
BTSF_SHORT
,
30
BTSF_OPEN
,
31
};
32
33
enum
apps_fault
{
34
APPS_OK
,
35
APPS_TIMEOUT
,
36
APPS_IMPLAUSIBILITY
,
37
APPS_ERROR
,
38
};
39
40
union
car_flags
{
41
uint32_t
as_u32
;
// So we can == current and previous values
42
43
struct
{
44
enum
car_state
state
;
45
46
struct
__packed {
47
// Hard faults
48
bool
bms
: 1;
49
bool
imd
: 1;
50
bool
bspd
: 1;
51
52
// Soft faults
53
enum
apps_fault
apps
: 2;
54
enum
btsf_fault
btsf
: 2;
55
56
// TSSI control
57
bool
true_fault_stat
: 1;
58
}
fault
;
59
60
struct
__packed {
61
// (external, from GPIO)
62
bool
hv_connected
: 1;
63
bool
shutdown_closed
: 1;
64
65
// CAN messages (precharge complete from BMS, drive/cooling aux switches from FSB)
66
bool
precharge_cplt
: 1;
67
bool
drive_en
: 1;
68
bool
cooling_en
: 1;
69
// Flag set in timer callback
70
bool
rtds_timer_cplt
: 1;
71
72
// (active when measured brake pressure is above the threshold)
73
bool
brake_pressed
: 1;
74
75
bool
have_reset
: 1;
76
}
status
;
77
};
78
};
79
80
void
task_state_init
(
Global_Handles_t
* handles_ptr);
81
82
float
get_brake_pressure
();
83
84
#endif
/* STATE_H */
rtos.h
RTOS task config parameter macros.
btsf_fault
btsf_fault
Definition
state.h:26
BTSF_OPEN
@ BTSF_OPEN
Definition
state.h:30
BTSF_SHORT
@ BTSF_SHORT
Definition
state.h:29
BTSF_OK
@ BTSF_OK
Definition
state.h:27
BTSF_SKILL_ISSUE
@ BTSF_SKILL_ISSUE
Definition
state.h:28
car_state
car_state
Definition
state.h:16
RTDS
@ RTDS
Definition
state.h:20
HARD_FAULT
@ HARD_FAULT
Definition
state.h:23
PRECHARGED
@ PRECHARGED
Definition
state.h:18
ZOOM
@ ZOOM
Definition
state.h:21
BRAKE_PRESSED
@ BRAKE_PRESSED
Definition
state.h:19
LV_ON
@ LV_ON
Definition
state.h:17
SOFT_FAULT
@ SOFT_FAULT
Definition
state.h:22
apps_fault
apps_fault
Definition
state.h:33
APPS_IMPLAUSIBILITY
@ APPS_IMPLAUSIBILITY
Definition
state.h:36
APPS_ERROR
@ APPS_ERROR
Definition
state.h:37
APPS_OK
@ APPS_OK
Definition
state.h:34
APPS_TIMEOUT
@ APPS_TIMEOUT
Definition
state.h:35
task_state_init
void task_state_init(Global_Handles_t *handles_ptr)
Initialize the state machine task and input queue.
Definition
state.c:152
get_brake_pressure
float get_brake_pressure()
Definition
state.c:586
Global_Handles_t
Definition
types.h:16
car_flags
Definition
state.h:40
car_flags::status
struct car_flags::@267342266174371223320057360006347007332107322341::__packed status
car_flags::apps
enum apps_fault apps
Definition
state.h:53
car_flags::bms
bool bms
Definition
state.h:48
car_flags::drive_en
bool drive_en
Definition
state.h:67
car_flags::as_u32
uint32_t as_u32
Definition
state.h:41
car_flags::brake_pressed
bool brake_pressed
Definition
state.h:73
car_flags::precharge_cplt
bool precharge_cplt
Definition
state.h:66
car_flags::fault
struct car_flags::@267342266174371223320057360006347007332107322341::__packed fault
car_flags::shutdown_closed
bool shutdown_closed
Definition
state.h:63
car_flags::hv_connected
bool hv_connected
Definition
state.h:62
car_flags::have_reset
bool have_reset
Definition
state.h:75
car_flags::bspd
bool bspd
Definition
state.h:50
car_flags::true_fault_stat
bool true_fault_stat
Definition
state.h:57
car_flags::cooling_en
bool cooling_en
Definition
state.h:68
car_flags::state
enum car_state state
Definition
state.h:44
car_flags::rtds_timer_cplt
bool rtds_timer_cplt
Definition
state.h:70
car_flags::imd
bool imd
Definition
state.h:49
car_flags::btsf
enum btsf_fault btsf
Definition
state.h:54
ecu
safety
application
inc
state.h
Generated by
1.14.0