utils_timer.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (C) 2012-2019 UCloud. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License").
  5. * You may not use this file except in compliance with the License.
  6. * A copy of the License is located at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * or in the "license" file accompanying this file. This file is distributed
  11. * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  12. * express or implied. See the License for the specific language governing
  13. * permissions and limitations under the License.
  14. */
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "utils_timer.h"
  19. bool has_expired(Timer *timer) {
  20. return HAL_Timer_Expired(timer);
  21. }
  22. void countdown_ms(Timer *timer, unsigned int timeout_ms) {
  23. HAL_Timer_Countdown_ms(timer, timeout_ms);
  24. }
  25. void countdown(Timer *timer, unsigned int timeout) {
  26. HAL_Timer_Countdown(timer, timeout);
  27. }
  28. int left_ms(Timer *timer) {
  29. return HAL_Timer_Remain_ms(timer);
  30. }
  31. void init_timer(Timer *timer) {
  32. HAL_Timer_Init(timer);
  33. }
  34. #ifdef __cplusplus
  35. }
  36. #endif