Nordic stack and drivers for the mbed BLE API

Dependents:   BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate writable_gatt ... more

Committer:
bogdanm
Date:
Wed Mar 26 14:38:17 2014 +0000
Revision:
0:eff01767de02
Child:
37:c29c330d942c
Initial import of the nRF51822 code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:eff01767de02 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
bogdanm 0:eff01767de02 2 *
bogdanm 0:eff01767de02 3 * The information contained herein is property of Nordic Semiconductor ASA.
bogdanm 0:eff01767de02 4 * Terms and conditions of usage are described in detail in NORDIC
bogdanm 0:eff01767de02 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
bogdanm 0:eff01767de02 6 *
bogdanm 0:eff01767de02 7 * Licensees are granted free, non-transferable use of the information. NO
bogdanm 0:eff01767de02 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
bogdanm 0:eff01767de02 9 * the file.
bogdanm 0:eff01767de02 10 *
bogdanm 0:eff01767de02 11 */
bogdanm 0:eff01767de02 12
bogdanm 0:eff01767de02 13 /** @file
bogdanm 0:eff01767de02 14 *
bogdanm 0:eff01767de02 15 * @defgroup app_timer Application Timer
bogdanm 0:eff01767de02 16 * @{
bogdanm 0:eff01767de02 17 * @ingroup app_common
bogdanm 0:eff01767de02 18 *
bogdanm 0:eff01767de02 19 * @brief Application timer functionality.
bogdanm 0:eff01767de02 20 *
bogdanm 0:eff01767de02 21 * @details It enables the application to create multiple timer instances based on the RTC1
bogdanm 0:eff01767de02 22 * peripheral. Checking for timeouts and invokation of user timeout handlers is performed
bogdanm 0:eff01767de02 23 * in the RTC1 interrupt handler. List handling is done using a software interrupt (SWI0).
bogdanm 0:eff01767de02 24 * Both interrupt handlers are running in APP_LOW priority level.
bogdanm 0:eff01767de02 25 *
bogdanm 0:eff01767de02 26 * @note When calling app_timer_start() or app_timer_stop(), the timer operation is just queued,
bogdanm 0:eff01767de02 27 * and the software interrupt is triggered. The actual timer start/stop operation is
bogdanm 0:eff01767de02 28 * executed by the SWI0 interrupt handler. Since the SWI0 interrupt is running in APP_LOW,
bogdanm 0:eff01767de02 29 * if the application code calling the timer function is running in APP_LOW or APP_HIGH,
bogdanm 0:eff01767de02 30 * the timer operation will not be performed until the application handler has returned.
bogdanm 0:eff01767de02 31 * This will be the case e.g. when stopping a timer from a timeout handler when not using
bogdanm 0:eff01767de02 32 * the scheduler.
bogdanm 0:eff01767de02 33 *
bogdanm 0:eff01767de02 34 * @details Use the USE_SCHEDULER parameter of the APP_TIMER_INIT() macro to select if the
bogdanm 0:eff01767de02 35 * @ref app_scheduler is to be used or not.
bogdanm 0:eff01767de02 36 *
bogdanm 0:eff01767de02 37 * @note Even if the scheduler is not used, app_timer.h will include app_scheduler.h, so when
bogdanm 0:eff01767de02 38 * compiling, app_scheduler.h must be available in one of the compiler include paths.
bogdanm 0:eff01767de02 39 */
bogdanm 0:eff01767de02 40
bogdanm 0:eff01767de02 41 #ifndef APP_TIMER_H__
bogdanm 0:eff01767de02 42 #define APP_TIMER_H__
bogdanm 0:eff01767de02 43
bogdanm 0:eff01767de02 44 #include <stdint.h>
bogdanm 0:eff01767de02 45 #include <stdbool.h>
bogdanm 0:eff01767de02 46 #include <stdio.h>
bogdanm 0:eff01767de02 47 #include "nordic_global.h"
bogdanm 0:eff01767de02 48 #include "app_error.h"
bogdanm 0:eff01767de02 49 #include "app_util.h"
bogdanm 0:eff01767de02 50 #include "app_scheduler.h"
bogdanm 0:eff01767de02 51 #include "compiler_abstraction.h"
bogdanm 0:eff01767de02 52
bogdanm 0:eff01767de02 53 #define APP_TIMER_SCHED_EVT_SIZE sizeof(app_timer_event_t) /**< Size of button events being passed through the scheduler (is to be used for computing the maximum size of scheduler events). */
bogdanm 0:eff01767de02 54 #define APP_TIMER_CLOCK_FREQ 32768 /**< Clock frequency of the RTC timer used to implement the app timer module. */
bogdanm 0:eff01767de02 55 #define APP_TIMER_MIN_TIMEOUT_TICKS 5 /**< Minimum value of the timeout_ticks parameter of app_timer_start(). */
bogdanm 0:eff01767de02 56
bogdanm 0:eff01767de02 57 #define APP_TIMER_NODE_SIZE 40 /**< Size of app_timer.timer_node_t (only for use inside APP_TIMER_BUF_SIZE()). */
bogdanm 0:eff01767de02 58 #define APP_TIMER_USER_OP_SIZE 24 /**< Size of app_timer.timer_user_op_t (only for use inside APP_TIMER_BUF_SIZE()). */
bogdanm 0:eff01767de02 59 #define APP_TIMER_USER_SIZE 8 /**< Size of app_timer.timer_user_t (only for use inside APP_TIMER_BUF_SIZE()). */
bogdanm 0:eff01767de02 60 #define APP_TIMER_INT_LEVELS 3 /**< Number of interrupt levels from where timer operations may be initiated (only for use inside APP_TIMER_BUF_SIZE()). */
bogdanm 0:eff01767de02 61
bogdanm 0:eff01767de02 62 /**@brief Compute number of bytes required to hold the application timer data structures.
bogdanm 0:eff01767de02 63 *
bogdanm 0:eff01767de02 64 * @param[in] MAX_TIMERS Maximum number of timers that can be created at any given time.
bogdanm 0:eff01767de02 65 * @param[in] OP_QUEUE_SIZE Size of queues holding timer operations that are pending execution.
bogdanm 0:eff01767de02 66 * NOTE: Due to the queue implementation, this size must be one more
bogdanm 0:eff01767de02 67 * than the size that is actually needed.
bogdanm 0:eff01767de02 68 *
bogdanm 0:eff01767de02 69 * @return Required application timer buffer size (in bytes).
bogdanm 0:eff01767de02 70 */
bogdanm 0:eff01767de02 71 #define APP_TIMER_BUF_SIZE(MAX_TIMERS, OP_QUEUE_SIZE) \
bogdanm 0:eff01767de02 72 ( \
bogdanm 0:eff01767de02 73 ((MAX_TIMERS) * APP_TIMER_NODE_SIZE) \
bogdanm 0:eff01767de02 74 + \
bogdanm 0:eff01767de02 75 ( \
bogdanm 0:eff01767de02 76 APP_TIMER_INT_LEVELS \
bogdanm 0:eff01767de02 77 * \
bogdanm 0:eff01767de02 78 (APP_TIMER_USER_SIZE + ((OP_QUEUE_SIZE) + 1) * APP_TIMER_USER_OP_SIZE) \
bogdanm 0:eff01767de02 79 ) \
bogdanm 0:eff01767de02 80 )
bogdanm 0:eff01767de02 81
bogdanm 0:eff01767de02 82 /**@brief Convert milliseconds to timer ticks.
bogdanm 0:eff01767de02 83 *
bogdanm 0:eff01767de02 84 * @note This macro uses 64 bit integer arithmetic, but as long as the macro parameters are
bogdanm 0:eff01767de02 85 * constants (i.e. defines), the computation will be done by the preprocessor.
bogdanm 0:eff01767de02 86 *
bogdanm 0:eff01767de02 87 * @param[in] MS Milliseconds.
bogdanm 0:eff01767de02 88 * @param[in] PRESCALER Value of the RTC1 PRESCALER register (must be the same value that was
bogdanm 0:eff01767de02 89 * passed to APP_TIMER_INIT()).
bogdanm 0:eff01767de02 90 *
bogdanm 0:eff01767de02 91 * @note When using this macro, it is the responsibility of the developer to ensure that the
bogdanm 0:eff01767de02 92 * values provided as input result in an output value that is supported by the
bogdanm 0:eff01767de02 93 * @ref app_timer_start function. For example, when the ticks for 1 ms is needed, the
bogdanm 0:eff01767de02 94 * maximum possible value of PRESCALER must be 6, when @ref APP_TIMER_CLOCK_FREQ is 32768.
bogdanm 0:eff01767de02 95 * This will result in a ticks value as 5. Any higher value for PRESCALER will result in a
bogdanm 0:eff01767de02 96 * ticks value that is not supported by this module.
bogdanm 0:eff01767de02 97 *
bogdanm 0:eff01767de02 98 * @return Number of timer ticks.
bogdanm 0:eff01767de02 99 */
bogdanm 0:eff01767de02 100 #define APP_TIMER_TICKS(MS, PRESCALER)\
bogdanm 0:eff01767de02 101 ((uint32_t)ROUNDED_DIV((MS) * (uint64_t)APP_TIMER_CLOCK_FREQ, ((PRESCALER) + 1) * 1000))
bogdanm 0:eff01767de02 102
bogdanm 0:eff01767de02 103 /**@brief Timer id type. */
bogdanm 0:eff01767de02 104 typedef uint32_t app_timer_id_t;
bogdanm 0:eff01767de02 105
bogdanm 0:eff01767de02 106 /**@brief Application timeout handler type. */
bogdanm 0:eff01767de02 107 typedef void (*app_timer_timeout_handler_t)(void * p_context);
bogdanm 0:eff01767de02 108
bogdanm 0:eff01767de02 109 /**@brief Type of function for passing events from the timer module to the scheduler. */
bogdanm 0:eff01767de02 110 typedef uint32_t (*app_timer_evt_schedule_func_t) (app_timer_timeout_handler_t timeout_handler,
bogdanm 0:eff01767de02 111 void * p_context);
bogdanm 0:eff01767de02 112
bogdanm 0:eff01767de02 113 /**@brief Timer modes. */
bogdanm 0:eff01767de02 114 typedef enum
bogdanm 0:eff01767de02 115 {
bogdanm 0:eff01767de02 116 APP_TIMER_MODE_SINGLE_SHOT, /**< The timer will expire only once. */
bogdanm 0:eff01767de02 117 APP_TIMER_MODE_REPEATED /**< The timer will restart each time it expires. */
bogdanm 0:eff01767de02 118 } app_timer_mode_t;
bogdanm 0:eff01767de02 119
bogdanm 0:eff01767de02 120 /**@brief Macro for initializing the application timer module.
bogdanm 0:eff01767de02 121 *
bogdanm 0:eff01767de02 122 * @details It will handle dimensioning and allocation of the memory buffer required by the timer,
bogdanm 0:eff01767de02 123 * making sure that the buffer is correctly aligned. It will also connect the timer module
bogdanm 0:eff01767de02 124 * to the scheduler (if specified).
bogdanm 0:eff01767de02 125 *
bogdanm 0:eff01767de02 126 * @param[in] PRESCALER Value of the RTC1 PRESCALER register. This will decide the
bogdanm 0:eff01767de02 127 * timer tick rate. Set to 0 for no prescaling.
bogdanm 0:eff01767de02 128 * @param[in] MAX_TIMERS Maximum number of timers that can be created at any given time.
bogdanm 0:eff01767de02 129 * @param[in] OP_QUEUES_SIZE Size of queues holding timer operations that are pending execution.
bogdanm 0:eff01767de02 130 * @param[in] USE_SCHEDULER TRUE if the application is using the event scheduler,
bogdanm 0:eff01767de02 131 * FALSE otherwise.
bogdanm 0:eff01767de02 132 *
bogdanm 0:eff01767de02 133 * @note Since this macro allocates a buffer, it must only be called once (it is OK to call it
bogdanm 0:eff01767de02 134 * several times as long as it is from the same location, e.g. to do a reinitialization).
bogdanm 0:eff01767de02 135 */
bogdanm 0:eff01767de02 136 /*lint -emacro(506, APP_TIMER_INIT) */ /* Suppress "Constant value Boolean */
bogdanm 0:eff01767de02 137 #define APP_TIMER_INIT(PRESCALER, MAX_TIMERS, OP_QUEUES_SIZE, USE_SCHEDULER) \
bogdanm 0:eff01767de02 138 do \
bogdanm 0:eff01767de02 139 { \
bogdanm 0:eff01767de02 140 static uint32_t APP_TIMER_BUF[CEIL_DIV(APP_TIMER_BUF_SIZE((MAX_TIMERS), \
bogdanm 0:eff01767de02 141 (OP_QUEUES_SIZE) + 1), \
bogdanm 0:eff01767de02 142 sizeof(uint32_t))]; \
bogdanm 0:eff01767de02 143 uint32_t ERR_CODE = app_timer_init((PRESCALER), \
bogdanm 0:eff01767de02 144 (MAX_TIMERS), \
bogdanm 0:eff01767de02 145 (OP_QUEUES_SIZE) + 1, \
bogdanm 0:eff01767de02 146 APP_TIMER_BUF, \
bogdanm 0:eff01767de02 147 (USE_SCHEDULER) ? app_timer_evt_schedule : NULL); \
bogdanm 0:eff01767de02 148 APP_ERROR_CHECK(ERR_CODE); \
bogdanm 0:eff01767de02 149 } while (0)
bogdanm 0:eff01767de02 150
bogdanm 0:eff01767de02 151 /**@brief Function for initializing the timer module.
bogdanm 0:eff01767de02 152 *
bogdanm 0:eff01767de02 153 * @note Normally initialization should be done using the APP_TIMER_INIT() macro, as that will both
bogdanm 0:eff01767de02 154 * allocate the buffers needed by the timer module (including aligning the buffers correctly,
bogdanm 0:eff01767de02 155 * and also take care of connecting the timer module to the scheduler (if specified).
bogdanm 0:eff01767de02 156 *
bogdanm 0:eff01767de02 157 * @param[in] prescaler Value of the RTC1 PRESCALER register. Set to 0 for no prescaling.
bogdanm 0:eff01767de02 158 * @param[in] max_timers Maximum number of timers that can be created at any given time.
bogdanm 0:eff01767de02 159 * @param[in] op_queues_size Size of queues holding timer operations that are pending
bogdanm 0:eff01767de02 160 * execution. NOTE: Due to the queue implementation, this size must
bogdanm 0:eff01767de02 161 * be one more than the size that is actually needed.
bogdanm 0:eff01767de02 162 * @param[in] p_buffer Pointer to memory buffer for internal use in the app_timer
bogdanm 0:eff01767de02 163 * module. The size of the buffer can be computed using the
bogdanm 0:eff01767de02 164 * APP_TIMER_BUF_SIZE() macro. The buffer must be aligned to a
bogdanm 0:eff01767de02 165 * 4 byte boundary.
bogdanm 0:eff01767de02 166 * @param[in] evt_schedule_func Function for passing timeout events to the scheduler. Point to
bogdanm 0:eff01767de02 167 * app_timer_evt_schedule() to connect to the scheduler. Set to NULL
bogdanm 0:eff01767de02 168 * to make the timer module call the timeout handler directly from
bogdanm 0:eff01767de02 169 * the timer interrupt handler.
bogdanm 0:eff01767de02 170 *
bogdanm 0:eff01767de02 171 * @retval NRF_SUCCESS Successful initialization.
bogdanm 0:eff01767de02 172 * @retval NRF_ERROR_INVALID_PARAM Invalid parameter (buffer not aligned to a 4 byte
bogdanm 0:eff01767de02 173 * boundary or NULL).
bogdanm 0:eff01767de02 174 */
bogdanm 0:eff01767de02 175 uint32_t app_timer_init(uint32_t prescaler,
bogdanm 0:eff01767de02 176 uint8_t max_timers,
bogdanm 0:eff01767de02 177 uint8_t op_queues_size,
bogdanm 0:eff01767de02 178 void * p_buffer,
bogdanm 0:eff01767de02 179 app_timer_evt_schedule_func_t evt_schedule_func);
bogdanm 0:eff01767de02 180
bogdanm 0:eff01767de02 181 /**@brief Function for creating a timer instance.
bogdanm 0:eff01767de02 182 *
bogdanm 0:eff01767de02 183 * @param[out] p_timer_id Id of the newly created timer.
bogdanm 0:eff01767de02 184 * @param[in] mode Timer mode.
bogdanm 0:eff01767de02 185 * @param[in] timeout_handler Function to be executed when the timer expires.
bogdanm 0:eff01767de02 186 *
bogdanm 0:eff01767de02 187 * @retval NRF_SUCCESS Timer was successfully created.
bogdanm 0:eff01767de02 188 * @retval NRF_ERROR_INVALID_PARAM Invalid parameter.
bogdanm 0:eff01767de02 189 * @retval NRF_ERROR_INVALID_STATE Application timer module has not been initialized.
bogdanm 0:eff01767de02 190 * @retval NRF_ERROR_NO_MEM Maximum number of timers has already been reached.
bogdanm 0:eff01767de02 191 *
bogdanm 0:eff01767de02 192 * @note This function does the timer allocation in the caller's context. It is also not protected
bogdanm 0:eff01767de02 193 * by a critical region. Therefore care must be taken not to call it from several interrupt
bogdanm 0:eff01767de02 194 * levels simultaneously.
bogdanm 0:eff01767de02 195 */
bogdanm 0:eff01767de02 196 uint32_t app_timer_create(app_timer_id_t * p_timer_id,
bogdanm 0:eff01767de02 197 app_timer_mode_t mode,
bogdanm 0:eff01767de02 198 app_timer_timeout_handler_t timeout_handler);
bogdanm 0:eff01767de02 199
bogdanm 0:eff01767de02 200 /**@brief Function for starting a timer.
bogdanm 0:eff01767de02 201 *
bogdanm 0:eff01767de02 202 * @param[in] timer_id Id of timer to start.
bogdanm 0:eff01767de02 203 * @param[in] timeout_ticks Number of ticks (of RTC1, including prescaling) to timeout event
bogdanm 0:eff01767de02 204 * (minimum 5 ticks).
bogdanm 0:eff01767de02 205 * @param[in] p_context General purpose pointer. Will be passed to the timeout handler when
bogdanm 0:eff01767de02 206 * the timer expires.
bogdanm 0:eff01767de02 207 *
bogdanm 0:eff01767de02 208 * @retval NRF_SUCCESS Timer was successfully started.
bogdanm 0:eff01767de02 209 * @retval NRF_ERROR_INVALID_PARAM Invalid parameter.
bogdanm 0:eff01767de02 210 * @retval NRF_ERROR_INVALID_STATE Application timer module has not been initialized, or timer
bogdanm 0:eff01767de02 211 * has not been created.
bogdanm 0:eff01767de02 212 * @retval NRF_ERROR_NO_MEM Timer operations queue was full.
bogdanm 0:eff01767de02 213 *
bogdanm 0:eff01767de02 214 * @note The minimum timeout_ticks value is 5.
bogdanm 0:eff01767de02 215 * @note For multiple active timers, timeouts occurring in close proximity to each other (in the
bogdanm 0:eff01767de02 216 * range of 1 to 3 ticks) will have a positive jitter of maximum 3 ticks.
bogdanm 0:eff01767de02 217 * @note When calling this method on a timer which is already running, the second start operation
bogdanm 0:eff01767de02 218 * will be ignored.
bogdanm 0:eff01767de02 219 */
bogdanm 0:eff01767de02 220 uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context);
bogdanm 0:eff01767de02 221
bogdanm 0:eff01767de02 222 /**@brief Function for stopping the specified timer.
bogdanm 0:eff01767de02 223 *
bogdanm 0:eff01767de02 224 * @param[in] timer_id Id of timer to stop.
bogdanm 0:eff01767de02 225 *
bogdanm 0:eff01767de02 226 * @retval NRF_SUCCESS Timer was successfully stopped.
bogdanm 0:eff01767de02 227 * @retval NRF_ERROR_INVALID_PARAM Invalid parameter.
bogdanm 0:eff01767de02 228 * @retval NRF_ERROR_INVALID_STATE Application timer module has not been initialized, or timer
bogdanm 0:eff01767de02 229 * has not been created.
bogdanm 0:eff01767de02 230 * @retval NRF_ERROR_NO_MEM Timer operations queue was full.
bogdanm 0:eff01767de02 231 */
bogdanm 0:eff01767de02 232 uint32_t app_timer_stop(app_timer_id_t timer_id);
bogdanm 0:eff01767de02 233
bogdanm 0:eff01767de02 234 /**@brief Function for stopping all running timers.
bogdanm 0:eff01767de02 235 *
bogdanm 0:eff01767de02 236 * @retval NRF_SUCCESS All timers were successfully stopped.
bogdanm 0:eff01767de02 237 * @retval NRF_ERROR_INVALID_STATE Application timer module has not been initialized.
bogdanm 0:eff01767de02 238 * @retval NRF_ERROR_NO_MEM Timer operations queue was full.
bogdanm 0:eff01767de02 239 */
bogdanm 0:eff01767de02 240 uint32_t app_timer_stop_all(void);
bogdanm 0:eff01767de02 241
bogdanm 0:eff01767de02 242 /**@brief Function for returning the current value of the RTC1 counter.
bogdanm 0:eff01767de02 243 *
bogdanm 0:eff01767de02 244 * @param[out] p_ticks Current value of the RTC1 counter.
bogdanm 0:eff01767de02 245 *
bogdanm 0:eff01767de02 246 * @retval NRF_SUCCESS Counter was successfully read.
bogdanm 0:eff01767de02 247 */
bogdanm 0:eff01767de02 248 uint32_t app_timer_cnt_get(uint32_t * p_ticks);
bogdanm 0:eff01767de02 249
bogdanm 0:eff01767de02 250 /**@brief Function for computing the difference between two RTC1 counter values.
bogdanm 0:eff01767de02 251 *
bogdanm 0:eff01767de02 252 * @param[in] ticks_to Value returned by app_timer_cnt_get().
bogdanm 0:eff01767de02 253 * @param[in] ticks_from Value returned by app_timer_cnt_get().
bogdanm 0:eff01767de02 254 * @param[out] p_ticks_diff Number of ticks from ticks_from to ticks_to.
bogdanm 0:eff01767de02 255 *
bogdanm 0:eff01767de02 256 * @retval NRF_SUCCESS Counter difference was successfully computed.
bogdanm 0:eff01767de02 257 */
bogdanm 0:eff01767de02 258 uint32_t app_timer_cnt_diff_compute(uint32_t ticks_to,
bogdanm 0:eff01767de02 259 uint32_t ticks_from,
bogdanm 0:eff01767de02 260 uint32_t * p_ticks_diff);
bogdanm 0:eff01767de02 261
bogdanm 0:eff01767de02 262
bogdanm 0:eff01767de02 263 // Type and functions for connecting the timer to the scheduler:
bogdanm 0:eff01767de02 264
bogdanm 0:eff01767de02 265 /**@cond NO_DOXYGEN */
bogdanm 0:eff01767de02 266 typedef struct
bogdanm 0:eff01767de02 267 {
bogdanm 0:eff01767de02 268 app_timer_timeout_handler_t timeout_handler;
bogdanm 0:eff01767de02 269 void * p_context;
bogdanm 0:eff01767de02 270 } app_timer_event_t;
bogdanm 0:eff01767de02 271
bogdanm 0:eff01767de02 272 static __INLINE void app_timer_evt_get(void * p_event_data, uint16_t event_size)
bogdanm 0:eff01767de02 273 {
bogdanm 0:eff01767de02 274 app_timer_event_t * p_timer_event = (app_timer_event_t *)p_event_data;
bogdanm 0:eff01767de02 275
bogdanm 0:eff01767de02 276 APP_ERROR_CHECK_BOOL(event_size == sizeof(app_timer_event_t));
bogdanm 0:eff01767de02 277 p_timer_event->timeout_handler(p_timer_event->p_context);
bogdanm 0:eff01767de02 278 }
bogdanm 0:eff01767de02 279
bogdanm 0:eff01767de02 280 static __INLINE uint32_t app_timer_evt_schedule(app_timer_timeout_handler_t timeout_handler,
bogdanm 0:eff01767de02 281 void * p_context)
bogdanm 0:eff01767de02 282 {
bogdanm 0:eff01767de02 283 app_timer_event_t timer_event;
bogdanm 0:eff01767de02 284
bogdanm 0:eff01767de02 285 timer_event.timeout_handler = timeout_handler;
bogdanm 0:eff01767de02 286 timer_event.p_context = p_context;
bogdanm 0:eff01767de02 287
bogdanm 0:eff01767de02 288 return app_sched_event_put(&timer_event, sizeof(timer_event), app_timer_evt_get);
bogdanm 0:eff01767de02 289 }
bogdanm 0:eff01767de02 290 /**@endcond */
bogdanm 0:eff01767de02 291
bogdanm 0:eff01767de02 292 #endif // APP_TIMER_H__
bogdanm 0:eff01767de02 293
bogdanm 0:eff01767de02 294 /** @} */