1. 日志模块增加获取时间

2. 环状缓冲区增加判断满
This commit is contained in:
coffee 2025-08-27 18:26:52 +08:00
parent 60f1c8c924
commit 129a54b843
4 changed files with 25 additions and 0 deletions

View File

@ -115,9 +115,16 @@ void HDLogOptFlashInit();
*/
void HDLogInit(uint32_t (*getTime)());
/**
* @brief
* @return
*/
uint32_t HDLogGetTime();
/**
* @brief
**/
__attribute__ ((format(printf, 6, 7)))
void HDLogOut(uint8_t ext, uint8_t level, const char *fileName, const char *funcName, int line, const char *format, ...);
/**

View File

@ -133,4 +133,7 @@ void HRingBufferClear(HRingBufferType* buffer);
// 判断环形缓冲区是否为空
uint8_t HRingBufferEmpty(HRingBufferType* buffer);
// 判断环形缓冲区是否满
uint8_t HRingBufferFull(HRingBufferType* buffer);
#endif // _H_RING_BUFFER_H_

View File

@ -250,6 +250,16 @@ void HDLogInit(uint32_t (*getTime)())
#endif
}
uint32_t HDLogGetTime()
{
if (sGetTime)
{
return sGetTime();
}
return 0;
}
void HDLogOut(uint8_t ext, uint8_t level, const char *fileName, const char *funcName, int line, const char *format, ...)
{
if (HBitGet(sLogItem, kLogLevelSwitch) == 0)

View File

@ -283,3 +283,8 @@ void HRingBufferClear(HRingBufferType* buffer) {
uint8_t HRingBufferEmpty(HRingBufferType* buffer) {
return HRingBufferGetUseLen(buffer) == 0;
}
uint8_t HRingBufferFull(HRingBufferType* buffer) {
return IsRingBufferFull(buffer);
}