/* * _limit_switch_handler() - shut down system if limit switch fired */ static uint8_t _limit_switch_handler(void) { if (cm_get_machine_state() == MACHINE_SHUTDOWN) { return (TG_NOOP);} if (gpio_get_limit_thrown() == false) return (TG_NOOP); cm_shutdown(); return (TG_OK); }
/* * _limit_switch_handler() - shut down system if limit switch fired */ static stat_t _limit_switch_handler(void) { if (cm_get_machine_state() == MACHINE_ALARM) { return (STAT_NOOP);} if (gpio_get_limit_thrown() == false) return (STAT_NOOP); // cm_alarm(gpio_get_sw_thrown); // unexplained complier warning: passing argument 1 of 'cm_shutdown' makes integer from pointer without a cast cm_alarm(sw.sw_num_thrown); return (STAT_OK); }
/* * _limit_switch_handler() - shut down system if limit switch fired */ static stat_t _limit_switch_handler(void) { if (cm_get_machine_state() == MACHINE_ALARM) { return (STAT_NOOP);} if (get_limit_switch_thrown() == false) return (STAT_NOOP); return(cm_hard_alarm(STAT_LIMIT_SWITCH_HIT)); return (STAT_OK); }
static stat_t _shutdown_idler() { if (cm_get_machine_state() != MACHINE_SHUTDOWN) { return (STAT_OK);} if (SysTickTimer_getValue() > cs.led_timer) { cs.led_timer = SysTickTimer_getValue() + LED_ALARM_TIMER; IndicatorLed_toggle(); } return (STAT_EAGAIN); // EAGAIN prevents any lower-priority actions from running }
static stat_t _alarm_idler(void) { if (cm_get_machine_state() != MACHINE_ALARM) { return (STAT_OK);} if (--tg.led_counter < 0) { tg.led_counter = LED_COUNTER; if (tg.led_state == 0) { gpio_led_on(INDICATOR_LED); tg.led_state = 1; } else { gpio_led_off(INDICATOR_LED); tg.led_state = 0; } } return (STAT_EAGAIN); // EAGAIN prevents any other actions from running }
static uint8_t _shutdown_idler(void) { if (cm_get_machine_state() != MACHINE_SHUTDOWN) { return (TG_OK);} if (--tg.led_counter < 0) { tg.led_counter = LED_COUNTER; if (tg.led_state == 0) { gpio_led_on(INDICATOR_LED); tg.led_state = 1; } else { gpio_led_off(INDICATOR_LED); tg.led_state = 0; } } return (TG_EAGAIN); // EAGAIN prevents any other actions from running }