diff --git a/docs/Code_Overview.md b/docs/Code_Overview.md index 207b37f4..ee640457 100644 --- a/docs/Code_Overview.md +++ b/docs/Code_Overview.md @@ -54,7 +54,7 @@ functions should never pause, delay, or do any work that lasts more than a few micro-seconds. These functions schedule work at specific times by scheduling timers. -Timer functions are scheduled by calling sched_timer() (located in +Timer functions are scheduled by calling sched_add_timer() (located in **src/sched.c**). The scheduler code will arrange for the given function to be called at the requested clock time. Timer interrupts are initially handled in an architecture specific interrupt handler diff --git a/src/adccmds.c b/src/adccmds.c index 81a7fff5..5f1fabb4 100644 --- a/src/adccmds.c +++ b/src/adccmds.c @@ -74,7 +74,7 @@ command_query_analog_in(uint32_t *args) a->max_value = args[6]; if (! a->sample_count) return; - sched_timer(&a->timer); + sched_add_timer(&a->timer); } DECL_COMMAND(command_query_analog_in, "query_analog_in oid=%c clock=%u sample_ticks=%u sample_count=%c" diff --git a/src/basecmd.c b/src/basecmd.c index 2170415a..8049e376 100644 --- a/src/basecmd.c +++ b/src/basecmd.c @@ -209,7 +209,7 @@ command_start_group(uint32_t *args) sched_del_timer(&group_timer); group_timer.func = group_end_event; group_timer.waketime = args[0]; - sched_timer(&group_timer); + sched_add_timer(&group_timer); } DECL_COMMAND(command_start_group, "start_group clock=%u"); diff --git a/src/endstop.c b/src/endstop.c index 913bb466..a504de92 100644 --- a/src/endstop.c +++ b/src/endstop.c @@ -64,7 +64,7 @@ command_end_stop_home(uint32_t *args) return; } e->flags = ESF_HOMING | (args[3] ? ESF_PIN_HIGH : 0); - sched_timer(&e->time); + sched_add_timer(&e->time); } DECL_COMMAND(command_end_stop_home, "end_stop_home oid=%c clock=%u rest_ticks=%u pin_value=%c"); diff --git a/src/gpiocmds.c b/src/gpiocmds.c index 259a7a5f..e3351b44 100644 --- a/src/gpiocmds.c +++ b/src/gpiocmds.c @@ -8,7 +8,7 @@ #include "board/gpio.h" // struct gpio_out #include "board/irq.h" // irq_disable #include "command.h" // DECL_COMMAND -#include "sched.h" // sched_timer +#include "sched.h" // sched_add_timer /**************************************************************** @@ -61,7 +61,7 @@ command_schedule_digital_out(uint32_t *args) d->timer.func = digital_out_event; d->timer.waketime = args[1]; d->value = args[2]; - sched_timer(&d->timer); + sched_add_timer(&d->timer); } DECL_COMMAND(command_schedule_digital_out, "schedule_digital_out oid=%c clock=%u value=%c"); @@ -202,7 +202,7 @@ command_schedule_soft_pwm_out(uint32_t *args) sched_del_timer(&s->timer); s->timer.waketime = time; s->timer.func = soft_pwm_load_event; - sched_timer(&s->timer); + sched_add_timer(&s->timer); } irq_enable(); } diff --git a/src/pwmcmds.c b/src/pwmcmds.c index 2865b62a..e8de0a3b 100644 --- a/src/pwmcmds.c +++ b/src/pwmcmds.c @@ -7,7 +7,7 @@ #include "basecmd.h" // oid_alloc #include "board/gpio.h" // struct gpio_pwm #include "command.h" // DECL_COMMAND -#include "sched.h" // sched_timer +#include "sched.h" // sched_add_timer struct pwm_out_s { struct timer timer; @@ -54,7 +54,7 @@ command_schedule_pwm_out(uint32_t *args) p->timer.func = pwm_event; p->timer.waketime = args[1]; p->value = args[2]; - sched_timer(&p->timer); + sched_add_timer(&p->timer); } DECL_COMMAND(command_schedule_pwm_out, "schedule_pwm_out oid=%c clock=%u value=%c"); diff --git a/src/sched.c b/src/sched.c index 6ccf8e5a..83c02075 100644 --- a/src/sched.c +++ b/src/sched.c @@ -97,7 +97,7 @@ static struct timer *timer_list = &ms_timer; // Schedule a function call at a supplied time. void -sched_timer(struct timer *add) +sched_add_timer(struct timer *add) { uint32_t waketime = add->waketime; irqstatus_t flag = irq_save(); diff --git a/src/sched.h b/src/sched.h index 9685317f..0c1820c3 100644 --- a/src/sched.h +++ b/src/sched.h @@ -12,7 +12,7 @@ // Declare a shutdown function (called on an emergency stop) #define DECL_SHUTDOWN(FUNC) _DECL_CALLBACK(shutdownfuncs, FUNC) -// Timer structure for scheduling timed events (see sched_timer() ) +// Timer structure for scheduling timed events (see sched_add_timer() ) struct timer { struct timer *next; uint_fast8_t (*func)(struct timer*); @@ -26,7 +26,7 @@ uint8_t sched_check_periodic(uint16_t time, uint16_t *pnext); uint32_t sched_from_us(uint32_t us); uint32_t sched_read_time(void); uint8_t sched_is_before(uint32_t time1, uint32_t time2); -void sched_timer(struct timer*); +void sched_add_timer(struct timer*); void sched_del_timer(struct timer *del); void sched_timer_kick(void); uint8_t sched_is_shutdown(void); diff --git a/src/stepper.c b/src/stepper.c index b196dc61..0d7f490b 100644 --- a/src/stepper.c +++ b/src/stepper.c @@ -202,7 +202,7 @@ command_queue_step(uint32_t *args) } else { s->first = m; stepper_load_next(s, s->next_step_time + m->interval); - sched_timer(&s->time); + sched_add_timer(&s->time); } irq_enable(); }