freeRTOS操作系统机器人实现
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.6 KiB

3 days ago
/******************************************************************************
(C), 2018-2099, Radkil
******************************************************************************
: rd_time.c
: 稿
: Radkil
: 2026224
:
:
:
1. : 2026224
: Radkil
:
******************************************************************************/
#include "rd_time.h"
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
WEAK unsigned int g_uiRandSeed = 12345;
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
WEAK time_t rd_time(time_t *tloc)
{
if (tloc != NULL)
{
*tloc = (time_t)-1;
}
return (time_t)-1; // 表示时间功能不可用
}
WEAK struct tm *rd_localtime_r(const time_t *timep, struct tm *result)
{
return NULL;
}
WEAK size_t rd_strftime(char *s, size_t max, const char *format, const struct tm *tm)
{
return (size_t)-1;
}
WEAK void rd_srand(unsigned int seed)
{
g_uiRandSeed = seed ? seed : 12345; // 种子不能为 0
}
// 简单的线性同余生成器 (LCG)
WEAK int rd_rand(void)
{
g_uiRandSeed = g_uiRandSeed * 1103515245 + 12345;
return (g_uiRandSeed >> 16) & 0x7FFF; // 返回 0~32767
}
WEAK uint32_t Rd_GetTime(void)
{
uint32_t HAL_GetTick(void);
return (int)HAL_GetTick();
}
WEAK void Rd_Delay(uint32_t Delay)
{
void HAL_Delay(uint32_t Delay);
HAL_Delay(Delay);
}