ble
Dependencies: HC_SR04_Ultrasonic_Library Servo mbed
Fork of FIP_REV1 by
BlueNRG_F4_BSP/inc/gp_timer.h@4:69a35a56ac48, 2015-07-09 (annotated)
- Committer:
- julientiron
- Date:
- Thu Jul 09 13:33:36 2015 +0000
- Revision:
- 4:69a35a56ac48
- Parent:
- 0:3d641e170a74
BLE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
julientiron | 0:3d641e170a74 | 1 | /******************** (C) COPYRIGHT 2012 STMicroelectronics ******************** |
julientiron | 0:3d641e170a74 | 2 | * File Name : gp_timer.h |
julientiron | 0:3d641e170a74 | 3 | * Author : AMS - HEA&RF BU |
julientiron | 0:3d641e170a74 | 4 | * Version : V1.0.0 |
julientiron | 0:3d641e170a74 | 5 | * Date : 19-July-2012 |
julientiron | 0:3d641e170a74 | 6 | * Description : General purpose timer library. |
julientiron | 0:3d641e170a74 | 7 | ******************************************************************************** |
julientiron | 0:3d641e170a74 | 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
julientiron | 0:3d641e170a74 | 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
julientiron | 0:3d641e170a74 | 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
julientiron | 0:3d641e170a74 | 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
julientiron | 0:3d641e170a74 | 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
julientiron | 0:3d641e170a74 | 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
julientiron | 0:3d641e170a74 | 14 | *******************************************************************************/ |
julientiron | 0:3d641e170a74 | 15 | |
julientiron | 0:3d641e170a74 | 16 | #ifndef __GP_TIMER_H__ |
julientiron | 0:3d641e170a74 | 17 | #define __GP_TIMER_H__ |
julientiron | 0:3d641e170a74 | 18 | |
julientiron | 0:3d641e170a74 | 19 | #include "clock.h" |
julientiron | 0:3d641e170a74 | 20 | |
julientiron | 0:3d641e170a74 | 21 | /** |
julientiron | 0:3d641e170a74 | 22 | * timer |
julientiron | 0:3d641e170a74 | 23 | * |
julientiron | 0:3d641e170a74 | 24 | * A structure that represents a timer. Use Timer_Set() to set the timer. |
julientiron | 0:3d641e170a74 | 25 | * |
julientiron | 0:3d641e170a74 | 26 | */ |
julientiron | 0:3d641e170a74 | 27 | struct timer { |
julientiron | 0:3d641e170a74 | 28 | |
julientiron | 0:3d641e170a74 | 29 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
julientiron | 0:3d641e170a74 | 30 | |
julientiron | 0:3d641e170a74 | 31 | tClockTime start; |
julientiron | 0:3d641e170a74 | 32 | tClockTime interval; |
julientiron | 0:3d641e170a74 | 33 | |
julientiron | 0:3d641e170a74 | 34 | #endif |
julientiron | 0:3d641e170a74 | 35 | }; |
julientiron | 0:3d641e170a74 | 36 | |
julientiron | 0:3d641e170a74 | 37 | |
julientiron | 0:3d641e170a74 | 38 | /** |
julientiron | 0:3d641e170a74 | 39 | * Timer_Set |
julientiron | 0:3d641e170a74 | 40 | * |
julientiron | 0:3d641e170a74 | 41 | * @param[in] t Pointer to a timer structure |
julientiron | 0:3d641e170a74 | 42 | * @param[in] interval timeout value |
julientiron | 0:3d641e170a74 | 43 | * |
julientiron | 0:3d641e170a74 | 44 | * This function sets the timeout value of a timer. |
julientiron | 0:3d641e170a74 | 45 | * |
julientiron | 0:3d641e170a74 | 46 | */ |
julientiron | 0:3d641e170a74 | 47 | void Timer_Set(struct timer *t, tClockTime interval); |
julientiron | 0:3d641e170a74 | 48 | |
julientiron | 0:3d641e170a74 | 49 | /** |
julientiron | 0:3d641e170a74 | 50 | * Timer_Reset |
julientiron | 0:3d641e170a74 | 51 | * |
julientiron | 0:3d641e170a74 | 52 | * @param[in] t Pointer to a timer structure |
julientiron | 0:3d641e170a74 | 53 | * |
julientiron | 0:3d641e170a74 | 54 | * This function resets the timer with the same interval given |
julientiron | 0:3d641e170a74 | 55 | * with Timer_Set, starting from the time it previously expired. |
julientiron | 0:3d641e170a74 | 56 | * |
julientiron | 0:3d641e170a74 | 57 | */ |
julientiron | 0:3d641e170a74 | 58 | void Timer_Reset(struct timer *t); |
julientiron | 0:3d641e170a74 | 59 | |
julientiron | 0:3d641e170a74 | 60 | /** |
julientiron | 0:3d641e170a74 | 61 | * Timer_Restart |
julientiron | 0:3d641e170a74 | 62 | * |
julientiron | 0:3d641e170a74 | 63 | * @param[in] t Pointer to a timer structure |
julientiron | 0:3d641e170a74 | 64 | * |
julientiron | 0:3d641e170a74 | 65 | * This function resets the timer with the same interval given |
julientiron | 0:3d641e170a74 | 66 | * with Timer_Set, starting from the current time. |
julientiron | 0:3d641e170a74 | 67 | * |
julientiron | 0:3d641e170a74 | 68 | */ |
julientiron | 0:3d641e170a74 | 69 | void Timer_Restart(struct timer *t); |
julientiron | 0:3d641e170a74 | 70 | |
julientiron | 0:3d641e170a74 | 71 | /** |
julientiron | 0:3d641e170a74 | 72 | * Timer_Expired |
julientiron | 0:3d641e170a74 | 73 | * |
julientiron | 0:3d641e170a74 | 74 | * @param[in] t Pointer to a timer structure |
julientiron | 0:3d641e170a74 | 75 | * |
julientiron | 0:3d641e170a74 | 76 | * This function returns TRUE if timer is expired, FALSE otherwise. |
julientiron | 0:3d641e170a74 | 77 | * |
julientiron | 0:3d641e170a74 | 78 | */ |
julientiron | 0:3d641e170a74 | 79 | int Timer_Expired(struct timer *t); |
julientiron | 0:3d641e170a74 | 80 | |
julientiron | 0:3d641e170a74 | 81 | /** |
julientiron | 0:3d641e170a74 | 82 | * Timer_Expired |
julientiron | 0:3d641e170a74 | 83 | * |
julientiron | 0:3d641e170a74 | 84 | * @param[in] t Pointer to a timer structure |
julientiron | 0:3d641e170a74 | 85 | * |
julientiron | 0:3d641e170a74 | 86 | * This function returns the time needed for expiration. |
julientiron | 0:3d641e170a74 | 87 | * |
julientiron | 0:3d641e170a74 | 88 | * @return Time before timer's expiration. |
julientiron | 0:3d641e170a74 | 89 | */ |
julientiron | 0:3d641e170a74 | 90 | tClockTime Timer_Remaining(struct timer *t); |
julientiron | 0:3d641e170a74 | 91 | |
julientiron | 0:3d641e170a74 | 92 | #endif /* __GP_TIMER_H__ */ |