Merge pull request #16 from Advanced-lj/master

修改拼写错误 && 格式化代码
master
0x1abin 2 years ago committed by GitHub
commit 8552905e23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,7 +15,7 @@ static uint32_t _timer_ticks = 0;
/** /**
* @brief Initializes the timer struct handle. * @brief Initializes the timer struct handle.
* @param handle: the timer handle strcut. * @param handle: the timer handle struct.
* @param timeout_cb: timeout callback. * @param timeout_cb: timeout callback.
* @param timeout: delay to start the timer. * @param timeout: delay to start the timer.
* @param repeat: repeat interval time. * @param repeat: repeat interval time.
@ -25,7 +25,7 @@ static uint32_t _timer_ticks = 0;
void timer_init(struct Timer* handle, void (*timeout_cb)(void *arg), \ void timer_init(struct Timer* handle, void (*timeout_cb)(void *arg), \
uint32_t timeout, uint32_t repeat, void *arg) uint32_t timeout, uint32_t repeat, void *arg)
{ {
// memset(handle, sizeof(struct Timer), 0); // memset(handle, 0, sizeof(struct Timer));
handle->timeout_cb = timeout_cb; handle->timeout_cb = timeout_cb;
handle->timeout = timeout; handle->timeout = timeout;
handle->repeat = repeat; handle->repeat = repeat;
@ -38,7 +38,7 @@ void timer_init(struct Timer* handle, void (*timeout_cb)(void *arg), \
/** /**
* @brief Start the timer work, add the handle into work list. * @brief Start the timer work, add the handle into work list.
* @param btn: target handle strcut. * @param handle: target handle struct.
* @retval 0: succeed. -1: already exist. * @retval 0: succeed. -1: already exist.
*/ */
int timer_start(struct Timer* handle) int timer_start(struct Timer* handle)
@ -59,7 +59,7 @@ int timer_start(struct Timer* handle)
/** /**
* @brief Stop the timer work, remove the handle off work list. * @brief Stop the timer work, remove the handle off work list.
* @param handle: target handle strcut. * @param handle: target handle struct.
* @retval 0: succeed. -1: timer not exist. * @retval 0: succeed. -1: timer not exist.
*/ */
int timer_stop(struct Timer* handle) int timer_stop(struct Timer* handle)
@ -77,7 +77,7 @@ int timer_stop(struct Timer* handle)
} }
} }
return 0; return -1;
} }
/** /**
@ -110,7 +110,7 @@ void timer_loop(void)
/** /**
* @brief background ticks, timer repeat invoking interval nms. * @brief background ticks, timer repeat invoking interval nms.
* @param None. * @param None.
* @retval None. * @retval None
*/ */
void timer_ticks(void) void timer_ticks(void)
{ {

@ -18,7 +18,7 @@ Your can configurate for your tick time such as 5ms/10ms and so on.
typedef struct Timer { typedef struct Timer {
uint32_t cur_ticks; /* Record current timer start tick */ uint32_t cur_ticks; /* Record current timer start tick */
uint32_t cur_expired_time; /* Record current timer expired time */ uint32_t cur_expired_time; /* Record current timer expired time */
uint32_t timeout; /* Delay (xx ms) time to start tiemr */ uint32_t timeout; /* Delay (xx ms) time to start timer */
uint32_t repeat; /* Timer interval expired time (xx ms) */ uint32_t repeat; /* Timer interval expired time (xx ms) */
void * arg; /* Input argument for timeout_cb function */ void * arg; /* Input argument for timeout_cb function */
void (*timeout_cb)(void *arg); /* Timer expired callback function */ void (*timeout_cb)(void *arg); /* Timer expired callback function */
@ -31,7 +31,7 @@ extern "C" {
/** /**
* @brief Initializes the timer struct handle. * @brief Initializes the timer struct handle.
* @param handle: the timer handle strcut. * @param handle: the timer handle struct.
* @param timeout_cb: timeout callback. * @param timeout_cb: timeout callback.
* @param timeout: delay to start the timer. * @param timeout: delay to start the timer.
* @param repeat: repeat interval time. * @param repeat: repeat interval time.
@ -43,14 +43,14 @@ void timer_init(struct Timer* handle, void(*timeout_cb)(void *arg), \
/** /**
* @brief Start the timer work, add the handle into work list. * @brief Start the timer work, add the handle into work list.
* @param btn: target handle strcut. * @param handle: target handle struct.
* @retval 0: succeed. -1: already exist. * @retval 0: succeed. -1: already exist.
*/ */
int timer_start(struct Timer* handle); int timer_start(struct Timer* handle);
/** /**
* @brief Stop the timer work, remove the handle off work list. * @brief Stop the timer work, remove the handle off work list.
* @param handle: target handle strcut. * @param handle: target handle struct.
* @retval 0: succeed. -1: timer not exist. * @retval 0: succeed. -1: timer not exist.
*/ */
int timer_stop(struct Timer* handle); int timer_stop(struct Timer* handle);
@ -58,7 +58,7 @@ int timer_stop(struct Timer* handle);
/** /**
* @brief background ticks, timer repeat invoking interval nms. * @brief background ticks, timer repeat invoking interval nms.
* @param None. * @param None.
* @retval None. * @retval None
*/ */
void timer_ticks(void); void timer_ticks(void);

Loading…
Cancel
Save