110VCGQ/project/110VCGQV5.5/user/Inc/user_stick.h
2024-11-18 10:09:39 +08:00

46 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* user_stick.h
*
* Created on: 2023年1月29日
* Author: wyf
*/
#ifndef INC_USER_STICK_H_
#define INC_USER_STICK_H_
#include "user.h"
#define TMR_COUNT 10 /* 软件定时器的个数 定时器ID范围 0 - 3) */
typedef enum
{
TMR_ONCE_MODE = 0, /* 一次工作模式 */
TMR_AUTO_MODE = 1 /* 自动定时工作模式 */
}TMR_MODE_E;
/* 定时器结构体,成员变量必须是 volatile, 否则C编译器优化时可能有问题 */
typedef struct
{
volatile uint8_t Mode; /* 计数器模式1次性 */
volatile uint8_t Flag; /* 定时到达标志 */
volatile uint32_t Count; /* 计数器 */
volatile uint32_t PreLoad; /* 计数器预装值 */
}SOFT_TMR;
/* 提供给其他C文件调用的函数 */
void bsp_InitTimer(void);
void delay_ms(uint32_t n);
void delay_us(uint32_t n);
void bsp_StartTimer(uint8_t _id, uint32_t _period);
void bsp_StartAutoTimer(uint8_t _id, uint32_t _period);
void bsp_StopTimer(uint8_t _id);
uint8_t bsp_CheckTimer(uint8_t _id);
int32_t bsp_GetRunTime(void);
int32_t bsp_CheckRunTime(int32_t _LastTime);
void SysTick_ISR(void);
#endif /* INC_USER_STICK_H_ */