aboutsummaryrefslogtreecommitdiffstats
path: root/src/chdelta.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-10-15 14:52:56 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-10-15 14:52:56 +0000
commit70c86d43ec79032c7172507fc12bf7d78d44a3de (patch)
treeebb5d12bddd55f84a711f0becc1f8c8960744cb2 /src/chdelta.c
parent779840691f4f6b3bb647d85f160ce238defa2de0 (diff)
downloadChibiOS-70c86d43ec79032c7172507fc12bf7d78d44a3de.tar.gz
ChibiOS-70c86d43ec79032c7172507fc12bf7d78d44a3de.tar.bz2
ChibiOS-70c86d43ec79032c7172507fc12bf7d78d44a3de.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@53 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chdelta.c')
-rw-r--r--src/chdelta.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/chdelta.c b/src/chdelta.c
index 8a8100e5f..16dfac5bc 100644
--- a/src/chdelta.c
+++ b/src/chdelta.c
@@ -40,7 +40,9 @@ void chVTInit(void) {
* Enables a virtual timer.
* @param vtp the \p VirtualTimer structure pointer
* @param time the number of time ticks, the value zero is allowed with
- * meaning "infinite".
+ * meaning "infinite". In this case the structure is initialized
+ * but not inserted in the delta list, the timer will never be
+ * triggered.
* @param vtfunc the timer callback function. After invoking the callback
* the timer is disabled and the structure can be disposed or
* reused.
@@ -51,8 +53,8 @@ void chVTInit(void) {
void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par) {
vtp->vt_par = par;
+ vtp->vt_func = vtfunc;
if (time) {
- vtp->vt_func = vtfunc;
VirtualTimer *p = dlist.dl_next;
while (p->vt_dtime < time) {
time -= p->vt_dtime;
@@ -66,7 +68,7 @@ void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par) {
p->vt_dtime -= time;
}
else
- vtp->vt_func = NULL;
+ vtp->vt_next = vtp->vt_prev = vtp; // Allows a chVTResetI() on the fake timer.
}
/**