MAV'RIC
|
Driver for servomotors using PWM. More...
#include <servo.hpp>
Public Member Functions | |
Servo (Pwm &pwm, const servo_conf_t config=servo_default_config_standard()) | |
Constructor. | |
bool | init (void) |
Initializes the servo. | |
float | read (void) const |
Returns the current servos value. | |
bool | write (float value, bool to_hardware=true) |
Sets the servos to a given value. | |
bool | failsafe (bool to_hardware=true) |
Sets the servos to failsafe value. | |
bool | write_to_hardware (void) |
Set PWM line according to the servo value. | |
void | calibrate_esc (void) |
Perform ESC calibration. | |
void | set_servo_max (void) |
Sets the maximum value to the servo. | |
void | set_servo_min (void) |
Sets the minimum value to the servo. | |
float | servo_max (void) |
Gets the maximum value to the servo. | |
float | servo_min (void) |
Gets the minimum value to the servo. |
Driver for servomotors using PWM.
Servo::Servo | ( | Pwm & | pwm, |
const servo_conf_t | config = servo_default_config_standard() |
||
) |
Constructor.
config | Configuration |
void Servo::calibrate_esc | ( | void | ) |
Perform ESC calibration.
DO NOT USE IN FLIGHT ! Set output to max for 2 seconds, then to failsafe value
bool Servo::failsafe | ( | bool | to_hardware = true | ) |
Sets the servos to failsafe value.
to_hardware | Indicates if hardware peripheral should be updated (false by default) |
bool Servo::init | ( | void | ) |
Initializes the servo.
float Servo::read | ( | void | ) | const |
Returns the current servos value.
bool Servo::write | ( | float | value, |
bool | to_hardware = true |
||
) |
Sets the servos to a given value.
value | The servo value to be set |
to_hardware | Indicates if hardware peripheral should be updated (false by default) |
bool Servo::write_to_hardware | ( | void | ) |
Set PWM line according to the servo value.