AWS IoT Embedded C Device SDK
Functions
timer.c File Reference

Linux implementation of the timer interface. More...

#include <stddef.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include "timer_platform.h"

Functions

bool has_timer_expired (Timer *timer)
 Check if a timer is expired. More...
 
void countdown_ms (Timer *timer, uint32_t timeout)
 Create a timer (milliseconds) More...
 
uint32_t left_ms (Timer *timer)
 Check the time remaining on a given timer. More...
 
void countdown_sec (Timer *timer, uint32_t timeout)
 Create a timer (seconds) More...
 
void init_timer (Timer *timer)
 Initialize a timer. More...
 

Function Documentation

void countdown_ms ( Timer ,
uint32_t   
)

Sets the timer to expire in a specified number of milliseconds.

Parameters
Timer- pointer to the timer to be set to expire in milliseconds
uint32_t- set the timer to expire in this number of milliseconds
void countdown_sec ( Timer ,
uint32_t   
)

Sets the timer to expire in a specified number of seconds.

Parameters
Timer- pointer to the timer to be set to expire in seconds
uint32_t- set the timer to expire in this number of seconds
bool has_timer_expired ( Timer )

Call this function passing in a timer to check if that timer has expired.

Parameters
Timer- pointer to the timer to be checked for expiration
Returns
bool - true = timer expired, false = timer not expired
void init_timer ( Timer )

Performs any initialization required to the timer passed in.

Parameters
Timer- pointer to the timer to be initialized
uint32_t left_ms ( Timer )

Checks the input timer and returns the number of milliseconds remaining on the timer.

Parameters
Timer- pointer to the timer to be set to checked
Returns
int - milliseconds left on the countdown timer