Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
scheduler.h
00001 /*! \file scheduler.h \brief Simple Task Scheduler. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'scheduler.h' 00005 // Title : Simple Task Scheduler 00006 // Author : Pascal Stang - Copyright (C) 2006 00007 // Created : 2006.05.24 00008 // Revised : 2006.05.26 00009 // Version : 0.2 00010 // Target MCU : NXP Cortex M3 LPC17xx and LPC13xx 00011 // Editor Tabs : 4 00012 // 00013 // NOTE: This code is currently below version 1.0, and therefore is considered 00014 // to be lacking in some functionality or documentation, or may not be fully 00015 // tested. Nonetheless, you can expect most functions to work. 00016 // 00017 // This code is distributed under the GNU Public License 00018 // which can be found at http://www.gnu.org/licenses/gpl.txt 00019 // 00020 //***************************************************************************** 00021 00022 #ifndef SCHEDULER_H 00023 #define SCHEDULER_H 00024 00025 // structures and typedefs 00026 typedef void (*taskfuncptr)(int htask, int systime); 00027 typedef void (*voidFuncPtr)(void); 00028 00029 struct task 00030 { 00031 int runtime; 00032 int nrepeat; 00033 int interval; 00034 taskfuncptr funcptr; 00035 }; 00036 00037 #ifndef TASKLIST_SIZE 00038 #define TASKLIST_SIZE 10 00039 #endif 00040 00041 // functions 00042 00043 // initialize scheduler 00044 void schedulerInit(void); 00045 00046 // run scheduler 00047 // this function should be called at the system clock tick rate 00048 // the system time must be passed in systime 00049 void schedulerRun(int systime); 00050 00051 // schedule a task 00052 // returns a handle to the task (or -1 for failure) 00053 int schedulerAddTask(int runtime, int nrepeat, int interval, taskfuncptr taskfunc); 00054 00055 // remove a scheduled task by handle 00056 int schedulerRemoveTask(int taskhandle); 00057 00058 // remove a scheduled task(s) by function reference 00059 // NOTE: this will remove ALL tasks referencing the specified function 00060 int schedulerRemoveTaskFunc(taskfuncptr funcptr); 00061 00062 #endif
Generated on Tue Jul 12 2022 20:58:06 by
1.7.2