Systm_Time.h
/*
* System_Time.h
*
* Created on: 2022年7月9日
* Author: Kevin
*/
#ifndef MY_DRIVER_HARDWARE_SYSTEM_TIME_H_
#define MY_DRIVER_HARDWARE_SYSTEM_TIME_H_
#include "Platform_Types.h" //定义数据类型
typedef enum // 枚举STM模块号
{
STM0,
STM1,
STM2,
STM3,
STM4,
}STMN_enum;
void systick_delay(STMN_enum stmn, uint32 time, uint32 num);
void systick_start(STMN_enum stmn);
uint32 systick_getval(STMN_enum stmn);
//------------------------------------以下宏定义用于延时------------------------------------
#define systick_delay_ms(stmn, time) systick_delay(stmn, 1000000, time) //设置延时时间 单位ms
#define systick_delay_us(stmn, time) systick_delay(stmn, time*1000, 1) //设置延时时间 单位us
#define systick_delay_ns(stmn, time) systick_delay(stmn, time, 1) //设置延时时间 单位ns
//------------------------------------以下宏定义用于获取当前时间------------------------------------
#define systick_getval_ms(stmn) systick_getval(stmn)/100000 //获取当前计时时间 单位ms
#define systick_getval_us(stmn) systick_getval(stmn)/100 //获取当前计时时间 单位us
#define systick_getval_ns(stmn) systick_getval(stmn)*10 //获取当前计时时间 单位ns
#endif /* MY_DRIVER_HARDWARE_SYSTEM_TIME_H_ */
|