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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
use core::ffi::c_uint;
pub const ROTATION_MINIMUM_DATA_RATE: c_uint = 5;
extern "C" {
/**
Reset Rotation Sensor
Reset the current absolute position to be the same as the
Rotation Sensor angle.
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\return 1 if the operation was successful or PROS_ERR if the operation
failed, setting errno.
*/
pub fn rotation_reset(port: u8) -> i32;
/**
Set the Rotation Sensor's refresh interval in milliseconds.
The rate may be specified in increments of 5ms, and will be rounded down to
the nearest increment. The minimum allowable refresh rate is 5ms. The default
rate is 10ms.
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\param rate The data refresh interval in milliseconds
\return 1 if the operation was successful or PROS_ERR if the operation
failed, setting errno.
*/
pub fn rotation_set_data_rate(port: u8, rate: u32) -> i32;
/**
Set the Rotation Sensor position reading to a desired rotation value
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\param position
The position in terms of ticks
\return 1 if the operation was successful or PROS_ERR if the operation
failed, setting errno.
*/
pub fn rotation_set_position(port: u8, position: u32) -> i32;
/**
Reset the Rotation Sensor position to 0
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-2
\return 1 if the operation was successful or PROS_ERR if the operation
failed, setting errno.
*/
pub fn rotation_reset_position(port: u8) -> i32;
/**
Get the Rotation Sensor's current position in centidegrees
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\return The position value or PROS_ERR_F if the operation failed, setting
errno.
*/
pub fn rotation_get_position(port: u8) -> i32;
/**
Get the Rotation Sensor's current velocity in centidegrees per second
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\return The velocity value or PROS_ERR_F if the operation failed, setting
errno.
*/
pub fn rotation_get_velocity(port: u8) -> i32;
/**
Get the Rotation Sensor's current angle in centidegrees (0-36000)
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\return The angle value (0-36000) or PROS_ERR_F if the operation failed, setting
errno.
*/
pub fn rotation_get_angle(port: u8) -> i32;
/**
Set the Rotation Sensor's direction reversed flag
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\param value
Determines if the direction of the Rotation Sensor is reversed or not.
\return 1 if operation succeeded or PROS_ERR if the operation failed, setting
errno.
*/
pub fn rotation_set_reversed(port: u8, value: bool) -> i32;
/**
Reverse the Rotation Sensor's direction
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\return 1 if the operation was successful or PROS_ERR if the operation
failed, setting errno.
*/
pub fn rotation_reverse(port: u8) -> i32;
/**
Initialize the Rotation Sensor with a reverse flag
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\param reverse_flag
Determines if the Rotation Sensor is reversed or not.
\return 1 if the operation was successful or PROS_ERR if the operation
failed, setting errno.
*/
pub fn rotation_init_reverse(port: u8, reverse_flag: bool) -> i32;
/**
Get the Rotation Sensor's reversed flag
This function uses the following values of errno when an error state is
reached:
ENXIO - The given value is not within the range of V5 ports (1-21).
ENODEV - The port cannot be configured as an Rotation Sensor
\param port
The V5 Rotation Sensor port number from 1-21
\return Boolean value of if the Rotation Sensor's direction is reversed or not
or PROS_ERR if the operation failed, setting errno.
*/
pub fn rotation_get_reversed(port: u8) -> i32;
}