add schDel

This commit is contained in:
2016-09-06 15:28:28 +02:00
parent c2022fb8bb
commit 6ed2143b98
2 changed files with 13 additions and 1 deletions

View File

@ -36,6 +36,15 @@ void schAdd(void (*exec)(void *), void *handle, uint32_t delay, uint32_t period)
}
}
void schDel(void (*exec)(void *), void *handle) {
for (uint8_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
if ((tasks[i].exec == exec) && (tasks[i].handle == handle)) {
tasks[i].exec = NULL;
break;
}
}
}
void schExec() {
for (uint8_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
if (tasks[i].exec != NULL && tasks[i].run > 0) {
@ -48,6 +57,8 @@ void schExec() {
}
}
void schUpdate() {
for (uint8_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
if (tasks[i].exec != NULL) {

View File

@ -13,7 +13,7 @@
#define MAX_NUM_OF_TASKS 5
#define MAX_NUM_OF_TASKS 6
typedef struct {
@ -27,6 +27,7 @@ typedef struct {
void schInit();
void schAdd(void (*exec)(void *), void *handle, uint32_t delay, uint32_t period);
void schDel(void (*exec)(void *), void *handle);
void schExec();
void schUpdate();