1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #ifndef __COMMON_H
- #define __COMMON_H
- #include "tim.h"
- #include "stdlib.h"
- #define _1_HZ_ 1000
- #define _2_HZ_ 500
- #define _5_HZ_ 200
- #define _10_HZ_ 100
- #define _20_HZ_ 50
- #define _50_HZ_ 20
- #define _100_HZ_ 10
- #define _200_HZ_ 5
- #define _500_HZ_ 2
- #define _1000_HZ_ 1
- typedef enum
- {
- COMP_NOEXIST = 0,
- COMP_NORMAL = 1,
- COMP_LOST = 2,
- COMP_CLOSED = 3,
- COMP_RECON = 4
- } comp_status;
- typedef struct
- {
- uint32_t recv_time;
- int error_time;
- comp_status connect_status;
- bool boot_flag;
- } Connect_check;
- void Check_dev_link(Connect_check *dev, uint16_t ms, char *p, uint16_t size);
- bool Check_Timer_Ready(uint32_t *time, uint16_t HZ);
- int findStrInArray(uint8_t *array, int aLen, const char *str);
- void buf2int(int *tint, unsigned char *buf);
- void short2buf(unsigned char *buf, short *tshort);
- void u16t_buf_sort(uint16_t *arr, uint16_t length);
- void char_to_hex_string(unsigned char *cdata, short lenc, char *sbuf, short lens, char *ES);
- char *itoa(int num, char *str, int radix);
- char *Int2String(int num, char *str, uint8_t size);
- int16_t math_cons_i16( int16_t value, int16_t min, int16_t max );
- bool StrArrayNull( uint8_t *array, int aLen );
- #endif
|