Add full automotive RTOS project
Add kernel (Cortex-M0/M3/M4, Tricore, S32K, RISC-V ports), drivers, middleware (CAN stack, diagnostics, safety), applications, board support, build/test tooling, and documentation.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @file brake_control.h
|
||||
* @brief Brake control module interface
|
||||
*/
|
||||
|
||||
#ifndef BRAKE_CONTROL_H
|
||||
#define BRAKE_CONTROL_H
|
||||
|
||||
#include "kernel.h"
|
||||
|
||||
/* Brake Control Parameters */
|
||||
#define BRAKE_CONTROL_PERIOD_MS 5
|
||||
#define ABS_CONTROL_PERIOD_MS 1
|
||||
#define WHEEL_SPEED_SENSOR_COUNT 4
|
||||
#define MAX_BRAKE_PRESSURE 20000 /* kPa */
|
||||
#define ABS_SLIP_THRESHOLD 0.2f
|
||||
#define ABS_DECELERATION_THRESHOLD -10.0f /* m/s² */
|
||||
|
||||
/* Brake States */
|
||||
typedef enum {
|
||||
BRAKE_STATE_IDLE = 0,
|
||||
BRAKE_STATE_NORMAL_BRAKING = 1,
|
||||
BRAKE_STATE_ABS_ACTIVE = 2,
|
||||
BRAKE_STATE_EMERGENCY = 3,
|
||||
BRAKE_STATE_FAULT = 4
|
||||
} BrakeState_t;
|
||||
|
||||
/* Wheel Speed Data */
|
||||
typedef struct {
|
||||
float wheel_speed[WHEEL_SPEED_SENSOR_COUNT]; /* km/h */
|
||||
float wheel_acceleration[WHEEL_SPEED_SENSOR_COUNT]; /* m/s² */
|
||||
uint16_t wheel_sensor_raw[WHEEL_SPEED_SENSOR_COUNT];
|
||||
bool sensor_fault[WHEEL_SPEED_SENSOR_COUNT];
|
||||
} WheelSpeedData_t;
|
||||
|
||||
/* Brake System Data */
|
||||
typedef struct {
|
||||
uint16_t brake_pedal_position;
|
||||
uint16_t brake_pressure;
|
||||
float vehicle_speed;
|
||||
float vehicle_deceleration;
|
||||
bool abs_active;
|
||||
bool brake_light;
|
||||
uint8_t abs_fault_code;
|
||||
} BrakeSystemData_t;
|
||||
|
||||
/* Brake Control Functions */
|
||||
KernelStatus_t brake_control_init(void);
|
||||
KernelStatus_t brake_control_start(void);
|
||||
KernelStatus_t brake_control_stop(void);
|
||||
KernelStatus_t brake_control_get_data(BrakeSystemData_t* data);
|
||||
KernelStatus_t brake_control_get_wheel_data(WheelSpeedData_t* data);
|
||||
BrakeState_t brake_control_get_state(void);
|
||||
void brake_control_task(void* parameters);
|
||||
void abs_control_task(void* parameters);
|
||||
|
||||
#endif /* BRAKE_CONTROL_H */
|
||||
Reference in New Issue
Block a user