toggle loop
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <PontCoopScheduler.h>
|
#include <PontCoopScheduler.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -41,12 +42,24 @@ void disableLoop(void *handle) {
|
|||||||
HAL_GPIO_WritePin(Loop_Disable_GPIO_Port, Loop_Disable_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(Loop_Disable_GPIO_Port, Loop_Disable_Pin, GPIO_PIN_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toggleLoop(void *handle) {
|
||||||
|
static bool state = false;
|
||||||
|
|
||||||
|
if (state) {
|
||||||
|
disableLoop(NULL);
|
||||||
|
} else {
|
||||||
|
enableLoop(NULL);
|
||||||
|
}
|
||||||
|
state ^= true;
|
||||||
|
}
|
||||||
|
|
||||||
void my_setup_2() {
|
void my_setup_2() {
|
||||||
schAdd(blinkRed, NULL, 0, 500);
|
schAdd(blinkRed, NULL, 0, 500);
|
||||||
schAdd(blinkGreen, NULL, 0, 1000);
|
schAdd(blinkGreen, NULL, 0, 1000);
|
||||||
schAdd(helloWorld, NULL, 0, 5000);
|
schAdd(helloWorld, NULL, 0, 5000);
|
||||||
schAdd(enableLoop, NULL, 10000, 0);
|
// schAdd(enableLoop, NULL, 10000, 0);
|
||||||
schAdd(disableLoop, NULL, 20000, 0);
|
// schAdd(disableLoop, NULL, 20000, 0);
|
||||||
|
schAdd(toggleLoop, NULL, 0, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void my_loop() {
|
void my_loop() {
|
||||||
|
Reference in New Issue
Block a user