diff --git a/include/pros/adi.h b/include/pros/adi.h index 272226257..9caac4fd0 100644 --- a/include/pros/adi.h +++ b/include/pros/adi.h @@ -257,8 +257,7 @@ int32_t adi_analog_calibrate(uint8_t port); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an analog input - * EADDRINUSE - The port is configured as something other than an analog input + * EADDRINUSE - The port is not configured as an analog input * * \param port * The ADI port (from 1-8, 'a'-'h', 'A'-'H') for which the value will be @@ -280,8 +279,7 @@ int32_t adi_analog_read(uint8_t port); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an analog input - * EADDRINUSE - The port is configured as something other than an analog input + * EADDRINUSE - The port is not configured as an analog input * * \param port * The ADI port (from 1-8, 'a'-'h', 'A'-'H') for which the value will be @@ -308,8 +306,7 @@ int32_t adi_analog_read_calibrated(uint8_t port); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an analog input - * EADDRINUSE - The port is configured as something other than an analog input + * EADDRINUSE - The port is not configured as an analog input * * \param port * The ADI port (from 1-8, 'a'-'h', 'A'-'H') for which the value will be @@ -331,8 +328,7 @@ int32_t adi_analog_read_calibrated_HR(uint8_t port); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as a digital input - * EADDRINUSE - The port is configured as something other than a digital input + * EADDRINUSE - The port is not configured as a digital input * * \param port * The ADI port to read (from 1-8, 'a'-'h', 'A'-'H') @@ -355,8 +351,7 @@ int32_t adi_digital_read(uint8_t port); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as a digital input - * EADDRINUSE - The port is configured as something other than a digital input + * EADDRINUSE - The port is not configured as a digital input * * \param port * The ADI port to read (from 1-8, 'a'-'h', 'A'-'H') @@ -374,8 +369,7 @@ int32_t adi_digital_get_new_press(uint8_t port); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as a digital output - * EADDRINUSE - The port is configured as something other than a digital output + * EADDRINUSE - The port is not configured as a digital output * * \param port * The ADI port to read (from 1-8, 'a'-'h', 'A'-'H') @@ -411,8 +405,7 @@ int32_t adi_pin_mode(uint8_t port, uint8_t mode); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an motor - * EADDRINUSE - The port is configured as something other than a motor + * EADDRINUSE - The port is not configured as an motor * * \param port * The ADI port to set (from 1-8, 'a'-'h', 'A'-'H') @@ -431,8 +424,7 @@ int32_t adi_motor_set(uint8_t port, int8_t speed); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an motor - * EADDRINUSE - The port is configured as something other than a motor + * EADDRINUSE - The port is not configured as an motor * * \param port * The ADI port to get (from 1-8, 'a'-'h', 'A'-'H') @@ -447,8 +439,7 @@ int32_t adi_motor_get(uint8_t port); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an motor - * EADDRINUSE - The port is configured as something other than a motor + * EADDRINUSE - The port is not configured as an motor * * \param port * The ADI port to set (from 1-8, 'a'-'h', 'A'-'H') @@ -474,8 +465,8 @@ typedef int32_t adi_encoder_t; * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an encoder - * EADDRINUSE - The port is configured as something other than an encoder + * EADDRINUSE - The port is not configured as an encoder + * * \param enc * The adi_encoder_t object from adi_encoder_init() to read @@ -491,8 +482,8 @@ int32_t adi_encoder_get(adi_encoder_t enc); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an encoder - * EADDRINUSE - The port is configured as something other than an encoder + * EADDRINUSE - The port is not configured as an encoder + * * \param port_top * The "top" wire from the encoder sensor with the removable cover side @@ -516,8 +507,8 @@ adi_encoder_t adi_encoder_init(uint8_t port_top, uint8_t port_bottom, const bool * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an encoder - * EADDRINUSE - The port is configured as something other than an encoder + * EADDRINUSE - The port is not configured as an encoder + * * \param enc * The adi_encoder_t object from adi_encoder_init() to reset @@ -533,8 +524,7 @@ int32_t adi_encoder_reset(adi_encoder_t enc); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an encoder - * EADDRINUSE - The port is configured as something other than an encoder + * EADDRINUSE - The port is not configured as an encoder * * \param enc * The adi_encoder_t object from adi_encoder_init() to stop @@ -562,8 +552,7 @@ typedef int32_t adi_ultrasonic_t; * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an ultrasonic - * EADDRINUSE - The port is configured as something other than an ultrasonic + * EADDRINUSE - The port is not configured as an ultrasonic * * \param ult * The adi_ultrasonic_t object from adi_ultrasonic_init() to read @@ -579,8 +568,7 @@ int32_t adi_ultrasonic_get(adi_ultrasonic_t ult); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an ultrasonic - * EADDRINUSE - The port is configured as something other than an ultrasonic + * EADDRINUSE - The port is not configured as an ultrasonic * * \param port_ping * The port connected to the orange OUTPUT cable. This should be in the @@ -600,8 +588,7 @@ adi_ultrasonic_t adi_ultrasonic_init(uint8_t port_ping, uint8_t port_echo); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as an ultrasonic - * EADDRINUSE - The port is configured as something other than an ultrasonic + * EADDRINUSE - The port is not configured as an ultrasonic * * \param ult * The adi_ultrasonic_t object from adi_ultrasonic_init() to stop @@ -630,8 +617,7 @@ typedef int32_t adi_gyro_t; * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as a gyro - * EADDRINUSE - The port is configured as something other than a gyro + * EADDRINUSE - The port is not configured as a gyro * * \param gyro * The adi_gyro_t object for which the angle will be returned @@ -651,8 +637,7 @@ double adi_gyro_get(adi_gyro_t gyro); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as a gyro - * EADDRINUSE - The port is configured as something other than a gyro + * EADDRINUSE - The port is not configured as a gyro * * \param port * The ADI port to initialize as a gyro (from 1-8, 'a'-'h', 'A'-'H') @@ -671,8 +656,7 @@ adi_gyro_t adi_gyro_init(uint8_t port, double multiplier); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as a gyro - * EADDRINUSE - The port is configured as something other than a gyro + * EADDRINUSE - The port is not configured as a gyro * * \param gyro * The adi_gyro_t object for which the angle will be returned @@ -688,8 +672,7 @@ int32_t adi_gyro_reset(adi_gyro_t gyro); * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of ADI Ports - * ENODEV - The port is not configured as a gyro - * EADDRINUSE - The port is configured as something other than a gyro + * EADDRINUSE - The port is not configured as a gyro * * \param gyro * The adi_gyro_t object to be shut down diff --git a/src/devices/vdml_adi.c b/src/devices/vdml_adi.c index 29c966478..d24d02d33 100644 --- a/src/devices/vdml_adi.c +++ b/src/devices/vdml_adi.c @@ -120,10 +120,6 @@ static void set_gyro_tare(uint8_t port, double tare) { #define validate_type(port, type) \ adi_port_config_e_t config = _adi_port_get_config(port); \ - if (config == E_ADI_TYPE_UNDEFINED) { \ - errno = ENODEV; \ - return PROS_ERR; \ - } \ if (config != type) { \ errno = EADDRINUSE; \ return PROS_ERR; \ @@ -131,10 +127,6 @@ static void set_gyro_tare(uint8_t port, double tare) { #define validate_type_f(port, type) \ adi_port_config_e_t config = _adi_port_get_config(port); \ - if (config == E_ADI_TYPE_UNDEFINED) { \ - errno = ENODEV; \ - return PROS_ERR_F; \ - } \ if (config != type) { \ errno = EADDRINUSE; \ return PROS_ERR_F; \ @@ -170,7 +162,7 @@ static void set_gyro_tare(uint8_t port, double tare) { static inline int32_t _adi_port_set_config(uint8_t port, adi_port_config_e_t type) { claim_port(INTERNAL_ADI_PORT, E_DEVICE_ADI); - vexDeviceAdiPortConfigSet(device->device_info, port, type); + vexDeviceAdiPortConfigSet(device->device_info, port, (V5_AdiPortConfiguration)type); return_port(INTERNAL_ADI_PORT, 1); }