libhal-google / libhal-soft

Library for generic soft drivers officially supported by libhal
Apache License 2.0
1 stars 6 forks source link

Add `hal::soft::stepper_motor` implementation #21

Open kammce opened 1 year ago

kammce commented 1 year ago

Implements servo and takes two hal::output_pins, one for step and one for direction as well as how many steps per revolution.

#include <libhal/servo.hpp>
#include <libhal/output_pin.hpp>

class stepper_motor : public hal::servo
{
  stepper_motor(hal::output_pin& p_direction,
                hal::output_pin& p_step,
                float p_steps_per_revolution);
};

steps_per_revolution is used to determine how many steps are required to reach a specified angle passed into the position function.

Zaaji commented 1 year ago

.take