1#![allow(non_camel_case_types, non_upper_case_globals)]
3
4use std::os::raw::{c_char, c_int};
5use ErrorCode;
6
7pub enum _Handle {}
8pub type Handle = *mut _Handle;
9
10#[repr(i32)]
13#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
14pub enum ControlFrame {
15 Control_3_General = 262272,
16 Control_4_Advanced = 262336,
17 Control_6_MotProfAddTrajPoint = 262464,
18}
19#[repr(i32)]
20#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
21pub enum ControlFrameEnhanced {
22 Control_3_General = 262272,
23 Control_4_Advanced = 262336,
24 Control_5_FeedbackOutputOverride = 262400,
25 Control_6_MotProfAddTrajPoint = 262464,
26}
27
28#[repr(i32)]
29#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
30pub enum ControlMode {
31 PercentOutput = 0,
32 Position = 1,
33 Velocity = 2,
34 Current = 3,
35 Follower = 5,
36 MotionProfile = 6,
37 MotionMagic = 7,
38 MotionProfileArc = 10,
39 Disabled = 15,
40}
41#[repr(i32)]
42#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
44pub enum DemandType {
45 Neutral = 0,
47 AuxPID = 1,
54 ArbitraryFeedForward = 2,
56}
57impl Default for DemandType {
58 #[inline]
59 fn default() -> DemandType {
60 DemandType::Neutral
61 }
62}
63
64impl FeedbackDevice {
65 pub const CTRE_MagEncoder_Absolute: FeedbackDevice = FeedbackDevice::PulseWidthEncodedPosition;
66 pub const CTRE_MagEncoder_Relative: FeedbackDevice = FeedbackDevice::QuadEncoder;
67}
68#[repr(i32)]
69#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
71pub enum FeedbackDevice {
72 None = -1,
73 QuadEncoder = 0,
74 Analog = 2,
75 Tachometer = 4,
76 PulseWidthEncodedPosition = 8,
77 SensorSum = 9,
78 SensorDifference = 10,
79 RemoteSensor0 = 11,
80 RemoteSensor1 = 12,
81 SoftwareEmulatedSensor = 15,
82}
83#[repr(i32)]
84#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
85pub enum RemoteFeedbackDevice {
86 None = -1,
87 SensorSum = 9,
88 SensorDifference = 10,
89 RemoteSensor0 = 11,
90 RemoteSensor1 = 12,
91 SoftwareEmulatedSensor = 15,
92}
93
94#[repr(u32)]
95#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
96pub enum FollowerType {
97 PercentOutput = 0,
98 AuxOutput1 = 1,
99}
100impl Default for FollowerType {
101 #[inline]
102 fn default() -> FollowerType {
103 FollowerType::PercentOutput
104 }
105}
106
107#[repr(i32)]
108#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
109pub enum LimitSwitchSource {
110 FeedbackConnector = 0,
111 RemoteTalonSRX = 1,
112 RemoteCANifier = 2,
113 Deactivated = 3,
114}
115#[repr(i32)]
116#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
117pub enum RemoteLimitSwitchSource {
118 RemoteTalonSRX = 1,
119 RemoteCANifier = 2,
120 Deactivated = 3,
121}
122#[repr(i32)]
123#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
124pub enum LimitSwitchNormal {
125 NormallyOpen = 0,
126 NormallyClosed = 1,
127 Disabled = 2,
128}
129
130#[repr(i32)]
131#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
132pub enum NeutralMode {
133 EEPROMSetting = 0,
135 Coast = 1,
137 Brake = 2,
139}
140
141#[repr(i32)]
142#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
143pub enum RemoteSensorSource {
144 Off = 0,
145 TalonSRX_SelectedSensor = 1,
146 Pigeon_Yaw = 2,
147 Pigeon_Pitch = 3,
148 Pigeon_Roll = 4,
149 CANifier_Quadrature = 5,
150 CANifier_PWMInput0 = 6,
151 CANifier_PWMInput1 = 7,
152 CANifier_PWMInput2 = 8,
153 CANifier_PWMInput3 = 9,
154 GadgeteerPigeon_Yaw = 10,
155 GadgeteerPigeon_Pitch = 11,
156 GadgeteerPigeon_Roll = 12,
157}
158
159#[repr(i32)]
160#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
161pub enum SensorTerm {
162 Sum0 = 0,
163 Sum1 = 1,
164 Diff0 = 2,
165 Diff1 = 3,
166}
167
168#[repr(i32)]
169#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
170pub enum StatusFrameEnhanced {
171 Status_1_General = 5120,
172 Status_2_Feedback0 = 5184,
173 Status_4_AinTempVbat = 5312,
174 Status_6_Misc = 5440,
175 Status_7_CommStatus = 5504,
176 Status_9_MotProfBuffer = 5632,
177 Status_10_Targets = 5696,
178 Status_12_Feedback1 = 5824,
179 Status_13_Base_PIDF0 = 5888,
180 Status_14_Turn_PIDF1 = 5952,
181 Status_15_FirmareApiStatus = 6016,
182 Status_3_Quadrature = 5248,
183 Status_8_PulseWidth = 5568,
184 Status_11_UartGadgeteer = 5760,
185}
186#[repr(i32)]
187#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
188pub enum StatusFrame {
189 Status_1_General = 5120,
190 Status_2_Feedback0 = 5184,
191 Status_4_AinTempVbat = 5312,
192 Status_6_Misc = 5440,
193 Status_7_CommStatus = 5504,
194 Status_9_MotProfBuffer = 5632,
195 Status_10_Targets = 5696,
196 Status_12_Feedback1 = 5824,
197 Status_13_Base_PIDF0 = 5888,
198 Status_14_Turn_PIDF1 = 5952,
199 Status_15_FirmareApiStatus = 6016,
200}
201
202#[repr(i32)]
203#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
204pub enum VelocityMeasPeriod {
205 Period_1Ms = 1,
206 Period_2Ms = 2,
207 Period_5Ms = 5,
208 Period_10Ms = 10,
209 Period_20Ms = 20,
210 Period_25Ms = 25,
211 Period_50Ms = 50,
212 Period_100Ms = 100,
213}
214
215#[repr(i32)]
216#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
217pub enum SetValueMotionProfile {
218 Invalid = -1,
219 Disable = 0,
220 Enable = 1,
221 Hold = 2,
222}
223impl From<c_int> for SetValueMotionProfile {
224 fn from(value: c_int) -> SetValueMotionProfile {
225 match value {
226 0 => SetValueMotionProfile::Disable,
227 1 => SetValueMotionProfile::Enable,
228 2 => SetValueMotionProfile::Hold,
229 _ => SetValueMotionProfile::Invalid,
230 }
231 }
232}
233impl Default for SetValueMotionProfile {
234 #[inline]
235 fn default() -> SetValueMotionProfile {
236 SetValueMotionProfile::Invalid
237 }
238}
239#[repr(i32)]
240#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
244#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
245pub enum TrajectoryDuration {
246 T0ms = 0,
247 T5ms = 5,
248 T10ms = 10,
249 T20ms = 20,
250 T30ms = 30,
251 T40ms = 40,
252 T50ms = 50,
253 T100ms = 100,
254}
255impl Default for TrajectoryDuration {
256 #[inline]
257 fn default() -> TrajectoryDuration {
258 TrajectoryDuration::T0ms
259 }
260}
261#[repr(C)]
264#[derive(Default, Debug)]
265#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
266pub struct TrajectoryPoint {
267 pub position: f64,
269 pub velocity: f64,
271 heading_deg: f64,
273 pub auxiliary_pos: f64,
275 pub profile_slot_select_0: u32,
283 pub profile_slot_select_1: u32,
287 pub is_last_point: bool,
292 pub zero_pos: bool,
301 pub time_dur: TrajectoryDuration,
305}
306#[test]
307fn bindgen_test_layout_TrajectoryPoint() {
308 assert_eq!(
309 ::std::mem::size_of::<TrajectoryPoint>(),
310 48usize,
311 concat!("Size of: ", stringify!(TrajectoryPoint))
312 );
313 assert_eq!(
314 ::std::mem::align_of::<TrajectoryPoint>(),
315 8usize,
316 concat!("Alignment of ", stringify!(TrajectoryPoint))
317 );
318 assert_eq!(
319 unsafe { &(*(::std::ptr::null::<TrajectoryPoint>())).position as *const _ as usize },
320 0usize,
321 concat!(
322 "Offset of field: ",
323 stringify!(TrajectoryPoint),
324 "::",
325 stringify!(position)
326 )
327 );
328 assert_eq!(
329 unsafe { &(*(::std::ptr::null::<TrajectoryPoint>())).velocity as *const _ as usize },
330 8usize,
331 concat!(
332 "Offset of field: ",
333 stringify!(TrajectoryPoint),
334 "::",
335 stringify!(velocity)
336 )
337 );
338 assert_eq!(
339 unsafe { &(*(::std::ptr::null::<TrajectoryPoint>())).heading_deg as *const _ as usize },
340 16usize,
341 concat!(
342 "Offset of field: ",
343 stringify!(TrajectoryPoint),
344 "::",
345 stringify!(heading_deg)
346 )
347 );
348 assert_eq!(
349 unsafe { &(*(::std::ptr::null::<TrajectoryPoint>())).auxiliary_pos as *const _ as usize },
350 24usize,
351 concat!(
352 "Offset of field: ",
353 stringify!(TrajectoryPoint),
354 "::",
355 stringify!(auxiliary_pos)
356 )
357 );
358 assert_eq!(
359 unsafe {
360 &(*(::std::ptr::null::<TrajectoryPoint>())).profile_slot_select_0 as *const _ as usize
361 },
362 32usize,
363 concat!(
364 "Offset of field: ",
365 stringify!(TrajectoryPoint),
366 "::",
367 stringify!(profile_slot_select_0)
368 )
369 );
370 assert_eq!(
371 unsafe {
372 &(*(::std::ptr::null::<TrajectoryPoint>())).profile_slot_select_1 as *const _ as usize
373 },
374 36usize,
375 concat!(
376 "Offset of field: ",
377 stringify!(TrajectoryPoint),
378 "::",
379 stringify!(profile_slot_select1)
380 )
381 );
382 assert_eq!(
383 unsafe { &(*(::std::ptr::null::<TrajectoryPoint>())).is_last_point as *const _ as usize },
384 40usize,
385 concat!(
386 "Offset of field: ",
387 stringify!(TrajectoryPoint),
388 "::",
389 stringify!(is_last_point)
390 )
391 );
392 assert_eq!(
393 unsafe { &(*(::std::ptr::null::<TrajectoryPoint>())).zero_pos as *const _ as usize },
394 41usize,
395 concat!(
396 "Offset of field: ",
397 stringify!(TrajectoryPoint),
398 "::",
399 stringify!(zero_pos)
400 )
401 );
402 assert_eq!(
403 unsafe { &(*(::std::ptr::null::<TrajectoryPoint>())).time_dur as *const _ as usize },
404 44usize,
405 concat!(
406 "Offset of field: ",
407 stringify!(TrajectoryPoint),
408 "::",
409 stringify!(time_dur)
410 )
411 );
412}
413#[repr(C)]
416#[derive(Default, Debug, PartialEq, Eq)]
417pub struct MotionProfileStatus {
418 pub top_buffer_rem: c_int,
424 pub top_buffer_cnt: c_int,
426 pub btm_buffer_cnt: c_int,
428 pub has_underrun: bool,
433 pub is_underrun: bool,
437 pub active_point_valid: bool,
440 pub is_last: bool,
441 pub profile_slot_select_0: c_int,
443 pub profile_slot_select_1: c_int,
445 pub output_enable: SetValueMotionProfile,
449 pub time_dur_ms: c_int,
451}
452#[test]
453fn bindgen_test_layout_MotionProfileStatus() {
454 assert_eq!(
455 ::std::mem::size_of::<MotionProfileStatus>(),
456 32usize,
457 concat!("Size of: ", stringify!(MotionProfileStatus))
458 );
459 assert_eq!(
460 ::std::mem::align_of::<MotionProfileStatus>(),
461 4usize,
462 concat!("Alignment of ", stringify!(MotionProfileStatus))
463 );
464 assert_eq!(
465 unsafe {
466 &(*(::std::ptr::null::<MotionProfileStatus>())).top_buffer_rem as *const _ as usize
467 },
468 0usize,
469 concat!(
470 "Offset of field: ",
471 stringify!(MotionProfileStatus),
472 "::",
473 stringify!(top_buffer_rem)
474 )
475 );
476 assert_eq!(
477 unsafe {
478 &(*(::std::ptr::null::<MotionProfileStatus>())).top_buffer_cnt as *const _ as usize
479 },
480 4usize,
481 concat!(
482 "Offset of field: ",
483 stringify!(MotionProfileStatus),
484 "::",
485 stringify!(top_buffer_cnt)
486 )
487 );
488 assert_eq!(
489 unsafe {
490 &(*(::std::ptr::null::<MotionProfileStatus>())).btm_buffer_cnt as *const _ as usize
491 },
492 8usize,
493 concat!(
494 "Offset of field: ",
495 stringify!(MotionProfileStatus),
496 "::",
497 stringify!(btm_buffer_cnt)
498 )
499 );
500 assert_eq!(
501 unsafe {
502 &(*(::std::ptr::null::<MotionProfileStatus>())).has_underrun as *const _ as usize
503 },
504 12usize,
505 concat!(
506 "Offset of field: ",
507 stringify!(MotionProfileStatus),
508 "::",
509 stringify!(has_underrun)
510 )
511 );
512 assert_eq!(
513 unsafe { &(*(::std::ptr::null::<MotionProfileStatus>())).is_underrun as *const _ as usize },
514 13usize,
515 concat!(
516 "Offset of field: ",
517 stringify!(MotionProfileStatus),
518 "::",
519 stringify!(is_underrun)
520 )
521 );
522 assert_eq!(
523 unsafe {
524 &(*(::std::ptr::null::<MotionProfileStatus>())).active_point_valid as *const _ as usize
525 },
526 14usize,
527 concat!(
528 "Offset of field: ",
529 stringify!(MotionProfileStatus),
530 "::",
531 stringify!(active_point_valid)
532 )
533 );
534 assert_eq!(
535 unsafe { &(*(::std::ptr::null::<MotionProfileStatus>())).is_last as *const _ as usize },
536 15usize,
537 concat!(
538 "Offset of field: ",
539 stringify!(MotionProfileStatus),
540 "::",
541 stringify!(is_last)
542 )
543 );
544 assert_eq!(
545 unsafe {
546 &(*(::std::ptr::null::<MotionProfileStatus>())).profile_slot_select_0 as *const _
547 as usize
548 },
549 16usize,
550 concat!(
551 "Offset of field: ",
552 stringify!(MotionProfileStatus),
553 "::",
554 stringify!(profile_slot_select_0)
555 )
556 );
557 assert_eq!(
558 unsafe {
559 &(*(::std::ptr::null::<MotionProfileStatus>())).profile_slot_select_1 as *const _
560 as usize
561 },
562 20usize,
563 concat!(
564 "Offset of field: ",
565 stringify!(MotionProfileStatus),
566 "::",
567 stringify!(profile_slot_select_1)
568 )
569 );
570 assert_eq!(
571 unsafe {
572 &(*(::std::ptr::null::<MotionProfileStatus>())).output_enable as *const _ as usize
573 },
574 24usize,
575 concat!(
576 "Offset of field: ",
577 stringify!(MotionProfileStatus),
578 "::",
579 stringify!(output_enable)
580 )
581 );
582 assert_eq!(
583 unsafe { &(*(::std::ptr::null::<MotionProfileStatus>())).time_dur_ms as *const _ as usize },
584 28usize,
585 concat!(
586 "Offset of field: ",
587 stringify!(MotionProfileStatus),
588 "::",
589 stringify!(time_dur_ms)
590 )
591 );
592}
593
594extern "C" {
595 pub fn c_MotController_Create1(baseArbId: c_int) -> Handle;
596
597 pub fn c_MotController_GetDeviceNumber(handle: Handle, deviceNumber: *mut c_int) -> ErrorCode;
598
599 pub fn c_MotController_GetDescription(
600 handle: Handle,
601 toFill: *mut c_char,
602 toFillByteSz: c_int,
603 numBytesFilled: *mut c_int,
604 ) -> ErrorCode;
605
606 pub fn c_MotController_SetDemand(
607 handle: Handle,
608 mode: c_int,
609 demand0: c_int,
610 demand1: c_int,
611 ) -> ErrorCode;
612
613 pub fn c_MotController_Set_4(
614 handle: Handle,
615 mode: c_int,
616 demand0: f64,
617 demand1: f64,
618 demand1Type: c_int,
619 ) -> ErrorCode;
620
621 pub fn c_MotController_SetNeutralMode(handle: Handle, neutralMode: c_int);
622
623 pub fn c_MotController_SetSensorPhase(handle: Handle, PhaseSensor: bool);
624
625 pub fn c_MotController_SetInverted(handle: Handle, invert: bool);
626
627 pub fn c_MotController_ConfigOpenLoopRamp(
628 handle: Handle,
629 secondsFromNeutralToFull: f64,
630 timeoutMs: c_int,
631 ) -> ErrorCode;
632
633 pub fn c_MotController_ConfigClosedLoopRamp(
634 handle: Handle,
635 secondsFromNeutralToFull: f64,
636 timeoutMs: c_int,
637 ) -> ErrorCode;
638
639 pub fn c_MotController_ConfigPeakOutputForward(
640 handle: Handle,
641 percentOut: f64,
642 timeoutMs: c_int,
643 ) -> ErrorCode;
644
645 pub fn c_MotController_ConfigPeakOutputReverse(
646 handle: Handle,
647 percentOut: f64,
648 timeoutMs: c_int,
649 ) -> ErrorCode;
650
651 pub fn c_MotController_ConfigNominalOutputForward(
652 handle: Handle,
653 percentOut: f64,
654 timeoutMs: c_int,
655 ) -> ErrorCode;
656
657 pub fn c_MotController_ConfigNominalOutputReverse(
658 handle: Handle,
659 percentOut: f64,
660 timeoutMs: c_int,
661 ) -> ErrorCode;
662
663 pub fn c_MotController_ConfigNeutralDeadband(
664 handle: Handle,
665 percentDeadband: f64,
666 timeoutMs: c_int,
667 ) -> ErrorCode;
668
669 pub fn c_MotController_ConfigVoltageCompSaturation(
670 handle: Handle,
671 voltage: f64,
672 timeoutMs: c_int,
673 ) -> ErrorCode;
674
675 pub fn c_MotController_ConfigVoltageMeasurementFilter(
676 handle: Handle,
677 filterWindowSamples: c_int,
678 timeoutMs: c_int,
679 ) -> ErrorCode;
680
681 pub fn c_MotController_EnableVoltageCompensation(handle: Handle, enable: bool);
682
683 pub fn c_MotController_GetBusVoltage(handle: Handle, voltage: *mut f64) -> ErrorCode;
684
685 pub fn c_MotController_GetMotorOutputPercent(
686 handle: Handle,
687 percentOutput: *mut f64,
688 ) -> ErrorCode;
689
690 pub fn c_MotController_GetOutputCurrent(handle: Handle, current: *mut f64) -> ErrorCode;
691
692 pub fn c_MotController_GetTemperature(handle: Handle, temperature: *mut f64) -> ErrorCode;
693
694 pub fn c_MotController_ConfigSelectedFeedbackSensor(
695 handle: Handle,
696 feedbackDevice: c_int,
697 pidIdx: c_int,
698 timeoutMs: c_int,
699 ) -> ErrorCode;
700
701 pub fn c_MotController_ConfigSelectedFeedbackCoefficient(
702 handle: Handle,
703 coefficient: f64,
704 pidIdx: c_int,
705 timeoutMs: c_int,
706 ) -> ErrorCode;
707
708 pub fn c_MotController_ConfigRemoteFeedbackFilter(
709 handle: Handle,
710 deviceID: c_int,
711 remoteSensorSource: c_int,
712 remoteOrdinal: c_int,
713 timeoutMs: c_int,
714 ) -> ErrorCode;
715
716 pub fn c_MotController_ConfigSensorTerm(
717 handle: Handle,
718 sensorTerm: c_int,
719 feedbackDevice: c_int,
720 timeoutMs: c_int,
721 ) -> ErrorCode;
722
723 pub fn c_MotController_GetSelectedSensorPosition(
724 handle: Handle,
725 param: *mut c_int,
726 pidIdx: c_int,
727 ) -> ErrorCode;
728
729 pub fn c_MotController_GetSelectedSensorVelocity(
730 handle: Handle,
731 param: *mut c_int,
732 pidIdx: c_int,
733 ) -> ErrorCode;
734
735 pub fn c_MotController_SetSelectedSensorPosition(
736 handle: Handle,
737 sensorPos: c_int,
738 pidIdx: c_int,
739 timeoutMs: c_int,
740 ) -> ErrorCode;
741
742 pub fn c_MotController_SetControlFramePeriod(
743 handle: Handle,
744 frame: c_int,
745 periodMs: c_int,
746 ) -> ErrorCode;
747
748 pub fn c_MotController_SetStatusFramePeriod(
749 handle: Handle,
750 frame: c_int,
751 periodMs: c_int,
752 timeoutMs: c_int,
753 ) -> ErrorCode;
754
755 pub fn c_MotController_GetStatusFramePeriod(
756 handle: Handle,
757 frame: c_int,
758 periodMs: *mut c_int,
759 timeoutMs: c_int,
760 ) -> ErrorCode;
761
762 pub fn c_MotController_ConfigVelocityMeasurementPeriod(
763 handle: Handle,
764 period: c_int,
765 timeoutMs: c_int,
766 ) -> ErrorCode;
767
768 pub fn c_MotController_ConfigVelocityMeasurementWindow(
769 handle: Handle,
770 windowSize: c_int,
771 timeoutMs: c_int,
772 ) -> ErrorCode;
773
774 pub fn c_MotController_ConfigForwardLimitSwitchSource(
775 handle: Handle,
776 type_: c_int,
777 normalOpenOrClose: c_int,
778 deviceID: c_int,
779 timeoutMs: c_int,
780 ) -> ErrorCode;
781
782 pub fn c_MotController_ConfigReverseLimitSwitchSource(
783 handle: Handle,
784 type_: c_int,
785 normalOpenOrClose: c_int,
786 deviceID: c_int,
787 timeoutMs: c_int,
788 ) -> ErrorCode;
789
790 pub fn c_MotController_OverrideLimitSwitchesEnable(handle: Handle, enable: bool);
791
792 pub fn c_MotController_ConfigForwardSoftLimitThreshold(
793 handle: Handle,
794 forwardSensorLimit: c_int,
795 timeoutMs: c_int,
796 ) -> ErrorCode;
797
798 pub fn c_MotController_ConfigReverseSoftLimitThreshold(
799 handle: Handle,
800 reverseSensorLimit: c_int,
801 timeoutMs: c_int,
802 ) -> ErrorCode;
803
804 pub fn c_MotController_ConfigForwardSoftLimitEnable(
805 handle: Handle,
806 enable: bool,
807 timeoutMs: c_int,
808 ) -> ErrorCode;
809
810 pub fn c_MotController_ConfigReverseSoftLimitEnable(
811 handle: Handle,
812 enable: bool,
813 timeoutMs: c_int,
814 ) -> ErrorCode;
815
816 pub fn c_MotController_OverrideSoftLimitsEnable(handle: Handle, enable: bool);
817
818 pub fn c_MotController_Config_kP(
819 handle: Handle,
820 slotIdx: c_int,
821 value: f64,
822 timeoutMs: c_int,
823 ) -> ErrorCode;
824
825 pub fn c_MotController_Config_kI(
826 handle: Handle,
827 slotIdx: c_int,
828 value: f64,
829 timeoutMs: c_int,
830 ) -> ErrorCode;
831
832 pub fn c_MotController_Config_kD(
833 handle: Handle,
834 slotIdx: c_int,
835 value: f64,
836 timeoutMs: c_int,
837 ) -> ErrorCode;
838
839 pub fn c_MotController_Config_kF(
840 handle: Handle,
841 slotIdx: c_int,
842 value: f64,
843 timeoutMs: c_int,
844 ) -> ErrorCode;
845
846 pub fn c_MotController_Config_IntegralZone(
847 handle: Handle,
848 slotIdx: c_int,
849 izone: f64,
850 timeoutMs: c_int,
851 ) -> ErrorCode;
852
853 pub fn c_MotController_ConfigAllowableClosedloopError(
854 handle: Handle,
855 slotIdx: c_int,
856 allowableClosedLoopError: c_int,
857 timeoutMs: c_int,
858 ) -> ErrorCode;
859
860 pub fn c_MotController_ConfigMaxIntegralAccumulator(
861 handle: Handle,
862 slotIdx: c_int,
863 iaccum: f64,
864 timeoutMs: c_int,
865 ) -> ErrorCode;
866
867 pub fn c_MotController_ConfigClosedLoopPeakOutput(
868 handle: Handle,
869 slotIdx: c_int,
870 percentOut: f64,
871 timeoutMs: c_int,
872 ) -> ErrorCode;
873
874 pub fn c_MotController_ConfigClosedLoopPeriod(
875 handle: Handle,
876 slotIdx: c_int,
877 loopTimeMs: c_int,
878 timeoutMs: c_int,
879 ) -> ErrorCode;
880
881 pub fn c_MotController_SetIntegralAccumulator(
882 handle: Handle,
883 iaccum: f64,
884 pidIdx: c_int,
885 timeoutMs: c_int,
886 ) -> ErrorCode;
887
888 pub fn c_MotController_GetClosedLoopError(
889 handle: Handle,
890 closedLoopError: *mut c_int,
891 pidIdx: c_int,
892 ) -> ErrorCode;
893
894 pub fn c_MotController_GetIntegralAccumulator(
895 handle: Handle,
896 iaccum: *mut f64,
897 pidIdx: c_int,
898 ) -> ErrorCode;
899
900 pub fn c_MotController_GetErrorDerivative(
901 handle: Handle,
902 derror: *mut f64,
903 pidIdx: c_int,
904 ) -> ErrorCode;
905
906 pub fn c_MotController_SelectProfileSlot(
907 handle: Handle,
908 slotIdx: c_int,
909 pidIdx: c_int,
910 ) -> ErrorCode;
911
912 pub fn c_MotController_GetActiveTrajectoryPosition(
913 handle: Handle,
914 param: *mut c_int,
915 ) -> ErrorCode;
916
917 pub fn c_MotController_GetActiveTrajectoryVelocity(
918 handle: Handle,
919 param: *mut c_int,
920 ) -> ErrorCode;
921
922 pub fn c_MotController_GetActiveTrajectoryHeading(handle: Handle, param: *mut f64)
923 -> ErrorCode;
924
925 pub fn c_MotController_GetActiveTrajectoryAll(
926 handle: Handle,
927 vel: *mut c_int,
928 pos: *mut c_int,
929 heading: *mut f64,
930 ) -> ErrorCode;
931
932 pub fn c_MotController_ConfigMotionCruiseVelocity(
933 handle: Handle,
934 sensorUnitsPer100ms: c_int,
935 timeoutMs: c_int,
936 ) -> ErrorCode;
937
938 pub fn c_MotController_ConfigMotionAcceleration(
939 handle: Handle,
940 sensorUnitsPer100msPerSec: c_int,
941 timeoutMs: c_int,
942 ) -> ErrorCode;
943
944 pub fn c_MotController_ClearMotionProfileTrajectories(handle: Handle) -> ErrorCode;
945
946 pub fn c_MotController_GetMotionProfileTopLevelBufferCount(
947 handle: Handle,
948 value: *mut c_int,
949 ) -> ErrorCode;
950
951 pub fn c_MotController_PushMotionProfileTrajectory(
952 handle: Handle,
953 position: f64,
954 velocity: f64,
955 headingDeg: f64,
956 profileSlotSelect: c_int,
957 isLastPoint: bool,
958 zeroPos: bool,
959 ) -> ErrorCode;
960
961 pub fn c_MotController_PushMotionProfileTrajectory_2(
962 handle: Handle,
963 position: f64,
964 velocity: f64,
965 headingDeg: f64,
966 profileSlotSelect0: c_int,
967 profileSlotSelect1: c_int,
968 isLastPoint: bool,
969 zeroPos: bool,
970 durationMs: c_int,
971 ) -> ErrorCode;
972
973 pub fn c_MotController_IsMotionProfileTopLevelBufferFull(
974 handle: Handle,
975 value: *mut bool,
976 ) -> ErrorCode;
977
978 pub fn c_MotController_ProcessMotionProfileBuffer(handle: Handle) -> ErrorCode;
979
980 pub fn c_MotController_GetMotionProfileStatus(
981 handle: Handle,
982 topBufferRem: *mut c_int,
983 topBufferCnt: *mut c_int,
984 btmBufferCnt: *mut c_int,
985 hasUnderrun: *mut bool,
986 isUnderrun: *mut bool,
987 activePointValid: *mut bool,
988 isLast: *mut bool,
989 profileSlotSelect: *mut c_int,
990 outputEnable: *mut c_int,
991 ) -> ErrorCode;
992
993 pub fn c_MotController_GetMotionProfileStatus_2(
994 handle: Handle,
995 topBufferRem: *mut c_int,
996 topBufferCnt: *mut c_int,
997 btmBufferCnt: *mut c_int,
998 hasUnderrun: *mut bool,
999 isUnderrun: *mut bool,
1000 activePointValid: *mut bool,
1001 isLast: *mut bool,
1002 profileSlotSelect: *mut c_int,
1003 outputEnable: *mut c_int,
1004 timeDurMs: *mut c_int,
1005 profileSlotSelect1: *mut c_int,
1006 ) -> ErrorCode;
1007
1008 pub fn c_MotController_ClearMotionProfileHasUnderrun(
1009 handle: Handle,
1010 timeoutMs: c_int,
1011 ) -> ErrorCode;
1012
1013 pub fn c_MotController_ChangeMotionControlFramePeriod(
1014 handle: Handle,
1015 periodMs: c_int,
1016 ) -> ErrorCode;
1017
1018 pub fn c_MotController_ConfigMotionProfileTrajectoryPeriod(
1019 handle: Handle,
1020 durationMs: c_int,
1021 timeoutMs: c_int,
1022 ) -> ErrorCode;
1023
1024 pub fn c_MotController_GetLastError(handle: Handle) -> ErrorCode;
1025
1026 pub fn c_MotController_GetFirmwareVersion(handle: Handle, arg1: *mut c_int) -> ErrorCode;
1027
1028 pub fn c_MotController_HasResetOccurred(handle: Handle, arg1: *mut bool) -> ErrorCode;
1029
1030 pub fn c_MotController_ConfigSetCustomParam(
1031 handle: Handle,
1032 newValue: c_int,
1033 paramIndex: c_int,
1034 timeoutMs: c_int,
1035 ) -> ErrorCode;
1036
1037 pub fn c_MotController_ConfigGetCustomParam(
1038 handle: Handle,
1039 readValue: *mut c_int,
1040 paramIndex: c_int,
1041 timoutMs: c_int,
1042 ) -> ErrorCode;
1043
1044 pub fn c_MotController_ConfigSetParameter(
1045 handle: Handle,
1046 param: c_int,
1047 value: f64,
1048 subValue: c_int,
1049 ordinal: c_int,
1050 timeoutMs: c_int,
1051 ) -> ErrorCode;
1052
1053 pub fn c_MotController_ConfigGetParameter(
1054 handle: Handle,
1055 param: c_int,
1056 value: *mut f64,
1057 ordinal: c_int,
1058 timeoutMs: c_int,
1059 ) -> ErrorCode;
1060
1061 pub fn c_MotController_ConfigPeakCurrentLimit(
1062 handle: Handle,
1063 amps: c_int,
1064 timeoutMs: c_int,
1065 ) -> ErrorCode;
1066
1067 pub fn c_MotController_ConfigPeakCurrentDuration(
1068 handle: Handle,
1069 milliseconds: c_int,
1070 timeoutMs: c_int,
1071 ) -> ErrorCode;
1072
1073 pub fn c_MotController_ConfigContinuousCurrentLimit(
1074 handle: Handle,
1075 amps: c_int,
1076 timeoutMs: c_int,
1077 ) -> ErrorCode;
1078
1079 pub fn c_MotController_EnableCurrentLimit(handle: Handle, enable: bool) -> ErrorCode;
1080
1081 pub fn c_MotController_SetLastError(handle: Handle, error: c_int) -> ErrorCode;
1082
1083 pub fn c_MotController_GetAnalogIn(handle: Handle, param: *mut c_int) -> ErrorCode;
1084
1085 pub fn c_MotController_SetAnalogPosition(
1086 handle: Handle,
1087 newPosition: c_int,
1088 timeoutMs: c_int,
1089 ) -> ErrorCode;
1090
1091 pub fn c_MotController_GetAnalogInRaw(handle: Handle, param: *mut c_int) -> ErrorCode;
1092
1093 pub fn c_MotController_GetAnalogInVel(handle: Handle, param: *mut c_int) -> ErrorCode;
1094
1095 pub fn c_MotController_GetQuadraturePosition(handle: Handle, param: *mut c_int) -> ErrorCode;
1096
1097 pub fn c_MotController_SetQuadraturePosition(
1098 handle: Handle,
1099 newPosition: c_int,
1100 timeoutMs: c_int,
1101 ) -> ErrorCode;
1102
1103 pub fn c_MotController_GetQuadratureVelocity(handle: Handle, param: *mut c_int) -> ErrorCode;
1104
1105 pub fn c_MotController_GetPulseWidthPosition(handle: Handle, param: *mut c_int) -> ErrorCode;
1106
1107 pub fn c_MotController_SetPulseWidthPosition(
1108 handle: Handle,
1109 newPosition: c_int,
1110 timeoutMs: c_int,
1111 ) -> ErrorCode;
1112
1113 pub fn c_MotController_GetPulseWidthVelocity(handle: Handle, param: *mut c_int) -> ErrorCode;
1114
1115 pub fn c_MotController_GetPulseWidthRiseToFallUs(
1116 handle: Handle,
1117 param: *mut c_int,
1118 ) -> ErrorCode;
1119
1120 pub fn c_MotController_GetPulseWidthRiseToRiseUs(
1121 handle: Handle,
1122 param: *mut c_int,
1123 ) -> ErrorCode;
1124
1125 pub fn c_MotController_GetPinStateQuadA(handle: Handle, param: *mut c_int) -> ErrorCode;
1126
1127 pub fn c_MotController_GetPinStateQuadB(handle: Handle, param: *mut c_int) -> ErrorCode;
1128
1129 pub fn c_MotController_GetPinStateQuadIdx(handle: Handle, param: *mut c_int) -> ErrorCode;
1130
1131 pub fn c_MotController_IsFwdLimitSwitchClosed(handle: Handle, param: *mut c_int) -> ErrorCode;
1132
1133 pub fn c_MotController_IsRevLimitSwitchClosed(handle: Handle, param: *mut c_int) -> ErrorCode;
1134
1135 pub fn c_MotController_GetFaults(handle: Handle, param: *mut c_int) -> ErrorCode;
1136
1137 pub fn c_MotController_GetStickyFaults(handle: Handle, param: *mut c_int) -> ErrorCode;
1138
1139 pub fn c_MotController_ClearStickyFaults(handle: Handle, timeoutMs: c_int) -> ErrorCode;
1140
1141 pub fn c_MotController_SelectDemandType(handle: Handle, enable: bool) -> ErrorCode;
1142
1143 pub fn c_MotController_SetMPEOutput(handle: Handle, MpeOutput: c_int) -> ErrorCode;
1144
1145 pub fn c_MotController_EnableHeadingHold(handle: Handle, enable: bool) -> ErrorCode;
1146
1147 pub fn c_MotController_GetAnalogInAll(
1148 handle: Handle,
1149 withOv: *mut c_int,
1150 raw: *mut c_int,
1151 vel: *mut c_int,
1152 ) -> ErrorCode;
1153
1154 pub fn c_MotController_GetQuadratureSensor(
1155 handle: Handle,
1156 pos: *mut c_int,
1157 vel: *mut c_int,
1158 ) -> ErrorCode;
1159
1160 pub fn c_MotController_GetPulseWidthAll(
1161 handle: Handle,
1162 pos: *mut c_int,
1163 vel: *mut c_int,
1164 riseToRiseUs: *mut c_int,
1165 riseToFallUs: *mut c_int,
1166 ) -> ErrorCode;
1167
1168 pub fn c_MotController_GetQuadPinStates(
1169 handle: Handle,
1170 quadA: *mut c_int,
1171 quadB: *mut c_int,
1172 quadIdx: *mut c_int,
1173 ) -> ErrorCode;
1174
1175 pub fn c_MotController_GetLimitSwitchState(
1176 handle: Handle,
1177 isFwdClosed: *mut c_int,
1178 isRevClosed: *mut c_int,
1179 ) -> ErrorCode;
1180
1181 pub fn c_MotController_GetClosedLoopTarget(
1182 handle: Handle,
1183 value: *mut c_int,
1184 pidIdx: c_int,
1185 ) -> ErrorCode;
1186}