#ifndef _ENCODEOPT_H_
#define _ENCODEOPT_H_

#include "../../_Lib-3.5/CMSIS/stm32f10x.h"
#include "../globalDef.h"

#pragma pack(push,1)
typedef union _table_encode_{
    uint32_t data;
    struct {
        uint32_t dgunId :4;  // 数据枪的索引
        uint32_t dportId :2; // 数据报税口索引
        uint32_t dcollId :4; // 数据采集器索引
        uint32_t bgunId :4;  // 总线枪的索引
        uint32_t bportId :2; // 总线报税口索引
        uint32_t bcollId :4; // 总线采集器索引

        uint32_t dreserve :12; // 预留
    }__attribute__((packed))da;
}__attribute__((packed))table_msg;
#pragma pack(pop)
typedef struct _encode_msg_{
    table_msg tableDa[64]; // 最多64把枪
    uint8_t encodenum; // 编码器的条数
    uint8_t benable;   // 此表是否启用
    uint8_t curIndex; // 对应enMsg的下标，当前读取的那条
}__attribute__((packed)) encodeMsg;
extern encodeMsg g_encodeOpt;

extern void encoder_timer_start(uint8_t min);
extern void encoder_timer_stop(void);
#endif
