task_communication.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef _TASK_COMMUNICATION_H_
  2. #define _TASK_COMMUNICATION_H_
  3. //-------------私有包含
  4. #include "FreeRTOS.h"
  5. #include "task.h"
  6. #include "main.h"
  7. #include "cmsis_os.h"
  8. #include "gpio.h"
  9. #include "stdio.h"
  10. #include "electronicFence.h"
  11. #include "EC800_FTP_OTA.h"
  12. #include "comm_car_485.h"
  13. #include "EC800.h"
  14. #include "task_ec800_upload.h"
  15. #include "flash.h"
  16. #include "global.h"
  17. /* typedef -----------------------------------------------------------*/
  18. typedef struct{
  19. uint8_t fenceStatus; // 围栏状态 1:超出围栏 0:围栏内
  20. uint8_t maxFeed; // 下发给车的最高时速 km/h
  21. uint8_t maxRunFeed; // 此时车的允许运行时速 km/h
  22. uint8_t driveStatus; // 行车状态 2:为中间态(打火但没行驶,车速为0) 1:初始态 3:运行态(行驶速度大于判断阈值)
  23. uint32_t Malfunction; // 故障 定义
  24. // bit0:超出围栏故障 bit1:485通信故障 bit2:MQTT故障
  25. // bit3:陀螺仪故障 bit4:电池故障 bit5:4G模块初始化失败
  26. // bit6:gps定位故障 bit7: OTA升级故障
  27. // bit8: 超速故障
  28. uint8_t vinRecSuccess; // 车架号成功获取标志 1;成功获取 0:暂未获取
  29. }comData;
  30. extern comData s_comData;
  31. // 故障枚举
  32. enum malfunction{
  33. fence,
  34. com485,
  35. errorMqtt,
  36. gyroscope,
  37. carError,
  38. init_4G_error,
  39. positionError,
  40. OTA_fault,
  41. outSpeed,
  42. subscribeFail, // 订阅主题失败
  43. publishFail, // 发布消息失败
  44. getLocationError, // 获取定位信息失败
  45. };
  46. /* define -----------------------------------------------------------*/
  47. // 时间计数 task_communication 任务周期1s
  48. #define times_5s 5
  49. #define times_60s 60
  50. #define times_10s 10
  51. //-------------函数声明
  52. extern void task_communication_content(void);
  53. #endif