59 lines
1.8 KiB
C
59 lines
1.8 KiB
C
/***
|
|
* @Author:
|
|
* @Date: 2023-04-04 08:13:11
|
|
* @LastEditors: xxx
|
|
* @LastEditTime: 2023-04-04 10:13:21
|
|
* @Description:
|
|
* @email:
|
|
* @Copyright (c) 2023 by xxx, All Rights Reserved.
|
|
*/
|
|
|
|
#ifndef __LIB_H
|
|
#define __LIB_H
|
|
#include <stdint.h>
|
|
#include "malloc.h"
|
|
#include "data_type_def.h"
|
|
#include "data_analysis.h"
|
|
#include "osel_arch.h"
|
|
#include "debug.h"
|
|
#include "sqqueue.h"
|
|
#include "clist.h"
|
|
#include "cmd.h"
|
|
|
|
#include "pbuf.h"
|
|
|
|
#define INTERNAL_EXTERN extern
|
|
|
|
#ifndef STM32
|
|
#include "log.h"
|
|
#else
|
|
#define LOG_PRINT(fmt, ...) \
|
|
do \
|
|
{ \
|
|
} while (0);
|
|
#define LOG_ERR(fmt, ...) \
|
|
do \
|
|
{ \
|
|
} while (0);
|
|
#define LOG_HEX(data, len) \
|
|
do \
|
|
{ \
|
|
} while (0);
|
|
#endif
|
|
|
|
extern void version_split(uint8_t *version, uint8_t *hi, uint8_t *lo);
|
|
extern void reverse(uint8_t *buf, uint16_t len);
|
|
extern BOOL is_in_array(uint16_t *arr, uint16_t len, uint16_t val);
|
|
extern BOOL is_same_value(uint8_t *buf, uint16_t len, uint8_t value);
|
|
extern uint16_t crc16_compute(const uint8_t *const uc_ptr, uint16_t uc_len);
|
|
extern uint8_t xor_compute(const uint8_t *const uc_ptr, uint16_t uc_len);
|
|
extern uint8_t get_bit_num(uint8_t bit);
|
|
extern BOOL is_bit_set(int x, int k);
|
|
extern uint8_t isLeap(uint16_t year); // 检查是否是闰年
|
|
extern uint16_t dayOfyear(uint16_t year, uint8_t month, uint8_t day); // 计算一年中的第几天
|
|
extern uint16_t weekOfyear(uint16_t year, uint8_t month, uint8_t day); // 计算一年中的第几周
|
|
extern uint8_t get_weekday(uint16_t year, uint8_t month, uint8_t day); // 获取今天星期几
|
|
extern uint8_t hex_format_dec(uint8_t hex);
|
|
extern uint8_t dec_format_hex(uint8_t dec);
|
|
#endif //__LIB_H
|