joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers eventOS_event_timer.h Source File

eventOS_event_timer.h

00001 /*
00002  * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef EVENTOS_EVENT_TIMER_H_
00017 #define EVENTOS_EVENT_TIMER_H_
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 #include "ns_types.h"
00022 
00023 /**
00024  * Send an event after time expired (in milliseconds)
00025  *
00026  * \param snmessage event to send
00027  * \param time time to sleep in milliseconds
00028  *
00029  * \return none
00030  *
00031  * */
00032 extern int8_t eventOS_event_timer_request(uint8_t snmessage, uint8_t event_type, int8_t tasklet_id, uint32_t time);
00033 /**
00034  * Cancel an event
00035  *
00036  * \param event event to cancel
00037  *
00038  * \return none
00039  *
00040  * */
00041 extern int8_t eventOS_event_timer_cancel(uint8_t snmessage, int8_t tasklet_id);
00042 
00043 /**
00044  * System Timer shortest time in milli seconds
00045  *
00046  * \param ticks Time in 10 ms resolution
00047  *
00048  * \return none
00049  *
00050  * */
00051 extern uint32_t eventOS_event_timer_shortest_active_timer(void);
00052 
00053 
00054 /** Timeout structure. Not to be modified by user */
00055 typedef struct timeout_entry_t timeout_t;
00056 
00057 /** Request timeout callback.
00058  *
00059  * Create timeout request for specific callback. Maximum 255 timeouts can be requested.
00060  * Not thread safe. Should not be called from interrupt context.
00061  * \param ms timeout in milliseconds. Maximum range is same as for eventOS_event_timer_request().
00062  * \param callback function to call after timeout
00063  * \param arg arquement to pass to callback
00064  * \return pointer to timeout structure or NULL on errors
00065  */
00066 timeout_t *eventOS_timeout_ms(void (*callback)(void *), uint32_t ms, void *arg);
00067 
00068 /** Cancell timeout request.
00069  * Not thread safe. Should not be called from interrupt context.
00070  * \param t timeout request id.
00071  */
00072 void eventOS_timeout_cancel(timeout_t *t);
00073 
00074 
00075 #ifdef __cplusplus
00076 }
00077 #endif
00078 
00079 #endif /* EVENTOS_EVENT_TIMER_H_ */