#ifndef _BSP_AIR_H
#define _BSP_AIR_H
#include "at32a423.h"
typedef enum
{
	AIR_1,
	AIR_2,
	AIR_3,
	AIR_4,
	AIR_5,
	AIR_6,
	AIR_7,
	AIR_8,
	AIR_9,
	AIR_10,
	AIR_MAX_NUM,
}air_num_enum;//气囊号

typedef enum
{
	CHARGE_AIR = 0x01,
	STOP_AIR = 0x02,
	DISCHARGE_AIR = 0x03,
}air_run_action_enum;

typedef struct
{
	uint8_t value1				: 2;
	uint8_t value2				: 2;
	uint8_t value3				: 2;
	uint8_t value4				: 2;
	uint8_t value5				: 2;
	uint8_t value6				: 2;
	uint8_t value7				: 2;
	uint8_t value8				: 2;
	uint8_t value9				: 2;
	uint8_t value10				: 2;
	uint8_t 							: 4;
}air_staus_struct;//气囊输出状态

typedef struct
{
	uint8_t   					 	: 2;		//保留位
	uint8_t message_type 	: 2;//消息类型
	uint8_t device_id 		: 4;//设备id
	//第一个字节
	uint8_t value_4				: 2;//阀门4
	uint8_t value_3				: 2;//阀门3
	uint8_t value_2				: 2;//阀门2
	uint8_t value_1				: 2;//阀门1
	//第二个字节
	uint8_t value_8				: 2;//阀门8
	uint8_t value_7				: 2;//阀门7
	uint8_t value_6				: 2;//阀门6
	uint8_t value_5				: 2;//阀门5
	//第三个字节
	uint8_t 							: 4;//保留位
	uint8_t value_10			: 2;//阀门10
	uint8_t value_9				: 2;//阀门9
	//第四个字节
	uint8_t error_flag		: 8;//错误标志
	//第五个字节
	uint8_t check_sum			: 8;//校验和
}air_spi_frame_struct;//协议帧

typedef enum
{
	AIR_PUMP_ERROR 					= 0X01,
	VALUE_JAM			 					= 0X02,
	OVER_VOLTAGE_ALARM 			= 0X04,
	OVER_TEMPERATURE 				= 0X08,
	CHECK_COURSE						= 0X10,
	LOW_VOLTAGE_ERROR				= 0X20,
	COMMUNICATION_OVER_TIME = 0X40,
}error_flag_enum;//错误码

void air_handle(void);

#endif

