app_timer_appsh.h 1.9 KB

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