add schDel
This commit is contained in:
@ -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) {
|
||||
|
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user