Remote Controlled Servo (RC Servo)#
Soft Driver#
Defined in namespace hal::soft
#include <libhal-soft/rc_servo.hpp>
-
class rc_servo : public hal::servo#
Generic RC servo driver.
Public Static Functions
-
static result<rc_servo> create(hal::pwm &p_pwm, settings p_settings)#
Factory function to create a rc_servo object.
Compile time error will occur if the min microseconds is more than the max microseconds, if the max microseconds is more than the frequency wavelength, or if the min angle is more than max angle.
- Parameters:
p_pwm – - pwm signal connected to the RC servo
p_settings – -
- Returns:
result<rc_servo> - Constructed rc_servo object
-
struct settings#
Information about the RC servo needed to control it properly.
Public Members
-
hal::hertz frequency = 50#
PWM signal frequency. Check the documentation for the RC servo to determine what range of frequencies can be used with it.
-
std::uint32_t min_microseconds = 1000#
The minimum pulse width in microseconds that maps to the minimum angle of the servo.
-
std::uint32_t max_microseconds = 2000#
The maximum pulse width in microseconds that maps to the maximum angle of the servo.
-
hal::hertz frequency = 50#
-
static result<rc_servo> create(hal::pwm &p_pwm, settings p_settings)#