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