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
25
32
39
40union car_flags {
41 uint32_t as_u32; // So we can == current and previous values
42
43 struct {
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
59
60 struct __packed {
61 // (external, from GPIO)
62 bool hv_connected : 1;
64
65 // CAN messages (precharge complete from BMS, drive/cooling aux switches from FSB)
67 bool drive_en : 1;
68 bool cooling_en : 1;
69 // Flag set in timer callback
71
72 // (active when measured brake pressure is above the threshold)
73 bool brake_pressed : 1;
74
75 bool have_reset : 1;
77 };
78};
79
80void task_state_init(Global_Handles_t* handles_ptr);
81
82float get_brake_pressure();
83
84#endif /* STATE_H */
RTOS task config parameter macros.
btsf_fault
Definition state.h:26
@ BTSF_OPEN
Definition state.h:30
@ BTSF_SHORT
Definition state.h:29
@ BTSF_OK
Definition state.h:27
@ BTSF_SKILL_ISSUE
Definition state.h:28
car_state
Definition state.h:16
@ RTDS
Definition state.h:20
@ HARD_FAULT
Definition state.h:23
@ PRECHARGED
Definition state.h:18
@ ZOOM
Definition state.h:21
@ BRAKE_PRESSED
Definition state.h:19
@ LV_ON
Definition state.h:17
@ SOFT_FAULT
Definition state.h:22
apps_fault
Definition state.h:33
@ APPS_IMPLAUSIBILITY
Definition state.h:36
@ APPS_ERROR
Definition state.h:37
@ APPS_OK
Definition state.h:34
@ APPS_TIMEOUT
Definition state.h:35
void task_state_init(Global_Handles_t *handles_ptr)
Initialize the state machine task and input queue.
Definition state.c:152
float get_brake_pressure()
Definition state.c:586
Definition types.h:16
Definition state.h:40
struct car_flags::@267342266174371223320057360006347007332107322341::__packed status
enum apps_fault apps
Definition state.h:53
bool bms
Definition state.h:48
bool drive_en
Definition state.h:67
uint32_t as_u32
Definition state.h:41
bool brake_pressed
Definition state.h:73
bool precharge_cplt
Definition state.h:66
struct car_flags::@267342266174371223320057360006347007332107322341::__packed fault
bool shutdown_closed
Definition state.h:63
bool hv_connected
Definition state.h:62
bool have_reset
Definition state.h:75
bool bspd
Definition state.h:50
bool true_fault_stat
Definition state.h:57
bool cooling_en
Definition state.h:68
enum car_state state
Definition state.h:44
bool rtds_timer_cplt
Definition state.h:70
bool imd
Definition state.h:49
enum btsf_fault btsf
Definition state.h:54