tset
Fork of X_NUCLEO_IDB0XA1 by
Embed:
(wiki syntax)
Show/hide line numbers
ble_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 "ble_clock.h" 00020 #include "ble_status.h" 00021 #ifdef __DMA_LP__ 00022 #include "stm32xx_timerserver.h" 00023 #endif /* __DMA_LP__ */ 00024 00025 /** 00026 * timer 00027 * 00028 * A structure that represents a timer. Use Timer_Set() to set the timer. 00029 * 00030 */ 00031 struct timer { 00032 00033 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00034 00035 tClockTime start; 00036 tClockTime interval; 00037 00038 #endif 00039 }; 00040 00041 typedef void (* TIMER_HCI_TIMEOUT_NOTIFY_CALLBACK_TYPE)(void); 00042 00043 /** 00044 * Timer_Set 00045 * 00046 * @param[in] t Pointer to a timer structure 00047 * @param[in] interval timeout value 00048 * 00049 * This function sets the timeout value of a timer. 00050 * 00051 */ 00052 void Timer_Set(struct timer *t, tClockTime interval); 00053 00054 /** 00055 * Timer_Reset 00056 * 00057 * @param[in] t Pointer to a timer structure 00058 * 00059 * This function resets the timer with the same interval given 00060 * with Timer_Set, starting from the time it previously expired. 00061 * 00062 */ 00063 void Timer_Reset(struct timer *t); 00064 00065 /** 00066 * Timer_Restart 00067 * 00068 * @param[in] t Pointer to a timer structure 00069 * 00070 * This function resets the timer with the same interval given 00071 * with Timer_Set, starting from the current time. 00072 * 00073 */ 00074 void Timer_Restart(struct timer *t); 00075 00076 /** 00077 * Timer_Expired 00078 * 00079 * @param[in] t Pointer to a timer structure 00080 * 00081 * This function returns TRUE if timer is expired, FALSE otherwise. 00082 * 00083 */ 00084 int Timer_Expired(struct timer *t); 00085 00086 /** 00087 * Timer_Expired 00088 * 00089 * @param[in] t Pointer to a timer structure 00090 * 00091 * This function returns the time needed for expiration. 00092 * 00093 * @return Time before timer's expiration. 00094 */ 00095 tClockTime Timer_Remaining(struct timer *t); 00096 00097 #ifdef __DMA_LP__ 00098 tBleStatus Blue_NRG_HCI_Timer_Start(uint32_t expiryTime, 00099 TIMER_HCI_TIMEOUT_NOTIFY_CALLBACK_TYPE timercb, 00100 uint8_t *timerID); 00101 00102 tBleStatus Blue_NRG_HCI_Timer_Stop(uint8_t timerID); 00103 #endif /* __DMA_LP__ */ 00104 00105 #endif /* __GP_TIMER_H__ */
Generated on Tue Jul 12 2022 17:29:34 by 1.7.2