Firmware SDK
twr_servo

Driver for Servo. More...

Data Structures

struct  twr_servo_t
 Servo instance. More...
 

Macros

#define TWR_SERVO_NO_ANGLE   255
 
#define TWR_SERVO_UNKNOWN_ANGLE   250
 
#define TWR_SERVO_DEFAULT_MIN   544
 
#define TWR_SERVO_DEFAULT_MAX   2400
 

Functions

void twr_servo_init (twr_servo_t *self, twr_pwm_channel_t channel)
 Initialize Servo. More...
 
void twr_servo_set_angle (twr_servo_t *self, uint8_t angle)
 Set angle. More...
 
uint8_t twr_servo_get_angle (twr_servo_t *self)
 Get angle. More...
 
void twr_servo_set_pulse_limits (twr_servo_t *self, uint16_t min_us, uint16_t max_us)
 Set pulse limits. More...
 
void twr_servo_set_microseconds (twr_servo_t *self, uint16_t us)
 Set Microseconds. More...
 

Detailed Description

Driver for Servo.

Function Documentation

◆ twr_servo_get_angle()

uint8_t twr_servo_get_angle ( twr_servo_t self)

Get angle.

Parameters
[in]selfInstance

Definition at line 48 of file twr_servo.c.

◆ twr_servo_init()

void twr_servo_init ( twr_servo_t self,
twr_pwm_channel_t  channel 
)

Initialize Servo.

Parameters
[in]selfInstance
[in]channelPWM Channel

Definition at line 6 of file twr_servo.c.

◆ twr_servo_set_angle()

void twr_servo_set_angle ( twr_servo_t self,
uint8_t  angle 
)

Set angle.

Parameters
[in]selfInstance
[in]angleAngle in degrees, 0 to 180

Definition at line 29 of file twr_servo.c.

Here is the call graph for this function:

◆ twr_servo_set_microseconds()

void twr_servo_set_microseconds ( twr_servo_t self,
uint16_t  us 
)

Set Microseconds.

Parameters
[in]selfInstance
[in]usMicroseconds

Definition at line 60 of file twr_servo.c.

Here is the call graph for this function:

◆ twr_servo_set_pulse_limits()

void twr_servo_set_pulse_limits ( twr_servo_t self,
uint16_t  min_us,
uint16_t  max_us 
)

Set pulse limits.

Parameters
[in]selfInstance
[in]min_usMin pulse in us (Default 544us)
[in]max_usMax pulse in us (Default 2400us)

Definition at line 53 of file twr_servo.c.