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