#ifndef _ETSC_H__
#define _ETSC_H__

typedef struct {
	bool b_etcs_en;
	bool b_etcs_running;
	float f_fvel;
	float f_torque_ref;
	float f_torque_tcs;
	float f_acc;
	u32	  n_fv_ts;
	int   n_etcs_run_cnt;
	float output;
}etcs_t;
void etcs_init(etcs_t *etcs);
void etcs_set_fvel(etcs_t *etcs, float vel);//设置前轮速度
float etcs_process(etcs_t *etcs);

static __INLINE bool etcs_is_running(etcs_t *etcs) {
	return etcs->b_etcs_running;
}

static __INLINE void etcs_enable(etcs_t *etcs, bool enable) {
	if (etcs->b_etcs_en != enable) {
		etcs->b_etcs_en = enable;
		etcs->output = 1.0f;
	}
}

static __INLINE float etcs_get_output(etcs_t *etcs) {
	return etcs->output;
}

#endif /* _ETSC_H__ */

