/** * @file apply_controller.h * @brief Apply/Hold/Release control of the EPB. * * @arch SWA-002 * @reqs SWE-001 SWE-002 SWE-003 SWE-004 * * ASIL: D */ #ifndef APPLY_CONTROLLER_H #define APPLY_CONTROLLER_H #include "epb_types.h" typedef struct { SwitchState sw_state; /* aus SwitchDebouncer */ bool standstill; /* aus Wheel-Speed-Plausi */ bool engine_running; bool brake_pedal_pressed; bool gear_engaged; bool safety_apply_request; /* aus SafetyManager */ uint16_t left_force_n; uint16_t right_force_n; } ApplyInputs; #define APPLY_TARGET_FORCE_N 12000U /* Target clamping force per actuator */ #define APPLY_TIMEOUT_50MS 30U /* 30 * 50ms = 1500 ms */ #define HOLD_TOLERANCE_N 1200U /* 10% of target */ EpbStatus apply_ctrl_init(void); /** * @brief 50 ms step function. * * @reqs SWE-001 SWE-002 SWE-003 SWE-004 */ void apply_ctrl_step_50ms(const ApplyInputs* in); EpbState apply_ctrl_get_state(void); EpbStatus apply_ctrl_last_error(void); uint32_t apply_ctrl_get_step_count(void); /* Watchdog alive counter */ #endif /* APPLY_CONTROLLER_H */