| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #ifndef __COMMON_H
- #define __COMMON_H
- #include "stm32f4xx_hal.h"
- #include "rtthread.h"
- #include "stm32f4xx_it.h"
- #include "stm32f4xx_hal_uart.h"
- #include "stdbool.h"
- #define _1_HZ_ 1000
- #define _2_HZ_ 500
- #define _3_HZ_ 300
- #define _4_HZ_ 250
- #define _5_HZ_ 200
- #define _6_HZ_ 166
- #define _7_HZ_ 143
- #define _8_HZ_ 125
- #define _9_HZ_ 115
- #define _10_HZ_ 100
- #define _11_HZ_ 91
- #define _12_HZ_ 83
- #define _13_HZ_ 75
- #define _14_HZ_ 67
- #define _15_HZ_ 60
- #define _16_HZ_ 53
- #define _17_HZ_ 47
- #define _18_HZ_ 41
- #define _19_HZ_ 37
- #define _20_HZ_ 50
- #define _40_HZ_ 25
- #define _31_HZ_ 33
- #define _32_HZ_ 32
- #define _33_HZ_ 31
- #define _50_HZ_ 20
- #define _100_HZ_ 10
- #define _200_HZ_ 5
- #define _300_HZ_ 3
- #define _500_HZ_ 2
- #define _1000_HZ_ 12
- 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 );
- void buf_sort(float *arr, uint32_t length);
- uint32_t cycle_check_ms(uint32_t *time);
- #endif
|