1use core::ffi::{c_double, c_int};
4
5use crate::map_jump_table;
6
7pub const V5_MAX_DEVICE_PORTS: usize = 32;
13
14#[allow(non_camel_case_types)]
16pub type V5_DeviceT = *mut V5_Device;
17
18pub type V5_Device = *mut core::ffi::c_void;
20
21#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)]
22#[repr(transparent)]
23pub struct V5_DeviceType(pub core::ffi::c_uchar);
24
25impl V5_DeviceType {
26 pub const kDeviceTypeNoSensor: Self = Self(0);
28
29 pub const kDeviceTypeMotorSensor: Self = Self(2);
31
32 pub const kDeviceTypeLedSensor: Self = Self(3);
34
35 pub const kDeviceTypeAbsEncSensor: Self = Self(4);
37
38 pub const kDeviceTypeCrMotorSensor: Self = Self(5);
40
41 pub const kDeviceTypeImuSensor: Self = Self(6);
43
44 pub const kDeviceTypeDistanceSensor: Self = Self(7);
46
47 pub const kDeviceTypeRadioSensor: Self = Self(8);
49
50 pub const kDeviceTypeTetherSensor: Self = Self(9);
52
53 pub const kDeviceTypeBrainSensor: Self = Self(10);
55
56 pub const kDeviceTypeVisionSensor: Self = Self(11);
58
59 pub const kDeviceTypeAdiSensor: Self = Self(12);
61
62 pub const kDeviceTypeRes1Sensor: Self = Self(13);
64
65 pub const kDeviceTypeRes2Sensor: Self = Self(14);
67
68 pub const kDeviceTypeRes3Sensor: Self = Self(15);
70
71 pub const kDeviceTypeOpticalSensor: Self = Self(16);
73
74 pub const kDeviceTypeMagnetSensor: Self = Self(17);
76
77 pub const kDeviceTypeGpsSensor: Self = Self(20);
79
80 pub const kDeviceTypeAicameraSensor: Self = Self(26);
82
83 pub const kDeviceTypeLightTowerSensor: Self = Self(27);
85
86 pub const kDeviceTypeArmDevice: Self = Self(28);
88
89 pub const kDeviceTypeAiVisionSensor: Self = Self(29);
91
92 pub const kDeviceTypePneumaticSensor: Self = Self(30);
94
95 pub const kDeviceTypeBumperSensor: Self = Self(0x40);
97 pub const kDeviceTypeGyroSensor: Self = Self(0x46);
98 pub const kDeviceTypeSonarSensor: Self = Self(0x47);
99 pub const kDeviceTypeGenericSensor: Self = Self(128);
100
101 pub const kDeviceTypeGenericSerial: Self = Self(129);
103
104 pub const kDeviceTypeUndefinedSensor: Self = Self(255);
106}
107
108map_jump_table! {
109 0x190 =>
110 pub fn vexDevicesGetNumber() -> u32,
114 0x194 =>
115 pub fn vexDevicesGetNumberByType(device_type: V5_DeviceType) -> u32,
117 0x198 =>
118 pub fn vexDevicesGet() -> V5_DeviceT,
120 0x19c =>
121 pub fn vexDeviceGetByIndex(index: u32) -> V5_DeviceT,
123 0x1a0 =>
124 pub fn vexDeviceGetStatus(devices: *mut V5_DeviceType) -> i32,
131 0x1b0 =>
132 pub fn vexDeviceGetTimestamp(device: V5_DeviceT) -> u32,
134 0x2a8 =>
135 pub fn vexDeviceGenericValueGet(device: V5_DeviceT) -> c_double,
136 0x1b4 => pub fn vexDeviceButtonStateGet() -> c_int,
137}