1use core::ffi::c_double;
4
5use crate::V5_DeviceT;
6
7#[repr(transparent)]
8#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)]
9pub struct V5_AdiPortConfiguration(pub core::ffi::c_uchar);
10
11impl V5_AdiPortConfiguration {
12 pub const kAdiPortTypeAnalogIn: Self = Self(0);
13 pub const kAdiPortTypeAnalogOut: Self = Self(1);
14 pub const kAdiPortTypeDigitalIn: Self = Self(2);
15 pub const kAdiPortTypeDigitalOut: Self = Self(3);
16 pub const kAdiPortTypeSmartButton: Self = Self(4);
17 pub const kAdiPortTypeSmartPot: Self = Self(5);
18 pub const kAdiPortTypeLegacyButton: Self = Self(6);
19 pub const kAdiPortTypeLegacyPotentiometer: Self = Self(7);
20 pub const kAdiPortTypeLegacyLineSensor: Self = Self(8);
21 pub const kAdiPortTypeLegacyLightSensor: Self = Self(9);
22 pub const kAdiPortTypeLegacyGyro: Self = Self(10);
23 pub const kAdiPortTypeLegacyAccelerometer: Self = Self(11);
24 pub const kAdiPortTypeLegacyServo: Self = Self(12);
25 pub const kAdiPortTypeLegacyPwm: Self = Self(13);
26 pub const kAdiPortTypeQuadEncoder: Self = Self(14);
27 pub const kAdiPortTypeSonar: Self = Self(15);
28 pub const kAdiPortTypeLegacyPwmSlew: Self = Self(16);
29 pub const kAdiPortTypeUndefined: Self = Self(255);
30}
31
32#[repr(transparent)]
33#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)]
34pub struct V5_DeviceBumperState(pub core::ffi::c_uchar);
35
36impl V5_DeviceBumperState {
37 pub const kBumperReleased: Self = Self(0);
38 pub const kBumperPressed: Self = Self(1);
39}
40
41unsafe extern "system" {
42 pub fn vexDeviceAdiPortConfigSet(
43 device: V5_DeviceT,
44 port: u32,
45 config: V5_AdiPortConfiguration,
46 );
47 pub fn vexDeviceAdiPortConfigGet(device: V5_DeviceT, port: u32) -> V5_AdiPortConfiguration;
48 pub fn vexDeviceAdiValueSet(device: V5_DeviceT, port: u32, value: i32);
49 pub fn vexDeviceAdiValueGet(device: V5_DeviceT, port: u32) -> i32;
50 pub fn vexDeviceAdiAddrLedSet(
51 device: V5_DeviceT,
52 port: u32,
53 pData: *mut u32,
54 nOffset: u32,
55 nLength: u32,
56 options: u32,
57 );
58 pub fn vexDeviceBumperGet(device: V5_DeviceT) -> V5_DeviceBumperState;
59 pub fn vexDeviceGyroReset(device: V5_DeviceT);
60 pub fn vexDeviceGyroHeadingGet(device: V5_DeviceT) -> c_double;
61 pub fn vexDeviceGyroDegreesGet(device: V5_DeviceT) -> c_double;
62 pub fn vexDeviceSonarValueGet(device: V5_DeviceT) -> i32;
63}