diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-05-07 08:11:03 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-05-07 08:11:03 +0000 |
commit | bec915e05274a94f2b1a5e2443f04de826dd1f6e (patch) | |
tree | cec2044911766f5dc5a7bd8b8c9ffe0fe81734f8 /os/various/evtimer.h | |
parent | 4afa0b98dff9eac6a94c104acf900e15147d2da3 (diff) | |
parent | b43c71424d201583822b26d13d11f7e3634cb515 (diff) | |
download | ChibiOS-bec915e05274a94f2b1a5e2443f04de826dd1f6e.tar.gz ChibiOS-bec915e05274a94f2b1a5e2443f04de826dd1f6e.tar.bz2 ChibiOS-bec915e05274a94f2b1a5e2443f04de826dd1f6e.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6916 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/various/evtimer.h')
-rw-r--r-- | os/various/evtimer.h | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/os/various/evtimer.h b/os/various/evtimer.h index 613c688a6..bb67691ba 100644 --- a/os/various/evtimer.h +++ b/os/various/evtimer.h @@ -25,42 +25,68 @@ #ifndef _EVTIMER_H_
#define _EVTIMER_H_
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
/*
* Module dependencies check.
*/
-#if !CH_USE_EVENTS
-#error "Event Timers require CH_USE_EVENTS"
+#if !CH_CFG_USE_EVENTS
+#error "Event Timers require CH_CFG_USE_EVENTS"
#endif
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
/**
- * @brief Event timer structure.
+ * @brief Type of a event timer structure.
*/
typedef struct {
- VirtualTimer et_vt;
- EventSource et_es;
- systime_t et_interval;
-} EvTimer;
+ virtual_timer_t et_vt;
+ event_source_t et_es;
+ systime_t et_interval;
+} event_timer_t;
+
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
- void evtStart(EvTimer *etp);
- void evtStop(EvTimer *etp);
+ void evtObjectInit(event_timer_t *etp, systime_t time);
+ void evtStart(event_timer_t *etp);
#ifdef __cplusplus
}
#endif
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
/**
- * @brief Initializes an @p EvTimer structure.
+ * @brief Stops the timer.
+ * @details If the timer was already stopped then the function has no effect.
*
- * @param etp the EvTimer structure to be initialized
- * @param time the interval in system ticks
+ * @param[in] etp pointer to an initialized @p event_timer_t structure.
*/
-#define evtInit(etp, time) { \
- chEvtInit(&(etp)->et_es); \
- (etp)->et_vt.vt_func = NULL; \
- (etp)->et_interval = (time); \
+static inline void vevtStop(event_timer_t *etp) {
+
+ chVTReset(&etp->et_vt);
}
#endif /* _EVTIMER_H_ */
|