Jeon byungchul
/
aws-iot-example
this is fork and i will modify for STM32
Fork of AWS-test by
aws-iot/platform/mbed_os/common/timer.cpp
- Committer:
- bcjun@aname.co.kr
- Date:
- 2017-08-04
- Revision:
- 3:1ef624d94403
- Parent:
- 0:cd5404401c2f
File content as of revision 3:1ef624d94403:
/** * @file timer.c * @brief mbed-os implementation of the timer interface needed for AWS. */ #ifdef __cplusplus extern "C" { #endif #include <stddef.h> #include "timer_interface.h" TimerExt::TimerExt() : mbed::Timer(){ } bool has_timer_expired(TimerAWS* timer) { return (timer->read_ms() > timer->timeout_ms); } void countdown_ms(TimerAWS *timer, uint32_t timeout) { timer->timeout_ms = timeout; timer->reset(); timer->start(); } void countdown_sec(TimerAWS *timer, uint32_t timeout) { timer->timeout_ms = (timeout * 1000); timer->reset(); timer->start(); } uint32_t left_ms(TimerAWS* timer) { if (timer->read_ms() < timer->timeout_ms) return (timer->timeout_ms - timer->read_ms()); return 0; } void init_timer(TimerAWS * timer){ timer->stop(); timer->reset(); timer->timeout_ms = 0; } #ifdef __cplusplus } #endif