123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- /*
- * BSD 2-Clause License
- * Copyright (c) 2022, LiteEMF
- * All rights reserved.
- * This software component is licensed by LiteEMF under BSD 2-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-2-Clause
- *
- */
- /************************************************************************************************************
- ** Description:
- 注意: 使用到了函数指针, 该接口适用于51平台
- ************************************************************************************************************/
- #include "hw_config.h"
- #if API_OS_TIMER_ENABLE
- #include "api/api_os_timer.h"
- #include "api/api_log.h"
- /******************************************************************************************************
- ** Defined
- *******************************************************************************************************/
- /******************************************************************************************************
- ** public Parameters
- *******************************************************************************************************/
- /******************************************************************************************************
- ** static Parameters
- *******************************************************************************************************/
- /*****************************************************************************************************
- ** static Function
- ******************************************************************************************************/
- /*****************************************************************************************************
- ** Function
- ******************************************************************************************************/
- /*******************************************************************
- ** Parameters:
- ** Returns:
- ** Description: 静态注册一个定时器,删除后资源不会释放
- *******************************************************************/
- error_t hal_os_timer_register(api_os_timer_t *ptimer)
- {
- error_t err = ERROR_SUCCESS;
-
- // if(TIMER_ONE_SHOT & ptimer->ctrl){
- // }else{
- // }
- UNUSED_PARAMETER(ptimer);
- return err;
- }
- /*******************************************************************
- ** Parameters:
- ** Returns:
- ** Description: 动态注册一个定时器,删除后回自动释放内存
- 由于使用到 emf_malloc 动态内存分配, 常驻定时器不要使用 api_os_timer_create 创建定时器
- *******************************************************************/
- error_t hal_os_timer_create(api_os_timer_t *ptimer)
- {
- error_t err = ERROR_SUCCESS;
-
- // if(TIMER_ONE_SHOT & ptimer->ctrl){
- // }else{
- // }
- UNUSED_PARAMETER(ptimer);
- return err;
- }
- error_t hal_os_timer_delete(api_os_timer_t *ptimer)
- {
- error_t err = ERROR_SUCCESS;
-
- // if(TIMER_ONE_SHOT & ptimer->ctrl){
- // }else{
- // }
- UNUSED_PARAMETER(ptimer);
- return err;
- }
- /*******************************************************************
- ** Parameters:
- ** Returns:
- ** Description: 调用soft_timer_start后等待timeout后才调用回调函数
- 如果定时器已经启动, 再次调用相当于soft_timer_modify 重置定时器
- *******************************************************************/
- error_t hal_os_timer_start(api_os_timer_t *ptimer)
- {
- error_t err = ERROR_SUCCESS;
-
- // if(TIMER_ONE_SHOT & ptimer->ctrl){
- // }else{
- // }
- UNUSED_PARAMETER(ptimer);
- return err;
- }
- /*******************************************************************
- ** Parameters:
- ** Returns:
- ** Description: 更新定时器
- *******************************************************************/
- error_t hal_os_timer_modify(api_os_timer_t *ptimer)
- {
- error_t err = ERROR_SUCCESS;
-
- // if(TIMER_ONE_SHOT & ptimer->ctrl){
- // }else{
- // }
- UNUSED_PARAMETER(ptimer);
- return err;
- }
- error_t hal_os_timer_stop(api_os_timer_t *ptimer)
- {
- error_t err = ERROR_SUCCESS;
- // if(TIMER_ONE_SHOT & ptimer->ctrl){
- // }else{
- // }
- UNUSED_PARAMETER(ptimer);
- return err;
- }
- #endif
|