#ifndef UI_COMM_IMPL_H #define UI_COMM_IMPL_H #ifdef __cplusplus /*C++编译环境下兼容C语言*/ extern "C" { #endif /*------ Exported includes(头文件) ----------------------*/ #include "main.h" #include "usart.h" #include "publicdata/type.h" /*------ Exported macro(宏定义) -------------------------*/ #if SYSTEM_TYPE == SYSTEM_TYPE_CCU601E_D #define UI_COM_ID E_USART_9 /* [CCU601E_D] USART9 */ #elif SYSTEM_TYPE == SYSTEM_TYPE_CCU621_M #define UI_COM_ID E_USART_5 /* [CCU621_M] USART5 */ #else #define UI_COM_ID E_USART_9 /* 默认 USART9 */ #endif #define UI_RX_BUF_SIZE NUM_128 //UI接收数据缓存区 #define UI_OUTTIME (20) //通信超时时间 #define UI_STATE_TIMEOUT (120) //状态超时时间 单位秒 #define UI_UPDATE_TIMEOUT (60*20) //系统升级状态超时时间 单位秒 #define UI_SEND_SLEEP (2) /*------ Exported struct(结构体定义) --------------------*/ // 数量宏:与 UI_SYSTEM_PARAM_T 字段数量保持一致(UI_SYSTEM_PARAM_T 定义在 ui_comm_impl.c 内部) #define UI_SYSTEM_PARAM_COUNT (14u) // 系统参数数量 #define UI_PILE_PROTECT_PARAM_COUNT (11u) // 充电桩保护参数数量 #define UI_NETWORK_PARAM_COUNT (21u) // 网络参数数量 #define UI_MODULE_PARAM_COUNT (5u) // 充电模块参数数量 #define UI_RESERVE_PARAM_COUNT (12u) // 预留参数数量 // union 内部用 u16_data/u8_data 作为通用 buffer,只需覆盖“单个类型”的最大字段数 #define UI_PARAM_MAX_COUNT (UI_NETWORK_PARAM_COUNT) // 参数类型枚举 typedef enum { E_UI_PARAM_TYPE_INVALID = 0, // 无效参数类型 E_UI_PARAM_TYPE_SYSTEM, //系统参数 E_UI_PARAM_TYPE_PILE_PROTECT,//充电桩保护参数 E_UI_PARAM_TYPE_NETWORK, //网络参数 E_UI_PARAM_TYPE_MODULE, //模块参数 E_UI_PARAM_TYPE_RESERVE, //预留参数 E_UI_PARAM_TYPE_OTHER, //其他参数类型... } E_UI_PARAM_TYPE_T; // ========================= Basic parameter(系统基础参数) ========================= // 系统参数(UI页面:系统参数配置) typedef struct { U16_T number_of_guns; // 0x0200 Number of guns U16_T pile_type; // 0x0201 Pile type U16_T terminal_address_1; // 0x0202 Terminal address 1 U16_T terminal_address_2; // 0x0203 Terminal address 2 U16_T gun_type_1; // 0x0204 Gun type 1 U16_T gun_type_2; // 0x0205 Gun type 2 U16_T light_panel_type; // 0x0206 Light panel type U16_T lcd_enable; // 0x0207 LCD Enable U16_T system_time_zone; // 0x0208 System Time Zone U16_T language_type; // 0x0209 Language type U16_T liquid_cooling_enable; // 0x020A Liquid cooling enable U16_T host_comm_type; // 0x020B Host comm type U16_T screensaver_enable; // 0x020C Screensaver Enable U16_T card_type; // 0x020D Card type } UI_SYSTEM_PARAM_T; // ========================= Charging pile protection parameter(充电桩保护参数) ========================= // 充电桩保护参数(UI页面:Charging pile protection parameter) typedef struct { U16_T min_out_vol; // 0x0220 Min out vol (0.1V) U16_T max_out_vol; // 0x0221 Max out vol (0.1V) U16_T max_out_cur; // 0x0222 Max out cur (0.1A) U16_T pile_rated_power; // 0x0223 Pile rated power (0.1kW) U16_T fan_start_temp; // 0x0224 Fan start temp (0.1°C) U16_T fan_stop_temp; // 0x0225 Fan stop temp (0.1°C) U16_T gun_temp_thresh; // 0x0226 Gun temp thresh (0.1°C) U16_T pile_temp_thresh; // 0x0227 Pile temp thresh (0.1°C) U16_T gun1_power_limit; // 0x0228 Gun 1 power limit (0.1kW) U16_T gun2_power_limit; // 0x0229 Gun 2 power limit (0.1kW) U16_T soc_thresh; // 0x022A SOC thresh (0.1%) } UI_PILE_PROTECT_PARAM_T; // ========================= Network parameter(网络参数) ========================= // 网络参数(如:本地IP、网关、MAC、APN、平台网络配置等) typedef struct { // Local IP: A.B.C.D U16_T local_ip_1; //0x0240 Local IP byte1 U16_T local_ip_2; //0x0241 Local IP byte2 U16_T local_ip_3; //0x0242 Local IP byte3 U16_T local_ip_4; //0x0243 Local IP byte4 // Gateway: A.B.C.D U16_T gateway_ip_1; //0x0244 Gateway IP byte1 U16_T gateway_ip_2; //0x0245 Gateway IP byte2 U16_T gateway_ip_3; //0x0246 Gateway IP byte3 U16_T gateway_ip_4; //0x0247 Gateway IP byte4 // MAC address: 6 bytes U16_T mac_addr_1; //0x0248 MAC byte1 U16_T mac_addr_2; //0x0249 MAC byte2 U16_T mac_addr_3; //0x024A MAC byte3 U16_T mac_addr_4; //0x024B MAC byte4 U16_T mac_addr_5; //0x024C MAC byte5 U16_T mac_addr_6; //0x024D MAC byte6 // APN type U16_T apn_type; //0x024E APN type // Platform 1 U16_T plat1_enable; //0x024F Platform1 enable U16_T plat1_net_type; //0x0250 Platform1 network type U16_T plat1_plat_type; //0x0251 Platform1 platform type // Platform 2 U16_T plat2_enable; //0x0252 Platform2 enable U16_T plat2_net_type; //0x0253 Platform2 network type U16_T plat2_plat_type; //0x0254 Platform2 platform type } UI_NET_PARAM_T; // 充电模块参数(UI页面:Module parameter) // 地址从 0x0260 开始(共 5 个) typedef struct { U16_T module_rated_power; // 0x0260 Module rated power (0.1kW) U16_T module_rated_volt; // 0x0261 Module rated voltage (0.1V) U16_T module_rated_cur; // 0x0262 Module rated current (0.1A) U16_T module_count; // 0x0263 Module count U16_T module_type; // 0x0264 Module type } UI_MODULE_PARAM_T; // 预留参数(UI页面:Reserve parameter) // 地址从 0x0280 开始,共 12 个 U16_T,全部默认 0 typedef struct { U16_T reserve_1; // 0x0280 U16_T reserve_2; // 0x0281 U16_T reserve_3; // 0x0282 U16_T reserve_4; // 0x0283 U16_T reserve_5; // 0x0284 U16_T reserve_6; // 0x0285 U16_T reserve_7; // 0x0286 U16_T reserve_8; // 0x0287 U16_T reserve_9; // 0x0288 U16_T reserve_10; // 0x0289 U16_T reserve_11; // 0x028A U16_T reserve_12; // 0x028B } UI_RESERVE_PARAM_T; // 参数结构体 typedef struct { E_UI_PARAM_TYPE_T e_ui_param_type; // 参数类型 union { U16_T u16_data[UI_PARAM_MAX_COUNT]; U8_T u8_data[UI_PARAM_MAX_COUNT * 2]; UI_SYSTEM_PARAM_T s_ui_system_param; UI_PILE_PROTECT_PARAM_T s_ui_pile_protect_param; UI_NET_PARAM_T s_ui_net_param; UI_MODULE_PARAM_T s_ui_module_param; UI_RESERVE_PARAM_T s_ui_reserve_param; } s_ui_param_union; // 参数联合体 } UI_PARAM_T; /*------ Exported variables(变量定义) -------------------*/ extern UI_PARAM_T s_ui_param; /*------ Exported function prototypes (函数声明) -------*/ U16_T u16_ui_recv_data(U8_T *u8_recvBuf ,U16_T u16_len); void v_ui_read_id_reg(void) ; void v_ui_id_change(U16_T id); void v_set_recv_data(U16_T u16_addr , U32_T u32_data) ; void v_set_recv_str_data(U16_T u16_addr , U8_T *u8_str , U8_T u8_str_len) ; void v_ui_ctrl_var_clear(void) ; // 配置参数写入(Basic parameter + Charging pile protection parameter) void v_ui_param_set_value(U16_T u16_addr, U32_T u32_data); void v_ui_set_param_type(E_UI_PARAM_TYPE_T e_type); U8_T u8_ui_save_param(E_UI_PARAM_TYPE_T e_type); void v_wr_var_data(U16_T addr,U16_T data); void v_wr_32var_data(U16_T addr,U32_T data) ; void v_show_AnimationIcon(U16_T addr, U16_T value) ; void v_wr_var_datas(U16_T addr, U8_T* data_buf, U8_T u8_len); void v_disp_text_clear(U16_T addr); void v_disp_string_handler(U16_T addr,U8_T* p_str,U8_T str_len); void v_ui_char_real_info(U8_T u8_gunNo); void v_ui_char_batt_info(U8_T u8_gunNo); void v_ui_char_log_info(U8_T u8_gunNo); void v_ui_standby_char_real_info(U8_T u8_gunNo); void v_ui_fault_info_show(void); #ifdef __cplusplus } #endif #endif /* UI_COMM_IMPL_H */