return;
}
range_cur_count = range_count;
- callout_init(&range_event, range_cb, NULL, 0);
- callout_schedule(&xbeeboard.mainloop_cm,
- &range_event, 0); /* immediate */
+ callout_init(&range_event, range_cb, NULL, LOW_PRIO);
range_running = 1;
+ callout_schedule(&xbeeboard.intr_cm,
+ &range_event, 0); /* immediate */
}
else if (!strcmp(res->action, "end")) {
if (range_running == 0) {
printf_P(PSTR("not running\r\n"));
return;
}
+ callout_stop(&xbeeboard.intr_cm, &range_event);
range_running = 0;
- callout_stop(&xbeeboard.mainloop_cm, &range_event);
}
}
printf_P(PSTR("no regs to be monitored\r\n"));
return;
}
- callout_init(&monitor_event, monitor_cb, NULL, 0);
- callout_schedule(&xbeeboard.mainloop_cm,
- &monitor_event, 0); /* immediate */
+ callout_init(&monitor_event, monitor_cb, NULL, 1);
monitor_running = 1;
monitor_current = LIST_FIRST(&xbee_monitor_list);
+ callout_schedule(&xbeeboard.intr_cm,
+ &monitor_event, 0); /* immediate */
printf_P(PSTR("monitor cb: %S %s\r\n"),
monitor_current->desc,
monitor_current->atcmd);
printf_P(PSTR("not running\r\n"));
return;
}
+ callout_stop(&xbeeboard.intr_cm, &monitor_event);
monitor_running = 0;
- callout_stop(&xbeeboard.mainloop_cm, &monitor_event);
}
}
monitor_count --;
if (monitor_count == 0) {
printf_P(PSTR("Disable monitoring, no more event\r\n"));
- callout_stop(&xbeeboard.mainloop_cm, &monitor_event);
+ callout_stop(&xbeeboard.intr_cm, &monitor_event);
monitor_running = 0;
return;
}
#define BEEP_PRIO 120
#define SPI_PRIO 100 /* users of spi_servo must have lower prio */
#define XBEE_PRIO 80
+#define LOW_PRIO 60
/* lowest priority */
#define MAX_POWER_LEVEL 5
struct rdline rdl;
char prompt[RDLINE_PROMPT_SIZE];
- struct callout_mgr mainloop_cm;
struct callout_mgr intr_cm;
struct callout spi_timer;
struct callout beep_timer;
void xbee_load_timeout(struct xbee_ctx *ctx)
{
- callout_init(&ctx->timeout, evt_timeout, ctx, 0);
- callout_schedule(&xbeeboard.mainloop_cm, &ctx->timeout, XBEE_TIMEOUT_MS);
+ uint8_t prio;
+
+ callout_init(&ctx->timeout, evt_timeout, ctx, XBEE_PRIO);
+ prio = callout_mgr_set_prio(&xbeeboard.intr_cm, XBEE_PRIO);
+ callout_schedule(&xbeeboard.intr_cm, &ctx->timeout, XBEE_TIMEOUT_MS);
+ callout_mgr_restore_prio(&xbeeboard.intr_cm, prio);
}
void xbee_unload_timeout(struct xbee_ctx *ctx)
{
- callout_stop(&xbeeboard.mainloop_cm, &ctx->timeout);
+ uint8_t prio;
+
+ prio = callout_mgr_set_prio(&xbeeboard.intr_cm, XBEE_PRIO);
+ callout_stop(&xbeeboard.intr_cm, &ctx->timeout);
+ callout_mgr_restore_prio(&xbeeboard.intr_cm, prio);
}
static void xbee_rx_poll_timer_cb(struct callout_mgr *cm, struct callout *tim,
uint8_t prio;
while (1) {
- callout_manage(&xbeeboard.mainloop_cm);
-
if (xbee_raw) {
int16_t c;