ble

Dependencies:   HC_SR04_Ultrasonic_Library Servo mbed

Fork of FIP_REV1 by Robotique FIP

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gp_timer.h Source File

gp_timer.h

00001 /******************** (C) COPYRIGHT 2012 STMicroelectronics ********************
00002 * File Name          : gp_timer.h
00003 * Author             : AMS - HEA&RF BU
00004 * Version            : V1.0.0
00005 * Date               : 19-July-2012
00006 * Description        : General purpose timer library.
00007 ********************************************************************************
00008 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00009 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
00010 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
00011 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
00012 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
00013 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00014 *******************************************************************************/
00015 
00016 #ifndef __GP_TIMER_H__
00017 #define __GP_TIMER_H__
00018 
00019 #include "clock.h"
00020 
00021 /**
00022  * timer
00023  *
00024  * A structure that represents a timer. Use Timer_Set() to set the timer.
00025  *
00026  */
00027 struct timer {
00028     
00029 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00030     
00031   tClockTime start;
00032   tClockTime interval;
00033   
00034 #endif
00035 };
00036 
00037 
00038 /**
00039  * Timer_Set
00040  *
00041  * @param[in] t             Pointer to a timer structure
00042  * @param[in] interval      timeout value
00043  *
00044  * This function sets the timeout value of a timer.
00045  *
00046  */
00047 void Timer_Set(struct timer *t, tClockTime interval);
00048 
00049 /**
00050  * Timer_Reset
00051  * 
00052  * @param[in] t     Pointer to a timer structure
00053  * 
00054  * This function resets the timer with the same interval given
00055  * with Timer_Set, starting from the time it previously expired.
00056  * 
00057  */ 
00058 void Timer_Reset(struct timer *t);
00059 
00060 /**
00061  * Timer_Restart
00062  * 
00063  * @param[in]  t   Pointer to a timer structure
00064  * 
00065  * This function resets the timer with the same interval given
00066  * with Timer_Set, starting from the current time.
00067  * 
00068  */ 
00069 void Timer_Restart(struct timer *t);
00070 
00071 /**
00072  * Timer_Expired
00073  *
00074  * @param[in] t    Pointer to a timer structure
00075  *
00076  * This function returns TRUE if timer is expired, FALSE otherwise.
00077  *
00078  */
00079 int Timer_Expired(struct timer *t);
00080 
00081 /**
00082  * Timer_Expired
00083  *
00084  * @param[in] t    Pointer to a timer structure
00085  *
00086  * This function returns the time needed for expiration.
00087  *
00088  * @return  Time before timer's expiration.
00089  */
00090 tClockTime Timer_Remaining(struct timer *t);
00091 
00092 #endif /* __GP_TIMER_H__ */