| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /*
- * @Description:
- * @Version: 2.0
- * @Author: Seven
- * @Date: 2023-08-09 16:54:10
- * @LastEditors: Seven
- * @LastEditTime: 2023-09-20 16:36:49
- */
- #ifndef TOOL_H__
- #define TOOL_H__
- #include "stm32f10x.h"
- typedef struct timeout_
- {
- uint8_t flag;
- uint64_t count;
- uint64_t timeout;
- }__attribute__((packed)) timeout_t;
- uint16_t CRC16_get(uint8_t *_buff,uint32_t _len);
- uint8_t _crc_get_gw(uint8_t *data, uint8_t size);
- uint8_t get_xor(uint8_t *buf, uint16_t len);
- void _ytsf_data_code(uint8_t *buff, uint8_t *len);
- void _ytsf_data_decode(uint8_t *buff, uint8_t *len);
- long HextoDec(char *s);
- unsigned char HexToChar(unsigned char bChar);
- int asciitohex(char *data, uint8_t *out_data, int len);
- uint32_t strtohex(char *data, uint8_t len);
- uint8_t ascii_to_bcd(uint8_t *data, uint8_t *res, uint16_t len);
- void timeout_setValue(timeout_t *tt,uint32_t val,uint8_t flg);
- void timeout_start(timeout_t *tt,uint8_t flg);
- void timeout_stop(timeout_t *tt);
- uint8_t timeout_isOut(timeout_t *tt);
- void timeout_setValue_us(timeout_t *tt,uint32_t val,uint8_t flg);
- void timeout_start_us(timeout_t *tt,uint8_t flg);
- void timeout_stop_us(timeout_t *tt);
- uint8_t timeout_isOut_us(timeout_t *tt);
- uint8_t buff_compare(uint8_t *buf1, uint8_t *buf2, uint16_t len);
- uint32_t crc_block_data_calculate(uint32_t *buf, uint32_t len);
- uint16_t set_flag_not(uint16_t data);
- uint8_t flag_not_cmp(uint16_t data);
- #endif
|