4G_module/custom/control_out/inc/control_out.h

73 lines
2.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __CONTROL_OUT_H__
#define __CONTROL_OUT_H__
#include "cm_os.h"
#include "cm_gpio.h"
#define ACC_RES_UP 10000
#define ACC_RES_DOWN 3300
#define VIN_RES_UP 240000
#define VIN_RES_DOWN 3300
// ACC 输出设置
#define ACC_OUT_RES_UP 5100
#define ACC_OUT_RES_DOWN 3300
#define ACC_OUT_PERIOD_US 1000000
#define ACC_OUT_Voltage_MAX 3820
#define ACC_OUT_Voltage_MIN 880
// #define ACC_Dmin (((880*ACC_OUT_RES_DOWN)/(ACC_OUT_RES_UP+ACC_OUT_RES_DOWN))*(ACC_OUT_PERIOD_US/(1800)))
// #define ACC_Dmax (((3820*ACC_OUT_RES_DOWN)/(ACC_OUT_RES_UP+ACC_OUT_RES_DOWN))*(ACC_OUT_PERIOD_US/(1800)))
typedef enum{
OUT_Door_lock = CM_GPIO_NUM_21, // 门锁
IO_MANAGER_MODE = CM_GPIO_NUM_12, // 管理模式
IO_RX_BACK = CM_GPIO_NUM_3, // 倒车
IO_TX_BRAKE = CM_GPIO_NUM_4, // 刹车
}control_io_t;
typedef struct{
union{
uint16_t VERSION; // 软件版本号
struct{
uint16_t SW_version:11; // 软件版本序号
uint16_t HW_version:4; // 硬件版本序号
uint16_t VER_type:1; // 当前固件类型00x0400010x20000
};
};
uint8_t Modbus_addr; // MODBUS地址
uint8_t Manager_sLim; // 管理员模式油门极限(Unit:%)
uint8_t Tourist_sLim; // 游客模式油门极限
uint8_t Speed_Cut_sLim; // 减速油门极限(Unit:%)(自动减速时油门极限)
uint16_t Brake_DLimit; // 刹车距离极限(前进)(Unit:mm)
uint16_t Speed_Cut_DLimit; // 减速距离极限
uint16_t Brake_DLimit_B; // 刹车距离极限(后退)
uint16_t Speed_Cut_DLimit_B;// 减速距离极限
uint16_t CRC16; // 配置信息CRC16校验码
}SYS_CONF_t;
extern SYS_CONF_t sys_conf;
typedef struct{
union{// 输入输出状态
struct{
uint8_t O_door_lock :1; // 1:电门锁打开,0:电门锁关闭
uint8_t MAG_MODE :1; // 1:游客模式,0:管理模式
uint8_t PLT_MODE :1; // 1:游客模式,0:管理模式
uint8_t IO_RX_back :1; // 1:正常 0:倒车
uint8_t IO_TX_brake :1; // 1:正常 0:刹车
uint8_t A_brake :1; // 1:自动刹车,0:手动刹车
uint8_t A_Speed_Cut :1; // 1:自动减速,0:手动减速
uint8_t P_Radar_EN :1; // 1:雷达使能,0:雷达禁止
};
uint8_t IO_STA;
};
} sys_sta_t;
extern sys_sta_t sys_sta;
void control_out_init(void);
#endif //__CONTROL_OUT_H__