utils_timer.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Tencent is pleased to support the open source community by making IoT Hub
  3. available.
  4. * Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
  5. * Licensed under the MIT License (the "License"); you may not use this file
  6. except in
  7. * compliance with the License. You may obtain a copy of the License at
  8. * http://opensource.org/licenses/MIT
  9. * Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is
  11. * distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  12. KIND,
  13. * either express or implied. See the License for the specific language
  14. governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #include "utils_timer.h"
  22. bool expired(Timer *timer)
  23. {
  24. return HAL_Timer_expired(timer);
  25. }
  26. void countdown_ms(Timer *timer, unsigned int timeout_ms)
  27. {
  28. HAL_Timer_countdown_ms(timer, timeout_ms);
  29. }
  30. void countdown(Timer *timer, unsigned int timeout)
  31. {
  32. HAL_Timer_countdown(timer, timeout);
  33. }
  34. int left_ms(Timer *timer)
  35. {
  36. return HAL_Timer_remain(timer);
  37. }
  38. void InitTimer(Timer *timer)
  39. {
  40. HAL_Timer_init(timer);
  41. }
  42. #ifdef __cplusplus
  43. }
  44. #endif