#ifndef __FUNCTIONAL_SAFETY_KEY_H #define __FUNCTIONAL_SAFETY_KEY_H #include "stm32f1xx_hal.h" #define FAILURE_TIME 2000 typedef union STATUS { struct { uint8_t Power :1;//Power uint8_t Walk :1;//Walk uint8_t Add :1;//+ uint8_t Dec :1;//- uint8_t sync :1;//sync uint8_t RS2 :1; uint8_t RS3 :1; uint8_t RS4 :1; }Status_Bit; uint8_t Status; }Key_Status_Struct_t; typedef struct { uint8_t power_long_press; //Power key long press flag uint8_t walk_long_press; //Walk key long press flag uint8_t set_long_press; //Set key long press flag uint8_t light_long_press; //Light key long press flag uint8_t add_long_press; //Add key long press flag uint8_t dec_long_press; //Dec key long press flag }Key_Flag_Struct_t; typedef enum { HANDSHAKE_NO = 0U, HANDSHAKE_YES, UPDATE_ING, UPDATE_FINISH, }PBU_TE_STATUS; extern PBU_TE_STATUS PBU_TE_Status; extern Key_Status_Struct_t Key_Recv_Status; extern Key_Status_Struct_t Key_Scan_Status; extern void Scan_Key(void); extern void SendKeyStatusToTE(void); extern void SendMotorEnableToTE(void); extern void SendMotorDisableToTE(void); extern void Error_Key_Process(void); extern void Scan_Key_ADC_Error(void); extern void Power_Mos_Check(void); extern void Vin_test_Check(void); #endif //__FUNCTIONAL_SAFETY_KEY_H