task pausing

master
Clyne Sullivan 7 years ago
parent f27b19a531
commit 5a6c8f4c22

@ -22,4 +22,6 @@ void task_init(void (*init)(void));
*/ */
void task_start(void (*task)(void), uint16_t stackSize); void task_start(void (*task)(void), uint16_t stackSize);
void task_hold(uint8_t hold);
#endif // TASK_H_ #endif // TASK_H_

@ -8,15 +8,15 @@ line 50 160 430 160 fg
line 240 50 240 270 fg line 240 50 240 270 fg
set x 50 set x 50
#do do
# delay 10 line x 170 x 150 fg
# line x 170 x 150 fg set x (x + 20)
# set x (x + 20) while (x < 430)
#while (x < 430)
#set y 50 set y 50
#do do
# delay 10 line 230 y 250 y fg
# line 230 y 250 y fg set y (y + 20)
# set y (y + 20) while (y < 270)
#while (y < 270)
line 80 250 380 90 511

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
#openocd -f /usr/share/openocd/scripts/board/st_nucleo_l476rg.cfg \ openocd -f /usr/share/openocd/scripts/board/st_nucleo_l476rg.cfg \
# -c "init; reset halt; flash write_image erase main.hex; reset run; exit" -c "init; reset halt; flash write_image erase main.hex; reset run; exit"
openocd -f /usr/share/openocd/scripts/board/st_nucleo_l476rg.cfg > /dev/null & #openocd -f /usr/share/openocd/scripts/board/st_nucleo_l476rg.cfg > /dev/null &
gdb-multiarch #gdb-multiarch

@ -4,8 +4,8 @@
#include <clock.h> #include <clock.h>
volatile uint8_t lock = 0; volatile uint8_t lock = 0;
#define LOCK while (lock) { delay(5); } lock = 1 #define LOCK while (lock) { delay(5); } task_hold(1); lock = 1
#define UNLOCK lock = 0 #define UNLOCK task_hold(0); lock = 0
static unsigned int curx = 0; static unsigned int curx = 0;
static unsigned int cury = 0; static unsigned int cury = 0;

@ -16,6 +16,11 @@ static volatile int next_idx = 0;
static uint8_t task_enable = 0; static uint8_t task_enable = 0;
void task_hold(uint8_t hold)
{
task_enable = !hold;
}
void task_init(void (*init)(void)) void task_init(void (*init)(void))
{ {
for (int i = 0; i < MAX_TASKS; i++) for (int i = 0; i < MAX_TASKS; i++)

Loading…
Cancel
Save