ChibiOS/RT Architecture - Reference Manual - Guides |
00001 /* 00002 ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. 00003 00004 This file is part of ChibiOS/RT. 00005 00006 ChibiOS/RT is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 ChibiOS/RT is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 --- 00020 00021 A special exception to the GPL can be applied should you wish to distribute 00022 a combined work that includes ChibiOS/RT, without being obliged to provide 00023 the source code for any proprietary components. See the file exception.txt 00024 for full details of how and when the exception can be applied. 00025 */ 00026 00027 /** 00028 * @file evtimer.h 00029 * @brief Events Generator Timer structures and macros. 00030 * @addtogroup event_timer 00031 * @{ 00032 */ 00033 00034 #ifndef _EVTIMER_H_ 00035 #define _EVTIMER_H_ 00036 00037 /** 00038 * @brief Event timer structure. 00039 */ 00040 typedef struct { 00041 VirtualTimer et_vt; 00042 EventSource et_es; 00043 systime_t et_interval; 00044 } EvTimer; 00045 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 void evtStart(EvTimer *etp); 00050 void evtStop(EvTimer *etp); 00051 #ifdef __cplusplus 00052 } 00053 #endif 00054 00055 /** 00056 * @brief Initializes an @p EvTimer structure. 00057 * 00058 * @param etp the EvTimer structure to be initialized 00059 * @param time the interval in system ticks 00060 */ 00061 #define evtInit(etp, time) { \ 00062 chEvtInit(&(etp)->et_es); \ 00063 (etp)->et_vt.vt_func = NULL; \ 00064 (etp)->et_interval = (time); \ 00065 } 00066 00067 #endif /* _EVTIMER_H_ */ 00068 00069 /** @} */