Common IO - basic v1.0.0
Common IO - basic v1.0.0 Library
 
Loading...
Searching...
No Matches
iot_timer.h
Go to the documentation of this file.
1/*
2 * Common IO - basic V1.0.0
3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 * this software and associated documentation files (the "Software"), to deal in
7 * the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * http://aws.amazon.com/freertos
23 * http://www.FreeRTOS.org
24 */
25
26/*******************************************************************************
27 * @file iot_timer.h
28 *
29 * @brief HAL APIs for a generic timer driver
30 *******************************************************************************
31 */
32
38#ifndef _IOT_TIMER_H_
39#define _IOT_TIMER_H_
40
49#define IOT_TIMER_SUCCESS ( 0 )
50#define IOT_TIMER_INVALID_VALUE ( 1 )
51#define IOT_TIMER_FUNCTION_NOT_SUPPORTED ( 2 )
52#define IOT_TIMER_NOT_RUNNING ( 3 )
53#define IOT_TIMER_SET_FAILED ( 4 )
58struct IotTimerDescriptor;
59
65typedef struct IotTimerDescriptor * IotTimerHandle_t;
66
73typedef void ( * IotTimerCallback_t)( void * pvUserContext );
74
87IotTimerHandle_t iot_timer_open( int32_t lTimerInstance );
88
106void iot_timer_set_callback( IotTimerHandle_t const pxTimerHandle,
107 IotTimerCallback_t xCallback,
108 void * pvUserContext );
109
121int32_t iot_timer_start( IotTimerHandle_t const pxTimerHandle );
122
137int32_t iot_timer_stop( IotTimerHandle_t const pxTimerHandle );
138
151int32_t iot_timer_get_value( IotTimerHandle_t const pxTimerHandle,
152 uint64_t * ullMicroSeconds );
153
202int32_t iot_timer_delay( IotTimerHandle_t const pxTimerHandle,
203 uint32_t ulDelayMicroSeconds );
204
219int32_t iot_timer_cancel( IotTimerHandle_t const pxTimerHandle );
220
234int32_t iot_timer_close( IotTimerHandle_t const pxTimerHandle );
235
240#endif /* ifndef _IOT_TIMER_H_ */
int32_t iot_timer_close(IotTimerHandle_t const pxTimerHandle)
iot_timer_close is used to de-initializes the timer, stops the timer if it was started and cancels th...
int32_t iot_timer_stop(IotTimerHandle_t const pxTimerHandle)
iot_timer_stop is used to stop the timer counter if the timer is running.
void(* IotTimerCallback_t)(void *pvUserContext)
timer callback notification type. This callback is used for notifying the caller when the setup timer...
Definition: iot_timer.h:73
int32_t iot_timer_get_value(IotTimerHandle_t const pxTimerHandle, uint64_t *ullMicroSeconds)
iot_timer_get_value is used to get the current timer value in micro seconds.
int32_t iot_timer_cancel(IotTimerHandle_t const pxTimerHandle)
iot_timer_cancel is used to cancel any existing delay call. If a call to iot_timer_delay() was made e...
int32_t iot_timer_start(IotTimerHandle_t const pxTimerHandle)
iot_timer_start is used to start the timer counter. This call only makes the timer counter running,...
void iot_timer_set_callback(IotTimerHandle_t const pxTimerHandle, IotTimerCallback_t xCallback, void *pvUserContext)
iot_timer_set_callback is used to set the callback to be called when the timer reaches the count (del...
int32_t iot_timer_delay(IotTimerHandle_t const pxTimerHandle, uint32_t ulDelayMicroSeconds)
iot_timer_delay is used to set up a delay/wake-up time in microseconds. The caller can use this API t...
struct IotTimerDescriptor * IotTimerHandle_t
IotTimerHandle_t type is the timer handle returned by calling iot_timer_open() this is initialized in...
Definition: iot_timer.h:65
IotTimerHandle_t iot_timer_open(int32_t lTimerInstance)
iot_timer_open is used to initialize the timer. This function will start the timer.