-
Notifications
You must be signed in to change notification settings - Fork 0
/
wr_serv.h
91 lines (70 loc) · 1.97 KB
/
wr_serv.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//*****************************************************************************
//
// wr_serv.h - Walking Robot's Engine
//
//*****************************************************************************
#ifndef __WR_SERV_H__
#define __WR_SERV_H__
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif
#include "wobot.h"
#define WR_SERV_ANGULAR_FACTOR 90
#define WR_SERV_FACTOR_SIZE 4
#define WR_SERV_COUNT 9
typedef void (*wrServFunction)(long,long);
typedef struct{
//
// pointer on WRPWMSetRation or WRTimerSetRation
//
wrServFunction setRatio;
//
// First argument to setRation function
//
long arg1;
//
// factor[i] - duty factor of PWM correcpond to i*WR_SERV_ANGULAR_FACTOR
//
long factor[WR_SERV_FACTOR_SIZE];
//
//
//
long currentSignalDuration;
long currentAngle;
//
// for slow movement
//
long stepSize;
long stepCount;
long finalSignalDuration;
int isEnable;
} wrServ;
extern wrServ wrServs[];
void WRServTimerHandler();
void WRServInit();
void WRServSetAngleWithDelay(long id, long angle, long delay);
void WRServSetAngle(long id, long angle);
void HeadSet(long angle);
void WRServSetRatio(long id, long ratio);
void WRServSetEnable(long id, int isEnable);
int WRServIsMovementComplete();
void WRServSaveFactor(long id, long angle);
void WRServDeleteFactor(long id);
void WRServSaveSettings();
void WRServLoadSettings();
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif
#endif // __WR_SERV_H__