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