aboutsummaryrefslogtreecommitdiffstats
path: root/os/various/evtimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/various/evtimer.h')
-rw-r--r--os/various/evtimer.h58
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_ */