テスト用
Fork of nRF51822 by
Diff: nordic/nrf-sdk/app_common/app_timer.h
- Revision:
- 45:3c4df37ed83e
- Parent:
- 37:c29c330d942c
- Child:
- 56:a1071b629aa3
--- a/nordic/nrf-sdk/app_common/app_timer.h Fri Jul 11 13:53:30 2014 +0100 +++ b/nordic/nrf-sdk/app_common/app_timer.h Wed Jul 16 10:53:07 2014 +0100 @@ -49,6 +49,10 @@ #include "app_scheduler.h" #include "compiler_abstraction.h" +#ifdef __cplusplus +extern "C" { +#endif // #ifdef __cplusplus + #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). */ #define APP_TIMER_CLOCK_FREQ 32768 /**< Clock frequency of the RTC timer used to implement the app timer module. */ #define APP_TIMER_MIN_TIMEOUT_TICKS 5 /**< Minimum value of the timeout_ticks parameter of app_timer_start(). */ @@ -85,9 +89,9 @@ * * @param[in] MS Milliseconds. * @param[in] PRESCALER Value of the RTC1 PRESCALER register (must be the same value that was - * passed to APP_TIMER_INIT()). - * - * @note When using this macro, it is the responsibility of the developer to ensure that the + * passed to APP_TIMER_INIT()). + * + * @note When using this macro, it is the responsibility of the developer to ensure that the * values provided as input result in an output value that is supported by the * @ref app_timer_start function. For example, when the ticks for 1 ms is needed, the * maximum possible value of PRESCALER must be 6, when @ref APP_TIMER_CLOCK_FREQ is 32768. @@ -122,11 +126,11 @@ * making sure that the buffer is correctly aligned. It will also connect the timer module * to the scheduler (if specified). * - * @note This module assumes that the LFCLK is already running. If it isn't, the module will - * be non-functional, since the RTC will not run. If you don't use a softdevice, you'll - * have to start the LFCLK manually. See the rtc_example's \ref lfclk_config() function - * for an example of how to do this. If you use a softdevice, the LFCLK is started on - * softdevice init. + * @note This module assumes that the LFCLK is already running. If it isn't, the module will + * be non-functional, since the RTC will not run. If you don't use a softdevice, you'll + * have to start the LFCLK manually. See the rtc_example's \ref lfclk_config() function + * for an example of how to do this. If you use a softdevice, the LFCLK is started on + * softdevice init. * * * @param[in] PRESCALER Value of the RTC1 PRESCALER register. This will decide the @@ -178,7 +182,7 @@ * @retval NRF_ERROR_INVALID_PARAM Invalid parameter (buffer not aligned to a 4 byte * boundary or NULL). */ -uint32_t app_timer_init(uint32_t prescaler, +uint32_t app_timer_init(uint32_t prescaler, uint8_t max_timers, uint8_t op_queues_size, void * p_buffer, @@ -278,7 +282,7 @@ static __INLINE void app_timer_evt_get(void * p_event_data, uint16_t event_size) { app_timer_event_t * p_timer_event = (app_timer_event_t *)p_event_data; - + APP_ERROR_CHECK_BOOL(event_size == sizeof(app_timer_event_t)); p_timer_event->timeout_handler(p_timer_event->p_context); } @@ -290,11 +294,15 @@ timer_event.timeout_handler = timeout_handler; timer_event.p_context = p_context; - + return app_sched_event_put(&timer_event, sizeof(timer_event), app_timer_evt_get); } /**@endcond */ +#ifdef __cplusplus +} +#endif // #ifdef __cplusplus + #endif // APP_TIMER_H__ /** @} */