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