encodeOpt.h 965 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef _ENCODEOPT_H_
  2. #define _ENCODEOPT_H_
  3. #include "../../_Lib-3.5/CMSIS/stm32f10x.h"
  4. #include "../globalDef.h"
  5. #pragma pack(push,1)
  6. typedef union _table_encode_{
  7. uint32_t data;
  8. struct {
  9. uint32_t dgunId :4; // 数据枪的索引
  10. uint32_t dportId :2; // 数据报税口索引
  11. uint32_t dcollId :4; // 数据采集器索引
  12. uint32_t bgunId :4; // 总线枪的索引
  13. uint32_t bportId :2; // 总线报税口索引
  14. uint32_t bcollId :4; // 总线采集器索引
  15. uint32_t dreserve :12; // 预留
  16. }__attribute__((packed))da;
  17. }__attribute__((packed))table_msg;
  18. #pragma pack(pop)
  19. typedef struct _encode_msg_{
  20. table_msg tableDa[64]; // 最多64把枪
  21. uint8_t encodenum; // 编码器的条数
  22. uint8_t benable; // 此表是否启用
  23. uint8_t curIndex; // 对应enMsg的下标,当前读取的那条
  24. }__attribute__((packed)) encodeMsg;
  25. extern encodeMsg g_encodeOpt;
  26. extern void encoder_timer_start(uint8_t min);
  27. extern void encoder_timer_stop(void);
  28. #endif