pros/adi.h file

Contains prototypes for interfacing with the ADI.

This file should not be modified by users, since it gets replaced whenever a kernel upgrade occurs.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Namespaces

namespace pros
LLEMU Conditional Include
namespace pros::c

Functions

adi_port_config_e_t adi_port_get_config(uint8_t port)
Gets the configuration for the given ADI port.
int32_t adi_port_get_value(uint8_t port)
Gets the value for the given ADI port.
int32_t adi_port_set_config(uint8_t port, adi_port_config_e_t type)
Configures an ADI port to act as a given sensor type.
int32_t adi_port_set_value(uint8_t port, int32_t value)
Sets the value for the given ADI port.
int32_t adi_analog_calibrate(uint8_t port)
Calibrates the analog sensor on the specified port and returns the new calibration value.
int32_t adi_analog_read(uint8_t port)
Gets the 12-bit value of the specified port.
int32_t adi_analog_read_calibrated(uint8_t port)
Gets the 12 bit calibrated value of an analog input port.
int32_t adi_analog_read_calibrated_HR(uint8_t port)
Gets the 16 bit calibrated value of an analog input port.
int32_t adi_digital_read(uint8_t port)
Gets the digital value (1 or 0) of a port configured as a digital input.
int32_t adi_digital_get_new_press(uint8_t port)
Gets a rising-edge case for a digital button press.
int32_t adi_digital_write(uint8_t port, bool value)
Sets the digital value (1 or 0) of a port configured as a digital output.
int32_t adi_pin_mode(uint8_t port, uint8_t mode)
Configures the port as an input or output with a variety of settings.
int32_t adi_motor_set(uint8_t port, int8_t speed)
Sets the speed of the motor on the given port.
int32_t adi_motor_get(uint8_t port)
Gets the last set speed of the motor on the given port.
int32_t adi_motor_stop(uint8_t port)
Stops the motor on the given port.
int32_t adi_encoder_get(adi_encoder_t enc)
Gets the number of ticks recorded by the encoder.
adi_encoder_t adi_encoder_init(uint8_t port_top, uint8_t port_bottom, bool reverse)
Creates an encoder object and configures the specified ports accordingly.
int32_t adi_encoder_reset(adi_encoder_t enc)
Sets the encoder value to zero.
int32_t adi_encoder_shutdown(adi_encoder_t enc)
Disables the encoder and voids the configuration on its ports.
int32_t adi_ultrasonic_get(adi_ultrasonic_t ult)
Gets the current ultrasonic sensor value in centimeters.
adi_ultrasonic_t adi_ultrasonic_init(uint8_t port_ping, uint8_t port_echo)
Creates an ultrasonic object and configures the specified ports accordingly.
int32_t adi_ultrasonic_shutdown(adi_ultrasonic_t ult)
Disables the ultrasonic sensor and voids the configuration on its ports.
double adi_gyro_get(adi_gyro_t gyro)
Gets the current gyro angle in tenths of a degree.
adi_gyro_t adi_gyro_init(uint8_t port, double multiplier)
Initializes a gyroscope on the given port.
int32_t adi_gyro_reset(adi_gyro_t gyro)
Resets the gyroscope value to zero.
int32_t adi_gyro_shutdown(adi_gyro_t gyro)
Disables the gyro and voids the configuration on its port.
adi_potentiometer_t adi_potentiometer_init(uint8_t port)
Initializes a potentiometer on the given port of the original potentiometer.
adi_potentiometer_t adi_potentiometer_type_init(uint8_t port, adi_potentiometer_type_e_t potentiometer_type)
Initializes a potentiometer on the given port.
double adi_potentiometer_get_angle(adi_potentiometer_t potentiometer)
Gets the current potentiometer angle in tenths of a degree.
adi_led_t adi_led_init(uint8_t port)
Initializes a led on the given port of the original led.
int32_t adi_led_clear_all(adi_led_t led, uint32_t* buffer, uint32_t buffer_length)
Clear the entire led strip of color.
int32_t adi_led_set(adi_led_t led, uint32_t* buffer, uint32_t buffer_length)
Set the entire led strip using the colors contained in the buffer.
int32_t adi_led_set_all(adi_led_t led, uint32_t* buffer, uint32_t buffer_length, uint32_t color)
Set the entire led strip to one color.
int32_t adi_led_set_pixel(adi_led_t led, uint32_t* buffer, uint32_t buffer_length, uint32_t color, uint32_t pixel_position)
Set one pixel on the led strip.
int32_t adi_led_clear_pixel(adi_led_t led, uint32_t* buffer, uint32_t buffer_length, uint32_t pixel_position)
Clear one pixel on the led strip.

Ease of use macro definitions

These functions provide ease of use definitions for the ADI functions.

#define HIGH
Used for adi_digital_write() to specify a logic HIGH state to output.
#define LOW
Used for adi_digital_write() to specify a logic LOW state to output.
#define INPUT
adi_pin_mode() state for a digital input.
#define OUTPUT
adi_pin_mode() state for a digital output.
#define INPUT_ANALOG
adi_pin_mode() state for an analog input.
#define OUTPUT_ANALOG
adi_pin_mode() state for an analog output.

Enums

enum adi_potentiometer_type_e { E_ADI_POT_EDR = 0, E_ADI_POT_V2 }

Typedefs

using adi_encoder_t = int32_t
Reference type for an initialized encoder.
using adi_ultrasonic_t = int32_t
Reference type for an initialized ultrasonic.
using adi_gyro_t = int32_t
Reference type for an initialized gyroscope.
using adi_potentiometer_t = int32_t
Reference type for an initialized potentiometer.
using adi_led_t = int32_t
Reference type for an initialized addressable led.

Defines

#define PROS_ERR
#define _DEPRECATE_DIGITAL_IN
#define _DEPRECATE_ANALOG_IN
#define INTERNAL_ADI_PORT
#define NUM_ADI_PORTS