Jackson Lv / nrf51-sdk

Dependents:   nRF51822

Fork of nrf51-sdk by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers app_timer_appsh.c Source File

app_timer_appsh.c

00001 /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is property of Nordic Semiconductor ASA.
00004  * Terms and conditions of usage are described in detail in NORDIC
00005  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  */
00012 
00013 #include "app_timer_appsh.h"
00014 #include "app_scheduler.h "
00015 
00016 static void app_timer_evt_get(void * p_event_data, uint16_t event_size)
00017 {
00018     app_timer_event_t * p_timer_event = (app_timer_event_t *)p_event_data;
00019     
00020     APP_ERROR_CHECK_BOOL(event_size == sizeof(app_timer_event_t));
00021     p_timer_event->timeout_handler(p_timer_event->p_context);
00022 }
00023 
00024 uint32_t app_timer_evt_schedule(app_timer_timeout_handler_t timeout_handler,
00025                                 void *                      p_context)
00026 {
00027     app_timer_event_t timer_event;
00028 
00029     timer_event.timeout_handler = timeout_handler;
00030     timer_event.p_context       = p_context;
00031     
00032     return app_sched_event_put(&timer_event, sizeof(timer_event), app_timer_evt_get);
00033 }
00034