hal_os_timer.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * BSD 2-Clause License
  3. * Copyright (c) 2022, LiteEMF
  4. * All rights reserved.
  5. * This software component is licensed by LiteEMF under BSD 2-Clause license,
  6. * the "License"; You may not use this file except in compliance with the
  7. * License. You may obtain a copy of the License at:
  8. * opensource.org/licenses/BSD-2-Clause
  9. *
  10. */
  11. /************************************************************************************************************
  12. ** Description:
  13. 注意: 使用到了函数指针, 该接口适用于51平台
  14. ************************************************************************************************************/
  15. #include "hw_config.h"
  16. #if API_OS_TIMER_ENABLE
  17. #include "api/api_os_timer.h"
  18. #include "api/api_log.h"
  19. /******************************************************************************************************
  20. ** Defined
  21. *******************************************************************************************************/
  22. /******************************************************************************************************
  23. ** public Parameters
  24. *******************************************************************************************************/
  25. /******************************************************************************************************
  26. ** static Parameters
  27. *******************************************************************************************************/
  28. /*****************************************************************************************************
  29. ** static Function
  30. ******************************************************************************************************/
  31. /*****************************************************************************************************
  32. ** Function
  33. ******************************************************************************************************/
  34. /*******************************************************************
  35. ** Parameters:
  36. ** Returns:
  37. ** Description: 静态注册一个定时器,删除后资源不会释放
  38. *******************************************************************/
  39. error_t hal_os_timer_register(api_os_timer_t *ptimer)
  40. {
  41. error_t err = ERROR_SUCCESS;
  42. // if(TIMER_ONE_SHOT & ptimer->ctrl){
  43. // }else{
  44. // }
  45. UNUSED_PARAMETER(ptimer);
  46. return err;
  47. }
  48. /*******************************************************************
  49. ** Parameters:
  50. ** Returns:
  51. ** Description: 动态注册一个定时器,删除后回自动释放内存
  52. 由于使用到 emf_malloc 动态内存分配, 常驻定时器不要使用 api_os_timer_create 创建定时器
  53. *******************************************************************/
  54. error_t hal_os_timer_create(api_os_timer_t *ptimer)
  55. {
  56. error_t err = ERROR_SUCCESS;
  57. // if(TIMER_ONE_SHOT & ptimer->ctrl){
  58. // }else{
  59. // }
  60. UNUSED_PARAMETER(ptimer);
  61. return err;
  62. }
  63. error_t hal_os_timer_delete(api_os_timer_t *ptimer)
  64. {
  65. error_t err = ERROR_SUCCESS;
  66. // if(TIMER_ONE_SHOT & ptimer->ctrl){
  67. // }else{
  68. // }
  69. UNUSED_PARAMETER(ptimer);
  70. return err;
  71. }
  72. /*******************************************************************
  73. ** Parameters:
  74. ** Returns:
  75. ** Description: 调用soft_timer_start后等待timeout后才调用回调函数
  76. 如果定时器已经启动, 再次调用相当于soft_timer_modify 重置定时器
  77. *******************************************************************/
  78. error_t hal_os_timer_start(api_os_timer_t *ptimer)
  79. {
  80. error_t err = ERROR_SUCCESS;
  81. // if(TIMER_ONE_SHOT & ptimer->ctrl){
  82. // }else{
  83. // }
  84. UNUSED_PARAMETER(ptimer);
  85. return err;
  86. }
  87. /*******************************************************************
  88. ** Parameters:
  89. ** Returns:
  90. ** Description: 更新定时器
  91. *******************************************************************/
  92. error_t hal_os_timer_modify(api_os_timer_t *ptimer)
  93. {
  94. error_t err = ERROR_SUCCESS;
  95. // if(TIMER_ONE_SHOT & ptimer->ctrl){
  96. // }else{
  97. // }
  98. UNUSED_PARAMETER(ptimer);
  99. return err;
  100. }
  101. error_t hal_os_timer_stop(api_os_timer_t *ptimer)
  102. {
  103. error_t err = ERROR_SUCCESS;
  104. // if(TIMER_ONE_SHOT & ptimer->ctrl){
  105. // }else{
  106. // }
  107. UNUSED_PARAMETER(ptimer);
  108. return err;
  109. }
  110. #endif