pros-sys 0.8.1

EFI for the PROS rust bindings
Documentation
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
use core::ffi::*;

pub const E_MOTOR_FAULT_NO_FAULTS: u32 = 0x00;
/// Analogous to motor_is_over_temp()
pub const E_MOTOR_FAULT_MOTOR_OVER_TEMP: u32 = 0x01;
/// Indicates a motor h-bridge fault
pub const E_MOTOR_FAULT_DRIVER_FAULT: u32 = 0x02;
/// Analogous to motor_is_over_current()
pub const E_MOTOR_FAULT_OVER_CURRENT: u32 = 0x04;
/// Indicates an h-bridge over current
pub const E_MOTOR_FAULT_DRV_OVER_CURRENT: u32 = 0x08;
pub type motor_fault_e_t = u32;

pub const E_MOTOR_FLAGS_NONE: u32 = 0x00;
/// Cannot currently communicate to the motor
pub const E_MOTOR_FLAGS_BUSY: u32 = 0x01;
/// Analogous to motor_is_stopped()
pub const E_MOTOR_FLAGS_ZERO_VELOCITY: u32 = 0x02;
pub const E_MOTOR_FLAGS_ZERO_POSITION: u32 = 0x04;
pub type motor_flag_e_t = u32;

/// Motor coasts when stopped, traditional behavior
pub const E_MOTOR_BRAKE_COAST: i32 = 0;
/// Motor brakes when stopped
pub const E_MOTOR_BRAKE_BRAKE: i32 = 1;
/// Motor actively holds position when stopped
pub const E_MOTOR_BRAKE_HOLD: i32 = 2;
pub const E_MOTOR_BRAKE_INVALID: i32 = i32::MAX;
pub type motor_brake_mode_e_t = i32;

/// Position is recorded as angle in degrees as a floating point number
pub const E_MOTOR_ENCODER_DEGREES: i32 = 0;
/// Position is recorded as angle in rotations as a floating point number
pub const E_MOTOR_ENCODER_ROTATIONS: i32 = 1;
/// Position is recorded as raw encoder ticks as a whole number
pub const E_MOTOR_ENCODER_COUNTS: i32 = 2;
pub const E_MOTOR_ENCODER_INVALID: i32 = i32::MAX;
pub type motor_encoder_units_e_t = i32;

/// 36:1, 100 RPM, Red gear set
pub const E_MOTOR_GEARSET_36: i32 = 0;
pub const E_MOTOR_GEAR_RED: i32 = E_MOTOR_GEARSET_36;
pub const E_MOTOR_GEAR_100: i32 = E_MOTOR_GEARSET_36;
/// 18:1, 200 RPM, Green gear set
pub const E_MOTOR_GEARSET_18: i32 = 1;
pub const E_MOTOR_GEAR_GREEN: i32 = E_MOTOR_GEARSET_18;
pub const E_MOTOR_GEAR_200: i32 = E_MOTOR_GEARSET_18;
/// 6:1, 600 RPM, Blue gear set
pub const E_MOTOR_GEARSET_06: i32 = 2;
pub const E_MOTOR_GEAR_BLUE: i32 = E_MOTOR_GEARSET_06;
pub const E_MOTOR_GEAR_600: i32 = E_MOTOR_GEARSET_06;
pub const E_MOTOR_GEARSET_INVALID: i32 = i32::MAX;
pub type motor_gearset_e_t = i32;

/**
Holds the information about a Motor's position or velocity PID controls.

These values are in 4.4 format, meaning that a value of 0x20 represents 2.0,
0x21 represents 2.0625, 0x22 represents 2.125, etc.
*/
#[repr(C)]
pub struct motor_pid_full_s_t {
    /// The feedforward constant
    pub kf: u8,
    /// The proportional constant
    pub kp: u8,
    /// The integral constants
    pub ki: u8,
    /// The derivative constant
    pub kd: u8,
    /// A constant used for filtering the profile acceleration
    pub filter: u8,
    /// The integral limit
    pub limit: u16,
    /// The threshold for determining if a position movement has
    /// reached its goal. This has no effect for velocity PID calculations.
    pub threshold: u8,
    /// The rate at which the PID computation is run in ms
    pub loopspeed: u8,
}

/**
Holds just the constants for a Motor's position or velocity PID controls.

These values are in 4.4 format, meaning that a value of 0x20 represents 2.0,
0x21 represents 2.0625, 0x22 represents 2.125, etc.
*/
#[repr(C)]
pub struct motor_pid_s_t {
    /// The feedforward constant
    pub kf: u8,
    /// The proportional constant
    pub kp: u8,
    /// The integral constant
    pub ki: u8,
    /// The derivative constant
    pub kd: u8,
}

extern "C" {
    /**
    Sets the voltage for the motor from -127 to 127.

    This is designed to map easily to the input from the controller's analog
    stick for simple opcontrol use. The actual behavior of the motor is analogous
    to use of motor_move_voltage(), or motorSet() from the PROS 2 API.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param voltage
           The new motor voltage from -127 to 127

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_move(port: i8, voltage: i32) -> i32;
    /**
    Stops the motor using the currently configured brake mode.

    This function sets motor velocity to zero, which will cause it to act
    according to the set brake mode. If brake mode is set to MOTOR_BRAKE_HOLD,
    this function may behave differently than calling motor_move_absolute(port, 0)
    or motor_move_relative(port, 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 a motor

    \param port
           The V5 port number from 1-21

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_brake(port: i8) -> i32;
    /**
    Sets the target absolute position for the motor to move to.

    This movement is relative to the position of the motor when initialized or
    the position when it was most recently reset with motor_set_zero_position().

    \note This function simply sets the target for the motor, it does not block
    program execution until the movement finishes.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param position
           The absolute position to move to in the motor's encoder units
    \param velocity
           The maximum allowable velocity for the movement in RPM

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_move_absolute(port: i8, position: c_double, velocity: i32) -> i32;
    /**
    Sets the relative target position for the motor to move to.

    This movement is relative to the current position of the motor as given in
    motor_get_position(). Providing 10.0 as the position parameter would result
    in the motor moving clockwise 10 units, no matter what the current position
    is.

    \note This function simply sets the target for the motor, it does not block
    program execution until the movement finishes.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param position
           The relative position to move to in the motor's encoder units
    \param velocity
           The maximum allowable velocity for the movement in RPM

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_move_relative(port: i8, position: c_double, velocity: i32) -> i32;
    /**
    Sets the velocity for the motor.

    This velocity corresponds to different actual speeds depending on the gearset
    used for the motor. This results in a range of +-100 for E_MOTOR_GEARSET_36,
    +-200 for E_MOTOR_GEARSET_18, and +-600 for E_MOTOR_GEARSET_6. The velocity
    is held with PID to ensure consistent speed, as opposed to setting the
    motor's voltage.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param velocity
           The new motor velocity from +-100, +-200, or +-600 depending on the
           motor's gearset

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_move_velocity(port: i8, velocity: i32) -> i32;
    /**
    Sets the output voltage for the motor from -12000 to 12000 in millivolts

    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 a motor

    \param port
           The V5 port number from 1-21
    \param voltage
           The new voltage value from -12000 to 12000

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_move_voltage(port: i8, voltage: i32) -> i32;
    /**
    Changes the output velocity for a profiled movement (motor_move_absolute or
    motor_move_relative). This will have no effect if the motor is not following
    a profiled movement.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param velocity
           The new motor velocity from +-100, +-200, or +-600 depending on the
           motor's gearset

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_modify_profiled_velocity(port: i8, velocity: i32) -> i32;
    /**
    Gets the target position set for the motor by the user.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The target position in its encoder units or PROS_ERR_F if the
    operation failed, setting errno.
    */
    pub fn motor_get_target_position(port: i8) -> c_double;
    /**
    Gets the velocity commanded to the motor by the user.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The commanded motor velocity from +-100, +-200, or +-600, or PROS_ERR
    if the operation failed, setting errno.
    */
    pub fn motor_get_target_velocity(port: i8) -> i32;
    /**
    Gets the actual velocity of the motor.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The motor's actual velocity in RPM or PROS_ERR_F if the operation
    failed, setting errno.
    */
    pub fn motor_get_actual_velocity(port: i8) -> c_double;
    /**
    Gets the current drawn by the motor in mA.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The motor's current in mA or PROS_ERR if the operation failed,
    setting errno.
    */
    pub fn motor_get_current_draw(port: i8) -> i32;
    /**
    Gets the direction of movement for the motor.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return 1 for moving in the positive direction, -1 for moving in the
    negative direction, or PROS_ERR if the operation failed, setting errno.
    */
    pub fn motor_get_direction(port: i8) -> i32;
    /**
    Gets the efficiency of the motor in percent.

    An efficiency of 100% means that the motor is moving electrically while
    drawing no electrical power, and an efficiency of 0% means that the motor
    is drawing power but not moving.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The motor's efficiency in percent or PROS_ERR_F if the operation
    failed, setting errno.
    */
    pub fn motor_get_efficiency(port: i8) -> c_double;
    /**
    Checks if the motor is drawing over its current limit.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return 1 if the motor's current limit is being exceeded and 0 if the current
    limit is not exceeded, or PROS_ERR if the operation failed, setting errno.
    */
    pub fn motor_is_over_current(port: i8) -> i32;
    /**
    Checks if the motor's temperature is above its limit.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return 1 if the temperature limit is exceeded and 0 if the the temperature
    is below the limit, or PROS_ERR if the operation failed, setting errno.
    */
    pub fn motor_is_over_temp(port: i8) -> i32;
    /**
    Checks if the motor is stopped.

    \note Although this function forwards data from the motor, the motor
    presently does not provide any value. This function returns PROS_ERR with
    errno set to ENOSYS.

    \param port
           The V5 port number from 1-21

    \return 1 if the motor is not moving, 0 if the motor is moving, or PROS_ERR
    if the operation failed, setting errno
    */
    pub fn motor_is_stopped(port: i8) -> i32;
    /**
    Checks if the motor is at its zero position.

    \note Although this function forwards data from the motor, the motor
    presently does not provide any value. This function returns PROS_ERR with
    errno set to ENOSYS.

    \param port
           The V5 port number from 1-21

    \return 1 if the motor is at zero absolute position, 0 if the motor has
    moved from its absolute zero, or PROS_ERR if the operation failed,
    setting errno
    */
    pub fn motor_get_zero_position_flag(port: i8) -> i32;

    /**
    Gets the faults experienced by the motor.

    Compare this bitfield to the bitmasks in motor_fault_e_t.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return A bitfield containing the motor's faults.
    */
    pub fn motor_get_faults(port: i8) -> motor_fault_e_t;
    /**
    Gets the flags set by the motor's operation.

    Compare this bitfield to the bitmasks in motor_flag_e_t.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return A bitfield containing the motor's flags.
    */
    pub fn motor_get_flags(port: i8) -> motor_flag_e_t;

    /**
    Gets the raw encoder count of the motor at a given timestamp.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param\[in] timestamp
               A pointer to a time in milliseconds for which the encoder count
               will be returned. If NULL, the timestamp at which the encoder
               count was read will not be supplied

    \return The raw encoder count at the given timestamp or PROS_ERR if the
    operation failed.
    */
    pub fn motor_get_raw_position(port: i8, timestamp: *const u32) -> i32;
    /**
    Gets the absolute position of the motor in its encoder units.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The motor's absolute position in its encoder units or PROS_ERR_F
    if the operation failed, setting errno.
    */
    pub fn motor_get_position(port: i8) -> c_double;
    /**
    Gets the power drawn by the motor in Watts.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The motor's power draw in Watts or PROS_ERR_F if the operation
    failed, setting errno.
    */
    pub fn motor_get_power(port: i8) -> c_double;
    /**
    Gets the temperature of the motor in degrees Celsius.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The motor's temperature in degrees Celsius or PROS_ERR_F if the
    operation failed, setting errno.
    */
    pub fn motor_get_temperature(port: i8) -> c_double;
    /**
    Gets the torque generated by the motor in Newton Meters (Nm).

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The motor's torque in Nm or PROS_ERR_F if the operation failed,
    setting errno.
    */
    pub fn motor_get_torque(port: i8) -> c_double;
    /**
    Gets the voltage delivered to the motor in millivolts.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The motor's voltage in mV or PROS_ERR_F if the operation failed,
    setting errno.
    */
    pub fn motor_get_voltage(port: i8) -> i32;

    /**
    Sets the position for the motor in its encoder units.

    This will be the future reference point for the motor's "absolute" position.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param position
           The new reference position in its encoder units

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_set_zero_position(port: i8, position: c_double) -> i32;
    /**
    Sets the "absolute" zero position of the motor to its current position.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_tare_position(port: i8) -> i32;
    /**
    Sets one of motor_brake_mode_e_t to the motor.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param mode
           The motor_brake_mode_e_t to set for the motor

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_set_brake_mode(port: i8, mode: motor_brake_mode_e_t) -> i32;
    /**
    Sets the current limit for the motor in mA.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param limit
           The new current limit in mA

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_set_current_limit(port: i8, limit: i32) -> i32;
    /**
    Sets one of motor_encoder_units_e_t for the motor encoder.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param units
           The new motor encoder units

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_set_encoder_units(port: i8, units: motor_encoder_units_e_t) -> i32;
    /**
    Sets one of motor_gearset_e_t for the motor.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param gearset
           The new motor gearset

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_set_gearing(port: i8, gearset: motor_gearset_e_t) -> i32;

    /**
    Takes in floating point values and returns a properly formatted pid struct.
    The motor_pid_s_t struct is in 4.4 format, i.e. 0x20 is 2.0, 0x21 is 2.0625,
    etc.
    This function will convert the floating point values to the nearest 4.4
    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 a motor

    \param kf
           The feedforward constant
    \param kp
           The proportional constant
    \param ki
           The integral constant
    \param kd
           The derivative constant

    \return A motor_pid_s_t struct formatted properly in 4.4.
    */
    #[deprecated(
        note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
    )]
    pub fn motor_convert_pid(
        kf: c_double,
        kp: c_double,
        ki: c_double,
        kd: c_double,
    ) -> motor_pid_s_t;
    /**
    Takes in floating point values and returns a properly formatted pid struct.
    The motor_pid_s_t struct is in 4.4 format, i.e. 0x20 is 2.0, 0x21 is 2.0625,
    etc.
    This function will convert the floating point values to the nearest 4.4
    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 a motor

    \param kf
           The feedforward constant
    \param kp
           The proportional constant
    \param ki
           The integral constant
    \param kd
           The derivative constant
    \param filter
           A constant used for filtering the profile acceleration
    \param limit
           The integral limit
    \param threshold
           The threshold for determining if a position movement has reached its
           goal. This has no effect for velocity PID calculations.
    \param loopspeed
           The rate at which the PID computation is run in ms

    \return A motor_pid_s_t struct formatted properly in 4.4.
    */
    #[deprecated(
        note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
    )]
    pub fn motor_convert_pid_full(
        kf: c_double,
        kp: c_double,
        ki: c_double,
        kd: c_double,
        filter: c_double,
        limit: c_double,
        threshold: c_double,
        loopspeed: c_double,
    ) -> motor_pid_full_s_t;
    /**
    Sets one of motor_pid_s_t for the motor. This intended to just modify the
    main PID constants.

    Only non-zero values of the struct will change the existing motor constants.

    \note This feature is in beta, it is advised to use caution when modifying
    the PID values. The motor could be damaged by particularly large constants.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param pid
           The new motor PID constants

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    #[deprecated(
        note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
    )]
    pub fn motor_set_pos_pid(port: i8, pid: motor_pid_s_t) -> i32;
    /**
    Sets one of motor_pid_full_s_t for the motor.

    Only non-zero values of the struct will change the existing motor constants.

    \note This feature is in beta, it is advised to use caution when modifying
    the PID values. The motor could be damaged by particularly large constants.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param pid
           The new motor PID constants

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    #[deprecated(
        note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
    )]
    pub fn motor_set_pos_pid_full(port: i8, pid: motor_pid_full_s_t) -> i32;
    /**
    Sets one of motor_pid_s_t for the motor. This intended to just modify the
    main PID constants.

    Only non-zero values of the struct will change the existing motor constants.

    \note This feature is in beta, it is advised to use caution when modifying
    the PID values. The motor could be damaged by particularly large constants.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param pid
           The new motor PID constants

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    #[deprecated(
        note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
    )]
    pub fn motor_set_vel_pid(port: i8, pid: motor_pid_s_t) -> i32;
    /**
    Sets one of motor_pid_full_s_t for the motor.

    Only non-zero values of the struct will change the existing motor constants.

    \note This feature is in beta, it is advised to use caution when modifying
    the PID values. The motor could be damaged by particularly large constants.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param pid
           The new motor PID constants

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    #[deprecated(
        note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
    )]
    pub fn motor_set_vel_pid_full(port: i8, pid: motor_pid_full_s_t) -> i32;
    /**
    Gets the position PID that was set for the motor. This function will return
    zero for all of the parameters if the motor_set_pos_pid() or
    motor_set_pos_pid_full() functions have not been used.

    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 a motor

    Additionally, in an error state all values of the returned struct are set
    to their negative maximum values.

    \param port
           The V5 port number from 1-21

    \return A motor_pid_full_s_t containing the position PID constants last set
    to the given motor
    */
    #[deprecated(
        note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
    )]
    pub fn motor_get_pos_pid(port: i8) -> motor_pid_full_s_t;
    /**
    Gets the velocity PID that was set for the motor. This function will return
    zero for all of the parameters if the motor_set_vel_pid() or
    motor_set_vel_pid_full() functions have not been used.

    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 a motor

    Additionally, in an error state all values of the returned struct are set
    to their negative maximum values.

    \param port
           The V5 port number from 1-21

    \return A motor_pid_full_s_t containing the velocity PID constants last set
    to the given motor
    */
    #[deprecated(
        note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
    )]
    pub fn motor_get_vel_pid(port: i8) -> motor_pid_full_s_t;
    /**
    Sets the reverse flag for the motor.

    This will invert its movements and the values returned for its position.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param reverse
           True reverses the motor, false is default

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_set_reversed(port: i8, reversed: bool) -> i32;
    /**
    Sets the voltage limit for the motor in Volts.

    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 a motor

    \param port
           The V5 port number from 1-21
    \param limit
           The new voltage limit in Volts

    \return 1 if the operation was successful or PROS_ERR if the operation
    failed, setting errno.
    */
    pub fn motor_set_voltage_limit(port: i8, limit: i32) -> i32;
    /**
    Gets the brake mode that was set for the motor.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return One of motor_brake_mode_e_t, according to what was set for the motor,
    or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno.
    */
    pub fn motor_get_brake_mode(port: i8) -> motor_brake_mode_e_t;
    /**
    Gets the current limit for the motor in mA.

    The default value is 2500 mA.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return The motor's current limit in mA or PROS_ERR if the operation failed,
    setting errno.
    */
    pub fn motor_get_current_limit(port: i8) -> i32;
    /**
    Gets the encoder units that were set for the motor.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return One of motor_encoder_units_e_t according to what is set for the motor
    or E_MOTOR_ENCODER_INVALID if the operation failed.
    */
    pub fn motor_get_encoder_units(port: i8) -> motor_encoder_units_e_t;
    /**
    Gets the gearset that was set for the motor.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return One of motor_gearset_e_t according to what is set for the motor,
    or E_GEARSET_INVALID if the operation failed.
    */
    pub fn motor_get_gearing(port: i8) -> motor_gearset_e_t;
    /**
    Gets the operation direction of the motor as set by the user.

    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 a motor

    \param port
           The V5 port number from 1-21

    \return 1 if the motor has been reversed and 0 if the motor was not reversed,
    or PROS_ERR if the operation failed, setting errno.
    */
    pub fn motor_is_reversed(port: i8) -> i32;
    /**
       Gets the voltage limit set by the user.

       Default value is 0V, which means that there is no software limitation imposed
       on the voltage.

       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 a motor

       \param port
              The V5 port number from 1-21

       \return The motor's voltage limit in V or PROS_ERR if the operation failed,
       setting errno.
    */
    pub fn motor_get_voltage_limit(port: i8) -> i32;
}