stepper: It is not necessary to ensure gpio_out_write value is 0 or 1
The gpio_out_write() and gpio_out_setup() calls will check for zero and non-zero, so it is not necessary to explicitly convert to 0/1 in the stepper.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
d56f8407a5
commit
039d3f0523
|
@ -150,7 +150,7 @@ command_config_stepper(uint32_t *args)
|
|||
if (!CONFIG_INLINE_STEPPER_HACK)
|
||||
s->time.func = stepper_event;
|
||||
s->flags = args[4] ? SF_INVERT_STEP : 0;
|
||||
s->step_pin = gpio_out_setup(args[1], s->flags & SF_INVERT_STEP ? 1 : 0);
|
||||
s->step_pin = gpio_out_setup(args[1], s->flags & SF_INVERT_STEP);
|
||||
s->dir_pin = gpio_out_setup(args[2], 0);
|
||||
s->min_stop_interval = args[3];
|
||||
s->position = -POSITION_BIAS;
|
||||
|
@ -276,7 +276,7 @@ stepper_stop(struct stepper *s)
|
|||
s->count = 0;
|
||||
s->flags &= SF_INVERT_STEP;
|
||||
gpio_out_write(s->dir_pin, 0);
|
||||
gpio_out_write(s->step_pin, s->flags & SF_INVERT_STEP ? 1 : 0);
|
||||
gpio_out_write(s->step_pin, s->flags & SF_INVERT_STEP);
|
||||
while (s->first) {
|
||||
struct stepper_move *next = s->first->next;
|
||||
move_free(s->first);
|
||||
|
|
Loading…
Reference in New Issue