use core::ffi::*;
pub const E_MOTOR_FAULT_NO_FAULTS: u32 = 0x00;
pub const E_MOTOR_FAULT_MOTOR_OVER_TEMP: u32 = 0x01;
pub const E_MOTOR_FAULT_DRIVER_FAULT: u32 = 0x02;
pub const E_MOTOR_FAULT_OVER_CURRENT: u32 = 0x04;
pub const E_MOTOR_FAULT_DRV_OVER_CURRENT: u32 = 0x08;
pub type motor_fault_e_t = u32;
pub const E_MOTOR_FLAGS_NONE: u32 = 0x00;
pub const E_MOTOR_FLAGS_BUSY: u32 = 0x01;
pub const E_MOTOR_FLAGS_ZERO_VELOCITY: u32 = 0x02;
pub const E_MOTOR_FLAGS_ZERO_POSITION: u32 = 0x04;
pub type motor_flag_e_t = u32;
pub const E_MOTOR_BRAKE_COAST: i32 = 0;
pub const E_MOTOR_BRAKE_BRAKE: i32 = 1;
pub const E_MOTOR_BRAKE_HOLD: i32 = 2;
pub const E_MOTOR_BRAKE_INVALID: i32 = i32::MAX;
pub type motor_brake_mode_e_t = i32;
pub const E_MOTOR_ENCODER_DEGREES: i32 = 0;
pub const E_MOTOR_ENCODER_ROTATIONS: i32 = 1;
pub const E_MOTOR_ENCODER_COUNTS: i32 = 2;
pub const E_MOTOR_ENCODER_INVALID: i32 = i32::MAX;
pub type motor_encoder_units_e_t = i32;
pub const E_MOTOR_GEARSET_36: i32 = 0;
pub const E_MOTOR_GEAR_RED: i32 = E_MOTOR_GEARSET_36;
pub const E_MOTOR_GEAR_100: i32 = E_MOTOR_GEARSET_36;
pub const E_MOTOR_GEARSET_18: i32 = 1;
pub const E_MOTOR_GEAR_GREEN: i32 = E_MOTOR_GEARSET_18;
pub const E_MOTOR_GEAR_200: i32 = E_MOTOR_GEARSET_18;
pub const E_MOTOR_GEARSET_06: i32 = 2;
pub const E_MOTOR_GEAR_BLUE: i32 = E_MOTOR_GEARSET_06;
pub const E_MOTOR_GEAR_600: i32 = E_MOTOR_GEARSET_06;
pub const E_MOTOR_GEARSET_INVALID: i32 = i32::MAX;
pub type motor_gearset_e_t = i32;
#[repr(C)]
pub struct motor_pid_full_s_t {
pub kf: u8,
pub kp: u8,
pub ki: u8,
pub kd: u8,
pub filter: u8,
pub limit: u16,
pub threshold: u8,
pub loopspeed: u8,
}
#[repr(C)]
pub struct motor_pid_s_t {
pub kf: u8,
pub kp: u8,
pub ki: u8,
pub kd: u8,
}
extern "C" {
pub fn motor_move(port: i8, voltage: i32) -> i32;
pub fn motor_brake(port: i8) -> i32;
pub fn motor_move_absolute(port: i8, position: c_double, velocity: i32) -> i32;
pub fn motor_move_relative(port: i8, position: c_double, velocity: i32) -> i32;
pub fn motor_move_velocity(port: i8, velocity: i32) -> i32;
pub fn motor_move_voltage(port: i8, voltage: i32) -> i32;
pub fn motor_modify_profiled_velocity(port: i8, velocity: i32) -> i32;
pub fn motor_get_target_position(port: i8) -> c_double;
pub fn motor_get_target_velocity(port: i8) -> i32;
pub fn motor_get_actual_velocity(port: i8) -> c_double;
pub fn motor_get_current_draw(port: i8) -> i32;
pub fn motor_get_direction(port: i8) -> i32;
pub fn motor_get_efficiency(port: i8) -> c_double;
pub fn motor_is_over_current(port: i8) -> i32;
pub fn motor_is_over_temp(port: i8) -> i32;
pub fn motor_is_stopped(port: i8) -> i32;
pub fn motor_get_zero_position_flag(port: i8) -> i32;
pub fn motor_get_faults(port: i8) -> motor_fault_e_t;
pub fn motor_get_flags(port: i8) -> motor_flag_e_t;
pub fn motor_get_raw_position(port: i8, timestamp: *const u32) -> i32;
pub fn motor_get_position(port: i8) -> c_double;
pub fn motor_get_power(port: i8) -> c_double;
pub fn motor_get_temperature(port: i8) -> c_double;
pub fn motor_get_torque(port: i8) -> c_double;
pub fn motor_get_voltage(port: i8) -> i32;
pub fn motor_set_zero_position(port: i8, position: c_double) -> i32;
pub fn motor_tare_position(port: i8) -> i32;
pub fn motor_set_brake_mode(port: i8, mode: motor_brake_mode_e_t) -> i32;
pub fn motor_set_current_limit(port: i8, limit: i32) -> i32;
pub fn motor_set_encoder_units(port: i8, units: motor_encoder_units_e_t) -> i32;
pub fn motor_set_gearing(port: i8, gearset: motor_gearset_e_t) -> i32;
#[deprecated(
note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
)]
pub fn motor_convert_pid(
kf: c_double,
kp: c_double,
ki: c_double,
kd: c_double,
) -> motor_pid_s_t;
#[deprecated(
note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
)]
pub fn motor_convert_pid_full(
kf: c_double,
kp: c_double,
ki: c_double,
kd: c_double,
filter: c_double,
limit: c_double,
threshold: c_double,
loopspeed: c_double,
) -> motor_pid_full_s_t;
#[deprecated(
note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
)]
pub fn motor_set_pos_pid(port: i8, pid: motor_pid_s_t) -> i32;
#[deprecated(
note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
)]
pub fn motor_set_pos_pid_full(port: i8, pid: motor_pid_full_s_t) -> i32;
#[deprecated(
note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
)]
pub fn motor_set_vel_pid(port: i8, pid: motor_pid_s_t) -> i32;
#[deprecated(
note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
)]
pub fn motor_set_vel_pid_full(port: i8, pid: motor_pid_full_s_t) -> i32;
#[deprecated(
note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
)]
pub fn motor_get_pos_pid(port: i8) -> motor_pid_full_s_t;
#[deprecated(
note = "Changing these values is not supported by VEX and may lead to permanent motor damage."
)]
pub fn motor_get_vel_pid(port: i8) -> motor_pid_full_s_t;
pub fn motor_set_reversed(port: i8, reversed: bool) -> i32;
pub fn motor_set_voltage_limit(port: i8, limit: i32) -> i32;
pub fn motor_get_brake_mode(port: i8) -> motor_brake_mode_e_t;
pub fn motor_get_current_limit(port: i8) -> i32;
pub fn motor_get_encoder_units(port: i8) -> motor_encoder_units_e_t;
pub fn motor_get_gearing(port: i8) -> motor_gearset_e_t;
pub fn motor_is_reversed(port: i8) -> i32;
pub fn motor_get_voltage_limit(port: i8) -> i32;
}