-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmotor_ctrl.h
44 lines (29 loc) · 1019 Bytes
/
motor_ctrl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*********************************************
* Name: motor_ctrl.h
* Desc: Motor Controller (PWM)
* Date: 2010-05-30
* Author: stanbaek
*********************************************/
#ifndef __MOTOR_CTRL_H
#define __MOTOR_CTRL_H
#define MC_CHANNEL_PWM1 1
#define MC_CHANNEL_PWM2 2
#define MC_CHANNEL_PWM3 3
#define MC_CHANNEL_PWM4 4
#define MC_STEER_MODE_DISC 0
#define MC_STEER_MODE_CONT 1
#define MC_STEER_LEFT -1.0
#define MC_STEER_RIGHT 1.0
#define MC_STEER_STRAIGHT 0.0
// by default, all RE ports are output
void mcSetup(void);
// the resolution of the duty cycle is 1/(2*PTPER)
void mcSetDutyCycle(unsigned char channel, float duty_cycle);
void mcThrust(float value);
// -100 <= value <= 100 for continuous mode
// value >0, =0, <0 for discrete mode (default mode)
void mcSteer(float value);
// set the motor control mode.
// the parameters could be either MC_STEER_MODE_DISC or MC_STEER_MODE_CONT
void mcSetSteerMode(unsigned char mode);
#endif // __MOTOR_CTRL_H