global(733).h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef _GLOBAL_H_
  2. #define _GLOBAL_H_
  3. /* includes ----------------------------------------------------------*/
  4. #include "stm32f1xx_hal.h"
  5. #include "usart.h"
  6. #include <string.h>
  7. #include "EC800.h"
  8. #include "flash.h"
  9. #include "comm_car_485.h"
  10. #include "task_communication.h"
  11. #include "gpio.h"
  12. /* typedef -----------------------------------------------------------*/
  13. typedef struct{
  14. uint16_t ctrEvent; // 中控板事件
  15. // bit0:中控板迁移事件
  16. // 故障相关
  17. uint16_t mqttTimeoutCnt; // MQTT通信超时计数
  18. uint8_t positionErrorCnt; // 定位信息错误计数
  19. uint8_t InitFaultFlag_4G; // 4g模块初始化标志 1:初始化失败 0:初始化成功
  20. uint8_t timeoutCnt_485; // 485通信超时计数
  21. uint8_t gyroDataFaultFlag; // 陀螺仪数据故障标志
  22. uint8_t otaUpgradeStartFlag; // OTA升级开始标志
  23. // 超级权限--超级用户
  24. uint8_t superUser; // 超级权限 1:开启超级权限 0:关闭超级权限
  25. }global_par;
  26. extern global_par s_global_par;
  27. // 事件枚举
  28. enum event{
  29. CtrlPanelMigration, // 中控板迁移事件
  30. };
  31. // 定义故障结构体
  32. typedef struct {
  33. char errid[32]; // 假设errid的最大长度为32字节
  34. char errorInfo[128]; // 假设errorInfo的最大长度为128字节
  35. } Fault;
  36. /* define ------------------------------------------------------------*/
  37. #define TIMEOUT_485 10 // 10s 485通信超时时间
  38. #define FILTER_TIME_gyro 3 // 3s 陀螺仪故障滤波时间
  39. #define TIME_OUT_OTA 600 // 120s OTA升级超时时间设置为2min 跟升级周期链接现在是200ms
  40. /* macro -------------------------------------------------------------*/
  41. /* variables ---------------------------------------------------------*/
  42. /* function prototypes -----------------------------------------------*/
  43. // @brief 中控板初始化
  44. extern void centralCtrSys_Init(param_boot *p_param_boot, global_par *p_global_par);
  45. // @brief 中控板故障检测
  46. extern void faultDetection(global_par *p_global_par);
  47. // @brief 控制蜂鸣器响应
  48. extern void control_beep_response(void);
  49. #endif