forked from ARMmbed/nrf5x-dfu-bootloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_timer_appsh.h
45 lines (38 loc) · 2.09 KB
/
app_timer_appsh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
#ifndef APP_TIMER_APPSH_H
#define APP_TIMER_APPSH_H
#include "app_timer.h"
#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). */
/**@brief Macro for initializing the application timer module to use with app_scheduler.
*
* @param[in] PRESCALER Value of the RTC1 PRESCALER register. This will decide the
* timer tick rate. Set to 0 for no prescaling.
* @param[in] MAX_TIMERS Maximum number of timers that can be created at any given time.
* @param[in] OP_QUEUES_SIZE Size of queues holding timer operations that are pending execution.
* @param[in] USE_SCHEDULER TRUE if the application is using the app_scheduler,
* FALSE otherwise.
*
* @note Since this macro allocates a buffer, it must only be called once (it is OK to call it
* several times as long as it is from the same location, e.g. to do a reinitialization).
*/
#define APP_TIMER_APPSH_INIT(PRESCALER, MAX_TIMERS, OP_QUEUES_SIZE, USE_SCHEDULER) \
APP_TIMER_INIT(PRESCALER, MAX_TIMERS, OP_QUEUES_SIZE, \
(USE_SCHEDULER) ? app_timer_evt_schedule : NULL)
typedef struct
{
app_timer_timeout_handler_t timeout_handler;
void * p_context;
} app_timer_event_t;
uint32_t app_timer_evt_schedule(app_timer_timeout_handler_t timeout_handler,
void * p_context);
#endif // APP_TIMER_APPSH_H