新建项目
This commit is contained in:
1 parent
5e2e890cfc
commit
633d9b872b
1351 files changed
+730564
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#include "softimer.h"
|
||||
|
||||
c_timer_t s_timer[MAX_SOFT_TIMER_COUNT] = {0};
|
||||
|
||||
|
||||
|
||||
static struct s_devier_t{
|
||||
uint32_t UsedTimer;// ¿ÉÓö¨Ê±Æ÷¸öÊý
|
||||
|
||||
} s_devier;
|
||||
|
||||
|
||||
|
||||
void csoftimer_task(void)
|
||||
{
|
||||
for(int i =0;i <MAX_SOFT_TIMER_COUNT;i++)
|
||||
{
|
||||
if ((s_timer[i].Busy == 1) && (s_timer[i].Timer == 1))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void csoftimer_start(c_timer_t timer)
|
||||
{
|
||||
for (int i =0;i <MAX_SOFT_TIMER_COUNT;i++ )
|
||||
{
|
||||
if (s_timer[i].Busy == 0)
|
||||
{
|
||||
s_timer[i].callback = timer.callback;
|
||||
s_timer[i].Timer = timer.Timer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef _SOFT_TIMER_H
|
||||
#define _SOFT_TIMER_H
|
||||
|
||||
#include "stm32g0xx_hal.h"
|
||||
|
||||
|
||||
#define MAX_SOFT_TIMER_COUNT 32
|
||||
|
||||
|
||||
typedef struct c_timer_t{
|
||||
uint32_t Timer;// 定时时长 ms
|
||||
void (*callback)(void); // 回调函数
|
||||
uint32_t Message; // 传递的消息
|
||||
uint32_t Param; // 传递进去的参数
|
||||
uint32_t Busy; // 1正在使用 0空闲的
|
||||
}c_timer_t;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user