Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_servo.h
1 #ifndef _BC_SERVO_H
2 #define _BC_SERVO_H
3 
4 #include <bc_pwm.h>
5 
9 
10 #define BC_SERVO_NO_ANGLE 255
11 #define BC_SERVO_UNKNOWN_ANGLE 250
12 #define BC_SERVO_DEFAULT_MIN 544
13 #define BC_SERVO_DEFAULT_MAX 2400
14 
16 
17 typedef struct
18 {
19  bc_pwm_channel_t _channel;
20  uint16_t _min;
21  uint16_t _max;
22  uint8_t _angle;
23 
24 } bc_servo_t;
25 
27 
31 
32 void bc_servo_init(bc_servo_t *self, bc_pwm_channel_t channel);
33 
37 
38 void bc_servo_set_angle(bc_servo_t *self, uint8_t angle);
39 
42 
43 uint8_t bc_servo_get_angle(bc_servo_t *self);
44 
49 
50 void bc_servo_set_pulse_limits(bc_servo_t *self, uint16_t min_us, uint16_t max_us);
51 
55 
56 void bc_servo_set_microseconds(bc_servo_t *self, uint16_t us);
57 
59 
60 #endif // _BC_SERVO_H
Servo instance.
Definition: bc_servo.h:17
void bc_servo_init(bc_servo_t *self, bc_pwm_channel_t channel)
Initialize Servo.
Definition: bc_servo.c:6
void bc_servo_set_pulse_limits(bc_servo_t *self, uint16_t min_us, uint16_t max_us)
Set pulse limits.
Definition: bc_servo.c:53
bc_pwm_channel_t
PWM channels.
Definition: bc_pwm.h:14
void bc_servo_set_microseconds(bc_servo_t *self, uint16_t us)
Set Microseconds.
Definition: bc_servo.c:60
uint8_t bc_servo_get_angle(bc_servo_t *self)
Get angle.
Definition: bc_servo.c:48
void bc_servo_set_angle(bc_servo_t *self, uint8_t angle)
Set angle.
Definition: bc_servo.c:29