1use core::ffi::{c_double, c_int};
4
5pub const V5_MAX_DEVICE_PORTS: usize = 32;
11
12#[allow(non_camel_case_types)]
14pub type V5_DeviceT = *mut V5_Device;
15
16pub type V5_Device = *mut core::ffi::c_void;
18
19#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)]
20#[repr(transparent)]
21pub struct V5_DeviceType(pub core::ffi::c_uchar);
22
23impl V5_DeviceType {
24 pub const kDeviceTypeNoSensor: Self = Self(0);
26
27 pub const kDeviceTypeMotorSensor: Self = Self(2);
29
30 pub const kDeviceTypeLedSensor: Self = Self(3);
32
33 pub const kDeviceTypeAbsEncSensor: Self = Self(4);
35
36 pub const kDeviceTypeCrMotorSensor: Self = Self(5);
38
39 pub const kDeviceTypeImuSensor: Self = Self(6);
41
42 pub const kDeviceTypeDistanceSensor: Self = Self(7);
44
45 pub const kDeviceTypeRadioSensor: Self = Self(8);
47
48 pub const kDeviceTypeTetherSensor: Self = Self(9);
50
51 pub const kDeviceTypeBrainSensor: Self = Self(10);
53
54 pub const kDeviceTypeVisionSensor: Self = Self(11);
56
57 pub const kDeviceTypeAdiSensor: Self = Self(12);
59
60 pub const kDeviceTypeRes1Sensor: Self = Self(13);
62
63 pub const kDeviceTypeRes2Sensor: Self = Self(14);
65
66 pub const kDeviceTypeRes3Sensor: Self = Self(15);
68
69 pub const kDeviceTypeOpticalSensor: Self = Self(16);
71
72 pub const kDeviceTypeMagnetSensor: Self = Self(17);
74
75 pub const kDeviceTypeGpsSensor: Self = Self(20);
77
78 pub const kDeviceTypeAicameraSensor: Self = Self(26);
80
81 pub const kDeviceTypeLightTowerSensor: Self = Self(27);
83
84 pub const kDeviceTypeArmDevice: Self = Self(28);
86
87 pub const kDeviceTypeAiVisionSensor: Self = Self(29);
89
90 pub const kDeviceTypePneumaticSensor: Self = Self(30);
92
93 pub const kDeviceTypeBumperSensor: Self = Self(0x40);
95 pub const kDeviceTypeGyroSensor: Self = Self(0x46);
96 pub const kDeviceTypeSonarSensor: Self = Self(0x47);
97 pub const kDeviceTypeGenericSensor: Self = Self(128);
98
99 pub const kDeviceTypeGenericSerial: Self = Self(129);
101
102 pub const kDeviceTypeUndefinedSensor: Self = Self(255);
104}
105
106unsafe extern "system" {
107 pub fn vexDevicesGetNumber() -> u32;
108 pub fn vexDevicesGetNumberByType(device_type: V5_DeviceType) -> u32;
109 pub fn vexDevicesGet() -> V5_DeviceT;
110 pub fn vexDeviceGetByIndex(index: u32) -> V5_DeviceT;
111 pub fn vexDeviceGetStatus(devices: *mut V5_DeviceType) -> i32;
112 pub fn vexDeviceGetTimestamp(device: V5_DeviceT) -> u32;
113 pub fn vexDeviceGenericValueGet(device: V5_DeviceT) -> c_double;
114 pub fn vexDeviceButtonStateGet() -> c_int;
115}