VEX Generic Device C API (For Advanced Users) module

Contents

Functions

v5_device_e_t get_plugged_type(uint8_t port)
Gets the type of device on given port.

Enums

enum v5_device_e { E_DEVICE_NONE = 0, E_DEVICE_MOTOR = 2, E_DEVICE_ROTATION = 4, E_DEVICE_IMU = 6, E_DEVICE_DISTANCE = 7, E_DEVICE_RADIO = 8, E_DEVICE_VISION = 11, E_DEVICE_ADI = 12, E_DEVICE_OPTICAL = 16, E_DEVICE_GPS = 20, E_DEVICE_SERIAL = 129, __attribute__ =((deprecated("use E_DEVICE_SERIAL instead"))) = E_DEVICE_SERIAL, E_DEVICE_UNDEFINED = 255 }
List of possible v5 devices.

Function documentation

v5_device_e_t get_plugged_type(uint8_t port)

Gets the type of device on given port.

Returns The device type as an enum.

Example

#define DEVICE_PORT 1

void opcontrol() {
  while (true) {
    v5_device_e_t pt = get_plugged_type(DEVICE_PORT);
    printf("device plugged type: {plugged type: %d}\n", pt);
    delay(20);
  }
}

Enum documentation

enum v5_device_e

List of possible v5 devices.

This list contains all current V5 Devices, and mirrors V5_DeviceType from the api.

Enumerators
E_DEVICE_NONE

No device is plugged into the port.

E_DEVICE_MOTOR

A motor is plugged into the port.

E_DEVICE_ROTATION

A rotation sensor is plugged into the port.

E_DEVICE_IMU

An inertial sensor is plugged into the port.

E_DEVICE_DISTANCE

A distance sensor is plugged into the port.

E_DEVICE_RADIO

A radio is plugged into the port.

E_DEVICE_VISION

A vision sensor is plugged into the port.

E_DEVICE_ADI

This port is an ADI expander.

E_DEVICE_OPTICAL

An optical sensor is plugged into the port.

E_DEVICE_GPS

A GPS sensor is plugged into the port.

E_DEVICE_SERIAL

A serial device is plugged into the port.

__attribute__

E_DEVICE_UNDEFINED

The device type is not defined, or is not a valid device.